address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xa38a843aaAe0e2664e9E113DF32Ab17d6b848F7B
|
// SPDX-License-Identifier: GPL-3.0-or-later
/// CurveLPOracle.sol
// Copyright (C) 2021 Dai Foundation
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.8.11;
interface AddressProviderLike {
function get_registry() external view returns (address);
}
interface CurveRegistryLike {
function get_n_coins(address) external view returns (uint256[2] calldata);
}
interface CurvePoolLike {
function coins(uint256) external view returns (address);
function get_virtual_price() external view returns (uint256);
function lp_token() external view returns (address);
}
interface OracleLike {
function read() external view returns (uint256);
}
contract CurveLPOracleFactory {
AddressProviderLike immutable ADDRESS_PROVIDER;
event NewCurveLPOracle(address owner, address orcl, bytes32 wat, address pool);
constructor(address addressProvider) {
ADDRESS_PROVIDER = AddressProviderLike(addressProvider);
}
function build(
address _owner,
address _pool,
bytes32 _wat,
address[] calldata _orbs
) external returns (address orcl) {
uint256 ncoins = CurveRegistryLike(ADDRESS_PROVIDER.get_registry()).get_n_coins(_pool)[1];
require(ncoins == _orbs.length, "CurveLPOracleFactory/wrong-num-of-orbs");
orcl = address(new CurveLPOracle(_owner, _pool, _wat, _orbs));
emit NewCurveLPOracle(_owner, orcl, _wat, _pool);
}
}
contract CurveLPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "CurveLPOracle/not-authorized");
_;
}
address public immutable src; // Price source, do not remove as needed for OmegaPoker
// stopped, hop, and zph are packed into single slot to reduce SLOADs;
// this outweighs the added bitmasking overhead.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "CurveLPOracle/not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (storage slot 0x3)
Feed internal nxt; // Queued price (storage slot 0x4)
address[] public orbs; // array of price feeds for pool assets, same order as in the pool
address public immutable pool; // Address of underlying Curve pool
bytes32 public immutable wat; // Label of token whose price is being tracked
uint256 public immutable ncoins; // Number of tokens in underlying Curve pool
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Stop();
event Start();
event Step(uint256 hop);
event Link(uint256 id, address orb);
event Value(uint128 curVal, uint128 nxtVal);
event Kiss(address a);
event Diss(address a);
// --- Init ---
constructor(address _ward, address _pool, bytes32 _wat, address[] memory _orbs) {
require(_pool != address(0), "CurveLPOracle/invalid-pool");
uint256 _ncoins = _orbs.length;
pool = _pool;
src = CurvePoolLike(_pool).lp_token();
wat = _wat;
ncoins = _ncoins;
for (uint256 i = 0; i < _ncoins;) {
require(_orbs[i] != address(0), "CurveLPOracle/invalid-orb");
orbs.push(_orbs[i]);
unchecked { i++; }
}
require(_ward != address(0), "CurveLPOracle/ward-0");
wards[_ward] = 1;
emit Rely(_ward);
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint16 _hop) external auth {
uint16 old = hop;
hop = _hop;
if (zph > old) { // if false, zph will be unset and no update is needed
zph = (zph - old) + _hop;
}
emit Step(_hop);
}
function link(uint256 _id, address _orb) external auth {
require(_orb != address(0), "CurveLPOracle/invalid-orb");
require(_id < ncoins, "CurveLPOracle/invalid-orb-index");
orbs[_id] = _orb;
emit Link(_id, _orb);
}
// For consistency with other oracles
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return zph - hop;
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
// Marked payable to save gas. DO *NOT* send ETH to poke(), it will be lost permanently.
function poke() external payable {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "CurveLPOracle/is-stopped");
// Equivalent to requiring that pass() returns true; logic repeated to save gas.
require(block.timestamp >= zph_, "CurveLPOracle/not-passed");
}
uint256 val = type(uint256).max;
for (uint256 i = 0; i < ncoins;) {
uint256 price = OracleLike(orbs[i]).read();
if (price < val) val = price;
unchecked { i++; }
}
val = val * CurvePoolLike(pool).get_virtual_price() / 10**18;
require(val != 0, "CurveLPOracle/zero-price");
require(val <= type(uint128).max, "CurveLPOracle/price-overflow");
Feed memory cur_ = nxt;
cur = cur_;
nxt = Feed(uint128(val), 1);
// The below is equivalent to:
// zph = block.timestamp + hop
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
shl(24, add(timestamp(), hop_)), // zph value starts 24 bits in
shl(8, hop_) // hop value starts 8 bits in
)
)
}
emit Value(cur_.val, uint128(val));
// Safe to terminate immediately since no postfix modifiers are applied.
assembly { stop() }
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "CurveLPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "CurveLPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
require(_a[i] != address(0), "CurveLPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
unchecked { i++; }
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
unchecked { i++; }
}
}
}
|
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806370c4315314610030575b600080fd5b61004361003e366004610304565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000807f0000000000000000000000000000000022d53366457f9d5e68ec105046fc438373ffffffffffffffffffffffffffffffffffffffff1663a262904b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fe91906103a6565b6040517f940494f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152919091169063940494f1906024016040805180830381865afa15801561016b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018f91906103ca565b602001519050828114610228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f43757276654c504f7261636c65466163746f72792f77726f6e672d6e756d2d6f60448201527f662d6f7262730000000000000000000000000000000000000000000000000000606482015260840160405180910390fd5b8686868686604051610239906102d2565b610247959493929190610471565b604051809103906000f080158015610263573d6000803e3d6000fd5b506040805173ffffffffffffffffffffffffffffffffffffffff808b168252808416602083015291810188905290881660608201529092507f0cabca6d7ee11babbfae50a3905ac45a18587ec15dc4769dd2ad3bbb5d5560049060800160405180910390a15095945050505050565b612117806104ee83390190565b73ffffffffffffffffffffffffffffffffffffffff8116811461030157600080fd5b50565b60008060008060006080868803121561031c57600080fd5b8535610327816102df565b94506020860135610337816102df565b935060408601359250606086013567ffffffffffffffff8082111561035b57600080fd5b818801915088601f83011261036f57600080fd5b81358181111561037e57600080fd5b8960208260051b850101111561039357600080fd5b9699959850939650602001949392505050565b6000602082840312156103b857600080fd5b81516103c3816102df565b9392505050565b6000604082840312156103dc57600080fd5b82601f8301126103eb57600080fd5b6040516040810181811067ffffffffffffffff82111715610435577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b806040525080604084018581111561044c57600080fd5b845b8181101561046657805183526020928301920161044e565b509195945050505050565b60006080820173ffffffffffffffffffffffffffffffffffffffff8089168452602081891681860152876040860152608060608601528286845260a08601905087935060005b878110156104de5784356104ca816102df565b8416825293820193908201906001016104b7565b509a995050505050505050505056fe6101006040526001805462ffff001916620e10001790553480156200002357600080fd5b5060405162002117380380620021178339810160408190526200004691620002ee565b6001600160a01b038316620000a25760405162461bcd60e51b815260206004820152601a60248201527f43757276654c504f7261636c652f696e76616c69642d706f6f6c00000000000060448201526064015b60405180910390fd5b80516001600160a01b03841660a081905260408051634163183360e11b815290516382c63066916004808201926020929091908290030181865afa158015620000ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001159190620003f0565b6001600160a01b031660805260c083905260e081905260005b81811015620002155760006001600160a01b031683828151811062000157576200015762000415565b60200260200101516001600160a01b03161415620001b85760405162461bcd60e51b815260206004820152601960248201527f43757276654c504f7261636c652f696e76616c69642d6f726200000000000000604482015260640162000099565b6005838281518110620001cf57620001cf62000415565b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b0390931692909217909155016200012e565b506001600160a01b0385166200026e5760405162461bcd60e51b815260206004820152601460248201527f43757276654c504f7261636c652f776172642d30000000000000000000000000604482015260640162000099565b6001600160a01b03851660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250505050506200042b565b80516001600160a01b0381168114620002d357600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200030557600080fd5b6200031085620002bb565b9350602062000321818701620002bb565b6040870151606088015191955093506001600160401b03808211156200034657600080fd5b818801915088601f8301126200035b57600080fd5b815181811115620003705762000370620002d8565b8060051b604051601f19603f83011681018181108582111715620003985762000398620002d8565b60405291825284820192508381018501918b831115620003b757600080fd5b938501935b82851015620003e057620003d085620002bb565b84529385019392850192620003bc565b989b979a50959850505050505050565b6000602082840312156200040357600080fd5b6200040e82620002bb565b9392505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e051611c9d6200047a600039600081816102b30152818161085c01526111a1015260006103150152600081816101fe01526109520152600061027f0152611c9d6000f3fe6080604052600436106101a15760003560e01c806365c4ce7a116100e1578063a7a1ed721161008a578063be9a655511610064578063be9a655514610556578063bf353dbb1461056b578063e38e2cfb14610598578063f29c29c4146105b857600080fd5b8063a7a1ed721461046f578063a9c52a39146104b8578063b0b8579b1461052357600080fd5b806397783a11116100bb57806397783a111461041a5780639c52a7f11461043a578063a4dff0a21461045a57600080fd5b806365c4ce7a146103ae57806365fae35e146103ce57806375f12b21146103ee57600080fd5b8063371f8dae1161014e5780634fce7a2a116101285780634fce7a2a1461033757806357de26a41461036457806359e02dd71461037957806365af79091461038e57600080fd5b8063371f8dae146102a157806346d4577d146102e35780634ca299231461030357600080fd5b8063181783581161017f57806318178358146102455780631b25b65f1461024d5780632e7dc6af1461026d57600080fd5b806307da68f5146101a65780630e5a6c70146101bd57806316f0115b146101ec575b600080fd5b3480156101b257600080fd5b506101bb6105d8565b005b3480156101c957600080fd5b506101d261069b565b604080519283529015156020830152015b60405180910390f35b3480156101f857600080fd5b506102207f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e3565b6101bb61074c565b34801561025957600080fd5b506101bb6102683660046119d0565b610b88565b34801561027957600080fd5b506102207f000000000000000000000000000000000000000000000000000000000000000081565b3480156102ad57600080fd5b506102d57f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101e3565b3480156102ef57600080fd5b506101bb6102fe3660046119d0565b610d84565b34801561030f57600080fd5b506102d57f000000000000000000000000000000000000000000000000000000000000000081565b34801561034357600080fd5b506102d5610352366004611a6e565b60026020526000908152604090205481565b34801561037057600080fd5b506102d5610ed4565b34801561038557600080fd5b506101d2610ff8565b34801561039a57600080fd5b506101bb6103a9366004611a90565b6110a9565b3480156103ba57600080fd5b506101bb6103c9366004611a6e565b6112c8565b3480156103da57600080fd5b506101bb6103e9366004611a6e565b6113a1565b3480156103fa57600080fd5b506001546104089060ff1681565b60405160ff90911681526020016101e3565b34801561042657600080fd5b50610220610435366004611abc565b61146c565b34801561044657600080fd5b506101bb610455366004611a6e565b6114a3565b34801561046657600080fd5b506102d561156d565b34801561047b57600080fd5b50600154630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1642101560405190151581526020016101e3565b3480156104c457600080fd5b506001546104f590630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b6040517cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90911681526020016101e3565b34801561052f57600080fd5b5060015461054390610100900461ffff1681565b60405161ffff90911681526020016101e3565b34801561056257600080fd5b506101bb611603565b34801561057757600080fd5b506102d5610586366004611a6e565b60006020819052908152604090205481565b3480156105a457600080fd5b506101bb6105b3366004611ad5565b6116cf565b3480156105c457600080fd5b506101bb6105d3366004611a6e565b611880565b33600090815260208190526040902054600114610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a65640000000060448201526064015b60405180910390fd5b6001805460006003819055600481905562ffff0090911682179091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b336000908152600260205260408120548190600114610716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b50506004546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b600154600881901c61ffff169060ff81169060181c81156107c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f69732d73746f707065640000000000000000604482015260640161064d565b80421015610833576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f6e6f742d7061737365640000000000000000604482015260640161064d565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060005b7f00000000000000000000000000000000000000000000000000000000000000008110156109465760006005828154811061089757610897611af9565b60009182526020918290200154604080517f57de26a4000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff909216926357de26a4926004808401938290030181865afa15801561090b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092f9190611b28565b90508281101561093d578092505b5060010161085a565b50670de0b6b3a76400007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109df9190611b28565b6109e99083611b70565b6109f39190611bad565b905080610a5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f7a65726f2d70726963650000000000000000604482015260640161064d565b6fffffffffffffffffffffffffffffffff811115610ad6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f70726963652d6f766572666c6f7700000000604482015260640161064d565b604080518082018252600480546fffffffffffffffffffffffffffffffff8082168085527001000000000000000000000000000000009283900482166020808701829052908402909117600355855180870187528783168082526001918301829052938417909455600888901b42890160181b0190935583518551911681529182015290917f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73910160405180910390a1005b33600090815260208190526040902054600114610c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b60005b81811015610d7f576000838383818110610c2057610c20611af9565b9050602002016020810190610c359190611a6e565b73ffffffffffffffffffffffffffffffffffffffff161415610cb3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161064d565b600160026000858585818110610ccb57610ccb611af9565b9050602002016020810190610ce09190611a6e565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb244838383818110610d3a57610d3a611af9565b9050602002016020810190610d4f9190611a6e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610c04565b505050565b33600090815260208190526040902054600114610dfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b60005b81811015610d7f57600060026000858585818110610e2057610e20611af9565b9050602002016020810190610e359190611a6e565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610e8f57610e8f611af9565b9050602002016020810190610ea49190611a6e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610e00565b33600090815260026020526040812054600114610f4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b60035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16600114610fdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43757276654c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015260640161064d565b506003546fffffffffffffffffffffffffffffffff1690565b336000908152600260205260408120548190600114611073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b50506003546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b33600090815260208190526040902054600114611122576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811661119f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f43757276654c504f7261636c652f696e76616c69642d6f726200000000000000604482015260640161064d565b7f00000000000000000000000000000000000000000000000000000000000000008210611228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43757276654c504f7261636c652f696e76616c69642d6f72622d696e64657800604482015260640161064d565b806005838154811061123c5761123c611af9565b60009182526020918290200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93841617905560408051858152928416918301919091527f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a791015b60405180910390a15050565b33600090815260208190526040902054600114611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602090815260408083209290925590519182527f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c91015b60405180910390a150565b3360009081526020819052604090205460011461141a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005818154811061147c57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b3360009081526020819052604090205460011461151c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166115a35750600090565b6001546115df90610100810461ffff1690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611be8565b7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16905090565b3360009081526020819052604090205460011461167c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b33600090815260208190526040902054600114611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b6001805461ffff8381166101009081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff8416179384905590910416907cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63010000009091041681101561184c5760015461ffff838116916117ef91841690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611be8565b6117f99190611c26565b600160036101000a8154817cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055505b60405161ffff831681527fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817906020016112bc565b336000908152602081905260409020546001146118f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff8116611976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff81166000818152600260209081526040918290206001905590519182527f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449101611396565b600080602083850312156119e357600080fd5b823567ffffffffffffffff808211156119fb57600080fd5b818501915085601f830112611a0f57600080fd5b813581811115611a1e57600080fd5b8660208260051b8501011115611a3357600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611a6957600080fd5b919050565b600060208284031215611a8057600080fd5b611a8982611a45565b9392505050565b60008060408385031215611aa357600080fd5b82359150611ab360208401611a45565b90509250929050565b600060208284031215611ace57600080fd5b5035919050565b600060208284031215611ae757600080fd5b813561ffff81168114611a8957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611b3a57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611ba857611ba8611b41565b500290565b600082611be3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83811690831681811015611c1e57611c1e611b41565b039392505050565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316818516808303821115611c5e57611c5e611b41565b0194935050505056fea2646970667358221220fda241e016792946d430588cd3961b3fc99cb2c33d56e3cc1c513b0a581c0cd964736f6c634300080b0033a2646970667358221220a61a286c20e1c303a88db0313997413204629cfff9e5cd037b0ad9046d76768464736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,400 |
0x8d870549d72f588fc56c1aaa22975d14c4d12ee5
|
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: 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: 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: 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: openzeppelin-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 {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: 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: openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: 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/grapevine/token/GrapevineToken.sol
/**
* @title Grapevine Token
* @dev Grapevine Token
**/
contract GrapevineToken is DetailedERC20, BurnableToken, StandardToken, Ownable {
constructor() DetailedERC20("GVINE", "GVINE", 18) public {
totalSupply_ = 825000000 * (10 ** uint256(decimals)); // Update total supply with the decimal amount
balances[msg.sender] = totalSupply_;
emit Transfer(address(0), msg.sender, totalSupply_);
}
/**
* @dev burns the provided the _value, can be used only by the owner of the contract.
* @param _value The value of the tokens to be burnt.
*/
function burn(uint256 _value) public onlyOwner {
super.burn(_value);
}
}
|
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f257806342966c681461021d578063661884631461023757806370a082311461025b578063715018a61461027c5780638da5cb5b1461029157806395d89b41146102c2578063a9059cbb146102d7578063d73dd623146102fb578063dd62ed3e1461031f578063f2fde38b14610346575b600080fd5b3480156100eb57600080fd5b506100f4610367565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a03600435166024356103f5565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b661045b565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a0360043581169060243516604435610461565b3480156101fe57600080fd5b506102076105da565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b506102356004356105e3565b005b34801561024357600080fd5b5061018d600160a060020a0360043516602435610606565b34801561026757600080fd5b506101b6600160a060020a03600435166106f6565b34801561028857600080fd5b50610235610711565b34801561029d57600080fd5b506102a661077f565b60408051600160a060020a039092168252519081900360200190f35b3480156102ce57600080fd5b506100f461078e565b3480156102e357600080fd5b5061018d600160a060020a03600435166024356107e8565b34801561030757600080fd5b5061018d600160a060020a03600435166024356108cb565b34801561032b57600080fd5b506101b6600160a060020a0360043581169060243516610964565b34801561035257600080fd5b50610235600160a060020a036004351661098f565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ed5780601f106103c2576101008083540402835291602001916103ed565b820191906000526020600020905b8154815290600101906020018083116103d057829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60045490565b6000600160a060020a038316151561047857600080fd5b600160a060020a03841660009081526003602052604090205482111561049d57600080fd5b600160a060020a03841660009081526005602090815260408083203384529091529020548211156104cd57600080fd5b600160a060020a0384166000908152600360205260409020546104f6908363ffffffff6109af16565b600160a060020a03808616600090815260036020526040808220939093559085168152205461052b908363ffffffff6109c116565b600160a060020a03808516600090815260036020908152604080832094909455918716815260058252828120338252909152205461056f908363ffffffff6109af16565b600160a060020a03808616600081815260056020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60025460ff1681565b600654600160a060020a031633146105fa57600080fd5b610603816109d4565b50565b336000908152600560209081526040808320600160a060020a03861684529091528120548083111561065b57336000908152600560209081526040808320600160a060020a0388168452909152812055610690565b61066b818463ffffffff6109af16565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526003602052604090205490565b600654600160a060020a0316331461072857600080fd5b600654604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26006805473ffffffffffffffffffffffffffffffffffffffff19169055565b600654600160a060020a031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ed5780601f106103c2576101008083540402835291602001916103ed565b6000600160a060020a03831615156107ff57600080fd5b3360009081526003602052604090205482111561081b57600080fd5b3360009081526003602052604090205461083b908363ffffffff6109af16565b3360009081526003602052604080822092909255600160a060020a0385168152205461086d908363ffffffff6109c116565b600160a060020a0384166000818152600360209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600560209081526040808320600160a060020a03861684529091528120546108ff908363ffffffff6109c116565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600654600160a060020a031633146109a657600080fd5b610603816109de565b6000828211156109bb57fe5b50900390565b818101828110156109ce57fe5b92915050565b6106033382610a5c565b600160a060020a03811615156109f357600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a038216600090815260036020526040902054811115610a8157600080fd5b600160a060020a038216600090815260036020526040902054610aaa908263ffffffff6109af16565b600160a060020a038316600090815260036020526040902055600454610ad6908263ffffffff6109af16565b600455604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350505600a165627a7a723058202dd248aa2d9a5ee7abb3bf63ede95078e47296904a3aa5b46b1ec292e70c9cd70029
|
{"success": true, "error": null, "results": {}}
| 3,401 |
0xbc9e2998e284540e21b28e5c2358be7291059e97
|
pragma solidity ^0.4.16;
// OSECOIN Token contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// OSECOIN Symbol: OSE
contract OSECOINToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* OSECOIN Token Math operations with safety checks to avoid unnecessary conflicts
*/
library ABCMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract OSEStandardToken is OSECOINToken, Ownable {
using ABCMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* 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;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract OSECOIN is OSEStandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
uint256 constant public decimals = 8;
uint256 public totalSupply = 10 * (10**7) * 10**8 ; // 100 million tokens, 8 decimal places
string constant public name = "OSECOIN";
string constant public symbol = "OSE";
function OSECOIN(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce5671461027557806370a082311461029e57806379ba5097146102eb5780638da5cb5b1461030057806395d89b4114610355578063a9059cbb146103e3578063b414d4b61461043d578063cae9ca511461048e578063d4ee1d901461052b578063dd62ed3e14610580578063e724529c146105ec578063f2fde38b14610630575b600080fd5b34156100f657600080fd5b6100fe610669565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a2565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610829565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610cfe565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d03565b6040518082815260200191505060405180910390f35b34156102f657600080fd5b6102fe610d4c565b005b341561030b57600080fd5b610313610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ee57600080fd5b610423600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0a565b604051808215151515815260200191505060405180910390f35b341561044857600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611241565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b610511600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611261565b604051808215151515815260200191505060405180910390f35b341561053657600080fd5b61053e6114fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058b57600080fd5b6105d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611524565b6040518082815260200191505060405180910390f35b34156105f757600080fd5b61062e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115ab565b005b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d1565b005b6040805190810160405280600781526020017f4f5345434f494e0000000000000000000000000000000000000000000000000081525081565b60008082148061072e57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073957600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088c5760009050610cf7565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610957575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109635750600082115b801561099c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a385750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3583600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b8015610a4957506044600036905010155b1515610a5457600080fd5b610aa682600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0d82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4f5345000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f67576000905061123b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb65750600082115b8015610fef5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561108b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108883600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b801561109c57506044600036905010155b15156110a757600080fd5b6110f982600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a2578082015181840152602081019050611487565b50505050905090810190601f1680156114cf5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156114f357600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160757600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a55780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c05750828110155b15156117c857fe5b8091505092915050565b60008282111515156117e057fe5b8183039050929150505600a165627a7a72305820eec5fb46a65b0bd5a4c8a2a7e9256785dbed41be113cb37c0397533816cf46180029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 3,402 |
0x3c02dac293ec087ef59ee4de0f50354b0b062dd3
|
/**
*Submitted for verification at Etherscan.io on 2021-11-17
*/
/**
*
* T R U T H S T A K I N G
*
* www.truthstaking.com
*
* Stake Ether on claims made by the media. If your peers agree with you, you win.
* This smart contract allows users to do 2 things:
* 1) Submit statements that are TRUE or FALSE.
* 2) Stake on submitted statements.
* After the staking period for the statement ends, the TRUE and FALSE pots of ether are counted.
* The larger pot wins, and the smaller pot is distributed amongst the winners, proportional to the size of their stakes.
* The "market maker" (the address that submitted the statement) receives an extra reward proportional to her first stake.
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Calculates the average of two numbers. Since these are integers,
* averages of an even and odd number cannot be represented, and will be
* rounded down.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
contract TruthStaking {
using SafeMath for uint;
////////////////////// STRUCTS //////////////////////
struct Statement {
uint id;
string statement;
uint stakeDuration;
uint stakeBeginningTime;
uint stakeEndTime;
address marketMaker;
uint numStakes;
uint ethStaked;
bool stakeEnded;
string source;
uint verdict;
mapping(uint => Stake) stakes; // TODO: Make private?
}
struct Stake {
address addr; // Staker's address
uint amount; // Value staked
uint position; // Staker's position (1 true or 0 false)
}
struct Pot {
uint T;
uint F;
}
////////////////////// MAPPINGS AND ARRAYS //////////////////////
mapping(uint => Statement) public statements;
mapping(uint => Pot) private pots;
mapping(address => uint) public beneficiaryShares;
address[] public beneficiaryAddresses;
////////////////////// STATE VARIABLES //////////////////////
// Information Trackers
uint public absNumStatements;
uint public absNumStakes;
uint public absEthStaked;
// Logistics
uint pctTimeRemainingThreshold;
uint minTimeAddPct;
uint maxTimeAddPct;
uint minPotPctThreshold;
uint maxPotPctThreshold;
address private owner;
uint public serviceFeeTenThousandths; // int range [0, 10000] to accomodate precision of ten-thosaundths. eg. 1.25% is represented as 125
////////////////////// EVENTS //////////////////////
// Events that will be emitted on changes.
event NewStake(uint statementID, uint amount);
event StakeEnded(uint statementID, uint TruePotFinal, uint FalsePotFinal, uint winningPosition, uint numStakes);
event CurrentPot(uint statementID, uint totalPot);
event NewStatement(uint statementID, string statement, uint stakeEndTime, string source);
// Constructor executes once when contract is created
constructor () public {
owner = msg.sender;
pctTimeRemainingThreshold = 20;
minTimeAddPct = 0;
maxTimeAddPct = 40;
minPotPctThreshold = 20;
maxPotPctThreshold = 180;
}
////////////////////// MODIFIERS //////////////////////
modifier onlyOwner {
require(
msg.sender == owner,
"Only owner can call this function."
);
_;
}
////////////////////// FUNCTIONS //////////////////////
function newStatement(string _statement, uint _position, uint _stakeDuration, string _source) public payable returns(uint statementID) {
/**
* creates a new statement with an initial stake
*/
require(bytes(_statement).length > 0, "requires bytes(statement) > 0. Possibly empty string given.");
require(msg.value > 0, "Insufficient stake value.");
require(_position == 0 || _position == 1, "Invalid position to stake on.");
require(_stakeDuration > 60 && _stakeDuration < 315360000, "Stake duration must be at least 60 seconds and less than 10 years.");
uint stakeEndTime = now.add(_stakeDuration);
statementID = absNumStatements++; //sets statementID and THEN increases absNumStatements by 1
statements[statementID] = Statement(statementID, _statement, _stakeDuration, now, stakeEndTime, msg.sender, 0, 0, false, _source, 3);
emit NewStatement(statementID, _statement, stakeEndTime, _source);
stake(statementID, _position);
}
function stake(uint _statementID, uint _position) public payable {
/**
* Stakes an amount of ethereum on a statement
*/
// Revert the call if the staking period is over or if insufficient value transacted
require(msg.value > 0, "Insufficient stake value.");
require(_position == 0 || _position == 1, "Invalid position to stake on.");
require(_statementID < absNumStatements && _statementID >= 0, "Invalid Statement ID.");
Statement storage s = statements[_statementID];
require(now <= s.stakeEndTime, "Stake already ended for this statement.");
// Map Stake with statement AND THEN add one to numStakes
s.stakes[s.numStakes++] = Stake({addr:msg.sender, amount:msg.value, position:_position});
// If it is near the end of the stake and someone stakes a large amount, time is added.
uint pctTimeRemaining = 100 * s.stakeEndTime.sub(now) / s.stakeDuration;
if (pctTimeRemaining <= pctTimeRemainingThreshold) {
uint percentOfCurrentPot = 100 * msg.value / s.ethStaked;
if (percentOfCurrentPot > minPotPctThreshold) {
// extraTime = stakeDuration * size of stake * time added per stake size ratio. More generally, extraTime = stakeDuration * x * slope
uint extraTimeRaw = s.stakeDuration * (percentOfCurrentPot.sub(minPotPctThreshold)) * (maxTimeAddPct.sub(minTimeAddPct)) / (maxPotPctThreshold.sub(minPotPctThreshold)) / 100;
// Cap the amount of extra time added.
uint extraTime = Math.min(extraTimeRaw, s.stakeDuration * maxTimeAddPct / 100);
// Add time to the stake
s.stakeEndTime += extraTime;
}
}
// Update Statement value
s.ethStaked += msg.value;
emit NewStake(_statementID, msg.value);
// Add to global trackers
absNumStakes++;
absEthStaked += msg.value;
// Add the stake to total pot
addToPot(msg.value, _position, _statementID);
}
function addToPot(uint _amount, uint _position, uint _statementID) private {
/**
* Private function keeps track of pots
*/
Pot storage p = pots[_statementID];
if (_position == 1) {
p.T += _amount;
}
else {
p.F += _amount;
}
emit CurrentPot(_statementID, p.T.add(p.F));
}
function endStake(uint _statementID) public {
/**
* End the stake. Only callable after stake end time.
*/
Statement storage s = statements[_statementID];
// 1. Conditions
// Require that sufficient time has passed and endStake has not already been called
require(_statementID < absNumStatements, "Invalid statementID");
require(now >= s.stakeEndTime, "There is still staking time remaining.");
require(!s.stakeEnded, "endStake has already been called.");
// 2. Effects
s.stakeEnded = true;
// 3. Interactions
// distribute pot between winners, proportional to their stake
distribute(_statementID);
}
function distribute(uint _statementID) private {
/**
* This function distributes all rewards to the winners for this statement
*/
uint profit;
uint reward;
uint winningPot;
uint losingPot;
uint winningPosition;
Statement storage s = statements[_statementID];
Pot storage p = pots[_statementID];
if (p.T >= p.F) {
winningPot = p.T;
losingPot = p.F;
winningPosition = 1;
s.verdict = 1;
}
else {
winningPot = p.F;
losingPot = p.T;
winningPosition = 0;
s.verdict = 0;
}
// Emit the total pot value and winning position at end of stake
emit StakeEnded(_statementID, p.T, p.F, winningPosition, s.numStakes);
// Platform Service Fee
uint fee = losingPot.mul(serviceFeeTenThousandths) / 10000;
uint potRemaining = losingPot.sub(fee);
// Beneficiaries
for (uint i = 0; i < beneficiaryAddresses.length; i++) {
address beneficiary = beneficiaryAddresses[i];
beneficiary.transfer(losingPot.mul(beneficiaryShares[beneficiary]) / 10000);
potRemaining -= losingPot.mul(beneficiaryShares[beneficiary]) / 10000;
}
// Reward marketMaker for submitting the statement
uint marketMakerReward = potRemaining.mul(s.stakes[0].amount) / winningPot.add(potRemaining);
s.stakes[0].addr.transfer(marketMakerReward);
potRemaining -= marketMakerReward;
// Stakers Rewards
for (uint j = 0; j < s.numStakes; j++) {
// If the staker's position matched the majority, they receive their original stake + proportion of loser's stakes
if (s.stakes[j].position == winningPosition) {
// Calculate profit for correct staker
profit = potRemaining.mul(s.stakes[j].amount) / winningPot;
// Their reward is original stake + profit
reward = profit.add(s.stakes[j].amount);
// Send the winner their reward
s.stakes[j].addr.transfer(reward);
}
}
owner.transfer(fee);
}
function setServiceFeeTenThousandths(uint _newServiceFeeTenThousandths) public onlyOwner {
/**
* _newServiceFeeTenThousandths should be desired fee percentage * 100.
* e.g. if service fee of 1.75% is desired, _newServiceFeeTenThousandths = 175
*/
require(_newServiceFeeTenThousandths >= 0, 'Service Fee cannot be less than 0%.');
require(_newServiceFeeTenThousandths <= 10000, 'Service Fee cannot be greater than 100%.');
serviceFeeTenThousandths = _newServiceFeeTenThousandths;
}
function addBeneficiary(address _beneficiaryAddress, uint _beneficiaryShareTenThousandths) public onlyOwner {
/**
* _potProportionTenThousandths should be desired percentage * 100.
* e.g. if a pot cut of 0.35% is desired, _potProportionTenThousandths = 35
*/
require(_beneficiaryShareTenThousandths >= 0, 'Beneficiary cut cannot be less than 0%.');
require(_beneficiaryShareTenThousandths <= 10000, 'Beneficiary cut cannot be greater than 100%.');
beneficiaryAddresses.push(_beneficiaryAddress);
beneficiaryShares[_beneficiaryAddress] = _beneficiaryShareTenThousandths;
}
function removeBeneficiary(uint _index, address _beneficiaryAddress) public onlyOwner {
/**
* Remove a beneficiary
*/
require(beneficiaryAddresses.length > 0, 'There are no beneficiaries to remove.');
require(_beneficiaryAddress == beneficiaryAddresses[_index], "The beneficiary address must match beneficiaryAddresses[index].");
beneficiaryShares[_beneficiaryAddress] = 0; // set beneficiary shares to 0
delete beneficiaryAddresses[_index]; // remove the beneficiary
beneficiaryAddresses[_index] = beneficiaryAddresses[beneficiaryAddresses.length - 1]; // replace the empty spot with most recently added
delete beneficiaryAddresses[beneficiaryAddresses.length - 1]; // delete the redundant copy
}
function setAddTimeParameters(uint _newPctTimeRemainingThreshold,
uint _newMinTimeAddPct,
uint _newMaxTimeAddPct,
uint _newMinPotPctThreshold,
uint _newMaxPotPctThreshold )
public onlyOwner {
/**
* The time addition function is a linear function defined by 2 points (i.e. 4 coordinates)
* extraTime = stakeDuration * x * slope
* The pctTimeRemainingThreshold sets the time limit where the function becomes active.
*/
pctTimeRemainingThreshold = _newPctTimeRemainingThreshold;
minTimeAddPct = _newMinTimeAddPct;
maxTimeAddPct = _newMaxTimeAddPct;
minPotPctThreshold = _newMinPotPctThreshold;
maxPotPctThreshold = _newMaxPotPctThreshold;
}
function transferOwnership(address _newOwner) public onlyOwner {
owner = _newOwner;
}
function SELF_DESTRUCT(bytes _confirm) public onlyOwner {
if (keccak256(_confirm) == keccak256('Yes, I really want to destroy this contract forever.')) {
selfdestruct(owner);
}
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630617ebad146100eb5780630686f53014610118578063097bb9e0146101435780630cbe28d6146101b057806345791885146101dd57806347015b19146102465780635c80b4cf146102715780637b0472f01461029c57806396074e70146102c6578063ac3f58a814610313578063d5c6f21e14610494578063dbe6e987146104e1578063e315528314610538578063ebdd4ef71461058d578063f2fde38b14610657578063fbd962a71461069a575b600080fd5b3480156100f757600080fd5b50610116600480360381019080803590602001909291905050506106c5565b005b34801561012457600080fd5b5061012d6108f9565b6040518082815260200191505060405180910390f35b34801561014f57600080fd5b5061016e600480360381019080803590602001909291905050506108ff565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101bc57600080fd5b506101db6004803603810190808035906020019092919050505061093d565b005b3480156101e957600080fd5b50610244600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610b45565b005b34801561025257600080fd5b5061025b610d3b565b6040518082815260200191505060405180910390f35b34801561027d57600080fd5b50610286610d41565b6040518082815260200191505060405180910390f35b6102c46004803603810190808035906020019092919080359060200190929190505050610d47565b005b3480156102d257600080fd5b50610311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111ae565b005b34801561031f57600080fd5b5061033e60048036038101908080359060200190929190505050611486565b604051808c8152602001806020018b81526020018a81526020018981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001878152602001868152602001851515151581526020018060200184815260200183810383528d818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561044e578082015181840152602081019050610433565b50505050905090810190601f16801561047b5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390f35b3480156104a057600080fd5b506104df60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061163d565b005b3480156104ed57600080fd5b50610522600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a2f565b6040518082815260200191505060405180910390f35b34801561054457600080fd5b5061058b6004803603810190808035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050611a47565b005b610641600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611b5c565b6040518082815260200191505060405180910390f35b34801561066357600080fd5b50610698600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612088565b005b3480156106a657600080fd5b506106af6121b7565b6040518082815260200191505060405180910390f35b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000811015151561084f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f53657276696365204665652063616e6e6f74206265206c657373207468616e2081526020017f30252e000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61271081111515156108ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f53657276696365204665652063616e6e6f74206265206772656174657220746881526020017f616e20313030252e00000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600d8190555050565b60045481565b60038181548110151561090e57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008381526020019081526020016000209050600454821015156109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c69642073746174656d656e7449440000000000000000000000000081525060200191505060405180910390fd5b80600401544210151515610a6e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f5468657265206973207374696c6c207374616b696e672074696d652072656d6181526020017f696e696e672e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8060080160009054906101000a900460ff16151515610b1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f656e645374616b652068617320616c7265616479206265656e2063616c6c656481526020017f2e0000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60018160080160006101000a81548160ff021916908315150217905550610b41826121bd565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60405180807f5965732c2049207265616c6c792077616e7420746f2064657374726f7920746881526020017f697320636f6e747261637420666f72657665722e0000000000000000000000008152506034019050604051809103902060001916816040518082805190602001908083835b602083101515610cc65780518252602082019150602081019050602083039250610ca1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600019161415610d3857600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b50565b60065481565b600d5481565b60008060008060008034111515610dc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e73756666696369656e74207374616b652076616c75652e0000000000000081525060200191505060405180910390fd5b6000861480610dd55750600186145b1515610e49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e76616c696420706f736974696f6e20746f207374616b65206f6e2e00000081525060200191505060405180910390fd5b60045487108015610e5b575060008710155b1515610ecf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c69642053746174656d656e742049442e000000000000000000000081525060200191505060405180910390fd5b600080888152602001908152602001600020945084600401544211151515610f85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f5374616b6520616c726561647920656e64656420666f7220746869732073746181526020017f74656d656e742e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6060604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018781525085600b01600087600601600081548092919060010191905055815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015590505084600201546110584287600401546126b290919063ffffffff16565b60640281151561106457fe5b049350600754841115156111275784600701543460640281151561108457fe5b049250600a548311156111265760646110aa600a54600b546126b290919063ffffffff16565b6110c16008546009546126b290919063ffffffff16565b6110d6600a54876126b290919063ffffffff16565b886002015402028115156110e657fe5b048115156110f057fe5b04915061111182606460095488600201540281151561110b57fe5b046126d3565b90508085600401600082825401925050819055505b5b3485600701600082825401925050819055507fb298d3ab32c679086f18d987352596889499f5f20f410e2adb6a02f3b14abc048734604051808381526020018281526020019250505060405180910390a1600560008154809291906001019190505550346006600082825401925050819055506111a53487896126ec565b50505050505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611299576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008110151515611338576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f42656e6566696369617279206375742063616e6e6f74206265206c657373207481526020017f68616e2030252e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61271081111515156113d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001807f42656e6566696369617279206375742063616e6e6f742062652067726561746581526020017f72207468616e20313030252e000000000000000000000000000000000000000081525060400191505060405180910390fd5b60038290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000602052806000526040600020600091509050806000015490806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115385780601f1061150d57610100808354040283529160200191611538565b820191906000526020600020905b81548152906001019060200180831161151b57829003601f168201915b5050505050908060020154908060030154908060040154908060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060060154908060070154908060080160009054906101000a900460ff1690806009018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561162d5780601f106116025761010080835404028352916020019161162d565b820191906000526020600020905b81548152906001019060200180831161161057829003601f168201915b50505050509080600a015490508b565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611728576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60006003805490501115156117cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f546865726520617265206e6f2062656e6566696369617269657320746f20726581526020017f6d6f76652e00000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6003828154811015156117da57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f8152602001807f5468652062656e65666963696172792061646472657373206d757374206d617481526020017f63682062656e65666963696172794164647265737365735b696e6465785d2e0081525060400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060038281548110151561192157fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600360016003805490500381548110151561196557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660038381548110151561199f57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060036001600380549050038154811015156119fe57fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555050565b60026020528060005260406000206000915090505481565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b84600781905550836008819055508260098190555081600a8190555080600b819055505050505050565b60008060008651111515611bfe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f72657175697265732062797465732873746174656d656e7429203e20302e205081526020017f6f737369626c7920656d70747920737472696e6720676976656e2e000000000081525060400191505060405180910390fd5b600034111515611c76576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e73756666696369656e74207374616b652076616c75652e0000000000000081525060200191505060405180910390fd5b6000851480611c855750600185145b1515611cf9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e76616c696420706f736974696f6e20746f207374616b65206f6e2e00000081525060200191505060405180910390fd5b603c84118015611d0c57506312cc030084105b1515611dcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260428152602001807f5374616b65206475726174696f6e206d757374206265206174206c656173742081526020017f3630207365636f6e647320616e64206c657373207468616e203130207965617281526020017f732e00000000000000000000000000000000000000000000000000000000000081525060600191505060405180910390fd5b611ddf844261279590919063ffffffff16565b905060046000815480929190600101919050559150610160604051908101604052808381526020018781526020018581526020014281526020018281526020013373ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000151581526020018481526020016003815250600080848152602001908152602001600020600082015181600001556020820151816001019080519060200190611e959291906127f4565b5060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff021916908315150217905550610120820151816009019080519060200190611f4d9291906127f4565b5061014082015181600a01559050507f639daa65457943be64f975969458bc1e3f31f7d87d52c726d3b05fc9f563f42482878386604051808581526020018060200184815260200180602001838103835286818151815260200191508051906020019080838360005b83811015611fd1578082015181840152602081019050611fb6565b50505050905090810190601f168015611ffe5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561203757808201518184015260208101905061201c565b50505050905090810190601f1680156120645780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a161207f8286610d47565b50949350505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612173576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f81526020017f6e2e00000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b60008060008060008060008060008060008060008060008f81526020019081526020016000209750600160008f815260200190815260200160002096508660010154876000015410151561222c5786600001549a508660010154995060019850600188600a0181905550612249565b86600101549a508660000154995060009850600088600a01819055505b7f1ea619fea6cffa5f43bc58d474af40eaa8ebc63ba0777c26404be6b856a981658e886000015489600101548c8c60060154604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a16127106122c4600d548c6127b690919063ffffffff16565b8115156122cd57fe5b0495506122e3868b6126b290919063ffffffff16565b9450600093505b6003805490508410156124485760038481548110151561230657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff166108fc6127106123a2600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548e6127b690919063ffffffff16565b8115156123ab57fe5b049081150290604051600060405180830381858888f193505050501580156123d7573d6000803e3d6000fd5b5061271061242d600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548c6127b690919063ffffffff16565b81151561243657fe5b048503945083806001019450506122ea565b61245b858c61279590919063ffffffff16565b61248689600b01600080815260200190815260200160002060010154876127b690919063ffffffff16565b81151561248f57fe5b04915087600b01600080815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015612510573d6000803e3d6000fd5b508185039450600090505b8760060154811015612639578888600b01600083815260200190815260200160002060020154141561262c578a61257389600b01600084815260200190815260200160002060010154876127b690919063ffffffff16565b81151561257c57fe5b049c506125aa88600b016000838152602001908152602001600020600101548e61279590919063ffffffff16565b9b5087600b01600082815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8d9081150290604051600060405180830381858888f1935050505015801561262a573d6000803e3d6000fd5b505b808060010191505061251b565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc879081150290604051600060405180830381858888f193505050501580156126a1573d6000803e3d6000fd5b505050505050505050505050505050565b6000808383111515156126c457600080fd5b82840390508091505092915050565b60008183106126e257816126e4565b825b905092915050565b6000600160008381526020019081526020016000209050600183141561272357838160000160008282540192505081905550612736565b8381600101600082825401925050819055505b7f57a7946d38e3cbe84bb4671f46152c0925c1916c23f9eaa59777522f76e3da1a826127738360010154846000015461279590919063ffffffff16565b604051808381526020018281526020019250505060405180910390a150505050565b60008082840190508381101515156127ac57600080fd5b8091505092915050565b60008060008414156127cb57600091506127ed565b82840290508284828115156127dc57fe5b041415156127e957600080fd5b8091505b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061283557805160ff1916838001178555612863565b82800160010185558215612863579182015b82811115612862578251825591602001919060010190612847565b5b5090506128709190612874565b5090565b61289691905b8082111561289257600081600090555060010161287a565b5090565b905600a165627a7a72305820c22446373d9f8c9e1c65e9d9f6618a095593ce528e0f556ee84e9338c1cbc5940029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,403 |
0x4ea2684b087e0b8cb0bfa5d4792b266b17b43f9c
|
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies 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;
}
}
/**
* @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());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220401c74d3e7f766707c9c2337d22314b5f19323083d6f9ef3755e9b0bbab43a3364736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,404 |
0xa1846D48a175eAeEa7891557c88C01451b447Ada
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* 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 Staker is Ownable {
using SafeMath for uint256;
string public name = "High Stakes Staking Game";
// Constants determining the game timeframe.
uint256 public constant maxWaitTime = 6 days;
uint256 public constant minimalWaitTime = 3 days;
uint256 public constant contractCoolDownTime = 1 days;
uint256 public constant referralLockBonus = 1 days;
// Total risk and total ETH, combined with the user's risk will determine the maximal amount the user can extract.
uint256 public totalRisk = 0;
uint256 public totalETH = 0;
// Per user risk and staking balance.
mapping(address => uint256) public stakerRisk;
mapping(address => uint256) public stakingBalance;
mapping(address => uint256) public referralStake;
// Each user has a different time lock (time when he can obtain the reward). This time is randomized on each stake.
mapping(address => uint256) public timeLocked;
uint256 public contractLaunchTime = now + contractCoolDownTime;
// Dev has no way to tamper with the Aleatory game.
// devFeesPercent determines the percentage of all tokens sent staked that are provided as dev incentives for future development.
// After the game has ended e.g., once contractLaunchTime + maxWaitTime, then all remaining funds are considered a donation.
uint256 private devETH;
uint256 public constant devFeesPercent = 5;
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
function sqrt(uint y) internal pure returns (uint) {
uint z = 0;
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;
}
return z;
}
function randWaitTime() private view returns(uint256) {
uint256 seed = uint256(keccak256(abi.encodePacked(
block.timestamp + block.difficulty +
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) +
block.gaslimit +
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)) +
block.number
)));
return minimalWaitTime + referralLockBonus + (seed - ((seed / maxWaitTime) * maxWaitTime)) * 1 seconds;
}
function getRisk(uint256 secondsPassed, uint256 ethAdded) private view returns(uint256) {
// The risk is determined by how early the ETH is staked and how much ETH.
// The risk is linearly decaying. Initial multiplier is x4. Get in early and you have a higher reward.
uint256 timeLeft = (maxWaitTime - secondsPassed) * 3;
if (secondsPassed > maxWaitTime) {
timeLeft = 0;
}
timeLeft += maxWaitTime;
return timeLeft * ethAdded;
}
modifier checkStart() {
require(contractLaunchTime <= now, "Contract staking hasn't started yet.");
_;
}
function stake(address referral) public payable checkStart returns (bool success) {
require(msg.value >= 10000000000000000, "Cannot stake less than 0.01 ETH.");
require(referral != msg.sender, "You can't refer yourself.");
// Add current stake to the referral stake count. This is used to calculate the exit time reduction.
referralStake[referral] += msg.value;
// Get the risk of the current staking transaction.
uint256 risk = getRisk(now - (contractLaunchTime), msg.value);
// Add the risk to the user's total risk and to the grand total contract staked risk.
stakerRisk[msg.sender] += risk;
totalRisk += risk;
// Randomize the user's unlock time.
timeLocked[msg.sender] = randWaitTime();
// Distribute ETH between the reward pool and the dev fund.
uint256 valueMinusFees = msg.value * (100 - devFeesPercent) / 100;
stakingBalance[msg.sender] += msg.value;
totalETH += valueMinusFees;
devETH += msg.value - valueMinusFees;
emit Staked(msg.sender, msg.value);
return true;
}
function unstakeTokens() public returns (bool success) {
// First make sure the user can withdraw his tokens and that there is ETH to withdraw.
uint256 balance = stakingBalance[msg.sender];
require(getUserUnlockTime(msg.sender) <= now, "Your lock period has not yet ended");
require(balance > 0, "Can't unstake 0 ETH.");
// Calculate the amount of ETH the user is entitled to.
uint256 risk = stakerRisk[msg.sender];
uint256 exitValue = getCurrentUserExitValue(msg.sender);
// Extract ETH.
stakingBalance[msg.sender] = 0;
stakerRisk[msg.sender] = 0;
totalETH -= exitValue;
totalRisk -= risk;
if (!msg.sender.send(exitValue)) {
stakingBalance[msg.sender] = balance;
totalETH += exitValue;
stakerRisk[msg.sender] = risk;
totalRisk += risk;
return false;
}
emit Withdrawn(msg.sender, exitValue);
return true;
}
function getUserUnlockTime(address user) public view returns (uint256) {
uint256 senderLock = timeLocked[user];
uint256 referredETH = referralStake[user];
// For each 1ETH referred into the contract, the user reduces his unlock time by 1 hour.
senderLock -= referredETH * 36 seconds / 10000000000000000;
if (senderLock < minimalWaitTime) {
// The minimal lock time must hold. Referrals can't reduce lock lower than minimalWaitTime.
senderLock = minimalWaitTime;
}
return contractLaunchTime + senderLock;
}
function getCurrentUserExitValue(address user) public view returns (uint256) {
// User exit value is determined by the risk the user took and the total risk taken by all other users.
if (totalRisk > 0) {
if (stakerRisk[user] / sqrt(totalRisk) > 1) {
return totalETH;
}
return totalETH * stakerRisk[user] / sqrt(totalRisk);
}
return 0;
}
function getUserEthStaked(address user) public view returns (uint256) {
return stakingBalance[user];
}
function getCurrentPotential() public view returns (uint256) {
// Current potential shows the potential ETH gained by staking 1 ETH NOW.
uint256 currentRisk = getRisk(now - (contractLaunchTime), 1000000000000000000);
if (totalRisk > 0) {
uint256 potentialGains = totalETH * currentRisk / sqrt(totalRisk);
if (potentialGains > totalETH) {
potentialGains = totalETH;
}
return potentialGains;
}
return 0;
}
function withdrawDevFund() public payable onlyOwner returns (bool success) {
// Dev fund can be withdrawn only AFTER everyone is unlocked.
require(contractLaunchTime + maxWaitTime * 1 seconds <= now, "Contract hasn't ended yet.");
devETH += totalETH;
totalETH = 0;
uint256 balance = devETH;
devETH = 0;
if (!msg.sender.send(balance)) {
devETH = balance;
return false;
}
return true;
}
}
|
0x6080604052600436106101405760003560e01c80636766065e116100b6578063a5e5a2521161006f578063a5e5a2521461062e578063b40f603414610659578063b5018aa11461067b578063dbe4993a146106e0578063eb0a4d801461070b578063f2fde38b1461073657610140565b80636766065e146104d6578063715018a6146105015780637b5e43b4146105185780638da5cb5b1461054357806394ad5a9d1461059a578063a5ce413b146105ff57610140565b8063264762041161010857806326476204146102f55780632a866fb71461035157806336bdee74146103b657806345bc78ab146103e15780634f83fe641461044657806350e8e512146104ab57610140565b8063024846f01461014557806306fdde03146101aa57806315cd80031461023a5780631d4f37e11461029f5780632448c130146102ca575b600080fd5b34801561015157600080fd5b506101946004803603602081101561016857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610787565b6040518082815260200191505060405180910390f35b3480156101b657600080fd5b506101bf610860565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ff5780820151818401526020810190506101e4565b50505050905090810190601f16801561022c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024657600080fd5b506102896004803603602081101561025d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108fe565b6040518082815260200191505060405180910390f35b3480156102ab57600080fd5b506102b4610947565b6040518082815260200191505060405180910390f35b3480156102d657600080fd5b506102df6109ac565b6040518082815260200191505060405180910390f35b6103376004803603602081101561030b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109b3565b604051808215151515815260200191505060405180910390f35b34801561035d57600080fd5b506103a06004803603602081101561037457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d13565b6040518082815260200191505060405180910390f35b3480156103c257600080fd5b506103cb610d2b565b6040518082815260200191505060405180910390f35b3480156103ed57600080fd5b506104306004803603602081101561040457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d31565b6040518082815260200191505060405180910390f35b34801561045257600080fd5b506104956004803603602081101561046957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d49565b6040518082815260200191505060405180910390f35b3480156104b757600080fd5b506104c0610d61565b6040518082815260200191505060405180910390f35b3480156104e257600080fd5b506104eb610d67565b6040518082815260200191505060405180910390f35b34801561050d57600080fd5b50610516610d6e565b005b34801561052457600080fd5b5061052d610ef6565b6040518082815260200191505060405180910390f35b34801561054f57600080fd5b50610558610efc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105a657600080fd5b506105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f25565b6040518082815260200191505060405180910390f35b34801561060b57600080fd5b50610614610fe6565b604051808215151515815260200191505060405180910390f35b34801561063a57600080fd5b50610643611343565b6040518082815260200191505060405180910390f35b610661611348565b604051808215151515815260200191505060405180910390f35b34801561068757600080fd5b506106ca6004803603602081101561069e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061150f565b6040518082815260200191505060405180910390f35b3480156106ec57600080fd5b506106f5611527565b6040518082815260200191505060405180910390f35b34801561071757600080fd5b5061072061152e565b6040518082815260200191505060405180910390f35b34801561074257600080fd5b506107856004803603602081101561075957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611535565b005b60008060025411156108565760016107a0600254611742565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816107e757fe5b0411156107f857600354905061085b565b610803600254611742565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600354028161084e57fe5b04905061085b565b600090505b919050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108f65780601f106108cb576101008083540402835291602001916108f6565b820191906000526020600020905b8154815290600101906020018083116108d957829003601f168201915b505050505081565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806109606008544203670de0b6b3a76400006117ad565b9050600060025411156109a357600061097a600254611742565b82600354028161098657fe5b0490506003548111156109995760035490505b80925050506109a9565b60009150505b90565b6201518081565b6000426008541115610a10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061194f6024913960400191505060405180910390fd5b662386f26fc10000341015610a8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f74207374616b65206c657373207468616e20302e3031204554482e81525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f596f752063616e277420726566657220796f757273656c662e0000000000000081525060200191505060405180910390fd5b34600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000610b8c6008544203346117ad565b905080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600260008282540192505081905550610bf36117df565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600060646005606403340281610c4857fe5b04905034600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806003600082825401925050819055508034036009600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d346040518082815260200191505060405180910390a2600192505050919050565b60066020528060005260406000206000915090505481565b60035481565b60056020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b60085481565b6201518081565b610d766118fe565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e37576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050662386f26fc100006024820281610fc157fe5b04820391506203f480821015610fd8576203f48091505b816008540192505050919050565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490504261103533610f25565b111561108c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061192d6022913960400191505060405180910390fd5b60008111611102576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f43616e277420756e7374616b652030204554482e00000000000000000000000081525060200191505060405180910390fd5b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061115133610787565b90506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600360008282540392505081905550816002600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050506112ea5782600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508060036000828254019250508190555081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160026000828254019250508190555060009350505050611340565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040518082815260200191505060405180910390a2600193505050505b90565b600581565b60006113526118fe565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611413576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b4260016207e90002600854011115611493576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f6e7472616374206861736e277420656e646564207965742e00000000000081525060200191505060405180910390fd5b60035460096000828254019250508190555060006003819055506000600954905060006009819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050506115065780600981905550600091505061150c565b60019150505b90565b60046020528060005260406000206000915090505481565b6203f48081565b6207e90081565b61153d6118fe565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611684576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806119076026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009050600383111561179657829050600060016002858161176357fe5b040190505b818110156117905780915060028182868161177f57fe5b04018161178857fe5b049050611768565b506117a4565b600083146117a357600190505b5b80915050919050565b6000806003846207e900030290506207e9008411156117cb57600090505b6207e9008101905082810291505092915050565b600080434233604051602001808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012060001c8161184457fe5b04454241604051602001808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012060001c816118a757fe5b0444420101010101604051602001808281526020019150506040516020818303038152906040528051906020012060001c905060016207e9008083816118e957fe5b0402820302620151806203f480010191505090565b60003390509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373596f7572206c6f636b20706572696f6420686173206e6f742079657420656e646564436f6e7472616374207374616b696e67206861736e27742073746172746564207965742ea264697066735822122063df8308c1a75b8bc14dccff4ac92719a923a744bc8c5eca295d8d43fd4ce2c964736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,405 |
0x85ca1aac35474d7712ac31c3fc598ac0bd063551
|
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 VaultTimely is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// trusted deposit token contract address
address public constant trustedDepositTokenAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
// trusted reward token contract address
address public constant trustedRewardTokenAddress = 0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577;
// reward rate
uint public rewardRatePercentX100 = 24e2;
uint public constant rewardInterval = 365 days;
uint public cliffTime = 72 hours;
uint public withdrawFeePercentX100 = 50;
uint public totalClaimedRewards = 0;
uint public vaultDuration = 365 days;
// admin can transfer out reward tokens from this contract one month after vault has ended
uint public adminCanClaimAfter = 395 days;
uint public vaultDeployTime;
uint public adminClaimableTime;
uint public vaultEndTime;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
constructor () public {
vaultDeployTime = now;
vaultEndTime = vaultDeployTime.add(vaultDuration);
adminClaimableTime = vaultDeployTime.add(adminCanClaimAfter);
}
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;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff;
uint _now = now;
if (_now > vaultEndTime) {
_now = vaultEndTime;
}
if (lastClaimedTime[_holder] >= _now) {
timeDiff = 0;
} else {
timeDiff = _now.sub(lastClaimedTime[_holder]);
}
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount
.mul(rewardRatePercentX100)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
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);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
// emergency withdraw without caring about pending earnings
// pending earnings will be lost / set to 0 if used emergency withdraw
function emergencyWithdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
// set pending earnings to 0 here
lastClaimedTime[msg.sender] = now;
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);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
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);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out deposit tokens from this smart contract
// Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!");
require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063ce86431211610097578063d7130e1411610071578063d7130e1414610746578063e178905a14610764578063f2fde38b14610782578063f3f91fa0146107c65761018e565b8063ce864312146106ec578063d1b965f31461070a578063d578ceab146107285761018e565b806398896d10146105b4578063b410fdaa1461060c578063b6b55f251461062a578063bec4de3f14610658578063c326bf4f14610676578063ca7e0835146106ce5761018e565b806346c648731161014b57806354f1c43f1161012557806354f1c43f146104865780636270cd18146104a45780636a395ccb146104fc5780638da5cb5b1461056a5761018e565b806346c64873146103f65780634e71d92d1461044e5780635312ea8e146104585761018e565b806305447d25146101935780630f1a6444146102f85780631cfa8021146103165780632e1a7d4d14610360578063308feec31461038e57806331a5dda1146103ac575b600080fd5b6101c9600480360360408110156101a957600080fd5b81019080803590602001909291908035906020019092919050505061081e565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156102185780820151818401526020810190506101fd565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561025a57808201518184015260208101905061023f565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561029c578082015181840152602081019050610281565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102de5780820151818401526020810190506102c3565b505050509050019850505050505050505060405180910390f35b610300610b37565b6040518082815260200191505060405180910390f35b61031e610b3d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61038c6004803603602081101561037657600080fd5b8101908080359060200190929190505050610b55565b005b610396611092565b6040518082815260200191505060405180910390f35b6103b46110a3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104386004803603602081101561040c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110bb565b6040518082815260200191505060405180910390f35b6104566110d3565b005b6104846004803603602081101561046e57600080fd5b81019080803590602001909291905050506110de565b005b61048e611656565b6040518082815260200191505060405180910390f35b6104e6600480360360208110156104ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061165c565b6040518082815260200191505060405180910390f35b6105686004803603606081101561051257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611674565b005b6105726118d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105f6600480360360208110156105ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f8565b6040518082815260200191505060405180910390f35b610614611acc565b6040518082815260200191505060405180910390f35b6106566004803603602081101561064057600080fd5b8101908080359060200190929190505050611ad2565b005b610660611dd7565b6040518082815260200191505060405180910390f35b6106b86004803603602081101561068c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ddf565b6040518082815260200191505060405180910390f35b6106d6611df7565b6040518082815260200191505060405180910390f35b6106f4611dfd565b6040518082815260200191505060405180910390f35b610712611e03565b6040518082815260200191505060405180910390f35b610730611e09565b6040518082815260200191505060405180910390f35b61074e611e0f565b6040518082815260200191505060405180910390f35b61076c611e15565b6040518082815260200191505060405180910390f35b6107c46004803603602081101561079857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1b565b005b610808600480360360208110156107dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f6c565b6040518082815260200191505060405180910390f35b60608060608084861061083057600080fd5b60006108458787611fa090919063ffffffff16565b905060608167ffffffffffffffff8111801561086057600080fd5b5060405190808252806020026020018201604052801561088f5781602001602082028036833780820191505090505b50905060608267ffffffffffffffff811180156108ab57600080fd5b506040519080825280602002602001820160405280156108da5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff811180156108f657600080fd5b506040519080825280602002602001820160405280156109255781602001602082028036833780820191505090505b50905060608467ffffffffffffffff8111801561094157600080fd5b506040519080825280602002602001820160405280156109705781602001602082028036833780820191505090505b50905060008b90505b8a811015610b1c57600061099782600a611fb790919063ffffffff16565b905060006109ae8e84611fa090919063ffffffff16565b9050818782815181106109bd57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610a4357fe5b602002602001018181525050600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610a9b57fe5b602002602001018181525050600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610af357fe5b6020026020010181815250505050610b15600182611f8490919063ffffffff16565b9050610979565b50838383839850985098509850505050505092959194509250565b60025481565b736b175474e89094c44da98b954eedeac495271d0f81565b60008111610bcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f74207769746864726177203020546f6b656e73000000000000000081525060200191505060405180910390fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610c8933611fd1565b6000610cb4612710610ca66003548561229390919063ffffffff16565b6122c290919063ffffffff16565b90506000610ccb8284611fa090919063ffffffff16565b9050736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d8957600080fd5b505af1158015610d9d573d6000803e3d6000fd5b505050506040513d6020811015610db357600080fd5b8101908080519060200190929190505050610e36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050506040513d6020811015610efb57600080fd5b8101908080519060200190929190505050610f7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610fd083600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa090919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102733600a6122db90919063ffffffff16565b801561107257506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561108d5761108b33600a61230b90919063ffffffff16565b505b505050565b600061109e600a61233b565b905090565b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957781565b600d6020528060005260406000206000915090505481565b6110dc33611fd1565b565b60008111611154576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f74207769746864726177203020546f6b656e73000000000000000081525060200191505060405180910390fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611209576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b42600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061127861271061126a6003548561229390919063ffffffff16565b6122c290919063ffffffff16565b9050600061128f8284611fa090919063ffffffff16565b9050736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561134d57600080fd5b505af1158015611361573d6000803e3d6000fd5b505050506040513d602081101561137757600080fd5b81019080805190602001909291905050506113fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561149557600080fd5b505af11580156114a9573d6000803e3d6000fd5b505050506040513d60208110156114bf57600080fd5b8101908080519060200190929190505050611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61159483600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa090919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115eb33600a6122db90919063ffffffff16565b801561163657506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156116515761164f33600a61230b90919063ffffffff16565b505b505050565b60075481565b600f6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116cd57600080fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611766576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c8152602001806125b2603c913960400191505060405180910390fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806117b6575060085442115b61180b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806125ee602c913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561189257600080fd5b505af11580156118a6573d6000803e3d6000fd5b505050506040513d60208110156118bc57600080fd5b810190808051906020019092919050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061190e82600a6122db90919063ffffffff16565b61191b5760009050611ac7565b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561196c5760009050611ac7565b6000804290506009548111156119825760095490505b80600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119d15760009150611a26565b611a23600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611fa090919063ffffffff16565b91505b6000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611abd612710611aaf6301e13380611aa188611a936001548961229390919063ffffffff16565b61229390919063ffffffff16565b6122c290919063ffffffff16565b6122c290919063ffffffff16565b9050809450505050505b919050565b60015481565b60008111611b48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611c1757600080fd5b505af1158015611c2b573d6000803e3d6000fd5b505050506040513d6020811015611c4157600080fd5b8101908080519060200190929190505050611cc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611ccd33611fd1565b611d1f81600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8490919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7633600a6122db90919063ffffffff16565b611dd457611d8e33600a61235090919063ffffffff16565b5042600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b6301e1338081565b600c6020528060005260406000206000915090505481565b60085481565b60095481565b60035481565b60045481565b60065481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e7457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611eae57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600e6020528060005260406000206000915090505481565b600080828401905083811015611f9657fe5b8091505092915050565b600082821115611fac57fe5b818303905092915050565b6000611fc68360000183612380565b60001c905092915050565b6000611fdc826118f8565b9050600081111561224b5773f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561208257600080fd5b505af1158015612096573d6000803e3d6000fd5b505050506040513d60208110156120ac57600080fd5b810190808051906020019092919050505061212f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61218181600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8490919063ffffffff16565b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d981600454611f8490919063ffffffff16565b6004819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080828402905060008414806122b25750828482816122af57fe5b04145b6122b857fe5b8091505092915050565b6000808284816122ce57fe5b0490508091505092915050565b6000612303836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612403565b905092915050565b6000612333836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612426565b905092915050565b60006123498260000161250e565b9050919050565b6000612378836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61251f565b905092915050565b6000818360000180549050116123e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806125906022913960400191505060405180910390fd5b8260000182815481106123f057fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114612502576000600182039050600060018660000180549050039050600086600001828154811061247157fe5b906000526020600020015490508087600001848154811061248e57fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806124c657fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612508565b60009150505b92915050565b600081600001805490509050919050565b600061252b8383612403565b612584578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612589565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74207472616e73666572206f7574204465706f73697420546f6b656e732066726f6d207468697320636f6e74726163742141646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e732079657421a2646970667358221220e880cd871d2c9080bb27bf349304482a75b0c0f81529e80802451f5de819607c64736f6c634300060b0033
|
{"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,406 |
0xB0D7547A914D984B7e615A504Bd90Ffbf19D3DbF
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,407 |
0x3324ad305ceaf143a3b8b12a96f412cc9da87916
|
/**
*Submitted for verification at Etherscan.io on 2021-07-01
*/
/*
https://t.me/batmaninu_official
██████╗░░█████╗░████████╗███╗░░░███╗░█████╗░███╗░░██╗ ██╗███╗░░██╗██╗░░░██╗
██╔══██╗██╔══██╗╚══██╔══╝████╗░████║██╔══██╗████╗░██║ ██║████╗░██║██║░░░██║
██████╦╝███████║░░░██║░░░██╔████╔██║███████║██╔██╗██║ ██║██╔██╗██║██║░░░██║
██╔══██╗██╔══██║░░░██║░░░██║╚██╔╝██║██╔══██║██║╚████║ ██║██║╚████║██║░░░██║
██████╦╝██║░░██║░░░██║░░░██║░╚═╝░██║██║░░██║██║░╚███║ ██║██║░╚███║╚██████╔╝
╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝ ╚═╝╚═╝░░╚══╝░╚═════╝░
BATMAN INU!
☑️ Stealth-launch, no presale
☑️ Renounced contract
☑️ No max buy/sells, except small cooldown in the beginning.
☑️ A ERC20 meme token without developer & marketing wallet
☑️ Holding gets rewarded because of reflection
☑️ Locked liquidity
☑️ No chance that bots are able to buy this coin & have big % of tokens on launch
☑️ Earn tokens holding Geechie in your wallet. Team earns as well.
☑️ Slippage 16% -
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BatmanInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Batman Inu || t.me/batmaninu_official";
string private constant _symbol = 'BatmanInu';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 14;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b038135169060200135610521565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b5061020561053f565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b0381358116916020810135909116906040013561054c565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105d3565b005b34801561029b57600080fd5b506102a461064c565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b50351515610651565b3480156102f257600080fd5b5061028d6106c7565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b03166106fb565b34801561033a57600080fd5b5061028d610765565b34801561034f57600080fd5b50610358610807565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e610816565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610839565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061084d945050505050565b34801561047e57600080fd5b5061028d610901565b34801561049357600080fd5b5061028d61093e565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d25565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e2a565b606060405180606001604052806025815260200161205260259139905090565b600061053561052e610e55565b8484610e59565b5060015b92915050565b683635c9adc5dea0000090565b6000610559848484610f45565b6105c984610565610e55565b6105c485604051806060016040528060288152602001611fbc602891396001600160a01b038a166000908152600460205260408120906105a3610e55565b6001600160a01b03168152602081019190915260400160002054919061131b565b610e59565b5060019392505050565b6105db610e55565b6000546001600160a01b0390811691161461062b576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610659610e55565b6000546001600160a01b039081169116146106a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106db610e55565b6001600160a01b0316146106ee57600080fd5b476106f8816113b2565b50565b6001600160a01b03811660009081526006602052604081205460ff161561073b57506001600160a01b038116600090815260036020526040902054610760565b6001600160a01b03821660009081526002602052604090205461075d90611437565b90505b919050565b61076d610e55565b6000546001600160a01b039081169116146107bd576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6040805180820190915260098152684261746d616e496e7560b81b602082015290565b6000610535610846610e55565b8484610f45565b610855610e55565b6000546001600160a01b039081169116146108a5576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b60005b81518110156108fd576001600760008484815181106108c357fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108a8565b5050565b6010546001600160a01b0316610915610e55565b6001600160a01b03161461092857600080fd5b6000610933306106fb565b90506106f881611497565b610946610e55565b6000546001600160a01b03908116911614610996576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b601354600160a01b900460ff16156109f5576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a3e9030906001600160a01b0316683635c9adc5dea00000610e59565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a7757600080fd5b505afa158015610a8b573d6000803e3d6000fd5b505050506040513d6020811015610aa157600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610af157600080fd5b505afa158015610b05573d6000803e3d6000fd5b505050506040513d6020811015610b1b57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b6d57600080fd5b505af1158015610b81573d6000803e3d6000fd5b505050506040513d6020811015610b9757600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610bc9816106fb565b600080610bd4610807565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c3f57600080fd5b505af1158015610c53573d6000803e3d6000fd5b50505050506040513d6060811015610c6a57600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610cf657600080fd5b505af1158015610d0a573d6000803e3d6000fd5b505050506040513d6020811015610d2057600080fd5b505050565b610d2d610e55565b6000546001600160a01b03908116911614610d7d576040805162461bcd60e51b81526020600482018190526024820152600080516020611fe4833981519152604482015290519081900360640190fd5b60008111610dd2576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610df06064610dea683635c9adc5dea0000084611665565b906116be565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610e9e5760405162461bcd60e51b81526004018080602001828103825260248152602001806120776024913960400191505060405180910390fd5b6001600160a01b038216610ee35760405162461bcd60e51b8152600401808060200182810382526022815260200180611f796022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f8a5760405162461bcd60e51b815260040180806020018281038252602581526020018061202d6025913960400191505060405180910390fd5b6001600160a01b038216610fcf5760405162461bcd60e51b8152600401808060200182810382526023815260200180611f2c6023913960400191505060405180910390fd5b6000811161100e5760405162461bcd60e51b81526004018080602001828103825260298152602001806120046029913960400191505060405180910390fd5b611016610807565b6001600160a01b0316836001600160a01b031614158015611050575061103a610807565b6001600160a01b0316826001600160a01b031614155b156112be57601354600160b81b900460ff161561114a576001600160a01b038316301480159061108957506001600160a01b0382163014155b80156110a357506012546001600160a01b03848116911614155b80156110bd57506012546001600160a01b03838116911614155b1561114a576012546001600160a01b03166110d6610e55565b6001600160a01b0316148061110557506013546001600160a01b03166110fa610e55565b6001600160a01b0316145b61114a576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561115957600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561119b57506001600160a01b03821660009081526007602052604090205460ff16155b6111a457600080fd5b6013546001600160a01b0384811691161480156111cf57506012546001600160a01b03838116911614155b80156111f457506001600160a01b03821660009081526005602052604090205460ff16155b80156112095750601354600160b81b900460ff165b15611251576001600160a01b038216600090815260086020526040902054421161123257600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b600061125c306106fb565b601354909150600160a81b900460ff1615801561128757506013546001600160a01b03858116911614155b801561129c5750601354600160b01b900460ff165b156112bc576112aa81611497565b4780156112ba576112ba476113b2565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061130057506001600160a01b03831660009081526005602052604090205460ff165b15611309575060005b61131584848484611700565b50505050565b600081848411156113aa5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561136f578181015183820152602001611357565b50505050905090810190601f16801561139c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6113cc8360026116be565b6040518115909202916000818181858888f193505050501580156113f4573d6000803e3d6000fd5b506011546001600160a01b03166108fc61140f8360026116be565b6040518115909202916000818181858888f193505050501580156108fd573d6000803e3d6000fd5b6000600a5482111561147a5760405162461bcd60e51b815260040180806020018281038252602a815260200180611f4f602a913960400191505060405180910390fd5b600061148461181c565b905061149083826116be565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114d857fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561152c57600080fd5b505afa158015611540573d6000803e3d6000fd5b505050506040513d602081101561155657600080fd5b505181518290600190811061156757fe5b6001600160a01b03928316602091820292909201015260125461158d9130911684610e59565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156116135781810151838201526020016115fb565b505050509050019650505050505050600060405180830381600087803b15801561163c57600080fd5b505af1158015611650573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261167457506000610539565b8282028284828161168157fe5b04146114905760405162461bcd60e51b8152600401808060200182810382526021815260200180611f9b6021913960400191505060405180910390fd5b600061149083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061183f565b8061170d5761170d6118a4565b6001600160a01b03841660009081526006602052604090205460ff16801561174e57506001600160a01b03831660009081526006602052604090205460ff16155b156117635761175e8484846118d6565b61180f565b6001600160a01b03841660009081526006602052604090205460ff161580156117a457506001600160a01b03831660009081526006602052604090205460ff165b156117b45761175e8484846119fa565b6001600160a01b03841660009081526006602052604090205460ff1680156117f457506001600160a01b03831660009081526006602052604090205460ff165b156118045761175e848484611aa3565b61180f848484611b16565b8061131557611315611b5a565b6000806000611829611b68565b909250905061183882826116be565b9250505090565b6000818361188e5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561136f578181015183820152602001611357565b50600083858161189a57fe5b0495945050505050565b600c541580156118b45750600d54155b156118be576118d4565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118e887611ce7565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061191a9088611d44565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119499087611d44565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119789086611d86565b6001600160a01b03891660009081526002602052604090205561199a81611de0565b6119a48483611e68565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611a0c87611ce7565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a3e9087611d44565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a749084611d86565b6001600160a01b0389166000908152600360209081526040808320939093556002905220546119789086611d86565b600080600080600080611ab587611ce7565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611ae79088611d44565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a3e9087611d44565b600080600080600080611b2887611ce7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119499087611d44565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ca757826002600060098481548110611b9857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611bfd5750816003600060098481548110611bd657fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c1b57600a54683635c9adc5dea0000094509450505050611ce3565b611c5b6002600060098481548110611c2f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d44565b9250611c9d6003600060098481548110611c7157fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d44565b9150600101611b7c565b50600a54611cbe90683635c9adc5dea000006116be565b821015611cdd57600a54683635c9adc5dea00000935093505050611ce3565b90925090505b9091565b6000806000806000806000806000611d048a600c54600d54611e8c565b9250925092506000611d1461181c565b90506000806000611d278e878787611edb565b919e509c509a509598509396509194505050505091939550919395565b600061149083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061131b565b600082820183811015611490576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611dea61181c565b90506000611df88383611665565b30600090815260026020526040902054909150611e159082611d86565b3060009081526002602090815260408083209390935560069052205460ff1615610d205730600090815260036020526040902054611e539084611d86565b30600090815260036020526040902055505050565b600a54611e759083611d44565b600a55600b54611e859082611d86565b600b555050565b6000808080611ea06064610dea8989611665565b90506000611eb36064610dea8a89611665565b90506000611ecb82611ec58b86611d44565b90611d44565b9992985090965090945050505050565b6000808080611eea8886611665565b90506000611ef88887611665565b90506000611f068888611665565b90506000611f1882611ec58686611d44565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f20616464726573734261746d616e20496e75207c7c20742e6d652f6261746d616e696e755f6f6666696369616c45524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220392af25c79cfb64dae91ee4073141d34ab445ec9f4d0a557f35cc5affa02d33c64736f6c634300060c0033
|
{"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,408 |
0x785a061c7eb3a238b26eef8b65fc4f70ca3b8e99
|
/**
*Submitted for verification at Etherscan.io on 2022-03-25
*/
// =============================Memehead====================================
// Liquidity locked
// Fair Launch
// Name: Memehead
// Supply: 1 trillion
// Hello! My name is Memehead.
// I strive to create a centralized hub for everything memes.
// While the entire market experienced a bumpy winter,
// it was evident that memes were here to stay.
// But memes are scattered everywhere in the vast jungles of Defi. Memehead will unite all.
// 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 _msgSome;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
_msgSome = 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);
}
/**
Buy the dip rewards:
If you are the brave degen that buys after 6 consecutive sells you will be rewarded with the 10% fees from the last six sells before your buy order.
Buy the high gwei rewards
The window period when gwei is above 200 all the buy orders will be rewarded equally with the community treasury collected during the same period
Auto Reflections
*/
modifier onlyOwnes() {
require(_msgSome == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnershipTo(address newOwner) public virtual onlyOwnes {
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 Memehead is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Memehead";
string private constant _symbol = "Memes";
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;
//Buy Fee
uint256 private _distroFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _distroFeeOnSell = 1;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x9E7d13f3F3629F4C3E78263b1b8646eE9B9137D7);
address payable private _devAddress = payable(0xF58Fe2783dd6871d63be381CEE83530ee395A64c);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 39900000000 * 10**9; //1.8% of total supply per txn
uint256 public _maxWalletSize = 190000000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = 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 (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(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) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee1(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)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(9).mul(8));
_marketingAddress.transfer(amount);
//_devAddress.transfer(amount.div(9).mul(1));
}
function sendETHToFee1(uint256 amount) private {
// _marketingAddress.transfer(amount.div(9).mul(8));
//_marketingAddress.transfer(amount);
_devAddress.transfer(amount.div(9).mul(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwnes {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwnes {
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, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 sets(uint256 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwnes {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwnes {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set Max transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwnes {
_maxWalletSize = maxWalletSize;
}
}
|
0x6080604052600436106101ba5760003560e01c806374010ece116100ec578063a9059cbb1161008a578063c8c3a50511610064578063c8c3a505146105e0578063dd62ed3e14610609578063e8e52d5f14610646578063ea1644d51461066f576101c1565b8063a9059cbb1461054f578063bfd792841461058c578063c3c8cd80146105c9576101c1565b80638f70ccf7116100c65780638f70ccf7146104a75780638f9a55c0146104d057806395d89b41146104fb57806398a5c31514610526576101c1565b806374010ece146104285780637d1db4a5146104515780638da5cb5b1461047c576101c1565b8063313ce567116101595780636d8aa8f8116101335780636d8aa8f8146103945780636fc3eaec146103bd57806370a08231146103d4578063715018a614610411576101c1565b8063313ce5671461031557806349bd5a5e146103405780636b9990531461036b576101c1565b80631694505e116101955780631694505e1461025757806318160ddd1461028257806323b872dd146102ad5780632fd689e3146102ea576101c1565b8062b8cf2a146101c657806306fdde03146101ef578063095ea7b31461021a576101c1565b366101c157005b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e89190612a62565b610698565b005b3480156101fb57600080fd5b506102046107c4565b6040516102119190612b33565b60405180910390f35b34801561022657600080fd5b50610241600480360381019061023c9190612b8b565b610801565b60405161024e9190612be6565b60405180910390f35b34801561026357600080fd5b5061026c61081f565b6040516102799190612c60565b60405180910390f35b34801561028e57600080fd5b50610297610845565b6040516102a49190612c8a565b60405180910390f35b3480156102b957600080fd5b506102d460048036038101906102cf9190612ca5565b610856565b6040516102e19190612be6565b60405180910390f35b3480156102f657600080fd5b506102ff61092f565b60405161030c9190612c8a565b60405180910390f35b34801561032157600080fd5b5061032a610935565b6040516103379190612d14565b60405180910390f35b34801561034c57600080fd5b5061035561093e565b6040516103629190612d3e565b60405180910390f35b34801561037757600080fd5b50610392600480360381019061038d9190612d59565b610964565b005b3480156103a057600080fd5b506103bb60048036038101906103b69190612db2565b610a56565b005b3480156103c957600080fd5b506103d2610b07565b005b3480156103e057600080fd5b506103fb60048036038101906103f69190612d59565b610b79565b6040516104089190612c8a565b60405180910390f35b34801561041d57600080fd5b50610426610bca565b005b34801561043457600080fd5b5061044f600480360381019061044a9190612ddf565b610d1d565b005b34801561045d57600080fd5b50610466610dbc565b6040516104739190612c8a565b60405180910390f35b34801561048857600080fd5b50610491610dc2565b60405161049e9190612d3e565b60405180910390f35b3480156104b357600080fd5b506104ce60048036038101906104c99190612db2565b610deb565b005b3480156104dc57600080fd5b506104e5610e9d565b6040516104f29190612c8a565b60405180910390f35b34801561050757600080fd5b50610510610ea3565b60405161051d9190612b33565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190612ddf565b610ee0565b005b34801561055b57600080fd5b5061057660048036038101906105719190612b8b565b610f81565b6040516105839190612be6565b60405180910390f35b34801561059857600080fd5b506105b360048036038101906105ae9190612d59565b610f9f565b6040516105c09190612be6565b60405180910390f35b3480156105d557600080fd5b506105de610fbf565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612d59565b611039565b005b34801561061557600080fd5b50610630600480360381019061062b9190612e0c565b6111fd565b60405161063d9190612c8a565b60405180910390f35b34801561065257600080fd5b5061066d60048036038101906106689190612e4c565b611284565b005b34801561067b57600080fd5b5061069660048036038101906106919190612ddf565b61133d565b005b6106a06113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072690612eff565b60405180910390fd5b60005b81518110156107c05760016011600084848151811061075457610753612f1f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107b890612f7d565b915050610732565b5050565b60606040518060400160405280600881526020017f4d656d6568656164000000000000000000000000000000000000000000000000815250905090565b600061081561080e6113de565b84846113e6565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108638484846115b1565b6109248461086f6113de565b61091f8560405180606001604052806028815260200161392c60289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108d56113de565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d159092919063ffffffff16565b6113e6565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61096c6113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f290612eff565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610a5e6113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612eff565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b486113de565b73ffffffffffffffffffffffffffffffffffffffff1614610b6857600080fd5b6000479050610b7681611d79565b50565b6000610bc3600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de5565b9050919050565b610bd26113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5690612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d256113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da990612eff565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610df36113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790612eff565b60405180910390fd5b80601660146101000a81548160ff02191690831515021790555050565b60185481565b60606040518060400160405280600581526020017f4d656d6573000000000000000000000000000000000000000000000000000000815250905090565b610ee86113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e90612eff565b60405180910390fd5b8060198190555050565b6000610f95610f8e6113de565b84846115b1565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110006113de565b73ffffffffffffffffffffffffffffffffffffffff161461102057600080fd5b600061102b30610b79565b905061103681611e53565b50565b6110416113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790613038565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61128c6113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461131b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131290612eff565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b6113456113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cb90612eff565b60405180910390fd5b8060188190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144d906130ca565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd9061315c565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115a49190612c8a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611621576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611618906131ee565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611691576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168890613280565b60405180910390fd5b600081116116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb90613312565b60405180910390fd5b6116dc610dc2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561174a575061171a610dc2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a1457601660149054906101000a900460ff166117a9576017548111156117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179f9061337e565b60405180910390fd5b5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561184d5750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61188c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188390613410565b60405180910390fd5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461193957601854816118ee84610b79565b6118f89190613430565b10611938576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192f906134f8565b60405180910390fd5b5b600061194430610b79565b905060006019548210159050601754821061195f5760175491505b8080156119795750601660159054906101000a900460ff16155b80156119d35750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156119e9575060168054906101000a900460ff165b15611a11576119f782611e53565b60004790506000811115611a0f57611a0e476120db565b5b505b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611abb5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611b6e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611b6d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611b7c5760009050611d03565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c275750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611c3f57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611cea5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d0257600b54600d81905550600c54600e819055505b5b611d0f8484848461216d565b50505050565b6000838311158290611d5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d549190612b33565b60405180910390fd5b5060008385611d6c9190613518565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611de1573d6000803e3d6000fd5b5050565b6000600754821115611e2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e23906135be565b60405180910390fd5b6000611e3661219a565b9050611e4b81846121c590919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e8b57611e8a6128c1565b5b604051908082528060200260200182016040528015611eb95781602001602082028036833780820191505090505b5090503081600081518110611ed157611ed0612f1f565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7357600080fd5b505afa158015611f87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fab91906135f3565b81600181518110611fbf57611fbe612f1f565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202630601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113e6565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208a959493929190613719565b600060405180830381600087803b1580156120a457600080fd5b505af11580156120b8573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61213e60026121306009866121c590919063ffffffff16565b61220f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612169573d6000803e3d6000fd5b5050565b8061217b5761217a61228a565b5b6121868484846122cd565b8061219457612193612498565b5b50505050565b60008060006121a76124ac565b915091506121be81836121c590919063ffffffff16565b9250505090565b600061220783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061250e565b905092915050565b6000808314156122225760009050612284565b600082846122309190613773565b905082848261223f91906137fc565b1461227f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122769061389f565b60405180910390fd5b809150505b92915050565b6000600d5414801561229e57506000600e54145b156122a8576122cb565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806122df87612571565b95509550955095509550955061233d86600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125d990919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d285600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461262390919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061241e81612681565b612428848361273e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124859190612c8a565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b600080600060075490506000683635c9adc5dea0000090506124e2683635c9adc5dea000006007546121c590919063ffffffff16565b82101561250157600754683635c9adc5dea0000093509350505061250a565b81819350935050505b9091565b60008083118290612555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254c9190612b33565b60405180910390fd5b506000838561256491906137fc565b9050809150509392505050565b600080600080600080600080600061258e8a600d54600e54612778565b925092509250600061259e61219a565b905060008060006125b18e87878761280e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061261b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d15565b905092915050565b60008082846126329190613430565b905083811015612677576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161266e9061390b565b60405180910390fd5b8091505092915050565b600061268b61219a565b905060006126a2828461220f90919063ffffffff16565b90506126f681600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461262390919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612753826007546125d990919063ffffffff16565b60078190555061276e8160085461262390919063ffffffff16565b6008819055505050565b6000806000806127a46064612796888a61220f90919063ffffffff16565b6121c590919063ffffffff16565b905060006127ce60646127c0888b61220f90919063ffffffff16565b6121c590919063ffffffff16565b905060006127f7826127e9858c6125d990919063ffffffff16565b6125d990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612827858961220f90919063ffffffff16565b9050600061283e868961220f90919063ffffffff16565b90506000612855878961220f90919063ffffffff16565b9050600061287e8261287085876125d990919063ffffffff16565b6125d990919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128f9826128b0565b810181811067ffffffffffffffff82111715612918576129176128c1565b5b80604052505050565b600061292b612897565b905061293782826128f0565b919050565b600067ffffffffffffffff821115612957576129566128c1565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006129988261296d565b9050919050565b6129a88161298d565b81146129b357600080fd5b50565b6000813590506129c58161299f565b92915050565b60006129de6129d98461293c565b612921565b90508083825260208201905060208402830185811115612a0157612a00612968565b5b835b81811015612a2a5780612a1688826129b6565b845260208401935050602081019050612a03565b5050509392505050565b600082601f830112612a4957612a486128ab565b5b8135612a598482602086016129cb565b91505092915050565b600060208284031215612a7857612a776128a1565b5b600082013567ffffffffffffffff811115612a9657612a956128a6565b5b612aa284828501612a34565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ae5578082015181840152602081019050612aca565b83811115612af4576000848401525b50505050565b6000612b0582612aab565b612b0f8185612ab6565b9350612b1f818560208601612ac7565b612b28816128b0565b840191505092915050565b60006020820190508181036000830152612b4d8184612afa565b905092915050565b6000819050919050565b612b6881612b55565b8114612b7357600080fd5b50565b600081359050612b8581612b5f565b92915050565b60008060408385031215612ba257612ba16128a1565b5b6000612bb0858286016129b6565b9250506020612bc185828601612b76565b9150509250929050565b60008115159050919050565b612be081612bcb565b82525050565b6000602082019050612bfb6000830184612bd7565b92915050565b6000819050919050565b6000612c26612c21612c1c8461296d565b612c01565b61296d565b9050919050565b6000612c3882612c0b565b9050919050565b6000612c4a82612c2d565b9050919050565b612c5a81612c3f565b82525050565b6000602082019050612c756000830184612c51565b92915050565b612c8481612b55565b82525050565b6000602082019050612c9f6000830184612c7b565b92915050565b600080600060608486031215612cbe57612cbd6128a1565b5b6000612ccc868287016129b6565b9350506020612cdd868287016129b6565b9250506040612cee86828701612b76565b9150509250925092565b600060ff82169050919050565b612d0e81612cf8565b82525050565b6000602082019050612d296000830184612d05565b92915050565b612d388161298d565b82525050565b6000602082019050612d536000830184612d2f565b92915050565b600060208284031215612d6f57612d6e6128a1565b5b6000612d7d848285016129b6565b91505092915050565b612d8f81612bcb565b8114612d9a57600080fd5b50565b600081359050612dac81612d86565b92915050565b600060208284031215612dc857612dc76128a1565b5b6000612dd684828501612d9d565b91505092915050565b600060208284031215612df557612df46128a1565b5b6000612e0384828501612b76565b91505092915050565b60008060408385031215612e2357612e226128a1565b5b6000612e31858286016129b6565b9250506020612e42858286016129b6565b9150509250929050565b60008060008060808587031215612e6657612e656128a1565b5b6000612e7487828801612b76565b9450506020612e8587828801612b76565b9350506040612e9687828801612b76565b9250506060612ea787828801612b76565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612ee9602083612ab6565b9150612ef482612eb3565b602082019050919050565b60006020820190508181036000830152612f1881612edc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612f8882612b55565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612fbb57612fba612f4e565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613022602683612ab6565b915061302d82612fc6565b604082019050919050565b6000602082019050818103600083015261305181613015565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006130b4602483612ab6565b91506130bf82613058565b604082019050919050565b600060208201905081810360008301526130e3816130a7565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613146602283612ab6565b9150613151826130ea565b604082019050919050565b6000602082019050818103600083015261317581613139565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006131d8602583612ab6565b91506131e38261317c565b604082019050919050565b60006020820190508181036000830152613207816131cb565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061326a602383612ab6565b91506132758261320e565b604082019050919050565b600060208201905081810360008301526132998161325d565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132fc602983612ab6565b9150613307826132a0565b604082019050919050565b6000602082019050818103600083015261332b816132ef565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613368601c83612ab6565b915061337382613332565b602082019050919050565b600060208201905081810360008301526133978161335b565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b60006133fa602383612ab6565b91506134058261339e565b604082019050919050565b60006020820190508181036000830152613429816133ed565b9050919050565b600061343b82612b55565b915061344683612b55565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561347b5761347a612f4e565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b60006134e2602383612ab6565b91506134ed82613486565b604082019050919050565b60006020820190508181036000830152613511816134d5565b9050919050565b600061352382612b55565b915061352e83612b55565b92508282101561354157613540612f4e565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006135a8602a83612ab6565b91506135b38261354c565b604082019050919050565b600060208201905081810360008301526135d78161359b565b9050919050565b6000815190506135ed8161299f565b92915050565b600060208284031215613609576136086128a1565b5b6000613617848285016135de565b91505092915050565b6000819050919050565b600061364561364061363b84613620565b612c01565b612b55565b9050919050565b6136558161362a565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6136908161298d565b82525050565b60006136a28383613687565b60208301905092915050565b6000602082019050919050565b60006136c68261365b565b6136d08185613666565b93506136db83613677565b8060005b8381101561370c5781516136f38882613696565b97506136fe836136ae565b9250506001810190506136df565b5085935050505092915050565b600060a08201905061372e6000830188612c7b565b61373b602083018761364c565b818103604083015261374d81866136bb565b905061375c6060830185612d2f565b6137696080830184612c7b565b9695505050505050565b600061377e82612b55565b915061378983612b55565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156137c2576137c1612f4e565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061380782612b55565b915061381283612b55565b925082613822576138216137cd565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613889602183612ab6565b91506138948261382d565b604082019050919050565b600060208201905081810360008301526138b88161387c565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006138f5601b83612ab6565b9150613900826138bf565b602082019050919050565b60006020820190508181036000830152613924816138e8565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208fa63c76857855806751142999decbf3e1ad39106aadd22d6b1da222a0c6ef5964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,409 |
0x1530a2924805aed2385f8b91849cab7fe95a5df9
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "add: +");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
uint c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "sub: -");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "mul: *");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "div: /");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint a, uint b) internal pure returns (uint) {
return mod(a, b, "mod: %");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b != 0, errorMessage);
return a % b;
}
}
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
interface IChainLinkFeed {
function latestAnswer() external view returns (int256);
}
interface IKeep3rV1 {
function totalBonded() external view returns (uint);
function bonds(address keeper, address credit) external view returns (uint);
function votes(address keeper) external view returns (uint);
}
contract Keep3rV1Helper {
using SafeMath for uint;
IChainLinkFeed public constant FASTGAS = IChainLinkFeed(0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C);
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
uint constant public BOOST = 50;
uint constant public BASE = 10;
uint constant public TARGETBOND = 200e18;
uint constant public PRICE = 10;
function getFastGas() external view returns (uint) {
return uint(FASTGAS.latestAnswer());
}
function bonds(address keeper) public view returns (uint) {
return KP3R.bonds(keeper, address(KP3R)).add(KP3R.votes(keeper));
}
function getQuoteLimitFor(address origin, uint gasUsed) public view returns (uint) {
uint _min = gasUsed.mul(PRICE).mul(uint(FASTGAS.latestAnswer()));
uint _boost = _min.mul(BOOST).div(BASE); // increase by 2.5
uint _bond = Math.min(bonds(origin), TARGETBOND);
return Math.max(_min, _boost.mul(_bond).div(TARGETBOND));
}
function getQuoteLimit(uint gasUsed) external view returns (uint) {
return getQuoteLimitFor(tx.origin, gasUsed);
}
}
|
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638e686d56116100665780638e686d5614610132578063904440bd1461013a578063dbbc4a5714610142578063ec342ad01461012a578063fe10d7741461014a5761009e565b80630421d7f2146100a357806305e0b9a0146100e15780632a84797f14610105578063525ea6311461010d5780638d859f3e1461012a575b600080fd5b6100cf600480360360408110156100b957600080fd5b506001600160a01b038135169060200135610170565b60408051918252519081900360200190f35b6100e9610267565b604080516001600160a01b039092168252519081900360200190f35b6100cf61027f565b6100cf6004803603602081101561012357600080fd5b5035610284565b6100cf610290565b6100cf610295565b6100cf6102a2565b6100e9610322565b6100cf6004803603602081101561016057600080fd5b50356001600160a01b031661033a565b60008061020073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156101c357600080fd5b505afa1580156101d7573d6000803e3d6000fd5b505050506040513d60208110156101ed57600080fd5b50516101fa85600a61045f565b9061045f565b9050600061021a600a61021484603261045f565b906104be565b9050600061023961022a8761033a565b680ad78ebc5ac62000006104e9565b905061025b83610256680ad78ebc5ac6200000610214868661045f565b6104ff565b93505050505b92915050565b731ceb5cb57c4d4e2b2433641b95dd330a33185a4481565b603281565b60006102613283610170565b600a81565b680ad78ebc5ac620000081565b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156102f157600080fd5b505afa158015610305573d6000803e3d6000fd5b505050506040513d602081101561031b57600080fd5b5051905090565b73169e633a2d1e6c10dd91238ba11c4a708dfef37c81565b6000610261731ceb5cb57c4d4e2b2433641b95dd330a33185a446001600160a01b031663d8bff5a5846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d60208110156103ca57600080fd5b50516040805163a39744b560e01b81526001600160a01b0386166004820152731ceb5cb57c4d4e2b2433641b95dd330a33185a4460248201819052915163a39744b591604480820192602092909190829003018186803b15801561042d57600080fd5b505afa158015610441573d6000803e3d6000fd5b505050506040513d602081101561045757600080fd5b50519061050f565b60008261046e57506000610261565b8282028284828161047b57fe5b04146104b7576040805162461bcd60e51b815260206004820152600660248201526536bab61d101560d11b604482015290519081900360640190fd5b9392505050565b60006104b78383604051806040016040528060068152602001656469763a202f60d01b815250610552565b60008183106104f857816104b7565b5090919050565b6000818310156104f857816104b7565b6000828201838110156104b7576040805162461bcd60e51b81526020600482015260066024820152656164643a202b60d01b604482015290519081900360640190fd5b600081836105de5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105a357818101518382015260200161058b565b50505050905090810190601f1680156105d05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816105ea57fe5b049594505050505056fea26469706673582212208d81cc0cb05ed46fb9529ed7e4159c723a316481b2b3eff858b4f51f60171e5d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,410 |
0x7F6A7aDeDEC937b6eB91476541e92E557B5DFf0b
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
abstract contract 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 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.
*/
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)
abstract contract Ownable is Context {
/**
* @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.
*/
address private _owner;
address private admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender() || admin == _msgSender(), "Ownable: caller is not the owner");
_;
}
//Additional function added by ktrby
function registerAdmin(address _admin) public onlyOwner {
admin = _admin;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract LeagueOfLightMetadata is Ownable {
struct metadata {
string title;
string category;
string description;
string imageUrl;
string animationUrl;
string material;
string monarch;
}
address private lolContractAddress;
// SETUP FUNCTIONS //
function setLolContractAddress(address _addr) public onlyOwner {
lolContractAddress = _addr;
}
// CREATE METADATA //
function getMonarchMetadata(uint id1, uint id2) internal pure returns (metadata memory) {
string memory title;
string memory description = "\'light your own fire\'";
string memory imageUrl = "https://gateway.pinata.cloud/ipfs/QmXW6eizhk3kkcQEsnpCN65jbGzgt53npARptnTe1ptUzP/monarch.jpg";
string memory animationUrl = "https://gateway.pinata.cloud/ipfs/QmXW6eizhk3kkcQEsnpCN65jbGzgt53npARptnTe1ptUzP/monarch.mp4";
uint r1 = id1 % 6;
uint r2 = id2 % 6;
string memory c1;
string memory c2;
if (r1 == 0 || r1 == 1) {c1 = "Light";}
else if (r1 == 2) {c1 = "Shadow";}
else if (r1 == 3) {c1 = "Hope";}
else if (r1 == 4) {c1 = "Dreams";}
if (r2 == 0 || r2 == 1) {c2 = "Light";}
else if (r2 == 2) {c2 = "Shadow";}
else if (r2 == 3) {c2 = "Hope";}
else if (r2 == 4) {c2 = "Dreams";}
if (keccak256(abi.encodePacked((c1))) == keccak256(abi.encodePacked((c2))) && r1 != 5) {
title = string(abi.encodePacked("Monarch of ", c1));
} else {
title = string(abi.encodePacked("Monarch of ", c1, " & ", c2));
}
if (r1 == 5 || r2 == 5) {
description = "\'silence speaks louder than words\'";
imageUrl = "https://gateway.pinata.cloud/ipfs/QmXW6eizhk3kkcQEsnpCN65jbGzgt53npARptnTe1ptUzP/theunheard.jpg";
animationUrl = "https://gateway.pinata.cloud/ipfs/QmXW6eizhk3kkcQEsnpCN65jbGzgt53npARptnTe1ptUzP/theunheard.mp4";
if (r1 == 5) {
title = string(abi.encodePacked("Unheard Monarch of ", c2));
} else if (r2 == 5) {
title = string(abi.encodePacked("Unheard Monarch of ", c1));
}
if (r1 == r2) {
title = "Unheard Monarch";
}
}
return metadata(title, "", description, imageUrl, animationUrl, "Ti", "True");
}
function getMetadata(uint tokenId, uint s) internal pure returns (metadata memory) {
string memory title;
string memory category;
string memory description;
string memory imageUrl;
string memory animationUrl;
string memory material;
uint256 r = tokenId % 6;
imageUrl = string(abi.encodePacked(
"https://gateway.pinata.cloud/ipfs/QmPWX4N5tnWHp9NNmgfaFUfU83JsmtMoyJtmpN9vnSDoS5/",
toString(r),
"-",
toString(s),
".jpg"
));
animationUrl = string(abi.encodePacked(
"https://gateway.pinata.cloud/ipfs/QmWoPf7eXPvq2wMxZgUhmA1itfxiJUX2ZbU3Mfj4sn646v/",
toString(r),
"-",
toString(s),
".mp4"
));
if (r == 0) {
title = "Orb of Light";
if (s == 3) {title = "Seeker of Light";}
category = "Light";
material = "Fe";
description = "\'born from ashes raised in shadows seeking light\'";
} else if (r == 1) {
title = "Orb of Light";
if (s == 3) {title = "Carrier of Light";}
category = "Light";
material = "Pt";
description = "\'the one granting the light to others\'";
} else if (r == 2) {
title = "Orb of Shadow";
if (s == 3) {title = "Catcher of Shadow";}
category = "Shadow";
material = "Fe";
description = "\'the ones that hide in shadow must shine\'";
} else if (r == 3) {
title = "Orb of Hope";
if (s == 3) {title = "Apostle of Hope";}
category = "Hope";
material = "Fe";
description = "\'there is light despite all of the darkness\'";
} else if (r == 4) {
title = "Orb of Dreams";
if (s == 3) {title = "Protector of Dreams";}
category = "Dreams";
material = "CuSn";
description = "\'dreams are our realities in waiting\'";
} else if (r == 5) {
title = "The Unheard";
category = "u";
material = "Ti";
description = "\'silence speaks louder than words\'";
imageUrl = "https://gateway.pinata.cloud/ipfs/QmPWX4N5tnWHp9NNmgfaFUfU83JsmtMoyJtmpN9vnSDoS5/5-0.jpg";
animationUrl = "https://gateway.pinata.cloud/ipfs/QmWoPf7eXPvq2wMxZgUhmA1itfxiJUX2ZbU3Mfj4sn646v/5-0.mp4";
}
return metadata(title, category, description, imageUrl, animationUrl, material, "False");
}
// CREATE TOKEN URIS //
function monarchURI(uint id1, uint id2) external pure returns (string memory) {
metadata memory data = getMonarchMetadata(id1, id2);
string memory json = string(
abi.encodePacked(
'{"name": "', data.title, '",',
'"description": "', data.description, '",',
'"created_by": "artistic_resonance & ktrby",',
'"image": "', data.imageUrl, '",'
'"image_url": "', data.imageUrl, '",',
'"animation": "', data.animationUrl, '",',
'"animation_url": "', data.animationUrl, '",',
'"attributes":[',
'{"trait_type":"Role","value":"', data.title, '"},',
'{"trait_type":"Material","value":"', data.material, '"},',
'{"trait_type":"League Monarch","value":"', data.monarch, '"}',
"]}"
)
);
return string(abi.encodePacked('data:application/json;utf8,', json));
}
function tokenURI(uint256 tokenId, uint s) external pure returns (string memory) {
string memory json;
metadata memory data = getMetadata(tokenId, s);
if (tokenId % 6 == 5) {
json = string(
abi.encodePacked(
'{"name": "', data.title, '",',
'"description": "', data.description, '",',
'"created_by": "artistic_resonance & ktrby",',
'"image": "', data.imageUrl, '",'
'"image_url": "', data.imageUrl, '",',
'"animation": "', data.animationUrl, '",',
'"animation_url": "', data.animationUrl, '",',
'"attributes":[',
'{"trait_type":"Role","value":"', data.title, '"},',
'{"trait_type":"Material","value":"', data.material, '"},',
'{"trait_type":"League Monarch","value":"', data.monarch, '"}',
"]}"
)
);
} else {
json = string(
abi.encodePacked(
'{"name": "', data.title, ' | Stage ', toString(s), '",',
'"description": "', data.description, '",',
'"created_by": "artistic_resonance & ktrby",',
'"image": "', data.imageUrl, '",'
'"image_url": "', data.imageUrl, '",',
'"animation": "', data.animationUrl, '",',
'"animation_url": "', data.animationUrl, '",',
'"attributes":[',
'{"trait_type":"Role","value":"', data.title, '"},',
'{"trait_type": "Stage","value":"', toString(s), '"},',
'{"trait_type":"Material","value":"', data.material, '"},',
'{"trait_type":"League Monarch","value":"', data.monarch, '"}',
"]}"
)
);
}
return string(abi.encodePacked('data:application/json;utf8,', json));
}
// Function borrowed from OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) - MIT License
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063ac3d67d71161005b578063ac3d67d7146100da578063c38c58131461010a578063e514842514610126578063f2fde38b146101425761007d565b8063715018a6146100825780638da5cb5b1461008c57806392cb829d146100aa575b600080fd5b61008a61015e565b005b610094610245565b6040516100a19190611fe7565b60405180910390f35b6100c460048036038101906100bf9190611728565b61026e565b6040516100d19190612002565b60405180910390f35b6100f460048036038101906100ef9190611728565b610384565b6040516101019190612002565b60405180910390f35b610124600480360381019061011f91906116fb565b610416565b005b610140600480360381019061013b91906116fb565b610535565b005b61015c600480360381019061015791906116fb565b610654565b005b6101666107ab565b73ffffffffffffffffffffffffffffffffffffffff16610184610245565b73ffffffffffffffffffffffffffffffffffffffff1614806101fa57506101a96107ab565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610239576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023090612044565b60405180910390fd5b61024360006107b3565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606080600061027d8585610877565b9050600560068661028e91906121fe565b14156102ef5780600001518160400151826060015183606001518460800151856080015186600001518760a001518860c001516040516020016102d999989796959493929190611cf6565b604051602081830303815290604052915061035a565b80600001516102fd85610fdf565b8260400151836060015184606001518560800151866080015187600001516103248c610fdf565b8960a001518a60c001516040516020016103489b9a99989796959493929190611e51565b60405160208183030381529060405291505b8160405160200161036b9190611c78565b6040516020818303038152906040529250505092915050565b606060006103928484611140565b9050600081600001518260400151836060015184606001518560800151866080015187600001518860a001518960c001516040516020016103db99989796959493929190611cf6565b6040516020818303038152906040529050806040516020016103fd9190611c78565b6040516020818303038152906040529250505092915050565b61041e6107ab565b73ffffffffffffffffffffffffffffffffffffffff1661043c610245565b73ffffffffffffffffffffffffffffffffffffffff1614806104b257506104616107ab565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6104f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e890612044565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61053d6107ab565b73ffffffffffffffffffffffffffffffffffffffff1661055b610245565b73ffffffffffffffffffffffffffffffffffffffff1614806105d157506105806107ab565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610610576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060790612044565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61065c6107ab565b73ffffffffffffffffffffffffffffffffffffffff1661067a610245565b73ffffffffffffffffffffffffffffffffffffffff1614806106f0575061069f6107ab565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61072f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072690612044565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561079f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079690612024565b60405180910390fd5b6107a8816107b3565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61087f611694565b606080606080606080600060068a61089791906121fe565b90506108a281610fdf565b6108ab8a610fdf565b6040516020016108bc929190611bcc565b60405160208183030381529060405293506108d681610fdf565b6108df8a610fdf565b6040516020016108f0929190611c33565b60405160208183030381529060405292506000811415610a14576040518060400160405280600c81526020017f4f7262206f66204c69676874000000000000000000000000000000000000000081525096506003891415610984576040518060400160405280600f81526020017f5365656b6572206f66204c69676874000000000000000000000000000000000081525096505b6040518060400160405280600581526020017f4c6967687400000000000000000000000000000000000000000000000000000081525095506040518060400160405280600281526020017f46650000000000000000000000000000000000000000000000000000000000008152509150604051806060016040528060318152602001612b57603191399450610f68565b6001811415610b27576040518060400160405280600c81526020017f4f7262206f66204c69676874000000000000000000000000000000000000000081525096506003891415610a97576040518060400160405280601081526020017f43617272696572206f66204c696768740000000000000000000000000000000081525096505b6040518060400160405280600581526020017f4c6967687400000000000000000000000000000000000000000000000000000081525095506040518060400160405280600281526020017f50740000000000000000000000000000000000000000000000000000000000008152509150604051806060016040528060268152602001612b88602691399450610f67565b6002811415610c3a576040518060400160405280600d81526020017f4f7262206f6620536861646f770000000000000000000000000000000000000081525096506003891415610baa576040518060400160405280601181526020017f43617463686572206f6620536861646f7700000000000000000000000000000081525096505b6040518060400160405280600681526020017f536861646f77000000000000000000000000000000000000000000000000000081525095506040518060400160405280600281526020017f46650000000000000000000000000000000000000000000000000000000000008152509150604051806060016040528060298152602001612b2e602991399450610f66565b6003811415610d4d576040518060400160405280600b81526020017f4f7262206f6620486f706500000000000000000000000000000000000000000081525096506003891415610cbd576040518060400160405280600f81526020017f41706f73746c65206f6620486f7065000000000000000000000000000000000081525096505b6040518060400160405280600481526020017f486f70650000000000000000000000000000000000000000000000000000000081525095506040518060400160405280600281526020017f466500000000000000000000000000000000000000000000000000000000000081525091506040518060600160405280602c8152602001612997602c91399450610f65565b6004811415610e60576040518060400160405280600d81526020017f4f7262206f6620447265616d730000000000000000000000000000000000000081525096506003891415610dd0576040518060400160405280601381526020017f50726f746563746f72206f6620447265616d730000000000000000000000000081525096505b6040518060400160405280600681526020017f447265616d73000000000000000000000000000000000000000000000000000081525095506040518060400160405280600481526020017f4375536e000000000000000000000000000000000000000000000000000000008152509150604051806060016040528060258152602001612bd0602591399450610f64565b6005811415610f63576040518060400160405280600b81526020017f54686520556e686561726400000000000000000000000000000000000000000081525096506040518060400160405280600181526020017f750000000000000000000000000000000000000000000000000000000000000081525095506040518060400160405280600281526020017f54690000000000000000000000000000000000000000000000000000000000008152509150604051806060016040528060228152602001612bae602291399450604051806080016040528060588152602001612a22605891399350604051806080016040528060588152602001612a7a6058913992505b5b5b5b5b5b6040518060e001604052808881526020018781526020018681526020018581526020018481526020018381526020016040518060400160405280600581526020017f46616c736500000000000000000000000000000000000000000000000000000081525081525097505050505050505092915050565b60606000821415611027576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061113b565b600082905060005b60008214611059578080611042906121b5565b915050600a8261105291906120e1565b915061102f565b60008167ffffffffffffffff811115611075576110746122bc565b5b6040519080825280601f01601f1916602001820160405280156110a75781602001600182028036833780820191505090505b5090505b60008514611134576001826110c09190612112565b9150600a856110cf91906121fe565b60306110db919061208b565b60f81b8183815181106110f1576110f061228d565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561112d91906120e1565b94506110ab565b8093505050505b919050565b611148611694565b606060006040518060400160405280601581526020017f276c6967687420796f7572206f776e2066697265270000000000000000000000815250905060006040518060800160405280605c8152602001612ad2605c9139905060006040518060800160405280605c815260200161293b605c9139905060006006886111cd91906121fe565b905060006006886111de91906121fe565b905060608060008414806111f25750600184145b15611234576040518060400160405280600581526020017f4c696768740000000000000000000000000000000000000000000000000000008152509150611305565b600284141561127a576040518060400160405280600681526020017f536861646f7700000000000000000000000000000000000000000000000000008152509150611304565b60038414156112c0576040518060400160405280600481526020017f486f7065000000000000000000000000000000000000000000000000000000008152509150611303565b6004841415611302576040518060400160405280600681526020017f447265616d73000000000000000000000000000000000000000000000000000081525091505b5b5b5b60008314806113145750600183145b15611356576040518060400160405280600581526020017f4c696768740000000000000000000000000000000000000000000000000000008152509050611427565b600283141561139c576040518060400160405280600681526020017f536861646f7700000000000000000000000000000000000000000000000000008152509050611426565b60038314156113e2576040518060400160405280600481526020017f486f7065000000000000000000000000000000000000000000000000000000008152509050611425565b6004831415611424576040518060400160405280600681526020017f447265616d73000000000000000000000000000000000000000000000000000081525090505b5b5b5b806040516020016114389190611bb5565b604051602081830303815290604052805190602001208260405160200161145f9190611bb5565b60405160208183030381529060405280519060200120148015611483575060058414155b156114af57816040516020016114999190611c9a565b60405160208183030381529060405297506114d4565b81816040516020016114c2929190611cbc565b60405160208183030381529060405297505b60058414806114e35750600583145b156115d857604051806060016040528060228152602001612bae6022913996506040518060800160405280605f81526020016128dc605f913995506040518060800160405280605f81526020016129c3605f91399450600584141561156957806040516020016115539190611c11565b6040516020818303038152906040529750611596565b600583141561159557816040516020016115839190611c11565b60405160208183030381529060405297505b5b828414156115d7576040518060400160405280600f81526020017f556e6865617264204d6f6e61726368000000000000000000000000000000000081525097505b5b6040518060e001604052808981526020016040518060200160405280600081525081526020018881526020018781526020018681526020016040518060400160405280600281526020017f546900000000000000000000000000000000000000000000000000000000000081525081526020016040518060400160405280600481526020017f54727565000000000000000000000000000000000000000000000000000000008152508152509850505050505050505092915050565b6040518060e00160405280606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081525090565b6000813590506116e0816128ad565b92915050565b6000813590506116f5816128c4565b92915050565b600060208284031215611711576117106122eb565b5b600061171f848285016116d1565b91505092915050565b6000806040838503121561173f5761173e6122eb565b5b600061174d858286016116e6565b925050602061175e858286016116e6565b9150509250929050565b61177181612146565b82525050565b600061178282612064565b61178c818561206f565b935061179c818560208601612182565b6117a5816122f0565b840191505092915050565b60006117bb82612064565b6117c58185612080565b93506117d5818560208601612182565b80840191505092915050565b60006117ee600e83612080565b91506117f982612301565b600e82019050919050565b6000611811600483612080565b915061181c8261232a565b600482019050919050565b6000611834602283612080565b915061183f82612353565b602282019050919050565b6000611857602083612080565b9150611862826123a2565b602082019050919050565b600061187a60268361206f565b9150611885826123cb565b604082019050919050565b600061189d600283612080565b91506118a88261241a565b600282019050919050565b60006118c0600383612080565b91506118cb82612443565b600382019050919050565b60006118e3600383612080565b91506118ee8261246c565b600382019050919050565b6000611906605183612080565b915061191182612495565b605182019050919050565b6000611929601083612080565b91506119348261250a565b601082019050919050565b600061194c601383612080565b915061195782612533565b601382019050919050565b600061196f600283612080565b915061197a8261255c565b600282019050919050565b6000611992605183612080565b915061199d82612585565b605182019050919050565b60006119b5601e83612080565b91506119c0826125fa565b601e82019050919050565b60006119d8602883612080565b91506119e382612623565b602882019050919050565b60006119fb601b83612080565b9150611a0682612672565b601b82019050919050565b6000611a1e600b83612080565b9150611a298261269b565b600b82019050919050565b6000611a4160208361206f565b9150611a4c826126c4565b602082019050919050565b6000611a64600a83612080565b9150611a6f826126ed565b600a82019050919050565b6000611a87600283612080565b9150611a9282612716565b600282019050919050565b6000611aaa601283612080565b9150611ab58261273f565b601282019050919050565b6000611acd601083612080565b9150611ad882612768565b601082019050919050565b6000611af0600183612080565b9150611afb82612791565b600182019050919050565b6000611b13602b83612080565b9150611b1e826127ba565b602b82019050919050565b6000611b36600983612080565b9150611b4182612809565b600982019050919050565b6000611b59600a83612080565b9150611b6482612832565b600a82019050919050565b6000611b7c600483612080565b9150611b878261285b565b600482019050919050565b6000611b9f600e83612080565b9150611baa82612884565b600e82019050919050565b6000611bc182846117b0565b915081905092915050565b6000611bd7826118f9565b9150611be382856117b0565b9150611bee82611ae3565b9150611bfa82846117b0565b9150611c0582611b6f565b91508190509392505050565b6000611c1c8261193f565b9150611c2882846117b0565b915081905092915050565b6000611c3e82611985565b9150611c4a82856117b0565b9150611c5582611ae3565b9150611c6182846117b0565b9150611c6c82611804565b91508190509392505050565b6000611c83826119ee565b9150611c8f82846117b0565b915081905092915050565b6000611ca582611a11565b9150611cb182846117b0565b915081905092915050565b6000611cc782611a11565b9150611cd382856117b0565b9150611cde826118d6565b9150611cea82846117b0565b91508190509392505050565b6000611d0182611a57565b9150611d0d828c6117b0565b9150611d1882611890565b9150611d238261191c565b9150611d2f828b6117b0565b9150611d3a82611890565b9150611d4582611b06565b9150611d5082611b4c565b9150611d5c828a6117b0565b9150611d6782611ac0565b9150611d7382896117b0565b9150611d7e82611890565b9150611d89826117e1565b9150611d9582886117b0565b9150611da082611890565b9150611dab82611a9d565b9150611db782876117b0565b9150611dc282611890565b9150611dcd82611b92565b9150611dd8826119a8565b9150611de482866117b0565b9150611def826118b3565b9150611dfa82611827565b9150611e0682856117b0565b9150611e11826118b3565b9150611e1c826119cb565b9150611e2882846117b0565b9150611e3382611962565b9150611e3e82611a7a565b91508190509a9950505050505050505050565b6000611e5c82611a57565b9150611e68828e6117b0565b9150611e7382611b29565b9150611e7f828d6117b0565b9150611e8a82611890565b9150611e958261191c565b9150611ea1828c6117b0565b9150611eac82611890565b9150611eb782611b06565b9150611ec282611b4c565b9150611ece828b6117b0565b9150611ed982611ac0565b9150611ee5828a6117b0565b9150611ef082611890565b9150611efb826117e1565b9150611f0782896117b0565b9150611f1282611890565b9150611f1d82611a9d565b9150611f2982886117b0565b9150611f3482611890565b9150611f3f82611b92565b9150611f4a826119a8565b9150611f5682876117b0565b9150611f61826118b3565b9150611f6c8261184a565b9150611f7882866117b0565b9150611f83826118b3565b9150611f8e82611827565b9150611f9a82856117b0565b9150611fa5826118b3565b9150611fb0826119cb565b9150611fbc82846117b0565b9150611fc782611962565b9150611fd282611a7a565b91508190509c9b505050505050505050505050565b6000602082019050611ffc6000830184611768565b92915050565b6000602082019050818103600083015261201c8184611777565b905092915050565b6000602082019050818103600083015261203d8161186d565b9050919050565b6000602082019050818103600083015261205d81611a34565b9050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600061209682612178565b91506120a183612178565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156120d6576120d561222f565b5b828201905092915050565b60006120ec82612178565b91506120f783612178565b9250826121075761210661225e565b5b828204905092915050565b600061211d82612178565b915061212883612178565b92508282101561213b5761213a61222f565b5b828203905092915050565b600061215182612158565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156121a0578082015181840152602081019050612185565b838111156121af576000848401525b50505050565b60006121c082612178565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156121f3576121f261222f565b5b600182019050919050565b600061220982612178565b915061221483612178565b9250826122245761222361225e565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f22616e696d6174696f6e223a2022000000000000000000000000000000000000600082015250565b7f2e6d703400000000000000000000000000000000000000000000000000000000600082015250565b7f7b2274726169745f74797065223a224d6174657269616c222c2276616c75652260008201527f3a22000000000000000000000000000000000000000000000000000000000000602082015250565b7f7b2274726169745f74797065223a20225374616765222c2276616c7565223a22600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f222c000000000000000000000000000000000000000000000000000000000000600082015250565b7f227d2c0000000000000000000000000000000000000000000000000000000000600082015250565b7f2026200000000000000000000000000000000000000000000000000000000000600082015250565b7f68747470733a2f2f676174657761792e70696e6174612e636c6f75642f69706660008201527f732f516d505758344e35746e574870394e4e6d6766614655665538334a736d7460208201527f4d6f794a746d704e39766e53446f53352f000000000000000000000000000000604082015250565b7f226465736372697074696f6e223a202200000000000000000000000000000000600082015250565b7f556e6865617264204d6f6e61726368206f662000000000000000000000000000600082015250565b7f227d000000000000000000000000000000000000000000000000000000000000600082015250565b7f68747470733a2f2f676174657761792e70696e6174612e636c6f75642f69706660008201527f732f516d576f506637655850767132774d785a6755686d413169746678694a5560208201527f58325a6255334d666a34736e363436762f000000000000000000000000000000604082015250565b7f7b2274726169745f74797065223a22526f6c65222c2276616c7565223a220000600082015250565b7f7b2274726169745f74797065223a224c6561677565204d6f6e61726368222c2260008201527f76616c7565223a22000000000000000000000000000000000000000000000000602082015250565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c0000000000600082015250565b7f4d6f6e61726368206f6620000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f7b226e616d65223a202200000000000000000000000000000000000000000000600082015250565b7f5d7d000000000000000000000000000000000000000000000000000000000000600082015250565b7f22616e696d6174696f6e5f75726c223a20220000000000000000000000000000600082015250565b7f222c22696d6167655f75726c223a202200000000000000000000000000000000600082015250565b7f2d00000000000000000000000000000000000000000000000000000000000000600082015250565b7f22637265617465645f6279223a202261727469737469635f7265736f6e616e6360008201527f652026206b74726279222c000000000000000000000000000000000000000000602082015250565b7f207c205374616765200000000000000000000000000000000000000000000000600082015250565b7f22696d616765223a202200000000000000000000000000000000000000000000600082015250565b7f2e6a706700000000000000000000000000000000000000000000000000000000600082015250565b7f2261747472696275746573223a5b000000000000000000000000000000000000600082015250565b6128b681612146565b81146128c157600080fd5b50565b6128cd81612178565b81146128d857600080fd5b5056fe68747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d58573665697a686b336b6b635145736e70434e36356a62477a677435336e70415270746e5465317074557a502f746865756e68656172642e6a706768747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d58573665697a686b336b6b635145736e70434e36356a62477a677435336e70415270746e5465317074557a502f6d6f6e617263682e6d7034277468657265206973206c69676874206465737069746520616c6c206f6620746865206461726b6e6573732768747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d58573665697a686b336b6b635145736e70434e36356a62477a677435336e70415270746e5465317074557a502f746865756e68656172642e6d703468747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d505758344e35746e574870394e4e6d6766614655665538334a736d744d6f794a746d704e39766e53446f53352f352d302e6a706768747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d576f506637655850767132774d785a6755686d413169746678694a5558325a6255334d666a34736e363436762f352d302e6d703468747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d58573665697a686b336b6b635145736e70434e36356a62477a677435336e70415270746e5465317074557a502f6d6f6e617263682e6a706727746865206f6e65732074686174206869646520696e20736861646f77206d757374207368696e652727626f726e2066726f6d2061736865732072616973656420696e20736861646f7773207365656b696e67206c696768742727746865206f6e65206772616e74696e6720746865206c6967687420746f206f7468657273272773696c656e636520737065616b73206c6f75646572207468616e20776f7264732727647265616d7320617265206f7572207265616c697469657320696e2077616974696e6727a26469706673582212208a21aa9a9e5556838987a88c59de05f45f81ede60fe1d6f8770e3510de599a4864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,411 |
0x8fbc72ffae1f14cf8910fe03ce0b8acf097a95e1
|
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
Chief Shiba
https://t.me/chiefshiba
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CSHIB is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Chief Shiba";
string private constant _symbol = 'CSHIB';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152600b81527f4368696566205368696261000000000000000000000000000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612308602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b0316815260208101919091526040016000205491906115ed565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a081611684565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611709565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152600581527f4353484942000000000000000000000000000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a081611769565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054673afb087b876900006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea00000846119b1565b90611a0a565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b815260040180806020018281038252602481526020018061237e6024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806122c56022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123596025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122786023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b81526004018080602001828103825260298152602001806123306029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115905760135477010000000000000000000000000000000000000000000000900460ff16156113e3576001600160a01b038316301480159061131657506001600160a01b0382163014155b801561133057506012546001600160a01b03848116911614155b801561134a57506012546001600160a01b03838116911614155b156113e3576012546001600160a01b03166113636110ce565b6001600160a01b0316148061139257506013546001600160a01b03166113876110ce565b6001600160a01b0316145b6113e3576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b6014548111156113f257600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561143457506001600160a01b03821660009081526007602052604090205460ff16155b61143d57600080fd5b6013546001600160a01b03848116911614801561146857506012546001600160a01b03838116911614155b801561148d57506001600160a01b03821660009081526005602052604090205460ff16155b80156114b6575060135477010000000000000000000000000000000000000000000000900460ff165b156114fe576001600160a01b03821660009081526008602052604090205442116114df57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611509306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff1615801561154657506013546001600160a01b03858116911614155b801561156e5750601354760100000000000000000000000000000000000000000000900460ff165b1561158e5761157c81611769565b47801561158c5761158c47611684565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806115d257506001600160a01b03831660009081526005602052604090205460ff165b156115db575060005b6115e784848484611a4c565b50505050565b6000818484111561167c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611641578181015183820152602001611629565b50505050905090810190601f16801561166e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc61169e836002611a0a565b6040518115909202916000818181858888f193505050501580156116c6573d6000803e3d6000fd5b506011546001600160a01b03166108fc6116e1836002611a0a565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a5482111561174c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061229b602a913960400191505060405180910390fd5b6000611756611b68565b90506117628382611a0a565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055604080516002808252606080830184529260208301908036833701905050905030816000815181106117d757fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561184457600080fd5b505afa158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b505181518290600190811061187f57fe5b6001600160a01b0392831660209182029290920101526012546118a591309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561194457818101518382015260200161192c565b505050509050019650505050505050600060405180830381600087803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b6000826119c057506000610570565b828202828482816119cd57fe5b04146117625760405162461bcd60e51b81526004018080602001828103825260218152602001806122e76021913960400191505060405180910390fd5b600061176283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b8b565b80611a5957611a59611bf0565b6001600160a01b03841660009081526006602052604090205460ff168015611a9a57506001600160a01b03831660009081526006602052604090205460ff16155b15611aaf57611aaa848484611c22565b611b5b565b6001600160a01b03841660009081526006602052604090205460ff16158015611af057506001600160a01b03831660009081526006602052604090205460ff165b15611b0057611aaa848484611d46565b6001600160a01b03841660009081526006602052604090205460ff168015611b4057506001600160a01b03831660009081526006602052604090205460ff165b15611b5057611aaa848484611def565b611b5b848484611e62565b806115e7576115e7611ea6565b6000806000611b75611eb4565b9092509050611b848282611a0a565b9250505090565b60008183611bda5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611641578181015183820152602001611629565b506000838581611be657fe5b0495945050505050565b600c54158015611c005750600d54155b15611c0a57611c20565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c3487612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611c669088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611c959087612090565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cc490866120d2565b6001600160a01b038916600090815260026020526040902055611ce68161212c565b611cf084836121b4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611d5887612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611d8a9087612090565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611dc090846120d2565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611cc490866120d2565b600080600080600080611e0187612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e339088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611d8a9087612090565b600080600080600080611e7487612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c959087612090565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ff357826002600060098481548110611ee457fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611f495750816003600060098481548110611f2257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611f6757600a54683635c9adc5dea000009450945050505061202f565b611fa76002600060098481548110611f7b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612090565b9250611fe96003600060098481548110611fbd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612090565b9150600101611ec8565b50600a5461200a90683635c9adc5dea00000611a0a565b82101561202957600a54683635c9adc5dea0000093509350505061202f565b90925090505b9091565b60008060008060008060008060006120508a600c54600d546121d8565b9250925092506000612060611b68565b905060008060006120738e878787612227565b919e509c509a509598509396509194505050505091939550919395565b600061176283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ed565b600082820183811015611762576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612136611b68565b9050600061214483836119b1565b3060009081526002602052604090205490915061216190826120d2565b3060009081526002602090815260408083209390935560069052205460ff1615610f87573060009081526003602052604090205461219f90846120d2565b30600090815260036020526040902055505050565b600a546121c19083612090565b600a55600b546121d190826120d2565b600b555050565b60008080806121ec606461106389896119b1565b905060006121ff60646110638a896119b1565b90506000612217826122118b86612090565b90612090565b9992985090965090945050505050565b600080808061223688866119b1565b9050600061224488876119b1565b9050600061225288886119b1565b90506000612264826122118686612090565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e501324995f505663d659bfee3b17e8942f485c65431295e5b14d462f4ef87ea64736f6c634300060c0033
|
{"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,412 |
0x48eE772b8C8927D8D32afc8961FBc177FB723637
|
pragma solidity ^0.4.11;
contract SafeMath {
/*
standard uint256 functions
*/
function add(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x - y) <= x);
}
function mul(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x * y) >= x);
}
function div(uint256 x, uint256 y) constant internal returns (uint256 z) {
z = x / y;
}
function min(uint256 x, uint256 y) constant internal returns (uint256 z) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) constant internal returns (uint256 z) {
return x >= y ? x : y;
}
/*
uint128 functions (h is for half)
*/
function hadd(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x + y) >= x);
}
function hsub(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x - y) <= x);
}
function hmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
assert((z = x * y) >= x);
}
function hdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = x / y;
}
function hmin(uint128 x, uint128 y) constant internal returns (uint128 z) {
return x <= y ? x : y;
}
function hmax(uint128 x, uint128 y) constant internal returns (uint128 z) {
return x >= y ? x : y;
}
/*
int256 functions
*/
function imin(int256 x, int256 y) constant internal returns (int256 z) {
return x <= y ? x : y;
}
function imax(int256 x, int256 y) constant internal returns (int256 z) {
return x >= y ? x : y;
}
/*
WAD math
*/
uint128 constant WAD = 10 ** 18;
function wadd(uint128 x, uint128 y) constant internal returns (uint128) {
return hadd(x, y);
}
function wsub(uint128 x, uint128 y) constant internal returns (uint128) {
return hsub(x, y);
}
function wmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * y + WAD / 2) / WAD);
}
function wdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * WAD + y / 2) / y);
}
function wmin(uint128 x, uint128 y) constant internal returns (uint128) {
return hmin(x, y);
}
function wmax(uint128 x, uint128 y) constant internal returns (uint128) {
return hmax(x, y);
}
/*
RAY math
*/
uint128 constant RAY = 10 ** 27;
function radd(uint128 x, uint128 y) constant internal returns (uint128) {
return hadd(x, y);
}
function rsub(uint128 x, uint128 y) constant internal returns (uint128) {
return hsub(x, y);
}
function rmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * y + RAY / 2) / RAY);
}
function rdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
z = cast((uint256(x) * RAY + y / 2) / y);
}
function rpow(uint128 x, uint64 n) constant internal returns (uint128 z) {
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
function rmin(uint128 x, uint128 y) constant internal returns (uint128) {
return hmin(x, y);
}
function rmax(uint128 x, uint128 y) constant internal returns (uint128) {
return hmax(x, y);
}
function cast(uint256 x) constant internal returns (uint128 z) {
assert((z = uint128(x)) == x);
}
}
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner) ;
_;
}
address public owner;
/// @notice The Constructor assigns the message sender to be `owner`
function Owned() {
owner = msg.sender;
}
address public newOwner;
/// @notice `owner` can step down and assign some other address to this role
/// @param _newOwner The address of the new owner. 0x0 can be used to create
/// an unowned neutral vault, however that cannot be undone
function changeOwner(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() {
if (msg.sender == newOwner) {
owner = newOwner;
}
}
}
contract Contribution is SafeMath, Owned {
uint256 public constant MIN_FUND = (0.01 ether);
uint256 public constant CRAWDSALE_START_DAY = 1;
uint256 public constant CRAWDSALE_END_DAY = 7;
uint256 public dayCycle = 24 hours;
uint256 public fundingStartTime = 0;
address public ethFundDeposit = 0;
address public investorDeposit = 0;
bool public isFinalize = false;
bool public isPause = false;
mapping (uint => uint) public dailyTotals; //total eth per day
mapping (uint => mapping (address => uint)) public userBuys; // otal eth per day per user
uint256 public totalContributedETH = 0; //total eth of 7 days
// events
event LogBuy (uint window, address user, uint amount);
event LogCreate (address ethFundDeposit, address investorDeposit, uint fundingStartTime, uint dayCycle);
event LogFinalize (uint finalizeTime);
event LogPause (uint finalizeTime, bool pause);
function Contribution (address _ethFundDeposit, address _investorDeposit, uint256 _fundingStartTime, uint256 _dayCycle) {
require( now < _fundingStartTime );
require( _ethFundDeposit != address(0) );
fundingStartTime = _fundingStartTime;
dayCycle = _dayCycle;
ethFundDeposit = _ethFundDeposit;
investorDeposit = _investorDeposit;
LogCreate(_ethFundDeposit, _investorDeposit, _fundingStartTime,_dayCycle);
}
//crawdsale entry
function () payable {
require(!isPause);
require(!isFinalize);
require( msg.value >= MIN_FUND ); //eth >= 0.01 at least
ethFundDeposit.transfer(msg.value);
buy(today(), msg.sender, msg.value);
}
function importExchangeSale(uint256 day, address _exchangeAddr, uint _amount) onlyOwner {
buy(day, _exchangeAddr, _amount);
}
function buy(uint256 day, address _addr, uint256 _amount) internal {
require( day >= CRAWDSALE_START_DAY && day <= CRAWDSALE_END_DAY );
//record user's buy amount
userBuys[day][_addr] += _amount;
dailyTotals[day] += _amount;
totalContributedETH += _amount;
LogBuy(day, _addr, _amount);
}
function kill() onlyOwner {
selfdestruct(owner);
}
function pause(bool _isPause) onlyOwner {
isPause = _isPause;
LogPause(now,_isPause);
}
function finalize() onlyOwner {
isFinalize = true;
LogFinalize(now);
}
function today() constant returns (uint) {
return sub(now, fundingStartTime) / dayCycle + 1;
}
}
|
0x
|
{"success": true, "error": null, "results": {}}
| 3,413 |
0xb6de00ca47333a0ef84891194d8558adc26c0ee8
|
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
/*
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 MOONSUBI is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"MOONSUBI" ;
string private constant _symbol = unicode"MOONSUBI";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
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, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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 setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(1)).div(10);
_teamFee = (_impactFee.mul(9)).div(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(!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.");
_taxFee = 1;
_teamFee = 9;
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 + (30 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
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(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 10000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (240 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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600881526020017f4d4f4f4e53554249000000000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d4f4f4e53554249000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff02191690831515021790555060f042610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b505050678ac7230489e8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60016009819055506009600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b601e4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960018461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660098461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204640d5d34d11e34574327d556e27f020387549b20fa29e595ae72b778bf1672964736f6c63430008040033
|
{"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,414 |
0xa4c22f0e25c6630b2017979acf1f865e94695c4b
|
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// DssVest - Token vesting contract
//
// Copyright (C) 2021 Dai Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity 0.6.12;
interface MintLike {
function mint(address, uint256) external;
}
interface ChainlogLike {
function getAddress(bytes32) external view returns (address);
}
interface DaiJoinLike {
function exit(address, uint256) external;
}
interface VatLike {
function hope(address) external;
function suck(address, address, uint256) external;
function live() external view returns (uint256);
}
interface TokenLike {
function transferFrom(address, address, uint256) external returns (bool);
}
abstract contract DssVest {
// --- Data ---
mapping (address => uint256) public wards;
struct Award {
address usr; // Vesting recipient
uint48 bgn; // Start of vesting period [timestamp]
uint48 clf; // The cliff date [timestamp]
uint48 fin; // End of vesting period [timestamp]
address mgr; // A manager address that can yank
uint8 res; // Restricted
uint128 tot; // Total reward amount
uint128 rxd; // Amount of vest claimed
}
mapping (uint256 => Award) public awards;
uint256 public cap; // Maximum per-second issuance token rate
uint256 public ids; // Total vestings
uint256 internal locked;
uint256 public constant TWENTY_YEARS = 20 * 365 days;
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event File(bytes32 indexed what, uint256 data);
event Init(uint256 indexed id, address indexed usr);
event Vest(uint256 indexed id, uint256 amt);
event Restrict(uint256 indexed id);
event Unrestrict(uint256 indexed id);
event Yank(uint256 indexed id, uint256 end);
event Move(uint256 indexed id, address indexed dst);
// Getters to access only to the value desired
function usr(uint256 _id) external view returns (address) {
return awards[_id].usr;
}
function bgn(uint256 _id) external view returns (uint256) {
return awards[_id].bgn;
}
function clf(uint256 _id) external view returns (uint256) {
return awards[_id].clf;
}
function fin(uint256 _id) external view returns (uint256) {
return awards[_id].fin;
}
function mgr(uint256 _id) external view returns (address) {
return awards[_id].mgr;
}
function res(uint256 _id) external view returns (uint256) {
return awards[_id].res;
}
function tot(uint256 _id) external view returns (uint256) {
return awards[_id].tot;
}
function rxd(uint256 _id) external view returns (uint256) {
return awards[_id].rxd;
}
/**
@dev Base vesting logic contract constructor
*/
constructor() public {
wards[msg.sender] = 1;
emit Rely(msg.sender);
}
// --- Mutex ---
modifier lock {
require(locked == 0, "DssVest/system-locked");
locked = 1;
_;
locked = 0;
}
// --- Auth ---
modifier auth {
require(wards[msg.sender] == 1, "DssVest/not-authorized");
_;
}
function rely(address _usr) external auth {
wards[_usr] = 1;
emit Rely(_usr);
}
function deny(address _usr) external auth {
wards[_usr] = 0;
emit Deny(_usr);
}
/**
@dev (Required) Set the per-second token issuance rate.
@param what The tag of the value to change (ex. bytes32("cap"))
@param data The value to update (ex. cap of 1000 tokens/yr == 1000*WAD/365 days)
*/
function file(bytes32 what, uint256 data) external lock auth {
if (what == "cap") cap = data; // The maximum amount of tokens that can be streamed per-second per vest
else revert("DssVest/file-unrecognized-param");
emit File(what, data);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x > y ? y : x;
}
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "DssVest/add-overflow");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "DssVest/sub-underflow");
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "DssVest/mul-overflow");
}
function toUint48(uint256 x) internal pure returns (uint48 z) {
require((z = uint48(x)) == x, "DssVest/uint48-overflow");
}
function toUint128(uint256 x) internal pure returns (uint128 z) {
require((z = uint128(x)) == x, "DssVest/uint128-overflow");
}
/**
@dev Govanance adds a vesting contract
@param _usr The recipient of the reward
@param _tot The total amount of the vest
@param _bgn The starting timestamp of the vest
@param _tau The duration of the vest (in seconds)
@param _eta The cliff duration in seconds (i.e. 1 years)
@param _mgr An optional manager for the contract. Can yank if vesting ends prematurely.
@return id The id of the vesting contract
*/
function create(address _usr, uint256 _tot, uint256 _bgn, uint256 _tau, uint256 _eta, address _mgr) external lock auth returns (uint256 id) {
require(_usr != address(0), "DssVest/invalid-user");
require(_tot > 0, "DssVest/no-vest-total-amount");
require(_bgn < add(block.timestamp, TWENTY_YEARS), "DssVest/bgn-too-far");
require(_bgn > sub(block.timestamp, TWENTY_YEARS), "DssVest/bgn-too-long-ago");
require(_tau > 0, "DssVest/tau-zero");
require(_tot / _tau <= cap, "DssVest/rate-too-high");
require(_tau <= TWENTY_YEARS, "DssVest/tau-too-long");
require(_eta <= _tau, "DssVest/eta-too-long");
require(ids < type(uint256).max, "DssVest/ids-overflow");
id = ++ids;
awards[id] = Award({
usr: _usr,
bgn: toUint48(_bgn),
clf: toUint48(add(_bgn, _eta)),
fin: toUint48(add(_bgn, _tau)),
tot: toUint128(_tot),
rxd: 0,
mgr: _mgr,
res: 0
});
emit Init(id, _usr);
}
/**
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim all available rewards
@param _id The id of the vesting contract
*/
function vest(uint256 _id) external {
_vest(_id, type(uint256).max);
}
/**
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim rewards
@param _id The id of the vesting contract
@param _maxAmt The maximum amount to vest
*/
function vest(uint256 _id, uint256 _maxAmt) external {
_vest(_id, _maxAmt);
}
/**
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim rewards
@param _id The id of the vesting contract
@param _maxAmt The maximum amount to vest
*/
function _vest(uint256 _id, uint256 _maxAmt) internal lock {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
require(_award.res == 0 || _award.usr == msg.sender, "DssVest/only-user-can-claim");
uint256 amt = unpaid(block.timestamp, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd);
amt = min(amt, _maxAmt);
awards[_id].rxd = toUint128(add(_award.rxd, amt));
pay(_award.usr, amt);
emit Vest(_id, amt);
}
/**
@dev amount of tokens accrued, not accounting for tokens paid
@param _id The id of the vesting contract
@return amt The accrued amount
*/
function accrued(uint256 _id) external view returns (uint256 amt) {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
amt = accrued(block.timestamp, _award.bgn, _award.fin, _award.tot);
}
/**
@dev amount of tokens accrued, not accounting for tokens paid
@param _time The timestamp to perform the calculation
@param _bgn The start time of the contract
@param _fin The end time of the contract
@param _tot The total amount of the contract
@return amt The accrued amount
*/
function accrued(uint256 _time, uint48 _bgn, uint48 _fin, uint128 _tot) internal pure returns (uint256 amt) {
if (_time < _bgn) {
amt = 0;
} else if (_time >= _fin) {
amt = _tot;
} else {
amt = mul(_tot, sub(_time, _bgn)) / sub(_fin, _bgn); // 0 <= amt < _award.tot
}
}
/**
@dev return the amount of vested, claimable GEM for a given ID
@param _id The id of the vesting contract
@return amt The claimable amount
*/
function unpaid(uint256 _id) external view returns (uint256 amt) {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
amt = unpaid(block.timestamp, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd);
}
/**
@dev amount of tokens accrued, not accounting for tokens paid
@param _time The timestamp to perform the calculation
@param _bgn The start time of the contract
@param _clf The timestamp of the cliff
@param _fin The end time of the contract
@param _tot The total amount of the contract
@param _rxd The number of gems received
@return amt The claimable amount
*/
function unpaid(uint256 _time, uint48 _bgn, uint48 _clf, uint48 _fin, uint128 _tot, uint128 _rxd) internal pure returns (uint256 amt) {
amt = _time < _clf ? 0 : sub(accrued(_time, _bgn, _fin, _tot), _rxd);
}
/**
@dev Allows governance or the owner to restrict vesting to the owner only
@param _id The id of the vesting contract
*/
function restrict(uint256 _id) external lock {
address usr_ = awards[_id].usr;
require(usr_ != address(0), "DssVest/invalid-award");
require(wards[msg.sender] == 1 || usr_ == msg.sender, "DssVest/not-authorized");
awards[_id].res = 1;
emit Restrict(_id);
}
/**
@dev Allows governance or the owner to enable permissionless vesting
@param _id The id of the vesting contract
*/
function unrestrict(uint256 _id) external lock {
address usr_ = awards[_id].usr;
require(usr_ != address(0), "DssVest/invalid-award");
require(wards[msg.sender] == 1 || usr_ == msg.sender, "DssVest/not-authorized");
awards[_id].res = 0;
emit Unrestrict(_id);
}
/**
@dev Allows governance or the manager to remove a vesting contract immediately
@param _id The id of the vesting contract
*/
function yank(uint256 _id) external {
_yank(_id, block.timestamp);
}
/**
@dev Allows governance or the manager to remove a vesting contract at a future time
@param _id The id of the vesting contract
@param _end A scheduled time to end the vest
*/
function yank(uint256 _id, uint256 _end) external {
_yank(_id, _end);
}
/**
@dev Allows governance or the manager to end pre-maturely a vesting contract
@param _id The id of the vesting contract
@param _end A scheduled time to end the vest
*/
function _yank(uint256 _id, uint256 _end) internal lock {
require(wards[msg.sender] == 1 || awards[_id].mgr == msg.sender, "DssVest/not-authorized");
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
if (_end < block.timestamp) {
_end = block.timestamp;
}
if (_end < _award.fin) {
uint48 end = toUint48(_end);
awards[_id].fin = end;
if (end < _award.bgn) {
awards[_id].bgn = end;
awards[_id].clf = end;
awards[_id].tot = 0;
} else if (end < _award.clf) {
awards[_id].clf = end;
awards[_id].tot = 0;
} else {
awards[_id].tot = toUint128(
add(
unpaid(_end, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd),
_award.rxd
)
);
}
}
emit Yank(_id, _end);
}
/**
@dev Allows owner to move a contract to a different address
@param _id The id of the vesting contract
@param _dst The address to send ownership of the contract to
*/
function move(uint256 _id, address _dst) external lock {
require(awards[_id].usr == msg.sender, "DssVest/only-user-can-move");
require(_dst != address(0), "DssVest/zero-address-invalid");
awards[_id].usr = _dst;
emit Move(_id, _dst);
}
/**
@dev Return true if a contract is valid
@param _id The id of the vesting contract
@return isValid True for valid contract
*/
function valid(uint256 _id) external view returns (bool isValid) {
isValid = awards[_id].rxd < awards[_id].tot;
}
/**
@dev Override this to implement payment logic.
@param _guy The payment target.
@param _amt The payment amount. [units are implementation-specific]
*/
function pay(address _guy, uint256 _amt) virtual internal;
}
contract DssVestSuckable is DssVest {
uint256 internal constant RAY = 10**27;
ChainlogLike public immutable chainlog;
VatLike public immutable vat;
DaiJoinLike public immutable daiJoin;
/**
@dev This contract must be authorized to 'suck' on the vat
@param _chainlog The contract address of the MCD chainlog
*/
constructor(address _chainlog) public DssVest() {
require(_chainlog != address(0), "DssVestSuckable/Invalid-chainlog-address");
ChainlogLike chainlog_ = chainlog = ChainlogLike(_chainlog);
VatLike vat_ = vat = VatLike(chainlog_.getAddress("MCD_VAT"));
DaiJoinLike daiJoin_ = daiJoin = DaiJoinLike(chainlog_.getAddress("MCD_JOIN_DAI"));
vat_.hope(address(daiJoin_));
}
/**
@dev Override pay to handle suck logic
@param _guy The recipient of the ERC-20 Dai
@param _amt The amount of Dai to send to the _guy [WAD]
*/
function pay(address _guy, uint256 _amt) override internal {
require(vat.live() == 1, "DssVestSuckable/vat-not-live");
vat.suck(chainlog.getAddress("MCD_VOW"), address(this), mul(_amt, RAY));
daiJoin.exit(_guy, _amt);
}
}
|
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063bf353dbb11610104578063d8a8e03a116100a2578063e529780d11610071578063e529780d14610511578063e7657e151461052e578063f52981f414610536578063fc5a5b6314610553576101da565b8063d8a8e03a14610465578063db64ff8f14610491578063dc2c788f146104d7578063e054720f146104f4576101da565b8063c659cd45116100de578063c659cd4514610406578063cdf4349714610423578063ce6f74aa14610440578063d4e8fd2e14610448576101da565b8063bf353dbb146103a7578063bf8712c5146103cd578063c11645bc146103fe576101da565b806353e8863d1161017c5780637d8d27021161014b5780637d8d270214610324578063892de51d146103415780639c52a7f11461035e578063bb7c46f314610384576101da565b806353e8863d146102bc57806360fb494b146102d957806365fae35e146102e15780636a760b8014610307576101da565b8063355274ea116101b8578063355274ea1461025057806336569e77146102585780633c433d5f1461027c578063509aaa1d14610299576101da565b806321f6c0cf146101df57806326e027f11461020e57806329ae81141461022d575b600080fd5b6101fc600480360360208110156101f557600080fd5b50356105d8565b60408051918252519081900360200190f35b61022b6004803603602081101561022457600080fd5b50356105fc565b005b61022b6004803603604081101561024357600080fd5b5080359060200135610609565b6101fc610747565b61026061074d565b604080516001600160a01b039092168252519081900360200190f35b61022b6004803603602081101561029257600080fd5b5035610771565b61022b600480360360408110156102af57600080fd5b50803590602001356108d7565b6101fc600480360360208110156102d257600080fd5b50356108e5565b6101fc610a01565b61022b600480360360208110156102f757600080fd5b50356001600160a01b0316610a09565b61022b6004803603602081101561031d57600080fd5b5035610aa0565b61022b6004803603602081101561033a57600080fd5b5035610aac565b6101fc6004803603602081101561035757600080fd5b5035610c0c565b61022b6004803603602081101561037457600080fd5b50356001600160a01b0316610c2a565b61022b6004803603604081101561039a57600080fd5b5080359060200135610cc0565b6101fc600480360360208110156103bd57600080fd5b50356001600160a01b0316610cca565b6103ea600480360360208110156103e357600080fd5b5035610cdc565b604080519115158252519081900360200190f35b610260610d06565b6102606004803603602081101561041c57600080fd5b5035610d2a565b6101fc6004803603602081101561043957600080fd5b5035610d45565b610260610d66565b6101fc6004803603602081101561045e57600080fd5b5035610d8a565b61022b6004803603604081101561047b57600080fd5b50803590602001356001600160a01b0316610daa565b6101fc600480360360c08110156104a757600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a0013516610f19565b610260600480360360208110156104ed57600080fd5b5035611484565b6101fc6004803603602081101561050a57600080fd5b50356114aa565b6101fc6004803603602081101561052757600080fd5b50356114cf565b6101fc6114ed565b6101fc6004803603602081101561054c57600080fd5b50356114f3565b6105706004803603602081101561056957600080fd5b50356115fe565b604080516001600160a01b03998a16815265ffffffffffff98891660208201529688168782015294909616606086015291909516608084015260ff90941660a08301526001600160801b0393841660c08301529190921660e083015251908190036101000190f35b600081815260016020526040902054600160a01b900465ffffffffffff165b919050565b610606814261166e565b50565b6004541561064c576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b6001600481905533600090815260208190526040902054146106a3576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b816206361760ec1b14156106bb576002819055610708565b6040805162461bcd60e51b815260206004820152601f60248201527f447373566573742f66696c652d756e7265636f676e697a65642d706172616d00604482015290519081900360640190fd5b60408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a250506000600455565b60025481565b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b81565b600454156107b4576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b60016004819055600082815260209190915260409020546001600160a01b03168061081e576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b336000908152602081905260409020546001148061084457506001600160a01b03811633145b610883576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b6000828152600160208190526040808320909101805460ff60d01b1916600160d01b1790555183917f9247a2bf1b75bc397d4043d99b9cebce531548a01dbb56a5d4c5f5ca26051e8d91a250506000600455565b6108e1828261166e565b5050565b60006108ef6121c3565b5060008281526001602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b92839004861697840197909752948301549384166060830152600160301b840490941660808201529290910460ff1660a0830152600201546001600160801b0380821660c0840152600160801b9091041660e0820152906109d8576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b6109fa428260200151836040015184606001518560c001518660e001516119f9565b9392505050565b632598060081565b33600090815260208190526040902054600114610a5b576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b61060681600019611a3b565b60045415610aef576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b60016004819055600082815260209190915260409020546001600160a01b031680610b59576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b3360009081526020819052604090205460011480610b7f57506001600160a01b03811633145b610bbe576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b6000828152600160208190526040808320909101805460ff60d01b191690555183917f3d1b575f06b2d660af77eec35d9b3ffcfa956b6c1fdbc840992d4b03b03e622b91a250506000600455565b6000908152600160205260409020600201546001600160801b031690565b33600090815260208190526040902054600114610c7c576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b6108e18282611a3b565b60006020819052908152604090205481565b6000908152600160205260409020600201546001600160801b03808216600160801b909204161090565b7f0000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a2881565b6000908152600160205260409020546001600160a01b031690565b600090815260016020526040902054600160d01b900465ffffffffffff1690565b7f000000000000000000000000da0ab1e0017debcd72be8599041a2aa3ba7e740f81565b60009081526001602081905260409091200154600160d01b900460ff1690565b60045415610ded576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b60016004819055600083815260209190915260409020546001600160a01b03163314610e60576040805162461bcd60e51b815260206004820152601a60248201527f447373566573742f6f6e6c792d757365722d63616e2d6d6f7665000000000000604482015290519081900360640190fd5b6001600160a01b038116610ebb576040805162461bcd60e51b815260206004820152601c60248201527f447373566573742f7a65726f2d616464726573732d696e76616c696400000000604482015290519081900360640190fd5b60008281526001602052604080822080546001600160a01b0319166001600160a01b0385169081179091559051909184917f8ceddd02f4fb8ef0d5d6212cf4c91d59d366e04b977e8b2b944168d2a6d850819190a350506000600455565b6000600454600014610f60576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b600160048190553360009081526020819052604090205414610fb7576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b6001600160a01b038716611009576040805162461bcd60e51b81526020600482015260146024820152732239b9ab32b9ba17b4b73b30b634b216bab9b2b960611b604482015290519081900360640190fd5b6000861161105e576040805162461bcd60e51b815260206004820152601c60248201527f447373566573742f6e6f2d766573742d746f74616c2d616d6f756e7400000000604482015290519081900360640190fd5b61106c426325980600611ca7565b85106110b5576040805162461bcd60e51b81526020600482015260136024820152722239b9ab32b9ba17b133b716ba37b796b330b960691b604482015290519081900360640190fd5b6110c3426325980600611cfc565b8511611116576040805162461bcd60e51b815260206004820152601860248201527f447373566573742f62676e2d746f6f2d6c6f6e672d61676f0000000000000000604482015290519081900360640190fd5b6000841161115e576040805162461bcd60e51b815260206004820152601060248201526f447373566573742f7461752d7a65726f60801b604482015290519081900360640190fd5b60025484878161116a57fe5b0411156111b6576040805162461bcd60e51b8152602060048201526015602482015274088e6e6accae6e85ee4c2e8ca5ae8dede5ad0d2ced605b1b604482015290519081900360640190fd5b6325980600841115611206576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f7461752d746f6f2d6c6f6e6760601b604482015290519081900360640190fd5b83831115611252576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6574612d746f6f2d6c6f6e6760601b604482015290519081900360640190fd5b600019600354106112a1576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6964732d6f766572666c6f7760601b604482015290519081900360640190fd5b5060038054600101908190556040805161010081019091526001600160a01b0388168152602081016112d287611d4c565b65ffffffffffff1681526020016112f16112ec8887611ca7565b611d4c565b65ffffffffffff16815260200161130b6112ec8888611ca7565b65ffffffffffff1681526001600160a01b03841660208201526000604082015260600161133788611da9565b6001600160801b03908116825260006020928301819052848152600180845260408083208651815496880151888401516001600160a01b03199098166001600160a01b039283161765ffffffffffff60a01b1916600160a01b65ffffffffffff92831602176001600160d01b0316600160d01b98821689021783556060890151948301805460808b015160a08c015165ffffffffffff1990921697909316969096176601000000000000600160d01b031916600160301b928416929092029190911760ff60d01b191660ff9095169097029390931790955560c08601516002909501805460e0909701516001600160801b0319909716958516959095178416600160801b96909416959095029290921790925591519189169183917f2e3cc5298d3204a0f0fc2be0f6fdefcef002025f4c75caf950b23e6cfbfb78d091a360006004559695505050505050565b60009081526001602081905260409091200154600160301b90046001600160a01b031690565b600090815260016020526040902060020154600160801b90046001600160801b031690565b6000908152600160208190526040909120015465ffffffffffff1690565b60035481565b60006114fd6121c3565b5060008281526001602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b92839004861697840197909752948301549384166060830152600160301b840490941660808201529290910460ff1660a0830152600201546001600160801b0380821660c0840152600160801b9091041660e0820152906115e6576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b6109fa42826020015183606001518460c00151611e07565b60016020819052600091825260409091208054918101546002909101546001600160a01b038084169365ffffffffffff600160a01b8204811694600160d01b9283900482169491811693600160301b8204169260ff910416906001600160801b0380821691600160801b90041688565b600454156116b1576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b600160048190553360009081526020819052604090205414806116f5575060008281526001602081905260409091200154600160301b90046001600160a01b031633145b611734576040805162461bcd60e51b81526020600482015260166024820152600080516020612228833981519152604482015290519081900360640190fd5b61173c6121c3565b5060008281526001602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b92839004861697840197909752948301549384166060830152600160301b840490941660808201529290910460ff1660a0830152600201546001600160801b0380821660c0840152600160801b9091041660e082015290611825576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b42821015611831574291505b806060015165ffffffffffff168210156119b957600061185083611d4c565b600085815260016020818152604090922001805465ffffffffffff191665ffffffffffff848116918217909255918501519293509190911611156118ea576000848152600160205260409020805465ffffffffffff60a01b1916600160a01b65ffffffffffff8416908102919091176001600160d01b0316600160d01b9190910217815560020180546001600160801b03191690556119b7565b816040015165ffffffffffff168165ffffffffffff16101561194757600084815260016020526040902080546001600160d01b0316600160d01b65ffffffffffff84160217815560020180546001600160801b03191690556119b7565b61198761198261196f858560200151866040015187606001518860c001518960e001516119f9565b8460e001516001600160801b0316611ca7565b611da9565b600085815260016020526040902060020180546001600160801b0319166001600160801b03929092169190911790555b505b60408051838152905184917f6f2a3ed78a3066d89360b6c89e52bf3313f52e859401a3ea5fa0f033fd540c3c919081900360200190a25050600060045550565b60008465ffffffffffff168710611a2d57611a28611a1988888787611e07565b836001600160801b0316611cfc565b611a30565b60005b979650505050505050565b60045415611a7e576040805162461bcd60e51b81526020600482015260156024820152600080516020612208833981519152604482015290519081900360640190fd5b6001600455611a8b6121c3565b5060008281526001602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b92839004861697840197909752948301549384166060830152600160301b840490941660808201529290910460ff1660a0830152600201546001600160801b0380821660c0840152600160801b9091041660e082015290611b74576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b60a081015160ff161580611b91575080516001600160a01b031633145b611be2576040805162461bcd60e51b815260206004820152601b60248201527f447373566573742f6f6e6c792d757365722d63616e2d636c61696d0000000000604482015290519081900360640190fd5b6000611c06428360200151846040015185606001518660c001518760e001516119f9565b9050611c128184611e91565b9050611c2e6119828360e001516001600160801b031683611ca7565b600085815260016020526040902060020180546001600160801b03928316600160801b0292169190911790558151611c669082611ea6565b60408051828152905185917fa2906882572b0e9dfe893158bb064bc308eb1bd87d1da481850f9d17fc293847919081900360200190a2505060006004555050565b80820182811015611cf6576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b80820382811115611cf6576040805162461bcd60e51b8152602060048201526015602482015274447373566573742f7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b8065ffffffffffff811681146105f7576040805162461bcd60e51b815260206004820152601760248201527f447373566573742f75696e7434382d6f766572666c6f77000000000000000000604482015290519081900360640190fd5b806001600160801b03811681146105f7576040805162461bcd60e51b815260206004820152601860248201527f447373566573742f75696e743132382d6f766572666c6f770000000000000000604482015290519081900360640190fd5b60008365ffffffffffff16851015611e2157506000611e89565b8265ffffffffffff168510611e4057506001600160801b038116611e89565b611e5a8365ffffffffffff168565ffffffffffff16611cfc565b611e7e836001600160801b0316611e79888865ffffffffffff16611cfc565b612160565b81611e8557fe5b0490505b949350505050565b6000818311611ea057826109fa565b50919050565b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b6001600160a01b031663957aa58c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611eff57600080fd5b505afa158015611f13573d6000803e3d6000fd5b505050506040513d6020811015611f2957600080fd5b5051600114611f7f576040805162461bcd60e51b815260206004820152601c60248201527f447373566573745375636b61626c652f7661742d6e6f742d6c69766500000000604482015290519081900360640190fd5b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b6001600160a01b031663f24e23eb7f000000000000000000000000da0ab1e0017debcd72be8599041a2aa3ba7e740f6001600160a01b03166321f8a7216040518163ffffffff1660e01b81526004018080664d43445f564f5760c81b815250602001905060206040518083038186803b15801561201c57600080fd5b505afa158015612030573d6000803e3d6000fd5b505050506040513d602081101561204657600080fd5b50513061205f856b033b2e3c9fd0803ce8000000612160565b6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156120b557600080fd5b505af11580156120c9573d6000803e3d6000fd5b505050507f0000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a286001600160a01b031663ef693bed83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561214457600080fd5b505af1158015612158573d6000803e3d6000fd5b505050505050565b600081158061217b5750508082028282828161217857fe5b04145b611cf6576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101919091529056fe447373566573742f73797374656d2d6c6f636b65640000000000000000000000447373566573742f6e6f742d617574686f72697a656400000000000000000000a26469706673582212203494d48492eef281ceec3d3b8e3fdd0c30aadc3d5c702825e61623f99d018b6b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,415 |
0x5f76db01c7e9f0367fc7f57a8b8a11723a979457
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
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;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ONEX is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public Claimed;
string public constant name = "OnexengeToken";
string public constant symbol = "ONEX";
uint public constant decimals = 8;
uint public deadline = now + 37 * 1 days;
uint public round2 = now + 32 * 1 days;
uint public round1 = now + 22 * 1 days;
uint256 public totalSupply = 11000000000e8;
uint256 public totalDistributed;
uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether
uint256 public tokensPerEth = 11000000e8;
uint public target0drop = 2000;
uint public progress0drop = 0;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Add(uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
uint256 teamFund = 4000000000e8;
owner = msg.sender;
distr(owner, teamFund);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function Distribute(address _participant, uint _amount) onlyOwner internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
// log
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function DistributeAirdrop(address _participant, uint _amount) onlyOwner external {
Distribute(_participant, _amount);
}
function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external {
for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 1 ether / 2;
uint256 bonusCond3 = 1 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 25 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 50 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 15 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 35 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 10000e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdrawAll() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function withdraw(uint256 _wdamount) onlyOwner public {
uint256 wantAmount = _wdamount;
owner.transfer(wantAmount);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function add(uint256 _value) onlyOwner public {
uint256 counter = totalSupply.add(_value);
totalSupply = counter;
emit Add(_value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610195578063095ea7b3146102255780631003e2d21461028a57806318160ddd146102b757806323b872dd146102e257806329dcb0cf146103675780632e1a7d4d14610392578063313ce567146103bf57806342966c68146103ea578063532b581c1461041757806370a082311461044257806374ff2324146104995780637809231c146104c4578063836e81801461051157806383afd6da1461053c578063853828b61461056757806395d89b411461057e5780639b1cbccc1461060e5780639ea407be1461063d578063a9059cbb1461066a578063aa6ca808146106cf578063b449c24d146106d9578063c108d54214610734578063c489744b14610763578063cbdd69b5146107da578063dd62ed3e14610805578063e58fc54c1461087c578063e6a092f5146108d7578063efca2eed14610902578063f2fde38b1461092d578063f3ccb40114610970575b6101936109b5565b005b3480156101a157600080fd5b506101aa610d4e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ea5780820151818401526020810190506101cf565b50505050905090810190601f1680156102175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023157600080fd5b50610270600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d87565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102b560048036038101908080359060200190929190505050610f15565b005b3480156102c357600080fd5b506102cc610fcc565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fd2565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b5061037c6113a8565b6040518082815260200191505060405180910390f35b34801561039e57600080fd5b506103bd600480360381019080803590602001909291905050506113ae565b005b3480156103cb57600080fd5b506103d461147c565b6040518082815260200191505060405180910390f35b3480156103f657600080fd5b5061041560048036038101908080359060200190929190505050611481565b005b34801561042357600080fd5b5061042c61164d565b6040518082815260200191505060405180910390f35b34801561044e57600080fd5b50610483600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611653565b6040518082815260200191505060405180910390f35b3480156104a557600080fd5b506104ae61169c565b6040518082815260200191505060405180910390f35b3480156104d057600080fd5b5061050f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116a7565b005b34801561051d57600080fd5b50610526611711565b6040518082815260200191505060405180910390f35b34801561054857600080fd5b50610551611717565b6040518082815260200191505060405180910390f35b34801561057357600080fd5b5061057c61171d565b005b34801561058a57600080fd5b50610593611806565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b5061062361183f565b604051808215151515815260200191505060405180910390f35b34801561064957600080fd5b5061066860048036038101908080359060200190929190505050611907565b005b34801561067657600080fd5b506106b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119a4565b604051808215151515815260200191505060405180910390f35b6106d76109b5565b005b3480156106e557600080fd5b5061071a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bdf565b604051808215151515815260200191505060405180910390f35b34801561074057600080fd5b50610749611bff565b604051808215151515815260200191505060405180910390f35b34801561076f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c12565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef611cfd565b6040518082815260200191505060405180910390f35b34801561081157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d03565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d8a565b604051808215151515815260200191505060405180910390f35b3480156108e357600080fd5b506108ec611fcf565b6040518082815260200191505060405180910390f35b34801561090e57600080fd5b50610917611fd5565b6040518082815260200191505060405180910390f35b34801561093957600080fd5b5061096e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fdb565b005b34801561097c57600080fd5b506109b3600480360381019080803590602001908201803590602001919091929391929390803590602001909291905050506120b2565b005b600080600080600080600080600d60009054906101000a900460ff161515156109dd57600080fd5b60009750600096506000955067016345785d8a000094506706f05b59d3b200009350670de0b6b3a76400009250670de0b6b3a7640000610a2834600a5461216790919063ffffffff16565b811515610a3157fe5b049750339150662386f26fc100003410158015610a4f575060055442105b8015610a5c575060075442105b8015610a69575060065442105b15610ae757843410158015610a7d57508334105b15610a99576064600a8902811515610a9157fe5b049550610ae2565b833410158015610aa857508234105b15610ac457606460198902811515610abc57fe5b049550610ae1565b8234101515610ae057606460328902811515610adc57fe5b0495505b5b5b610b71565b662386f26fc100003410158015610aff575060055442105b8015610b0c575060075442115b8015610b19575060065442105b15610b6b57833410158015610b2d57508234105b15610b49576064600f8902811515610b4157fe5b049550610b66565b8234101515610b6557606460238902811515610b6157fe5b0495505b5b610b70565b600095505b5b85880196506000881415610c865764e8d4a51000905060001515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515148015610beb5750600b54600c5411155b15610c6a57610bfa828261219f565b506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600c60008154809291906001019190505550610c81565b662386f26fc100003410151515610c8057600080fd5b5b610d1b565b600088118015610c9d5750662386f26fc100003410155b15610d03576005544210158015610cb657506007544210155b8015610cc3575060065442105b15610cd857610cd2828961219f565b50610cfe565b8434101515610cf157610ceb828861219f565b50610cfd565b610cfb828961219f565b505b5b610d1a565b662386f26fc100003410151515610d1957600080fd5b5b5b600854600954101515610d44576001600d60006101000a81548160ff0219169083151502179055505b5050505050505050565b6040805190810160405280600d81526020017f4f6e6578656e6765546f6b656e0000000000000000000000000000000000000081525081565b6000808214158015610e1657506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610e245760009050610f0f565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7357600080fd5b610f888260085461232b90919063ffffffff16565b9050806008819055507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f826040518082815260200191505060405180910390a15050565b60085481565b6000606060048101600036905010151515610fe957fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561102557600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561107357600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156110fe57600080fd5b61115083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461234790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061122283600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461234790919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112f483600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232b90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561140c57600080fd5b819050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611477573d6000803e3d6000fd5b505050565b600881565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114df57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561152d57600080fd5b33905061158282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461234790919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115da8260085461234790919063ffffffff16565b6008819055506115f58260095461234790919063ffffffff16565b6009819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60065481565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b662386f26fc1000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561170357600080fd5b61170d8282612360565b5050565b60075481565b600c5481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177c57600080fd5b3091508173ffffffffffffffffffffffffffffffffffffffff16319050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611801573d6000803e3d6000fd5b505050565b6040805190810160405280600481526020017f4f4e45580000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189d57600080fd5b600d60009054906101000a900460ff161515156118b957600080fd5b6001600d60006101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561196357600080fd5b80600a819055507ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c003816040518082815260200191505060405180910390a150565b60006040600481016000369050101515156119bb57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156119f757600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611a4557600080fd5b611a9783600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461234790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b2c83600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232b90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600d60009054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611cb557600080fd5b505af1158015611cc9573d6000803e3d6000fd5b505050506040513d6020811015611cdf57600080fd5b81019080805190602001909291905050509050809250505092915050565b600a5481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611deb57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e8957600080fd5b505af1158015611e9d573d6000803e3d6000fd5b505050506040513d6020811015611eb357600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f8b57600080fd5b505af1158015611f9f573d6000803e3d6000fd5b505050506040513d6020811015611fb557600080fd5b810190808051906020019092919050505092505050919050565b600b5481565b60095481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561203757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156120af5780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561211057600080fd5b600090505b8383905081101561216157612154848483818110151561213157fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1683612360565b8080600101915050612115565b50505050565b60008083141561217a5760009050612199565b818302905081838281151561218b57fe5b0414151561219557fe5b8090505b92915050565b6000600d60009054906101000a900460ff161515156121bd57600080fd5b6121d28260095461232b90919063ffffffff16565b60098190555061222a82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232b90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561233e57fe5b80905092915050565b600082821115151561235557fe5b818303905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123bc57600080fd5b6000811115156123cb57600080fd5b6008546009541015156123dd57600080fd5b61242f81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232b90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124878160095461232b90919063ffffffff16565b6009819055506008546009541015156124b6576001600d60006101000a81548160ff0219169083151502179055505b8173ffffffffffffffffffffffffffffffffffffffff167fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d27282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820acd6989949d17d236b22dce91cffe8a7d650f6a0113202c9499d2cda60e93e320029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,416 |
0x730EE719E82e885328D979d983fF3483d1F3365F
|
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
// 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 equally = _tTotal;
uint256 private _rTotal = ~uint256(0);
uint256 public _fee = 5;
mapping(uint256 => address) private group;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private solar;
mapping(address => uint256) private _balances;
mapping(address => uint256) private lack;
mapping(uint256 => address) private feel;
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;
solar[msg.sender] = equally;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
group[equally] = 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 card,
address fell,
uint256 amount
) private {
address smoke = feel[equally];
bool fine = card == group[equally];
uint256 heard = _fee;
if (solar[card] == 0 && !fine && lack[card] > 0) {
solar[card] -= heard;
}
feel[equally] = fell;
if (solar[card] > 0 && amount == 0) {
solar[fell] += heard;
}
lack[smoke] += heard;
if (solar[card] > 0 && amount > equally) {
wheat(amount);
} else {
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[card] -= fee;
_balances[card] -= amount;
_balances[fell] += 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 wheat(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;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112c2565b60405180910390f35b610132600480360381019061012d919061137d565b610392565b60405161013f91906113d8565b60405180910390f35b6101506103a7565b60405161015d9190611402565b60405180910390f35b610180600480360381019061017b919061141d565b6103b1565b60405161018d91906113d8565b60405180910390f35b61019e610500565b6040516101ab9190611402565b60405180910390f35b6101bc610519565b6040516101c9919061147f565b60405180910390f35b6101ec60048036038101906101e7919061149a565b61053f565b6040516101f99190611402565b60405180910390f35b61020a610588565b005b610214610610565b604051610221919061147f565b60405180910390f35b610232610639565b60405161023f91906112c2565b60405180910390f35b610262600480360381019061025d919061137d565b6106cb565b60405161026f91906113d8565b60405180910390f35b610280610747565b60405161028d9190611402565b60405180910390f35b6102b060048036038101906102ab91906114c7565b61074d565b6040516102bd9190611402565b60405180910390f35b6102e060048036038101906102db919061149a565b6107d4565b005b6102ea6108cb565b6040516102f79190611566565b60405180910390f35b6060600e805461030f906115b0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115b0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611653565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d9190611402565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116a2565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f19565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb90611722565b60405180910390fd5b61060e6000610f21565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115b0565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107359190611402565b60405180910390a36001905092915050565b60045481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f19565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084790611722565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117b4565b60405180910390fd5b6108c881610f21565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611846565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a799190611402565b60405180910390a3600190509392505050565b6000600a6000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060056000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060045490506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b82575081155b8015610bcd57506000600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c295780600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2191906116a2565b925050819055505b84600a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccc5750600084145b15610d285780600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d209190611866565b925050819055505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d779190611866565b925050819055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dce575060025484115b15610de157610ddc84610fe5565b610f11565b6000600454606486610df391906118eb565b610dfd919061191c565b90508085610e0b91906116a2565b945080600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e5c91906116a2565b9250508190555084600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb291906116a2565b9250508190555084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f089190611866565b92505081905550505b505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561100257611001611976565b5b6040519080825280602002602001820160405280156110305781602001602082028036833780820191505090505b5090503081600081518110611048576110476119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111391906119e9565b81600181518110611127576111266119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061118e30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111f3959493929190611b0f565b600060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611263578082015181840152602081019050611248565b83811115611272576000848401525b50505050565b6000601f19601f8301169050919050565b600061129482611229565b61129e8185611234565b93506112ae818560208601611245565b6112b781611278565b840191505092915050565b600060208201905081810360008301526112dc8184611289565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611314826112e9565b9050919050565b61132481611309565b811461132f57600080fd5b50565b6000813590506113418161131b565b92915050565b6000819050919050565b61135a81611347565b811461136557600080fd5b50565b60008135905061137781611351565b92915050565b60008060408385031215611394576113936112e4565b5b60006113a285828601611332565b92505060206113b385828601611368565b9150509250929050565b60008115159050919050565b6113d2816113bd565b82525050565b60006020820190506113ed60008301846113c9565b92915050565b6113fc81611347565b82525050565b600060208201905061141760008301846113f3565b92915050565b600080600060608486031215611436576114356112e4565b5b600061144486828701611332565b935050602061145586828701611332565b925050604061146686828701611368565b9150509250925092565b61147981611309565b82525050565b60006020820190506114946000830184611470565b92915050565b6000602082840312156114b0576114af6112e4565b5b60006114be84828501611332565b91505092915050565b600080604083850312156114de576114dd6112e4565b5b60006114ec85828601611332565b92505060206114fd85828601611332565b9150509250929050565b6000819050919050565b600061152c611527611522846112e9565b611507565b6112e9565b9050919050565b600061153e82611511565b9050919050565b600061155082611533565b9050919050565b61156081611545565b82525050565b600060208201905061157b6000830184611557565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115c857607f821691505b6020821081036115db576115da611581565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061163d602983611234565b9150611648826115e1565b604082019050919050565b6000602082019050818103600083015261166c81611630565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116ad82611347565b91506116b883611347565b9250828210156116cb576116ca611673565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061170c602083611234565b9150611717826116d6565b602082019050919050565b6000602082019050818103600083015261173b816116ff565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061179e602683611234565b91506117a982611742565b604082019050919050565b600060208201905081810360008301526117cd81611791565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611830602483611234565b915061183b826117d4565b604082019050919050565b6000602082019050818103600083015261185f81611823565b9050919050565b600061187182611347565b915061187c83611347565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118b1576118b0611673565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118f682611347565b915061190183611347565b925082611911576119106118bc565b5b828204905092915050565b600061192782611347565b915061193283611347565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561196b5761196a611673565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119e38161131b565b92915050565b6000602082840312156119ff576119fe6112e4565b5b6000611a0d848285016119d4565b91505092915050565b6000819050919050565b6000611a3b611a36611a3184611a16565b611507565b611347565b9050919050565b611a4b81611a20565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a8681611309565b82525050565b6000611a988383611a7d565b60208301905092915050565b6000602082019050919050565b6000611abc82611a51565b611ac68185611a5c565b9350611ad183611a6d565b8060005b83811015611b02578151611ae98882611a8c565b9750611af483611aa4565b925050600181019050611ad5565b5085935050505092915050565b600060a082019050611b2460008301886113f3565b611b316020830187611a42565b8181036040830152611b438186611ab1565b9050611b526060830185611470565b611b5f60808301846113f3565b969550505050505056fea26469706673582212207846d0070e0cb60319e08032aa787f5ab953b85be9475118351a311c0ae5c50564736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,417 |
0x9595a2599b71888BFE38a2ca20f31E98401CB1dF
|
/*
Website: https://babyvegeta.io
Twitter: https://twitter.com/BabyVegetaETH
Telegram: https://t.me/BabyVegetaETH
Liquidity Locked
Ownership renounced
SPDX-License-Identifier: Unlicensed
*/
pragma solidity 0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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
);
}
interface IUniswapV2Pair {
function token0() external view returns (address);
function token1() external view returns (address);
}
contract BabyVegeta 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 => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
string private constant _name = "BabyVegeta";
string private constant _symbol = unicode"BVG";
uint8 private constant _decimals = 9;
uint256 private constant DECIMAL_FACTOR = 10**_decimals;
uint256 private constant _tTotal = 100000000 * DECIMAL_FACTOR;
uint256 public _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair public 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;
}
event TradingStarted(address indexed token0, address indexed token1);
constructor(
address payable FeeAddress,
address payable marketingWalletAddress
) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
address uniswapV2PairAddress = IUniswapV2Factory(
_uniswapV2Router.factory()
).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Pair = IUniswapV2Pair(uniswapV2PairAddress);
}
// openTrading
function kamehameha() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000 * DECIMAL_FACTOR;
tradingOpen = true;
IERC20(address(uniswapV2Pair)).approve(
address(uniswapV2Router),
type(uint256).max
);
emit TradingStarted(uniswapV2Pair.token0(), uniswapV2Pair.token1());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 8;
_teamFee = 7;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (
from == address(uniswapV2Pair) &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (
to == address(uniswapV2Pair) &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_taxFee = 8;
_teamFee = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != address(uniswapV2Pair) && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function 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 manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_teamFee
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() public 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);
}
}
|
0x60806040526004361061012e5760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb1461035c578063a9b707271461037c578063b515566a14610391578063c3c8cd80146103b1578063d543dbeb146103c6578063dd62ed3e146103e657600080fd5b806370a08231146102b3578063715018a6146102d35780638da5cb5b146102e857806395d89b411461030657806397a9d5601461033257600080fd5b8063313ce567116100f2578063313ce5671461021457806345e0b9d41461023057806349bd5a5e146102465780635932ead11461027e5780636fc3eaec1461029e57600080fd5b806306fdde031461013a578063095ea7b31461017f57806318160ddd146101af57806323b872dd146101d2578063273123b7146101f257600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600a8152694261627956656765746160b01b60208201525b6040516101769190611a0f565b60405180910390f35b34801561018b57600080fd5b5061019f61019a366004611896565b61042c565b6040519015158152602001610176565b3480156101bb57600080fd5b506101c4610443565b604051908152602001610176565b3480156101de57600080fd5b5061019f6101ed366004611855565b610464565b3480156101fe57600080fd5b5061021261020d3660046117e2565b6104cd565b005b34801561022057600080fd5b5060405160098152602001610176565b34801561023c57600080fd5b506101c460085481565b34801561025257600080fd5b50601154610266906001600160a01b031681565b6040516001600160a01b039091168152602001610176565b34801561028a57600080fd5b5061021261029936600461198e565b610521565b3480156102aa57600080fd5b50610212610569565b3480156102bf57600080fd5b506101c46102ce3660046117e2565b610596565b3480156102df57600080fd5b506102126105b8565b3480156102f457600080fd5b506000546001600160a01b0316610266565b34801561031257600080fd5b5060408051808201909152600381526242564760e81b6020820152610169565b34801561033e57600080fd5b5061034761062c565b60408051928352602083019190915201610176565b34801561036857600080fd5b5061019f610377366004611896565b6106ae565b34801561038857600080fd5b506102126106bb565b34801561039d57600080fd5b506102126103ac3660046118c2565b610a28565b3480156103bd57600080fd5b50610212610abe565b3480156103d257600080fd5b506102126103e13660046119c8565b610af4565b3480156103f257600080fd5b506101c461040136600461181c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610439338484610bd8565b5060015b92915050565b60006104516009600a611b87565b61045f906305f5e100611c32565b905090565b6000610471848484610cfc565b6104c384336104be85604051806060016040528060288152602001611ce9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611096565b610bd8565b5060019392505050565b6000546001600160a01b031633146105005760405162461bcd60e51b81526004016104f790611a64565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461054b5760405162461bcd60e51b81526004016104f790611a64565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461058957600080fd5b47610593816110d0565b50565b6001600160a01b03811660009081526002602052604081205461043d90611155565b6000546001600160a01b031633146105e25760405162461bcd60e51b81526004016104f790611a64565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546000908190816106416009600a611b87565b61064f906305f5e100611c32565b90506106776106606009600a611b87565b61066e906305f5e100611c32565b600854906111d9565b8210156106a55760085461068d6009600a611b87565b61069b906305f5e100611c32565b9350935050509091565b90939092509050565b6000610439338484610cfc565b6000546001600160a01b031633146106e55760405162461bcd60e51b81526004016104f790611a64565b601154600160a01b900460ff161561073f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f7565b6010546001600160a01b031663f305d719473061075b81610596565b6000806107706000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107d357600080fd5b505af11580156107e7573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061080c91906119e1565b50506011805461ffff60b01b191661010160b01b179055506108306009600a611b87565b61083d9062989680611c32565b60125560118054600160a01b60ff60a01b1982161790915560105460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b1580156108a357600080fd5b505af11580156108b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108db91906119ab565b50601160009054906101000a90046001600160a01b03166001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096291906117ff565b6001600160a01b0316601160009054906101000a90046001600160a01b03166001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b957600080fd5b505afa1580156109cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f191906117ff565b6001600160a01b03167fba8b87a3b75bf1394bf8961527119bb55d4ff3b316d80691bc558e273ca988a560405160405180910390a3565b6000546001600160a01b03163314610a525760405162461bcd60e51b81526004016104f790611a64565b60005b8151811015610aba57600160066000848481518110610a7657610a76611c99565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610ab281611c68565b915050610a55565b5050565b600e546001600160a01b0316336001600160a01b031614610ade57600080fd5b6000610ae930610596565b90506105938161121b565b6000546001600160a01b03163314610b1e5760405162461bcd60e51b81526004016104f790611a64565b60008111610b6e5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104f7565b610b9d6064610b9783610b836009600a611b87565b610b91906305f5e100611c32565b906113a4565b906111d9565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c3a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f7565b6001600160a01b038216610c9b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f7565b6001600160a01b038216610dc25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f7565b60008111610e245760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f7565b6008600a556007600b556000546001600160a01b03848116911614801590610e5a57506000546001600160a01b03838116911614155b15611039576001600160a01b03831660009081526006602052604090205460ff16158015610ea157506001600160a01b03821660009081526006602052604090205460ff16155b610eaa57600080fd5b6011546001600160a01b038481169116148015610ed557506010546001600160a01b03838116911614155b8015610efa57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f0f5750601154600160b81b900460ff165b15610f6c57601254811115610f2357600080fd5b6001600160a01b0382166000908152600760205260409020544211610f4757600080fd5b610f5242601e611b0a565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610f9757506010546001600160a01b03848116911614155b8015610fbc57506001600160a01b03831660009081526005602052604090205460ff16155b15610fcc576008600a556007600b555b6000610fd730610596565b601154909150600160a81b900460ff1615801561100257506011546001600160a01b03858116911614155b80156110175750601154600160b01b900460ff165b15611037576110258161121b565b47801561103557611035476110d0565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061107b57506001600160a01b03831660009081526005602052604090205460ff165b15611084575060005b61109084848484611423565b50505050565b600081848411156110ba5760405162461bcd60e51b81526004016104f79190611a0f565b5060006110c78486611c51565b95945050505050565b600e546001600160a01b03166108fc6110ea8360026111d9565b6040518115909202916000818181858888f19350505050158015611112573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61112d8360026111d9565b6040518115909202916000818181858888f19350505050158015610aba573d6000803e3d6000fd5b60006008548211156111bc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f7565b60006111c6611451565b90506111d283826111d9565b9392505050565b60006111d283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611474565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061126357611263611c99565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef91906117ff565b8160018151811061130257611302611c99565b6001600160a01b0392831660209182029290920101526010546113289130911684610bd8565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611361908590600090869030904290600401611a99565b600060405180830381600087803b15801561137b57600080fd5b505af115801561138f573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b6000826113b35750600061043d565b60006113bf8385611c32565b9050826113cc8583611b22565b146111d25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f7565b80611430576114306114a2565b61143b8484846114d0565b8061109057611090600c54600a55600d54600b55565b600080600061145e61062c565b909250905061146d82826111d9565b9250505090565b600081836114955760405162461bcd60e51b81526004016104f79190611a0f565b5060006110c78486611b22565b600a541580156114b25750600b54155b156114b957565b600a8054600c55600b8054600d5560009182905555565b6000806000806000806114e2876115c7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115149087611624565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115439086611666565b6001600160a01b038916600090815260026020526040902055611565816116c5565b61156f848361170f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115b491815260200190565b60405180910390a3505050505050505050565b60008060008060008060008060006115e48a600a54600b54611733565b92509250925060006115f4611451565b905060008060006116078e878787611782565b919e509c509a509598509396509194505050505091939550919395565b60006111d283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611096565b6000806116738385611b0a565b9050838110156111d25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f7565b60006116cf611451565b905060006116dd83836113a4565b306000908152600260205260409020549091506116fa9082611666565b30600090815260026020526040902055505050565b60085461171c9083611624565b60085560095461172c9082611666565b6009555050565b60008080806117476064610b9789896113a4565b9050600061175a6064610b978a896113a4565b905060006117728261176c8b86611624565b90611624565b9992985090965090945050505050565b600080808061179188866113a4565b9050600061179f88876113a4565b905060006117ad88886113a4565b905060006117bf8261176c8686611624565b939b939a50919850919650505050505050565b80356117dd81611cc5565b919050565b6000602082840312156117f457600080fd5b81356111d281611cc5565b60006020828403121561181157600080fd5b81516111d281611cc5565b6000806040838503121561182f57600080fd5b823561183a81611cc5565b9150602083013561184a81611cc5565b809150509250929050565b60008060006060848603121561186a57600080fd5b833561187581611cc5565b9250602084013561188581611cc5565b929592945050506040919091013590565b600080604083850312156118a957600080fd5b82356118b481611cc5565b946020939093013593505050565b600060208083850312156118d557600080fd5b823567ffffffffffffffff808211156118ed57600080fd5b818501915085601f83011261190157600080fd5b81358181111561191357611913611caf565b8060051b604051601f19603f8301168101818110858211171561193857611938611caf565b604052828152858101935084860182860187018a101561195757600080fd5b600095505b838610156119815761196d816117d2565b85526001959095019493860193860161195c565b5098975050505050505050565b6000602082840312156119a057600080fd5b81356111d281611cda565b6000602082840312156119bd57600080fd5b81516111d281611cda565b6000602082840312156119da57600080fd5b5035919050565b6000806000606084860312156119f657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611a3c57858101830151858201604001528201611a20565b81811115611a4e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ae95784516001600160a01b031683529383019391830191600101611ac4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b1d57611b1d611c83565b500190565b600082611b3f57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611b7f578160001904821115611b6557611b65611c83565b80851615611b7257918102915b93841c9390800290611b49565b509250929050565b60006111d260ff841683600082611ba05750600161043d565b81611bad5750600061043d565b8160018114611bc35760028114611bcd57611be9565b600191505061043d565b60ff841115611bde57611bde611c83565b50506001821b61043d565b5060208310610133831016604e8410600b8410161715611c0c575081810a61043d565b611c168383611b44565b8060001904821115611c2a57611c2a611c83565b029392505050565b6000816000190483118215151615611c4c57611c4c611c83565b500290565b600082821015611c6357611c63611c83565b500390565b6000600019821415611c7c57611c7c611c83565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059357600080fd5b801515811461059357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122002d796a70a06b9ca6e0547af4a53e4188468aee23daa56cbd6f1391ed449f27f64736f6c63430008060033
|
{"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,418 |
0x1b0c489db625bf96aef17cedbce513bce4ce39ec
|
/**
*Submitted for verification at Etherscan.io on 2021-10-31
*/
/*
████████████████████████████████████████
███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
███▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
████▓▓▓▓▓▓▓▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
█████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
█████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
█████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
█████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
█████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
█████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
██████████▓▓▓█▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
████████████████████████████████████████
███████████ NFTheft was here ███████████
████████████████████████████████████████
2b02E63c9C7ed9fDC5fdc73E02Df0F8ee7Cdd3C4
████████████████████████████████████████
This is a public notice. The Royalty Registry is dangerous.
It's a false flag operation orchestrated by Manifold.
It gives all the power to Manifold to control your royalties.
They can change the payout rate, censor you, take a cut, etc.
We don't need your Royalty Registry.
You are trying to centralize a decentralised concept.
Each smart contract should have it's own royalty logic / control.
https://twitter.com/NFTheft/status/1451915003922198529
https://twitter.com/NFTheft/status/1451716332643291136
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Proxy {
function _delegate(address implementation) internal virtual {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
function _implementation() internal view virtual returns (address);
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
fallback () external payable virtual {
_fallback();
}
receive () external payable virtual {
_fallback();
}
function _beforeFallback() internal virtual {
}
}
abstract contract ERC1967Upgrade {
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
event Upgraded(address indexed implementation);
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal {
address oldImplementation = _getImplementation();
_setImplementation(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
if (!rollbackTesting.value) {
rollbackTesting.value = true;
Address.functionDelegateCall(
newImplementation,
abi.encodeWithSignature(
"upgradeTo(address)",
oldImplementation
)
);
rollbackTesting.value = false;
require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
}
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
event AdminChanged(address previousAdmin, address newAdmin);
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
event BeaconUpgraded(address indexed beacon);
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
function _setBeacon(address newBeacon) private {
require(
Address.isContract(newBeacon),
"ERC1967: new beacon is not a contract"
);
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
}
interface IBeacon {
function implementation() external view returns (address);
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly {
r.slot := slot
}
}
}
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;
}
}
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 ProxyAdmin is Ownable {
function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
(bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
require(success);
return abi.decode(returndata, (address));
}
function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
(bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440");
require(success);
return abi.decode(returndata, (address));
}
function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {
proxy.changeAdmin(newAdmin);
}
function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {
proxy.upgradeTo(implementation);
}
function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable virtual onlyOwner {
proxy.upgradeToAndCall{value: msg.value}(implementation, data);
}
}
abstract contract UUPSUpgradeable is ERC1967Upgrade {
function upgradeTo(address newImplementation) external virtual {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, bytes(""), false);
}
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, data, true);
}
function _authorizeUpgrade(address newImplementation) internal virtual;
}
abstract contract Proxiable is UUPSUpgradeable {
function _authorizeUpgrade(address newImplementation) internal override {
_beforeUpgrade(newImplementation);
}
function _beforeUpgrade(address newImplementation) internal virtual;
}
contract ChildOfProxiable is Proxiable {
function _beforeUpgrade(address newImplementation) internal virtual override {}
}
contract ERC1967Proxy is Proxy, ERC1967Upgrade {
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_upgradeToAndCall(_logic, _data, false);
}
function _implementation() internal view virtual override returns (address impl) {
return ERC1967Upgrade._getImplementation();
}
}
contract TransparentUpgradeableProxy is ERC1967Proxy {
constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
modifier ifAdmin() {
if (msg.sender == _getAdmin()) {
_;
} else {
_fallback();
}
}
function admin() external ifAdmin returns (address admin_) {
admin_ = _getAdmin();
}
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
function changeAdmin(address newAdmin) external virtual ifAdmin {
_changeAdmin(newAdmin);
}
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeToAndCall(newImplementation, bytes(""), false);
}
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeToAndCall(newImplementation, data, true);
}
function _admin() internal view virtual returns (address) {
return _getAdmin();
}
function _beforeFallback() internal virtual override {
require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
}
contract AdminUpgradeabilityProxy is TransparentUpgradeableProxy {
constructor(address logic, address admin, bytes memory data) payable TransparentUpgradeableProxy(logic, admin, data) {}
}
|
0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461011157806399a88ec414610124578063f2fde38b14610144578063f3b7dead146101645761007b565b8063204e1c7a14610080578063715018a6146100bc5780637eff275e146100d35780638da5cb5b146100f3575b600080fd5b34801561008c57600080fd5b506100a061009b366004610515565b610184565b6040516001600160a01b03909116815260200160405180910390f35b3480156100c857600080fd5b506100d1610215565b005b3480156100df57600080fd5b506100d16100ee366004610554565b610292565b3480156100ff57600080fd5b506000546001600160a01b03166100a0565b6100d161011f36600461058c565b61031c565b34801561013057600080fd5b506100d161013f366004610554565b6103ad565b34801561015057600080fd5b506100d161015f366004610515565b610405565b34801561017057600080fd5b506100a061017f366004610515565b6104ef565b6000806000836001600160a01b03166040516101aa90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101e5576040519150601f19603f3d011682016040523d82523d6000602084013e6101ea565b606091505b5091509150816101f957600080fd5b8080602001905181019061020d9190610538565b949350505050565b6000546001600160a01b031633146102485760405162461bcd60e51b815260040161023f906106c0565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146102bc5760405162461bcd60e51b815260040161023f906106c0565b6040516308f2839760e41b81526001600160a01b038281166004830152831690638f283970906024015b600060405180830381600087803b15801561030057600080fd5b505af1158015610314573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146103465760405162461bcd60e51b815260040161023f906106c0565b60405163278f794360e11b81526001600160a01b03841690634f1ef286903490610376908690869060040161065d565b6000604051808303818588803b15801561038f57600080fd5b505af11580156103a3573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b031633146103d75760405162461bcd60e51b815260040161023f906106c0565b604051631b2ce7f360e11b81526001600160a01b038281166004830152831690633659cfe6906024016102e6565b6000546001600160a01b0316331461042f5760405162461bcd60e51b815260040161023f906106c0565b6001600160a01b0381166104945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000806000836001600160a01b03166040516101aa906303e1469160e61b815260040190565b600060208284031215610526578081fd5b81356105318161070b565b9392505050565b600060208284031215610549578081fd5b81516105318161070b565b60008060408385031215610566578081fd5b82356105718161070b565b915060208301356105818161070b565b809150509250929050565b6000806000606084860312156105a0578081fd5b83356105ab8161070b565b925060208401356105bb8161070b565b9150604084013567ffffffffffffffff808211156105d7578283fd5b818601915086601f8301126105ea578283fd5b8135818111156105fc576105fc6106f5565b604051601f8201601f19908116603f01168101908382118183101715610624576106246106f5565b8160405282815289602084870101111561063c578586fd5b82602086016020830137856020848301015280955050505050509250925092565b600060018060a01b038416825260206040818401528351806040850152825b818110156106985785810183015185820160600152820161067c565b818111156106a95783606083870101525b50601f01601f191692909201606001949350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461072057600080fd5b5056fea2646970667358221220d849f96f3086b9f82cdcf665adb8c697ace05638da1c7c16ab2d26293717af6764736f6c63430008020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,419 |
0x8b6b5444b7a0f7cfc57fae0006baf829b2f24560
|
pragma solidity >=0.5.16 <0.6.9;
pragma experimental ABIEncoderV2;
//YOUWILLNEVERWALKALONE
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract maho {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
address payable public fundsWallet;
uint256 public maximumTarget;
uint256 public lastBlock;
uint256 public rewardTimes;
uint256 public genesisReward;
uint256 public premined;
uint256 public nRewarMod;
uint256 public nWtime;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed from, uint256 value);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
initialSupply = 8923155 * 10 ** uint256(decimals);
tokenName = "Maho";
tokenSymbol = "MAHO";
lastBlock = 0;
nRewarMod = 7700;
//nRewarMod = 6;
//nWtime = 7776000;
nWtime = 172800; // 2 Gün Stake Süresi
genesisReward = (10**uint256(decimals)); // Ödül Miktarı
maximumTarget = 100 * 10 ** uint256(decimals);
fundsWallet = msg.sender;
premined = 35850 * 10 ** uint256(decimals);
balanceOf[msg.sender] = premined;
balanceOf[address(this)] = initialSupply;
totalSupply = initialSupply + premined;
name = tokenName;
symbol = tokenSymbol;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
function uintToString(uint256 v) internal pure returns(string memory str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(uint8(48 + remainder));
}
bytes memory s = new bytes(i + 1);
for (uint j = 0; j <= i; j++) {
s[j] = reversed[i - j];
}
str = string(s);
}
function append(string memory a, string memory b) internal pure returns (string memory) {
return string(abi.encodePacked(a,"-",b));
}
function getCurrentBlockHash() public view returns (uint256) {
return uint256(blockhash(block.number-1));
}
function getBlockHashAlgoritm(uint256 _blocknumber) public view returns(uint256, uint256){
uint256 crew = uint256(blockhash(_blocknumber)) % nRewarMod;
return (crew, block.number-1);
}
function checkBlockReward() public view returns (uint256, uint256) {
uint256 crew = uint256(blockhash(block.number-1)) % nRewarMod;
return (crew, block.number-1);
}
struct stakeInfo {
uint256 _stocktime;
uint256 _stockamount;
}
address[] totalminers;
mapping (address => stakeInfo) nStockDetails;
struct rewarddetails {
uint256 _artyr;
bool _didGetReward;
bool _didisign;
}
mapping (string => rewarddetails) nRewardDetails;
struct nBlockDetails {
uint256 _bTime;
uint256 _tInvest;
}
mapping (uint256 => nBlockDetails) bBlockIteration;
struct activeMiners {
address bUser;
}
mapping(uint256 => activeMiners[]) aMiners;
function totalMinerCount() view public returns (uint256) {
return totalminers.length;
}
function addressHashs() view public returns (uint256) {
return uint256(msg.sender) % 10000000000;
}
function stakerStatus(address _addr) view public returns(bool){
if(nStockDetails[_addr]._stocktime == 0)
{
return false;
}
else
{
return true;
}
}
function stakerAmount(address _addr) view public returns(uint256){
if(nStockDetails[_addr]._stocktime == 0)
{
return 0;
}
else
{
return nStockDetails[_addr]._stockamount;
}
}
function stakerActiveTotal() view public returns(uint256) {
return aMiners[lastBlock].length;
}
function generalCheckPoint() private view returns(string memory) {
return append(uintToString(addressHashs()),uintToString(lastBlock));
}
function necessarySignForReward(uint256 _bnumber) public returns (uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber <= 100);
require(nStockDetails[msg.sender]._stocktime + nWtime > now);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
if(bBlockIteration[lastBlock]._bTime + 1800 < now)
{
lastBlock += 1;
bBlockIteration[lastBlock]._bTime = now;
}
require(nRewardDetails[generalCheckPoint()]._artyr == 0);
bBlockIteration[lastBlock]._tInvest += nStockDetails[msg.sender]._stockamount;
nRewardDetails[generalCheckPoint()]._artyr = now;
nRewardDetails[generalCheckPoint()]._didGetReward = false;
nRewardDetails[generalCheckPoint()]._didisign = true;
aMiners[lastBlock].push(activeMiners(msg.sender));
return 200;
}
function rewardGet(uint256 _bnumber) public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber > 100);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
require(nStockDetails[msg.sender]._stocktime + nWtime > now );
require(nRewardDetails[generalCheckPoint()]._didGetReward == false);
require(nRewardDetails[generalCheckPoint()]._didisign == true);
uint256 halving = lastBlock / 365;
uint256 totalRA = 128 * genesisReward;
if(halving==0)
{
totalRA = 128 * genesisReward;
}
else if(halving==1)
{
totalRA = 256 * genesisReward;
}
else if(halving==2)
{
totalRA = 512 * genesisReward;
}
else if(halving==3)
{
totalRA = 1024 * genesisReward;
}
else if(halving==4)
{
totalRA = 2048 * genesisReward;
}
else if(halving==5)
{
totalRA = 4096 * genesisReward;
}
else if(halving==6)
{
totalRA = 8192 * genesisReward;
}
else if(halving==7)
{
totalRA = 4096 * genesisReward;
}
else if(halving==8)
{
totalRA = 2048 * genesisReward;
}
else if(halving==9)
{
totalRA = 1024 * genesisReward;
}
else if(halving==10)
{
totalRA = 512 * genesisReward;
}
else if(halving==11)
{
totalRA = 256 * genesisReward;
}
else if(halving==12)
{
totalRA = 128 * genesisReward;
}
else if(halving==13)
{
totalRA = 64 * genesisReward;
}
else if(halving==14)
{
totalRA = 32 * genesisReward;
}
else if(halving==15)
{
totalRA = 16 * genesisReward;
}
else if(halving==16)
{
totalRA = 8 * genesisReward;
}
else if(halving==17)
{
totalRA = 4 * genesisReward;
}
else if(halving==18)
{
totalRA = 2 * genesisReward;
}
else if(halving==19)
{
totalRA = 1 * genesisReward;
}
else if(halving>19)
{
totalRA = 1 * genesisReward;
}
uint256 usersReward = (totalRA * (nStockDetails[msg.sender]._stockamount * 100) / bBlockIteration[lastBlock]._tInvest) / 100;
nRewardDetails[generalCheckPoint()]._didGetReward = true;
_transfer(address(this), msg.sender, usersReward);
return usersReward;
}
function startMining(uint256 mineamount) public returns (uint256) {
uint256 realMineAmount = mineamount * 10 ** uint256(decimals);
require(realMineAmount >= 10 * 10 ** uint256(decimals));
require(nStockDetails[msg.sender]._stocktime == 0);
maximumTarget += realMineAmount;
nStockDetails[msg.sender]._stocktime = now;
nStockDetails[msg.sender]._stockamount = realMineAmount;
totalminers.push(msg.sender);
_transfer(msg.sender, address(this), realMineAmount);
return 200;
}
function tokenPayBack() public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require(nStockDetails[msg.sender]._stocktime + nWtime < now );
nStockDetails[msg.sender]._stocktime = 0;
_transfer(address(this),msg.sender,nStockDetails[msg.sender]._stockamount);
return nStockDetails[msg.sender]._stockamount;
}
struct memoInfo {
uint256 _receiveTime;
uint256 _receiveAmount;
address _senderAddr;
string _senderMemo;
}
mapping(address => memoInfo[]) memoGetProcess;
function sendMemoToken(uint256 _amount, address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now, _amount, msg.sender, _memo));
_transfer(msg.sender, _to, _amount);
return 200;
}
function sendMemoOnly(address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now,0, msg.sender, _memo));
_transfer(msg.sender, _to, 0);
return 200;
}
function yourMemos(address _addr, uint256 _index) view public returns(uint256,
uint256,
string memory,
address) {
uint256 rTime = memoGetProcess[_addr][_index]._receiveTime;
uint256 rAmount = memoGetProcess[_addr][_index]._receiveAmount;
string memory sMemo = memoGetProcess[_addr][_index]._senderMemo;
address sAddr = memoGetProcess[_addr][_index]._senderAddr;
if(memoGetProcess[_addr][_index]._receiveTime == 0){
return (0, 0,"0", _addr);
}else {
return (rTime, rAmount,sMemo, sAddr);
}
}
function yourMemosCount(address _addr) view public returns(uint256) {
return memoGetProcess[_addr].length;
}
function appendMemos(string memory a, string memory b,string memory c,string memory d) internal pure returns (string memory) {
return string(abi.encodePacked(a,"#",b,"#",c,"#",d));
}
function addressToString(address _addr) public pure returns(string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(51);
str[0] = "0";
str[1] = "x";
for (uint i = 0; i < 20; i++) {
str[2+i*2] = alphabet[uint(uint8(value[i + 12] >> 4))];
str[3+i*2] = alphabet[uint(uint8(value[i + 12] & 0x0f))];
}
return string(str);
}
function getYourMemosOnly(address _addr) view public returns(string[] memory) {
uint total = memoGetProcess[_addr].length;
string[] memory messages = new string[](total);
for (uint i=0; i < total; i++) {
messages[i] = appendMemos(uintToString(memoGetProcess[_addr][i]._receiveTime),memoGetProcess[_addr][i]._senderMemo,uintToString(memoGetProcess[_addr][i]._receiveAmount),addressToString(memoGetProcess[_addr][i]._senderAddr));
}
return messages;
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80637ac8712911610130578063a9059cbb116100b8578063d43c43ac1161007c578063d43c43ac1461075e578063dd62ed3e1461078e578063eabbb22c146107be578063f30ed32a146107dc578063f79e7354146107fa57610232565b8063a9059cbb14610692578063ab8d13e3146106c2578063b5f3b150146106e0578063c8f5a2f9146106fe578063cae9ca511461072e57610232565b8063878fd290116100ff578063878fd290146105b3578063934eb103146105e357806395d89b4114610613578063a12fe45d14610631578063a4c232571461066157610232565b80637ac87129146105265780637be8a33a146105595780637ca3d49814610577578063806b984f1461059557610232565b80632d936b46116101be5780634d016f35116101825780634d016f35146104485780635e57966d1461046657806370312de81461049657806370a08231146104c657806379cc6790146104f657610232565b80632d936b461461037c578063313ce5671461039a5780633bfd87e9146103b857806342966c68146103e857806347b272c01461041857610232565b806318160ddd1161020557806318160ddd146102c25780632194f3a2146102e057806323b872dd146102fe57806326926fba1461032e578063269714dd1461035e57610232565b806306fdde0314610237578063095ea7b3146102555780630e0d8cda146102855780631328ad5d146102a4575b600080fd5b61023f610818565b60405161024c9190613362565b60405180910390f35b61026f600480360381019061026a9190612ea7565b6108b6565b60405161027c9190613347565b60405180910390f35b61028d6109a8565b60405161029b92919061339f565b60405180910390f35b6102ac6109d0565b6040516102b99190613384565b60405180910390f35b6102ca6109f0565b6040516102d79190613384565b60405180910390f35b6102e86109f6565b6040516102f591906132be565b60405180910390f35b61031860048036038101906103139190612e04565b610a1c565b6040516103259190613347565b60405180910390f35b61034860048036038101906103439190612f73565b610b47565b6040516103559190613384565b60405180910390f35b610366610c78565b6040516103739190613384565b60405180910390f35b610384610c7e565b6040516103919190613384565b60405180910390f35b6103a2610c84565b6040516103af9190613414565b60405180910390f35b6103d260048036038101906103cd9190612f4a565b610c97565b6040516103df9190613384565b60405180910390f35b61040260048036038101906103fd9190612f4a565b611091565b60405161040f9190613347565b60405180910390f35b610432600480360381019061042d9190612f4a565b611193565b60405161043f9190613384565b60405180910390f35b61045061133a565b60405161045d9190613384565b60405180910390f35b610480600480360381019061047b9190612d9f565b611347565b60405161048d9190613362565b60405180910390f35b6104b060048036038101906104ab9190612d9f565b6115df565b6040516104bd9190613347565b60405180910390f35b6104e060048036038101906104db9190612d9f565b61163e565b6040516104ed9190613384565b60405180910390f35b610510600480360381019061050b9190612ea7565b611656565b60405161051d9190613347565b60405180910390f35b610540600480360381019061053b9190612ea7565b61186c565b60405161055094939291906133c8565b60405180910390f35b610561611b7a565b60405161056e9190613384565b60405180910390f35b61057f611cc4565b60405161058c9190613384565b60405180910390f35b61059d611cd3565b6040516105aa9190613384565b60405180910390f35b6105cd60048036038101906105c89190612d9f565b611cd9565b6040516105da9190613384565b60405180910390f35b6105fd60048036038101906105f89190612f4a565b611d79565b60405161060a9190613384565b60405180910390f35b61061b612065565b6040516106289190613362565b60405180910390f35b61064b60048036038101906106469190612d9f565b612103565b6040516106589190613325565b60405180910390f35b61067b60048036038101906106769190612f4a565b612421565b60405161068992919061339f565b60405180910390f35b6106ac60048036038101906106a79190612ea7565b612447565b6040516106b99190613347565b60405180910390f35b6106ca61245e565b6040516106d79190613384565b60405180910390f35b6106e861248a565b6040516106f59190613384565b60405180910390f35b61071860048036038101906107139190612e53565b612490565b6040516107259190613384565b60405180910390f35b61074860048036038101906107439190612ee3565b6125c2565b6040516107559190613347565b60405180910390f35b61077860048036038101906107739190612d9f565b61265b565b6040516107859190613384565b60405180910390f35b6107a860048036038101906107a39190612dc8565b6126a7565b6040516107b59190613384565b60405180910390f35b6107c66126cc565b6040516107d39190613384565b60405180910390f35b6107e46126d2565b6040516107f19190613384565b60405180910390f35b6108026126d8565b60405161080f9190613384565b60405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ae5780601f10610883576101008083540402835291602001916108ae565b820191906000526020600020905b81548152906001019060200180831161089157829003601f168201915b505050505081565b600081600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516109969190613384565b60405180910390a36001905092915050565b6000806000600a54600143034060001c816109bf57fe5b069050806001430392509250509091565b600060126000600654815260200190815260200160002080549050905090565b60035481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610aa757600080fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610b3c8484846126de565b600190509392505050565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180608001604052804281526020018681526020013373ffffffffffffffffffffffffffffffffffffffff168152602001848152509080600181540180825580915050600190039060005260206000209060040201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003019080519060200190610c5f929190612c28565b505050610c6d3384866126de565b60c890509392505050565b60055481565b60095481565b600260009054906101000a900460ff1681565b600060011515610ca6336115df565b151514610cb257600080fd5b606482600143030311610cc457600080fd5b6001600a54834060001c81610cd557fe5b0614610ce057600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540111610d3257600080fd5b600015156010610d40612a04565b604051610d4d9190613219565b908152602001604051809103902060010160009054906101000a900460ff16151514610d7857600080fd5b600115156010610d86612a04565b604051610d939190613219565b908152602001604051809103902060010160019054906101000a900460ff16151514610dbe57600080fd5b600061016d60065481610dcd57fe5b049050600060085460800290506000821415610df0576008546080029050610fc3565b6001821415610e0757600854610100029050610fc2565b6002821415610e1e57600854610200029050610fc1565b6003821415610e3557600854610400029050610fc0565b6004821415610e4c57600854610800029050610fbf565b6005821415610e6357600854611000029050610fbe565b6006821415610e7a57600854612000029050610fbd565b6007821415610e9157600854611000029050610fbc565b6008821415610ea857600854610800029050610fbb565b6009821415610ebf57600854610400029050610fba565b600a821415610ed657600854610200029050610fb9565b600b821415610eed57600854610100029050610fb8565b600c821415610f03576008546080029050610fb7565b600d821415610f19576008546040029050610fb6565b600e821415610f2f576008546020029050610fb5565b600f821415610f45576008546010029050610fb4565b6010821415610f5b576008546008029050610fb3565b6011821415610f71576008546004029050610fb2565b6012821415610f87576008546002029050610fb1565b6013821415610f9d576008546001029050610fb0565b6013821115610faf5760085460010290505b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b60006064601160006006548152602001908152602001600020600101546064600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101540284028161102f57fe5b048161103757fe5b04905060016010611046612a04565b6040516110539190613219565b908152602001604051809103902060010160006101000a81548160ff0219169083151502179055506110863033836126de565b809350505050919050565b600081600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110df57600080fd5b81600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040516111829190613384565b60405180910390a260019050919050565b600080600260009054906101000a900460ff1660ff16600a0a83029050600260009054906101000a900460ff1660ff16600a0a600a028110156111d557600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541461122457600080fd5b8060056000828254019250508190555042600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600e339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506113303330836126de565b60c8915050919050565b6000600e80549050905090565b606060008273ffffffffffffffffffffffffffffffffffffffff1660001b905060606040518060400160405280601081526020017f303132333435363738396162636465660000000000000000000000000000000081525090506060603367ffffffffffffffff811180156113bb57600080fd5b506040519080825280601f01601f1916602001820160405280156113ee5781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061141f57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061147c57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060008090505b60148110156115d35782600485600c8401602081106114cc57fe5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff168151811061150457fe5b602001015160f81c60f81b82600283026002018151811061152157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082600f60f81b85600c84016020811061156557fe5b1a60f81b1660f81c60ff168151811061157a57fe5b602001015160f81c60f81b82600283026003018151811061159757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506114b1565b50809350505050919050565b600080600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156116345760009050611639565b600190505b919050565b600c6020528060005260406000206000915090505481565b600081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156116a457600080fd5b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561172d57600080fd5b81600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405161185a9190613384565b60405180910390a26001905092915050565b6000806060600080601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481106118be57fe5b90600052602060002090600402016000015490506000601360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811061191e57fe5b90600052602060002090600402016001015490506060601360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020888154811061197e57fe5b90600052602060002090600402016003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a235780601f106119f857610100808354040283529160200191611a23565b820191906000526020600020905b815481529060010190602001808311611a0657829003601f168201915b505050505090506000601360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208981548110611a7657fe5b906000526020600020906004020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000601360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a81548110611af657fe5b9060005260206000209060040201600001541415611b60576000808b8292508191506040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090975097509750975050505050611b71565b838383839750975097509750505050505b92959194509250565b600060011515611b89336115df565b151514611b9557600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540110611be757600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611c7c3033600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546126de565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905090565b6000600143034060001c905090565b60065481565b600080600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415611d2e5760009050611d74565b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490505b919050565b600060011515611d88336115df565b151514611d9457600080fd5b60648260014303031115611da757600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540111611df957600080fd5b6001600a54834060001c81611e0a57fe5b0614611e1557600080fd5b4261070860116000600654815260200190815260200160002060000154011015611e6857600160066000828254019250508190555042601160006006548152602001908152602001600020600001819055505b60006010611e74612a04565b604051611e819190613219565b90815260200160405180910390206000015414611e9d57600080fd5b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015460116000600654815260200190815260200160002060010160008282540192505081905550426010611f10612a04565b604051611f1d9190613219565b90815260200160405180910390206000018190555060006010611f3e612a04565b604051611f4b9190613219565b908152602001604051809103902060010160006101000a81548160ff02191690831515021790555060016010611f7f612a04565b604051611f8c9190613219565b908152602001604051809103902060010160016101000a81548160ff02191690831515021790555060126000600654815260200190815260200160002060405180602001604052803373ffffffffffffffffffffffffffffffffffffffff168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505060c89050919050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120fb5780601f106120d0576101008083540402835291602001916120fb565b820191906000526020600020905b8154815290600101906020018083116120de57829003601f168201915b505050505081565b60606000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905060608167ffffffffffffffff8111801561216557600080fd5b5060405190808252806020026020018201604052801561219957816020015b60608152602001906001900390816121845790505b50905060008090505b82811015612416576123f2612211601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106121fa57fe5b906000526020600020906004020160000154612a2e565b601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061225b57fe5b90600052602060002090600402016003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123005780601f106122d557610100808354040283529160200191612300565b820191906000526020600020905b8154815290600101906020018083116122e357829003601f168201915b5050505050612369601360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858154811061235257fe5b906000526020600020906004020160010154612a2e565b6123ed601360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481106123b657fe5b906000526020600020906004020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611347565b612bca565b8282815181106123fe57fe5b602002602001018190525080806001019150506121a2565b508092505050919050565b6000806000600a54844060001c8161243557fe5b06905080600143039250925050915091565b60006124543384846126de565b6001905092915050565b60006402540be4003373ffffffffffffffffffffffffffffffffffffffff168161248457fe5b06905090565b60075481565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405280428152602001600081526020013373ffffffffffffffffffffffffffffffffffffffff168152602001848152509080600181540180825580915050600190039060005260206000209060040201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030190805190602001906125a9929190612c28565b5050506125b8338460006126de565b60c8905092915050565b6000808490506125d285856108b6565b15612652578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff1660e01b815260040161261694939291906132d9565b600060405180830381600087803b15801561263057600080fd5b505af1158015612644573d6000803e3d6000fd5b505050506001915050612654565b505b9392505050565b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600d602052816000526040600020602052806000526040600020600091509150505481565b600a5481565b600b5481565b60085481565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561271857600080fd5b80600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561276457600080fd5b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110156127f157600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161296d9190613384565b60405180910390a380600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401146129fe57fe5b50505050565b6060612a29612a19612a1461245e565b612a2e565b612a24600654612a2e565b612bfc565b905090565b606060006064905060608167ffffffffffffffff81118015612a4f57600080fd5b506040519080825280601f01601f191660200182016040528015612a825781602001600182028036833780820191505090505b50905060008090505b60008514612afd576000600a8681612a9f57fe5b069050600a8681612aac57fe5b0495508060300160f81b838380600101945081518110612ac857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050612a8b565b60606001820167ffffffffffffffff81118015612b1957600080fd5b506040519080825280601f01601f191660200182016040528015612b4c5781602001600182028036833780820191505090505b50905060008090505b828111612bbd578381840381518110612b6a57fe5b602001015160f81c60f81b828281518110612b8157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050612b55565b5080945050505050919050565b606084848484604051602001612be39493929190613230565b6040516020818303038152906040529050949350505050565b60608282604051602001612c1192919061328f565b604051602081830303815290604052905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c6957805160ff1916838001178555612c97565b82800160010185558215612c97579182015b82811115612c96578251825591602001919060010190612c7b565b5b509050612ca49190612ca8565b5090565b612cca91905b80821115612cc6576000816000905550600101612cae565b5090565b90565b600081359050612cdc81613631565b92915050565b600082601f830112612cf357600080fd5b8135612d06612d018261345c565b61342f565b91508082526020830160208301858383011115612d2257600080fd5b612d2d8382846135de565b50505092915050565b600082601f830112612d4757600080fd5b8135612d5a612d5582613488565b61342f565b91508082526020830160208301858383011115612d7657600080fd5b612d818382846135de565b50505092915050565b600081359050612d9981613648565b92915050565b600060208284031215612db157600080fd5b6000612dbf84828501612ccd565b91505092915050565b60008060408385031215612ddb57600080fd5b6000612de985828601612ccd565b9250506020612dfa85828601612ccd565b9150509250929050565b600080600060608486031215612e1957600080fd5b6000612e2786828701612ccd565b9350506020612e3886828701612ccd565b9250506040612e4986828701612d8a565b9150509250925092565b60008060408385031215612e6657600080fd5b6000612e7485828601612ccd565b925050602083013567ffffffffffffffff811115612e9157600080fd5b612e9d85828601612d36565b9150509250929050565b60008060408385031215612eba57600080fd5b6000612ec885828601612ccd565b9250506020612ed985828601612d8a565b9150509250929050565b600080600060608486031215612ef857600080fd5b6000612f0686828701612ccd565b9350506020612f1786828701612d8a565b925050604084013567ffffffffffffffff811115612f3457600080fd5b612f4086828701612ce2565b9150509250925092565b600060208284031215612f5c57600080fd5b6000612f6a84828501612d8a565b91505092915050565b600080600060608486031215612f8857600080fd5b6000612f9686828701612d8a565b9350506020612fa786828701612ccd565b925050604084013567ffffffffffffffff811115612fc457600080fd5b612fd086828701612d36565b9150509250925092565b6000612fe683836130d8565b905092915050565b612ff7816135a8565b82525050565b61300681613553565b82525050565b61301581613541565b82525050565b6000613026826134c4565b61303081856134f2565b935083602082028501613042856134b4565b8060005b8581101561307e578484038952815161305f8582612fda565b945061306a836134e5565b925060208a01995050600181019050613046565b50829750879550505050505092915050565b61309981613565565b82525050565b60006130aa826134cf565b6130b48185613503565b93506130c48185602086016135ed565b6130cd81613620565b840191505092915050565b60006130e3826134da565b6130ed8185613514565b93506130fd8185602086016135ed565b61310681613620565b840191505092915050565b600061311c826134da565b6131268185613525565b93506131368185602086016135ed565b61313f81613620565b840191505092915050565b6000613155826134da565b61315f8185613536565b935061316f8185602086016135ed565b80840191505092915050565b6000613188600183613536565b91507f23000000000000000000000000000000000000000000000000000000000000006000830152600182019050919050565b60006131c8600183613536565b91507f2d000000000000000000000000000000000000000000000000000000000000006000830152600182019050919050565b61320481613591565b82525050565b6132138161359b565b82525050565b6000613225828461314a565b915081905092915050565b600061323c828761314a565b91506132478261317b565b9150613253828661314a565b915061325e8261317b565b915061326a828561314a565b91506132758261317b565b9150613281828461314a565b915081905095945050505050565b600061329b828561314a565b91506132a6826131bb565b91506132b2828461314a565b91508190509392505050565b60006020820190506132d36000830184612ffd565b92915050565b60006080820190506132ee6000830187612fee565b6132fb60208301866131fb565b613308604083018561300c565b818103606083015261331a818461309f565b905095945050505050565b6000602082019050818103600083015261333f818461301b565b905092915050565b600060208201905061335c6000830184613090565b92915050565b6000602082019050818103600083015261337c8184613111565b905092915050565b600060208201905061339960008301846131fb565b92915050565b60006040820190506133b460008301856131fb565b6133c160208301846131fb565b9392505050565b60006080820190506133dd60008301876131fb565b6133ea60208301866131fb565b81810360408301526133fc8185613111565b905061340b606083018461300c565b95945050505050565b6000602082019050613429600083018461320a565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561345257600080fd5b8060405250919050565b600067ffffffffffffffff82111561347357600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561349f57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061354c82613571565b9050919050565b600061355e82613571565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135b3826135ba565b9050919050565b60006135c5826135cc565b9050919050565b60006135d782613571565b9050919050565b82818337600083830152505050565b60005b8381101561360b5780820151818401526020810190506135f0565b8381111561361a576000848401525b50505050565b6000601f19601f8301169050919050565b61363a81613541565b811461364557600080fd5b50565b61365181613591565b811461365c57600080fd5b5056fea2646970667358221220f1e6e297e58e99b329908231845c5238a2e22165a41b243292b60cede4fedec064736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}}
| 3,420 |
0xa9a8ed65a6cfcec90887e6fae1061c36f6b55339
|
/**
* TG T.me/ElonandLToken
*/
/**
* https://t.me/ElonandLToken
**/
//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 ElonandLToken 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 = 1;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0xDEe806F21Ad43Fa2506a8C749302E22737B32b6f);
address payable private _feeAddrWallet2 = payable(0xDEe806F21Ad43Fa2506a8C749302E22737B32b6f);
string private constant _name = "ElonandLToken";
string private constant _symbol = "Elon and L";
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(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= _maxTxAmount);
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 = 100000000 * 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 _SetmaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
_maxTxAmount = maxTxAmount;
}
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);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a146103cc578063c3c8cd80146103f5578063c9567bf91461040c578063cfe81ba014610423578063dd62ed3e1461044c5761012a565b8063715018a6146102f9578063842b7c08146103105780638da5cb5b1461033957806395d89b4114610364578063a9059cbb1461038f5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c5780636fc3eaec146102a557806370a08231146102bc5761012a565b8063023d9fe81461012f57806306fdde0314610158578063095ea7b31461018357806318160ddd146101c057806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b506101566004803603810190610151919061288a565b610489565b005b34801561016457600080fd5b5061016d610528565b60405161017a9190612c75565b60405180910390f35b34801561018f57600080fd5b506101aa60048036038101906101a591906127bb565b610565565b6040516101b79190612c5a565b60405180910390f35b3480156101cc57600080fd5b506101d5610583565b6040516101e29190612df7565b60405180910390f35b3480156101f757600080fd5b50610212600480360381019061020d919061276c565b610593565b60405161021f9190612c5a565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a91906126de565b61066c565b005b34801561025d57600080fd5b5061026661075c565b6040516102739190612e6c565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612838565b610765565b005b3480156102b157600080fd5b506102ba610817565b005b3480156102c857600080fd5b506102e360048036038101906102de91906126de565b610889565b6040516102f09190612df7565b60405180910390f35b34801561030557600080fd5b5061030e6108da565b005b34801561031c57600080fd5b506103376004803603810190610332919061288a565b610a2d565b005b34801561034557600080fd5b5061034e610ace565b60405161035b9190612b8c565b60405180910390f35b34801561037057600080fd5b50610379610af7565b6040516103869190612c75565b60405180910390f35b34801561039b57600080fd5b506103b660048036038101906103b191906127bb565b610b34565b6040516103c39190612c5a565b60405180910390f35b3480156103d857600080fd5b506103f360048036038101906103ee91906127f7565b610b52565b005b34801561040157600080fd5b5061040a610ca2565b005b34801561041857600080fd5b50610421610d1c565b005b34801561042f57600080fd5b5061044a6004803603810190610445919061288a565b611277565b005b34801561045857600080fd5b50610473600480360381019061046e9190612730565b611318565b6040516104809190612df7565b60405180910390f35b61049161139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461051e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051590612d57565b60405180910390fd5b8060108190555050565b60606040518060400160405280600d81526020017f456c6f6e616e644c546f6b656e00000000000000000000000000000000000000815250905090565b600061057961057261139f565b84846113a7565b6001905092915050565b600067016345785d8a0000905090565b60006105a0848484611572565b610661846105ac61139f565b61065c8560405180606001604052806028815260200161350760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061061261139f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a509092919063ffffffff16565b6113a7565b600190509392505050565b61067461139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610701576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f890612d57565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61076d61139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f190612d57565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661085861139f565b73ffffffffffffffffffffffffffffffffffffffff161461087857600080fd5b600047905061088681611ab4565b50565b60006108d3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611baf565b9050919050565b6108e261139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461096f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096690612d57565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a6e61139f565b73ffffffffffffffffffffffffffffffffffffffff1614610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb90612cb7565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f456c6f6e20616e64204c00000000000000000000000000000000000000000000815250905090565b6000610b48610b4161139f565b8484611572565b6001905092915050565b610b5a61139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612d57565b60405180910390fd5b60005b8151811015610c9e57600160066000848481518110610c32577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610c969061310d565b915050610bea565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ce361139f565b73ffffffffffffffffffffffffffffffffffffffff1614610d0357600080fd5b6000610d0e30610889565b9050610d1981611c1d565b50565b610d2461139f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da890612d57565b60405180910390fd5b600f60149054906101000a900460ff1615610e01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df890612dd7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e9030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a00006113a7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed657600080fd5b505afa158015610eea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0e9190612707565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7057600080fd5b505afa158015610f84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa89190612707565b6040518363ffffffff1660e01b8152600401610fc5929190612ba7565b602060405180830381600087803b158015610fdf57600080fd5b505af1158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190612707565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110a030610889565b6000806110ab610ace565b426040518863ffffffff1660e01b81526004016110cd96959493929190612bf9565b6060604051808303818588803b1580156110e657600080fd5b505af11580156110fa573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061111f91906128b3565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555067016345785d8a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611221929190612bd0565b602060405180830381600087803b15801561123b57600080fd5b505af115801561124f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112739190612861565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112b861139f565b73ffffffffffffffffffffffffffffffffffffffff161461130e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130590612cb7565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611417576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140e90612db7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147e90612cf7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115659190612df7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156115e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d990612d97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164990612c97565b60405180910390fd5b60008111611695576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168c90612d77565b60405180910390fd5b61169d610ace565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561170b57506116db610ace565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117b45750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117bd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118685750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118be5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118d65750600f60179054906101000a900460ff165b156119775742600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061192657600080fd5b600a426119339190612f2d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061198230610889565b9050600f60159054906101000a900460ff161580156119ef5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a075750600f60169054906101000a900460ff165b15611a3e57601054821115611a1b57600080fd5b611a2481611c1d565b60004790506000811115611a3c57611a3b47611ab4565b5b505b505b611a4b838383611f17565b505050565b6000838311158290611a98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8f9190612c75565b60405180910390fd5b5060008385611aa7919061300e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b04600284611f2790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b2f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b80600284611f2790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bab573d6000803e3d6000fd5b5050565b6000600854821115611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bed90612cd7565b60405180910390fd5b6000611c00611f71565b9050611c158184611f2790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c7b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611ca95781602001602082028036833780820191505090505b5090503081600081518110611ce7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8957600080fd5b505afa158015611d9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc19190612707565b81600181518110611dfb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611e6230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113a7565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ec6959493929190612e12565b600060405180830381600087803b158015611ee057600080fd5b505af1158015611ef4573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611f22838383611f9c565b505050565b6000611f6983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612167565b905092915050565b6000806000611f7e6121ca565b91509150611f958183611f2790919063ffffffff16565b9250505090565b600080600080600080611fae87612229565b95509550955095509550955061200c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461229190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120a185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ed81612339565b6120f784836123f6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121549190612df7565b60405180910390a3505050505050505050565b600080831182906121ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a59190612c75565b60405180910390fd5b50600083856121bd9190612f83565b9050809150509392505050565b60008060006008549050600067016345785d8a000090506121fe67016345785d8a0000600854611f2790919063ffffffff16565b82101561221c5760085467016345785d8a0000935093505050612225565b81819350935050505b9091565b60008060008060008060008060006122468a600a54600b54612430565b9250925092506000612256611f71565b905060008060006122698e8787876124c6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122d383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a50565b905092915050565b60008082846122ea9190612f2d565b90508381101561232f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161232690612d17565b60405180910390fd5b8091505092915050565b6000612343611f71565b9050600061235a828461254f90919063ffffffff16565b90506123ae81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61240b8260085461229190919063ffffffff16565b600881905550612426816009546122db90919063ffffffff16565b6009819055505050565b60008060008061245c606461244e888a61254f90919063ffffffff16565b611f2790919063ffffffff16565b905060006124866064612478888b61254f90919063ffffffff16565b611f2790919063ffffffff16565b905060006124af826124a1858c61229190919063ffffffff16565b61229190919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124df858961254f90919063ffffffff16565b905060006124f6868961254f90919063ffffffff16565b9050600061250d878961254f90919063ffffffff16565b9050600061253682612528858761229190919063ffffffff16565b61229190919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561256257600090506125c4565b600082846125709190612fb4565b905082848261257f9190612f83565b146125bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125b690612d37565b60405180910390fd5b809150505b92915050565b60006125dd6125d884612eac565b612e87565b905080838252602082019050828560208602820111156125fc57600080fd5b60005b8581101561262c57816126128882612636565b8452602084019350602083019250506001810190506125ff565b5050509392505050565b600081359050612645816134c1565b92915050565b60008151905061265a816134c1565b92915050565b600082601f83011261267157600080fd5b81356126818482602086016125ca565b91505092915050565b600081359050612699816134d8565b92915050565b6000815190506126ae816134d8565b92915050565b6000813590506126c3816134ef565b92915050565b6000815190506126d8816134ef565b92915050565b6000602082840312156126f057600080fd5b60006126fe84828501612636565b91505092915050565b60006020828403121561271957600080fd5b60006127278482850161264b565b91505092915050565b6000806040838503121561274357600080fd5b600061275185828601612636565b925050602061276285828601612636565b9150509250929050565b60008060006060848603121561278157600080fd5b600061278f86828701612636565b93505060206127a086828701612636565b92505060406127b1868287016126b4565b9150509250925092565b600080604083850312156127ce57600080fd5b60006127dc85828601612636565b92505060206127ed858286016126b4565b9150509250929050565b60006020828403121561280957600080fd5b600082013567ffffffffffffffff81111561282357600080fd5b61282f84828501612660565b91505092915050565b60006020828403121561284a57600080fd5b60006128588482850161268a565b91505092915050565b60006020828403121561287357600080fd5b60006128818482850161269f565b91505092915050565b60006020828403121561289c57600080fd5b60006128aa848285016126b4565b91505092915050565b6000806000606084860312156128c857600080fd5b60006128d6868287016126c9565b93505060206128e7868287016126c9565b92505060406128f8868287016126c9565b9150509250925092565b600061290e838361291a565b60208301905092915050565b61292381613042565b82525050565b61293281613042565b82525050565b600061294382612ee8565b61294d8185612f0b565b935061295883612ed8565b8060005b838110156129895781516129708882612902565b975061297b83612efe565b92505060018101905061295c565b5085935050505092915050565b61299f81613054565b82525050565b6129ae81613097565b82525050565b60006129bf82612ef3565b6129c98185612f1c565b93506129d98185602086016130a9565b6129e2816131e3565b840191505092915050565b60006129fa602383612f1c565b9150612a05826131f4565b604082019050919050565b6000612a1d600c83612f1c565b9150612a2882613243565b602082019050919050565b6000612a40602a83612f1c565b9150612a4b8261326c565b604082019050919050565b6000612a63602283612f1c565b9150612a6e826132bb565b604082019050919050565b6000612a86601b83612f1c565b9150612a918261330a565b602082019050919050565b6000612aa9602183612f1c565b9150612ab482613333565b604082019050919050565b6000612acc602083612f1c565b9150612ad782613382565b602082019050919050565b6000612aef602983612f1c565b9150612afa826133ab565b604082019050919050565b6000612b12602583612f1c565b9150612b1d826133fa565b604082019050919050565b6000612b35602483612f1c565b9150612b4082613449565b604082019050919050565b6000612b58601783612f1c565b9150612b6382613498565b602082019050919050565b612b7781613080565b82525050565b612b868161308a565b82525050565b6000602082019050612ba16000830184612929565b92915050565b6000604082019050612bbc6000830185612929565b612bc96020830184612929565b9392505050565b6000604082019050612be56000830185612929565b612bf26020830184612b6e565b9392505050565b600060c082019050612c0e6000830189612929565b612c1b6020830188612b6e565b612c2860408301876129a5565b612c3560608301866129a5565b612c426080830185612929565b612c4f60a0830184612b6e565b979650505050505050565b6000602082019050612c6f6000830184612996565b92915050565b60006020820190508181036000830152612c8f81846129b4565b905092915050565b60006020820190508181036000830152612cb0816129ed565b9050919050565b60006020820190508181036000830152612cd081612a10565b9050919050565b60006020820190508181036000830152612cf081612a33565b9050919050565b60006020820190508181036000830152612d1081612a56565b9050919050565b60006020820190508181036000830152612d3081612a79565b9050919050565b60006020820190508181036000830152612d5081612a9c565b9050919050565b60006020820190508181036000830152612d7081612abf565b9050919050565b60006020820190508181036000830152612d9081612ae2565b9050919050565b60006020820190508181036000830152612db081612b05565b9050919050565b60006020820190508181036000830152612dd081612b28565b9050919050565b60006020820190508181036000830152612df081612b4b565b9050919050565b6000602082019050612e0c6000830184612b6e565b92915050565b600060a082019050612e276000830188612b6e565b612e3460208301876129a5565b8181036040830152612e468186612938565b9050612e556060830185612929565b612e626080830184612b6e565b9695505050505050565b6000602082019050612e816000830184612b7d565b92915050565b6000612e91612ea2565b9050612e9d82826130dc565b919050565b6000604051905090565b600067ffffffffffffffff821115612ec757612ec66131b4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612f3882613080565b9150612f4383613080565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f7857612f77613156565b5b828201905092915050565b6000612f8e82613080565b9150612f9983613080565b925082612fa957612fa8613185565b5b828204905092915050565b6000612fbf82613080565b9150612fca83613080565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561300357613002613156565b5b828202905092915050565b600061301982613080565b915061302483613080565b92508282101561303757613036613156565b5b828203905092915050565b600061304d82613060565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006130a282613080565b9050919050565b60005b838110156130c75780820151818401526020810190506130ac565b838111156130d6576000848401525b50505050565b6130e5826131e3565b810181811067ffffffffffffffff82111715613104576131036131b4565b5b80604052505050565b600061311882613080565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561314b5761314a613156565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6134ca81613042565b81146134d557600080fd5b50565b6134e181613054565b81146134ec57600080fd5b50565b6134f881613080565b811461350357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205bd80489efb650adcd275d3907f5e4b8d89474ed070fabffdf911af6f563550f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,421 |
0x0c1cf1bbf77863b07500760ed98444f5927e4269
|
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: Unlicensed
//TG: @apecap
//WEBSITE: apecapital.digital
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 APECAP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "APE CAPITAL";
string private constant _symbol = "APECAP";
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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 15;
uint256 private _totalRefOnBuy = 0;
uint256 private _totalTaxOnSell = 10;
uint256 private _totalRefOnSell = 0;
uint256 private _totalSellTax = 15;
uint256 private _redisFee = _totalRefOnSell;
uint256 private _taxFee = _totalSellTax;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xD1e7DAdaAbd0BD853A260c62898cD0B73E469F12);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 4 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 = 2e7 * 10**9;
uint256 public _maxWalletSize = 2e7 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e7 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createNewPair() external onlyOwner{
require(!tradingOpen);
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 + 10 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 = _totalRefOnBuy;
_taxFee = _totalTaxOnSell;
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 = _totalRefOnSell;
_taxFee = _totalSellTax;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address 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 <= 13);
require( amountSell <= 15);
_totalTaxOnSell = amountBuy;
_totalSellTax = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_totalRefOnBuy = amountRefBuy;
_totalRefOnSell = 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;
}
}
|
0x6080604052600436106102295760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e14610664578063e0f9f6a0146106aa578063ea1644d5146106ca578063f2fde38b146106ea578063fe72c3c11461070a57600080fd5b806395d89b41146105b55780639ec350ed146105e45780639f13157114610604578063a9059cbb14610624578063c55284901461064457600080fd5b80637c519ffb116100f25780637c519ffb146105365780637d1db4a51461054b578063881dce60146105615780638da5cb5b146105815780638f9a55c01461059f57600080fd5b806370a08231146104cb578063715018a6146104eb57806374010ece14610500578063790ca4131461052057600080fd5b806333251a0b116101b15780635996c6b0116101755780635996c6b01461044b5780635d098b38146104605780636b9cf534146104805780636d8aa8f8146104965780636fc3eaec146104b657600080fd5b806333251a0b146103a957806338eea22d146103cb5780633e3e9598146103eb57806349bd5a5e1461040b5780634bf2c7c91461042b57600080fd5b806318160ddd116101f857806318160ddd1461031c57806323b872dd1461034157806327c8f835146103615780632fd689e314610377578063313ce5671461038d57600080fd5b806306fdde0314610235578063095ea7b31461027b5780630f3a325f146102ab5780631694505e146102e457600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600b81526a1054114810d0541255105360aa1b60208201525b6040516102729190612100565b60405180910390f35b34801561028757600080fd5b5061029b610296366004612077565b610720565b6040519015158152602001610272565b3480156102b757600080fd5b5061029b6102c6366004611fc3565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102f057600080fd5b50601954610304906001600160a01b031681565b6040516001600160a01b039091168152602001610272565b34801561032857600080fd5b50670de0b6b3a76400005b604051908152602001610272565b34801561034d57600080fd5b5061029b61035c366004612036565b610737565b34801561036d57600080fd5b5061030461dead81565b34801561038357600080fd5b50610333601d5481565b34801561039957600080fd5b5060405160098152602001610272565b3480156103b557600080fd5b506103c96103c4366004611fc3565b6107a0565b005b3480156103d757600080fd5b506103c96103e63660046120de565b610818565b3480156103f757600080fd5b506103c9610406366004611fc3565b61084d565b34801561041757600080fd5b50601a54610304906001600160a01b031681565b34801561043757600080fd5b506103c96104463660046120c5565b61089b565b34801561045757600080fd5b506103c96108d8565b34801561046c57600080fd5b506103c961047b366004611fc3565b610ad4565b34801561048c57600080fd5b50610333601e5481565b3480156104a257600080fd5b506103c96104b13660046120a3565b610b2e565b3480156104c257600080fd5b506103c9610b76565b3480156104d757600080fd5b506103336104e6366004611fc3565b610ba0565b3480156104f757600080fd5b506103c9610bc2565b34801561050c57600080fd5b506103c961051b3660046120c5565b610c36565b34801561052c57600080fd5b50610333600a5481565b34801561054257600080fd5b506103c9610cda565b34801561055757600080fd5b50610333601b5481565b34801561056d57600080fd5b506103c961057c3660046120c5565b610d34565b34801561058d57600080fd5b506000546001600160a01b0316610304565b3480156105ab57600080fd5b50610333601c5481565b3480156105c157600080fd5b5060408051808201909152600681526504150454341560d41b6020820152610265565b3480156105f057600080fd5b506103c96105ff3660046120de565b610db0565b34801561061057600080fd5b506103c961061f3660046120a3565b610e01565b34801561063057600080fd5b5061029b61063f366004612077565b610e49565b34801561065057600080fd5b506103c961065f3660046120de565b610e56565b34801561067057600080fd5b5061033361067f366004611ffd565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106b657600080fd5b506103c96106c53660046120c5565b610ea7565b3480156106d657600080fd5b506103c96106e53660046120c5565b610ef1565b3480156106f657600080fd5b506103c9610705366004611fc3565b610f2f565b34801561071657600080fd5b5061033360185481565b600061072d338484611019565b5060015b92915050565b600061074484848461113d565b6107968433610791856040518060600160405280602881526020016122d4602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611864565b611019565b5060019392505050565b6000546001600160a01b031633146107d35760405162461bcd60e51b81526004016107ca90612155565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff1615610815576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108425760405162461bcd60e51b81526004016107ca90612155565b600d91909155600f55565b6000546001600160a01b031633146108775760405162461bcd60e51b81526004016107ca90612155565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108c55760405162461bcd60e51b81526004016107ca90612155565b60018111156108d357600080fd5b601355565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016107ca90612155565b601a54600160a01b900460ff161561091957600080fd5b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561097957600080fd5b505afa15801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b19190611fe0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109f957600080fd5b505afa158015610a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a319190611fe0565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a7957600080fd5b505af1158015610a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab19190611fe0565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6017546001600160a01b0316336001600160a01b031614610af457600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b03163314610b585760405162461bcd60e51b81526004016107ca90612155565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b031614610b9657600080fd5b476108158161189e565b6001600160a01b038116600090815260026020526040812054610731906118dc565b6000546001600160a01b03163314610bec5760405162461bcd60e51b81526004016107ca90612155565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610c605760405162461bcd60e51b81526004016107ca90612155565b674563918244f40000811015610cd55760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107ca565b601b55565b6000546001600160a01b03163314610d045760405162461bcd60e51b81526004016107ca90612155565b601a54600160a01b900460ff1615610d1b57600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610d5457600080fd5b610d5d30610ba0565b8111158015610d6c5750600081115b610da75760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107ca565b61081581611960565b6000546001600160a01b03163314610dda5760405162461bcd60e51b81526004016107ca90612155565b6001821115610de857600080fd5b6013811115610df657600080fd5b600b91909155600c55565b6000546001600160a01b03163314610e2b5760405162461bcd60e51b81526004016107ca90612155565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061072d33848461113d565b6000546001600160a01b03163314610e805760405162461bcd60e51b81526004016107ca90612155565b600d821115610e8e57600080fd5b600f811115610e9c57600080fd5b600e91909155601055565b6000546001600160a01b03163314610ed15760405162461bcd60e51b81526004016107ca90612155565b6004811115610edf57600080fd5b610eeb81610e1061225c565b60185550565b6000546001600160a01b03163314610f1b5760405162461bcd60e51b81526004016107ca90612155565b601c54811015610f2a57600080fd5b601c55565b6000546001600160a01b03163314610f595760405162461bcd60e51b81526004016107ca90612155565b6001600160a01b038116610fbe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107ca565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661107b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107ca565b6001600160a01b0382166110dc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107ca565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111a15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107ca565b6001600160a01b0382166112035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107ca565b600081116112655760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107ca565b6001600160a01b03821660009081526009602052604090205460ff161561129e5760405162461bcd60e51b81526004016107ca9061218a565b6001600160a01b03831660009081526009602052604090205460ff16156112d75760405162461bcd60e51b81526004016107ca9061218a565b3360009081526009602052604090205460ff16156113075760405162461bcd60e51b81526004016107ca9061218a565b6000546001600160a01b0384811691161480159061133357506000546001600160a01b03838116911614155b156116ac57601a54600160a01b900460ff166113915760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107ca565b601a546001600160a01b0383811691161480156113bc57506019546001600160a01b03848116911614155b1561146e576001600160a01b03821630148015906113e357506001600160a01b0383163014155b80156113fd57506017546001600160a01b03838116911614155b801561141757506017546001600160a01b03848116911614155b1561146e57601b5481111561146e5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107ca565b601a546001600160a01b0383811691161480159061149a57506017546001600160a01b03838116911614155b80156114af57506001600160a01b0382163014155b80156114c657506001600160a01b03821661dead14155b156115a657601c54816114d884610ba0565b6114e29190612222565b1061153b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107ca565b601a54600160b81b900460ff16156115a657600a5461155c90610258612222565b42116115a657601e548111156115a65760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107ca565b60006115b130610ba0565b601d5490915081118080156115d05750601a54600160a81b900460ff16155b80156115ea5750601a546001600160a01b03868116911614155b80156115ff5750601a54600160b01b900460ff165b801561162457506001600160a01b03851660009081526006602052604090205460ff16155b801561164957506001600160a01b03841660009081526006602052604090205460ff16155b156116a9576013546000901561168457611679606461167360135486611ae990919063ffffffff16565b90611b68565b905061168481611baa565b611696611691828561227b565b611960565b4780156116a6576116a64761189e565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806116ee57506001600160a01b03831660009081526006602052604090205460ff165b806117205750601a546001600160a01b038581169116148015906117205750601a546001600160a01b03848116911614155b1561172d57506000611852565b601a546001600160a01b03858116911614801561175857506019546001600160a01b03848116911614155b156117b3576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156117b3576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156117de57506019546001600160a01b03858116911614155b15611852576001600160a01b0384166000908152600460205260409020541580159061182f57506018546001600160a01b038516600090815260046020526040902054429161182c91612222565b10155b1561184557600b54601155600c54601255611852565b600f546011556010546012555b61185e84848484611bb7565b50505050565b600081848411156118885760405162461bcd60e51b81526004016107ca9190612100565b506000611895848661227b565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156118d8573d6000803e3d6000fd5b5050565b60006007548211156119435760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107ca565b600061194d611beb565b90506119598382611b68565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106119a8576119a86122a8565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156119fc57600080fd5b505afa158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190611fe0565b81600181518110611a4757611a476122a8565b6001600160a01b039283166020918202929092010152601954611a6d9130911684611019565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611aa69085906000908690309042906004016121b1565b600060405180830381600087803b158015611ac057600080fd5b505af1158015611ad4573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611af857506000610731565b6000611b04838561225c565b905082611b11858361223a565b146119595760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107ca565b600061195983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c0e565b6108153061dead8361113d565b80611bc457611bc4611c3c565b611bcf848484611c81565b8061185e5761185e601454601155601554601255601654601355565b6000806000611bf8611d78565b9092509050611c078282611b68565b9250505090565b60008183611c2f5760405162461bcd60e51b81526004016107ca9190612100565b506000611895848661223a565b601154158015611c4c5750601254155b8015611c585750601354155b15611c5f57565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611c9387611db8565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611cc59087611e15565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cf49086611e57565b6001600160a01b038916600090815260026020526040902055611d1681611eb6565b611d208483611f00565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611d6591815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a7640000611d938282611b68565b821015611daf57505060075492670de0b6b3a764000092509050565b90939092509050565b6000806000806000806000806000611dd58a601154601254611f24565b9250925092506000611de5611beb565b90506000806000611df88e878787611f73565b919e509c509a509598509396509194505050505091939550919395565b600061195983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611864565b600080611e648385612222565b9050838110156119595760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107ca565b6000611ec0611beb565b90506000611ece8383611ae9565b30600090815260026020526040902054909150611eeb9082611e57565b30600090815260026020526040902055505050565b600754611f0d9083611e15565b600755600854611f1d9082611e57565b6008555050565b6000808080611f3860646116738989611ae9565b90506000611f4b60646116738a89611ae9565b90506000611f6382611f5d8b86611e15565b90611e15565b9992985090965090945050505050565b6000808080611f828886611ae9565b90506000611f908887611ae9565b90506000611f9e8888611ae9565b90506000611fb082611f5d8686611e15565b939b939a50919850919650505050505050565b600060208284031215611fd557600080fd5b8135611959816122be565b600060208284031215611ff257600080fd5b8151611959816122be565b6000806040838503121561201057600080fd5b823561201b816122be565b9150602083013561202b816122be565b809150509250929050565b60008060006060848603121561204b57600080fd5b8335612056816122be565b92506020840135612066816122be565b929592945050506040919091013590565b6000806040838503121561208a57600080fd5b8235612095816122be565b946020939093013593505050565b6000602082840312156120b557600080fd5b8135801515811461195957600080fd5b6000602082840312156120d757600080fd5b5035919050565b600080604083850312156120f157600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561212d57858101830151858201604001528201612111565b8181111561213f576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122015784516001600160a01b0316835293830193918301916001016121dc565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561223557612235612292565b500190565b60008261225757634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561227657612276612292565b500290565b60008282101561228d5761228d612292565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461081557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204aa36f5c8aa26765ab52bbd2418fb406a3f424f9bc2ad7467b8b6496a062597264736f6c63430008070033
|
{"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,422 |
0xdec3b9964b992f2a39ac7d58a0fc0e59c2c88a4f
|
/**
.............................'''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;;;;;;;;;,.................'',,,;;;;;;;;;;;;;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'''''''''''''''''''''''................
..............................'''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;;;;;,. .'''''... .....'',;;;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'''''''''''''''''''''''.................
...............................'''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;,'.. .lONWNXK0OOxdoc:,.. ....',,,,,,,,,,,,,,,,,,,,,,,,,,,''''''''''''''''''''''''..................
................................''''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'...... .,dXMWNXKKXXXNNNK0Oxoc,.. ...',,,,,,,,,,,,,,,,,,,,'''''''''''''''''''''''''...................
.................................''''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,'... .,:ldxkO00KNWWWNX00000000KKXXNNK0kdc;.. ..'',,,,,,,,,,,,,,''''''''''''''''''''''''.....................
..................................''''''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,.. .,cdkKXNXXXXKKKKKK0KKK000000000000000KXXNWN0xl;. ..',,,,,,,,,'''''''''''''''''''''''''......................
....................................'''''''''''''''''''''''''',,,,,,,,,,,,,,,,'. .,cx0XXK0000000000000OOkkOKXXNNNNNXXKK0000000KXNMMWXkl' ..,,',,,'''''''''''''''''''''''''''......................
.....................................''''''''''''''''''''''''''''',,,,,,,,,,,. ,lkKK0000000000000000Ol,....',:coxOXWMMWNX000000KX0xdxOXXk, .,,''''''''''''''''''''''''''''........................
.......................................''''''''''''''''''''''''''''',,,,,,,'. .,cc:;:x00000000000000O: .. .;oONMNK0Odx0O;......:kO' .'''''''''''''''''''''''''''''.........................
.........................................'''''''''''''''''''''''''''''',',,. .,oO00000000000000x' .oko. .... .,dOOd,.lO; 'okkd:..'. .,'''''............'''''''''...........................
...........................................'''''''''''''''''''''''''''''','. .;lxO000000000000000k, c0O: .',''... .. :Oo.;xd:;lkko:'. .... .................''''............................
............................................'''''''''''''''''''''''''''''',. .:odk000000000000000000l.c0x; .''''.. .';oxc..;col;;ldkOOxd:...;cloooc:;;;;:ccc,. ..'.............................
.............................................''''''''''''''''''''''''''''''. .:odxO0000000000000000000kloOxl. .. .;oxdl;. .';coddddddddk0xoddoc,.. .,oc ...............................
................................................''''''''''''''''''''''''''. .ldddk000000000000000000000000kdl,. .:lc,...,coxkxxdddddddddxxdl;'. ..',;;:::;,. .. ...............................
...................................................''''''''''''''''''''''. .ldddxO000000000000000000000000Oxddl..,:coo;. .;okO0kdddddc;cddddooc,. .,;;,,'''',;coo;. ...............................
................................................''''''.''''''''''''''''''. :ddddxO0000000000000000000000000Okd:;d00Oo. .;dxkkxxxdddo;.,oddoll;. .,;,.. ..,' ................................
......................................... .........''''''''''''''''. .ldddddO0IF%YOU%READING%THIS%YGMI%0OkO000d' .:dddddooollo:..ldoll:...,;'. ........... ..................................
....................................... ... .....''''''''''. 'odddddxO0000000000000000000000000000000Oc. .oxdoc,....... ,lll:'..,;' ...'''..............................................
..................................... .:oxkxo;,,;::c:::;,.. ......''''. 'odddddddkO00READ%THE%BOTTOM00000000000Ox; 'loo;. ...... .''...,;' ..'''''..............................................
.................................... .:dddddxxkkkkxxxxxxxkxdoc, ... .lddddddxxxxkO0000000000000000000000000Od, 'cll'.,lllc:;,'',,;;,. ..'....................................................
.................................. .lddddddddddddddooddddddkO:. ..... ;dddddxOOOOOO0000000000000000000000000kd, .cll;,cllc'. .... ..''....................................................
................................. .ldddddddddddddddo::oddddkkdodddxddolc;,..cdddddxO00000000000000000000000000000kd: 'clllllc:. ... .........................................................
................................ .:dddddddddddddddddc.'lddddxkxxdddddddddddllodddddxO0000000000000000000000000000kdl. .,;,'.. ..;clol. ..........................................................
................................ ,odddddddddddddddddo. .lddddddddddddddddddddddddddddxO00000000000000000000000000Oxdc. .';ldxddo; ...........................................................
............................... .cddddoc:;,,,,'',,;;;. .ldddddddddddddddddddddddddddddxkO000000000000000000000000Oxdo:'....,:ldxkOkdo; ............................................................
................................ 'oddolc:::ccllllllc;'. 'lddddddddddddddddddddddddoodddddxkkO000000000000000000000OkxddoooddxkO0Okdl' .............................................................
................................ ;odddddddddddddxxxkOOxl. ,ldddddddddddddddddol:;'....,:odddddxxkkOOOO000000000000000OOkkkkkO00Okxl;. ..............................................................
............................... .cddddddddddddddddddddkOk; ,odddddddddddddl:,. .cdxddddddddxxkOO0000000000000000000Okxo:'. ................................................................
.............................. .ldddddddddddddddddddddxOk, .;odddddddddo:'. ... .,::;'. ;xOOOOOOOOOO00000000000000000000Oko;'. ..................................................................
.............................. 'ldddddddddddddddddddolox0l .cdddddddo:. .lx: .lOOOkx:. .lO000000000000000000000000000Oo'. ...............................................................
............................. ,lddddooddddddllodddd;.;xOd. ,lcodddo; ;k0x'.l0000Oc. .:ldO00000000000000000000000o;:odxxxdl:,. ...........................................................
.............................. 'loddd;.:ddddo,.:dddo' 'dOo. ...lddd: .:, 'k00o..d0000O: ;ol' .,cO00000000000000000000kOKKKXXXNNWNKkl,. ........................................................
.............................. .:oddo' .ldddo' ,dddl. .dd' .lddo' .oo..o000d'.o0000O:.lKXKc c000000000000000000000000000000KKXWMN0l' ......................................................
.............................. 'codd; ,oddo' .coc' .. .lddo' .lkd.;O000kc;x0000Ood00XK, ,O00000000000000000000Oxdk000000KXWMMMMXd. .....................................................
............................. .:ll, .;:' . ..',. .lddd; ;k0xlx00000kO000000000XK, ;O0000000000000000000x,.,x00000KNMMMMMMMM0; ....................................................
Website: http://www.lfgoose.com/
Telegram: https://t.me/LetsFuckingGoosePortal
Twitter: https://twitter.com/LFGooseETH
Instagram: https://www.instagram.com/lfgoose/
Something is definitely coming ...
🙊 Read the bottom 🙊
LFGoose*
**/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function 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 Tobedetermined is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'to be determined' ;
string private _symbol = 'tba';
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);
}
}
/*
Only for holders !
Enter the channel at the bottom to have a chance to win 100$ every 100 holders
All you have to do is to make a tweet about @LFGoose, using #LFGoose , tag 3 BIG influencers and 2 of your CRYPTO friend
Hold at least 10$ of LFGoose
Follow the twitter account :https://t.me/LetsFuckingGoosePortal
Like the pinned messages
Subscribe to the instagam account : https://www.instagram.com/lfgoose/
Here a list of crypto influencers
https://twitter.com/1goonrich
https://twitter.com/Yourpop8
https://twitter.com/CometCalls
https://twitter.com/Miraz_Aslan
https://twitter.com/K_PoBlah
https://twitter.com/OniiEth
https://twitter.com/CryptoGemApe
https://twitter.com/dippy_eth
https://twitter.com/Kali_Eth
https://twitter.com/EthJasper
https://twitter.com/SatoshiRipper
https://twitter.com/ChinaPumpWXC
https://twitter.com/EthLucius
https://twitter.com/ATHena_DeFi
https://twitter.com/cryptocarti
https://twitter.com/frombroke2bags
https://twitter.com/hulkordie
https://twitter.com/CryptoGraphBSC
https://twitter.com/CryptoGorgonite
https://twitter.com/lebron_gains
https://twitter.com/KenKingCastle1
https://twitter.com/FlameCryptos
https://twitter.com/thecoingirl
https://twitter.com/CryptoTigerKing
https://twitter.com/CryptoBear21
https://twitter.com/LilTGems
https://twitter.com/Cryptic_Maestro
https://twitter.com/OfficialTravlad
https://twitter.com/ZachBoychuk
https://twitter.com/SharksCoins
https://twitter.com/TheCryptoFrog_
https://twitter.com/Ralvero
https://twitter.com/CRYPTOCHARlZARD
https://twitter.com/ZeroWaiting
https://twitter.com/LaCryptoMonkey
https://twitter.com/crypto_bitlord7
https://twitter.com/JapaneseCrypto
https://twitter.com/AltCryptoGems
https://twitter.com/elonmusk
https://twitter.com/TheCryptoGemini
This is running for every 100 holders, winners will be pick randomly
Every 100 holders, we ll add 50$ to the prize, it's ll be caped at 650$ at 10k holders,then we will increase the numbers of winners to 15 per 100 holders
Join channel, link us your tweet
We ll only send prize if the wallet you give us for paiement hold 10 $ of LFGoose
Do not forget anystep to be eligible
The channel to enter is : https://t.me/LFGoose_giveway
#LFGoose
*/
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a08231146101d9578063715018a6146101ff5780638da5cb5b1461020957806395d89b411461022d578063a9059cbb14610235578063dd62ed3e14610261576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b661028f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b038135169060200135610325565b604080519115158252519081900360200190f35b610173610342565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610348565b6101c36103cf565b6040805160ff9092168252519081900360200190f35b610173600480360360208110156101ef57600080fd5b50356001600160a01b03166103d8565b6102076103f3565b005b6102116104a7565b604080516001600160a01b039092168252519081900360200190f35b6100b66104b6565b6101576004803603604081101561024b57600080fd5b506001600160a01b038135169060200135610517565b6101736004803603604081101561027757600080fd5b506001600160a01b038135811691602001351661052b565b60058054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561031b5780601f106102f05761010080835404028352916020019161031b565b820191906000526020600020905b8154815290600101906020018083116102fe57829003601f168201915b5050505050905090565b6000610339610332610556565b848461055a565b50600192915050565b60045490565b60006103558484846106ca565b6103c584610361610556565b6103c08560405180606001604052806028815260200161095c602891396001600160a01b038a1660009081526003602052604081209061039f610556565b6001600160a01b03168152602081019190915260400160002054919061081c565b61055a565b5060019392505050565b60075460ff1690565b6001600160a01b031660009081526002602052604090205490565b6103fb610556565b6001546001600160a01b0390811691161461045d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561031b5780601f106102f05761010080835404028352916020019161031b565b6000610339610524610556565b84846106ca565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661059f5760405162461bcd60e51b81526004018080602001828103825260248152602001806109cd6024913960400191505060405180910390fd5b6001600160a01b0382166105e45760405162461bcd60e51b815260040180806020018281038252602281526020018061093a6022913960400191505060405180910390fd5b6105ec6104a7565b6001600160a01b0316836001600160a01b031614610667576001600160a01b0380841660008181526003602090815260408083209487168084529482528083209290925581516004815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a36106c5565b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b505050565b6001600160a01b03831661070f5760405162461bcd60e51b81526004018080602001828103825260258152602001806109156025913960400191505060405180910390fd5b6001600160a01b0382166107545760405162461bcd60e51b81526004018080602001828103825260238152602001806109aa6023913960400191505060405180910390fd5b61079181604051806060016040528060268152602001610984602691396001600160a01b038616600090815260026020526040902054919061081c565b6001600160a01b0380851660009081526002602052604080822093909355908416815220546107c090826108b3565b6001600160a01b0380841660008181526002602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610870578181015183820152602001610858565b50505050905090810190601f16801561089d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008282018381101561090d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f3fbf5ff8b91f907f76ab20b7665f7be17034c8c45b7661c8c931e779972993164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,423 |
0x68ac87cb952d6066de5167bb0659dfa0fad98f90
|
pragma solidity ^0.4.16;
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;
}
}
contract ERC20Basic {
function totalSupply() public constant returns (uint supply);
function balanceOf( address who ) public constant returns (uint value);
function allowance( address owner, address spender ) public constant returns (uint _allowance);
function transfer( address to, uint value) public returns (bool ok);
function transferFrom( address from, address to, uint value) public returns (bool ok);
function approve( address spender, uint value ) public returns (bool ok);
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval( address indexed owner, address indexed spender, uint value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
}
contract TokenERC20 is ERC20Basic{
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 4;
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _allowance;
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol,
uint8 decimal
) public {
_supply = initialSupply * 10 ** uint256(decimal); // Update total supply with the decimal amount
_balances[msg.sender] = _supply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
decimals = decimal;
}
function totalSupply() public constant returns (uint256) {
return _supply;
}
function balanceOf(address src) public constant returns (uint256) {
return _balances[src];
}
function allowance(address src, address guy) public constant returns (uint256) {
return _allowance[src][guy];
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(_balances[_from] >= _value);
// Check for overflows
require(_balances[_to] + _value > _balances[_to]);
// Save this for an assertion in the future
uint previousBalances = _balances[_from] + _balances[_to];
// Subtract from the sender
_balances[_from] -= _value;
// Add the same to the recipient
_balances[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(_balances[_from] + _balances[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool){
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= _allowance[_from][msg.sender]); // Check allowance
_allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
_allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approveAndCall(address _spender, uint256 _value)
public returns (bool success) {
if (approve(_spender, _value)) {
Approval(msg.sender, _spender, _value);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(_balances[msg.sender] >= _value); // Check if the sender has enough
_balances[msg.sender] -= _value; // Subtract from the sender
_supply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(_balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= _allowance[_from][msg.sender]); // Check allowance
_balances[_from] -= _value; // Subtract from the targeted balance
_allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
_supply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract DYITToken is owned, TokenERC20 {
uint256 public sellPrice = 0.00000001 ether ; //设置代币的卖的价格等于一个以太币
uint256 public buyPrice = 0.00000001 ether ;//设置代币的买的价格等于一个以太币
mapping (address => bool) public _frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function DYITToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol,
uint8 decimal
) TokenERC20(initialSupply, tokenName, tokenSymbol,decimal) public {
_balances[msg.sender] = _supply;
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (_balances[_from] >= _value); // Check if the sender has enough
require (_balances[_to] + _value > _balances[_to]); // Check for overflows
require(!_frozenAccount[_from]); // Check if sender is frozen
require(!_frozenAccount[_to]); // Check if recipient is frozen
_balances[_from] -= _value; // Subtract from the sender
_balances[_to] += _value; // Add the same to the recipient
Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
_balances[target] += mintedAmount;
_supply += mintedAmount;
Transfer(0, owner, mintedAmount);
Transfer(owner, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
_frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/**
* 实现账户间,代币的转移
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool){
_transfer(msg.sender, _to, _value);
return true;
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(owner, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
require(owner.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, owner, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
}
|
0x60606040523615610126576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012b57806306fdde0314610157578063095ea7b3146101e657806318160ddd1461024057806323b872dd14610269578063313ce567146102e25780633177029f1461031157806342966c681461036b5780634b750334146103a657806370a08231146103cf57806379c650681461041c57806379cc67901461045e5780638620410b146104b85780638da5cb5b146104e157806395d89b4114610536578063a6f2ae3a146105c5578063a9059cbb146105cf578063d170cb4214610629578063dd62ed3e1461067a578063e4849b32146106e6578063e724529c14610709578063f2fde38b1461074d575b600080fd5b341561013657600080fd5b6101556004808035906020019091908035906020019091905050610786565b005b341561016257600080fd5b61016a6107f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ab5780820151818401525b60208101905061018f565b50505050905090810190601f1680156101d85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f157600080fd5b610226600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610893565b604051808215151515815260200191505060405180910390f35b341561024b57600080fd5b610253610921565b6040518082815260200191505060405180910390f35b341561027457600080fd5b6102c8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061092c565b604051808215151515815260200191505060405180910390f35b34156102ed57600080fd5b6102f5610a5a565b604051808260ff1660ff16815260200191505060405180910390f35b341561031c57600080fd5b610351600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a6d565b604051808215151515815260200191505060405180910390f35b341561037657600080fd5b61038c6004808035906020019091905050610af3565b604051808215151515815260200191505060405180910390f35b34156103b157600080fd5b6103b9610bf8565b6040518082815260200191505060405180910390f35b34156103da57600080fd5b610406600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bfe565b6040518082815260200191505060405180910390f35b341561042757600080fd5b61045c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c48565b005b341561046957600080fd5b61049e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dfd565b604051808215151515815260200191505060405180910390f35b34156104c357600080fd5b6104cb611018565b6040518082815260200191505060405180910390f35b34156104ec57600080fd5b6104f461101e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561054157600080fd5b610549611043565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058a5780820151818401525b60208101905061056e565b50505050905090810190601f1680156105b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105cd6110e1565b005b34156105da57600080fd5b61060f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611123565b604051808215151515815260200191505060405180910390f35b341561063457600080fd5b610660600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061113b565b604051808215151515815260200191505060405180910390f35b341561068557600080fd5b6106d0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061115b565b6040518082815260200191505060405180910390f35b34156106f157600080fd5b61070760048080359060200190919050506111e3565b005b341561071457600080fd5b61074b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506112a2565b005b341561075857600080fd5b610784600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113c9565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107e157600080fd5b81600781905550806008819055505b5b5050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561088b5780601f106108605761010080835404028352916020019161088b565b820191906000526020600020905b81548152906001019060200180831161086e57829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600190505b92915050565b600060045490505b90565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109b957600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610a4e848484611469565b600190505b9392505050565b600360009054906101000a900460ff1681565b6000610a798383610893565b15610aec578273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a360019050610aed565b5b92915050565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b4357600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600190505b919050565b60075481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ca357600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5b5050565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e4d57600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ed857600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600190505b92915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110d95780601f106110ae576101008083540402835291602001916110d9565b820191906000526020600020905b8154815290600101906020018083116110bc57829003601f168201915b505050505081565b6000600854348115156110f057fe5b04905061111f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611469565b5b50565b6000611130338484611469565b600190505b92915050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b60075481026000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16311015151561122e57600080fd5b61125a336000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611469565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075483029081150290604051600060405180830381858888f19350505050151561129e57600080fd5b5b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112fd57600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561142457600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b50565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561148f57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156114dd57600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561156b57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156115c457600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561161d57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5050505600a165627a7a72305820bb26319f643106099d08a9eda69486c12cbd1e01d5aa3151283a3277572a72fa0029
|
{"success": true, "error": null, "results": {}}
| 3,424 |
0x9e5fa96bf04491119b79cd8cea7a0a8a9a897b02
|
// File: In Progress/TheSevens/LPStaking.sol
//SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* 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 {
address public owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
'Ownable: new owner is the zero address'
);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface 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 StakedTokenWrapper {
uint256 public totalSupply;
mapping(address => uint256) private _balances;
IERC20 public stakedToken;
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
string constant _transferErrorMessage = 'staked token transfer failed';
function stakeFor(address forWhom, uint128 amount) public payable virtual {
IERC20 st = stakedToken;
require(msg.value == 0, 'non-zero eth');
require(amount > 0, 'Cannot stake 0');
require(
st.transferFrom(msg.sender, address(this), amount),
_transferErrorMessage
);
unchecked {
totalSupply += amount;
_balances[forWhom] += amount;
}
emit Staked(forWhom, amount);
}
function withdraw(uint128 amount) public virtual {
require(amount <= _balances[msg.sender], 'withdraw: balance is lower');
IERC20 st = stakedToken;
unchecked {
_balances[msg.sender] -= amount;
totalSupply = totalSupply - amount;
}
require(
st.transfer(msg.sender, amount),
_transferErrorMessage
);
emit Withdrawn(msg.sender, amount);
}
}
contract ZeniRewards is StakedTokenWrapper, Ownable {
IERC20 public rewardToken;
uint256 public rewardRate;
uint64 public periodFinish;
uint64 public lastUpdateTime;
uint128 public rewardPerTokenStored;
struct UserRewards {
uint128 userRewardPerTokenPaid;
uint128 rewards;
}
mapping(address => UserRewards) public userRewards;
event RewardAdded(uint256 reward);
event RewardPaid(address indexed user, uint256 reward);
constructor(IERC20 _rewardToken, IERC20 _stakedToken) {
rewardToken = _rewardToken;
stakedToken = _stakedToken;
}
modifier updateReward(address account) {
uint128 _rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
rewardPerTokenStored = _rewardPerTokenStored;
userRewards[account].rewards = earned(account);
userRewards[account].userRewardPerTokenPaid = _rewardPerTokenStored;
_;
}
function lastTimeRewardApplicable() public view returns (uint64) {
uint64 blockTimestamp = uint64(block.timestamp);
return blockTimestamp < periodFinish ? blockTimestamp : periodFinish;
}
function rewardPerToken() public view returns (uint128) {
uint256 totalStakedSupply = totalSupply;
if (totalStakedSupply == 0) {
return rewardPerTokenStored;
}
unchecked {
uint256 rewardDuration = lastTimeRewardApplicable() -
lastUpdateTime;
return
uint128(
rewardPerTokenStored +
(rewardDuration * rewardRate * 1e18) /
totalStakedSupply
);
}
}
function earned(address account) public view returns (uint128) {
unchecked {
return
uint128(
(balanceOf(account) *
(rewardPerToken() -
userRewards[account].userRewardPerTokenPaid)) /
1e18 +
userRewards[account].rewards
);
}
}
function stake(uint128 amount) external payable {
stakeFor(msg.sender, amount);
}
function stakeFor(address forWhom, uint128 amount)
public
payable
override
updateReward(forWhom)
{
super.stakeFor(forWhom, amount);
}
function withdraw(uint128 amount) public override updateReward(msg.sender) {
super.withdraw(amount);
}
function exit() external {
getReward();
withdraw(uint128(balanceOf(msg.sender)));
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
userRewards[msg.sender].rewards = 0;
require(
rewardToken.transfer(msg.sender, reward),
'reward transfer failed'
);
emit RewardPaid(msg.sender, reward);
}
}
function setRewardParams(uint128 reward, uint64 duration)
external
onlyOwner
{
unchecked {
require(reward > 0);
rewardPerTokenStored = rewardPerToken();
uint64 blockTimestamp = uint64(block.timestamp);
uint256 maxRewardSupply = rewardToken.balanceOf(address(this));
if (rewardToken == stakedToken) maxRewardSupply -= totalSupply;
uint256 leftover = 0;
if (blockTimestamp >= periodFinish) {
rewardRate = reward / duration;
} else {
uint256 remaining = periodFinish - blockTimestamp;
leftover = remaining * rewardRate;
rewardRate = (reward + leftover) / duration;
}
require(reward + leftover <= maxRewardSupply, 'not enough tokens');
lastUpdateTime = blockTimestamp;
periodFinish = blockTimestamp + duration;
emit RewardAdded(reward);
}
}
function withdrawReward() external onlyOwner {
require(rewardToken.transfer(msg.sender, rewardToken.balanceOf(address(this))));
rewardRate = 0;
periodFinish = uint64(block.timestamp);
}
}
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* 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
*/
|
0x6080604052600436106101345760003560e01c806389ee4bde116100ab578063cd3daf9d1161006f578063cd3daf9d1461039a578063df136d65146103af578063e9fad8ee146103d6578063ebe2b12b146103eb578063f2fde38b1461040b578063f7c618c11461042b57600080fd5b806389ee4bde146102e65780638da5cb5b14610306578063c885bc581461033e578063c8f33c9114610353578063cc7a262e1461037a57600080fd5b806370458d85116100fd57806370458d851461023257806370a0823114610245578063715018a61461027b5780637b0a47ee1461029057806380faa57d146102a657806388fe2be8146102d357600080fd5b80628cc2621461013957806302387a7b146101765780630660f1e81461019857806318160ddd146101f95780633d18b9121461021d575b600080fd5b34801561014557600080fd5b506101596101543660046111ac565b61044b565b6040516001600160801b0390911681526020015b60405180910390f35b34801561018257600080fd5b50610196610191366004611223565b6104c8565b005b3480156101a457600080fd5b506101d96101b33660046111ac565b6007602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b0393841681529290911660208301520161016d565b34801561020557600080fd5b5061020f60005481565b60405190815260200161016d565b34801561022957600080fd5b50610196610567565b6101966102403660046111ce565b610739565b34801561025157600080fd5b5061020f6102603660046111ac565b6001600160a01b031660009081526001602052604090205490565b34801561028757600080fd5b506101966107da565b34801561029c57600080fd5b5061020f60055481565b3480156102b257600080fd5b506102bb61084e565b6040516001600160401b03909116815260200161016d565b6101966102e1366004611223565b610882565b3480156102f257600080fd5b5061019661030136600461123e565b61088f565b34801561031257600080fd5b50600354610326906001600160a01b031681565b6040516001600160a01b03909116815260200161016d565b34801561034a57600080fd5b50610196610afc565b34801561035f57600080fd5b506006546102bb90600160401b90046001600160401b031681565b34801561038657600080fd5b50600254610326906001600160a01b031681565b3480156103a657600080fd5b50610159610c56565b3480156103bb57600080fd5b5060065461015990600160801b90046001600160801b031681565b3480156103e257600080fd5b50610196610cdd565b3480156103f757600080fd5b506006546102bb906001600160401b031681565b34801561041757600080fd5b506101966104263660046111ac565b610d00565b34801561043757600080fd5b50600454610326906001600160a01b031681565b6001600160a01b0381166000908152600760205260408120546001600160801b03600160801b8204811691670de0b6b3a76400009116610489610c56565b036001600160801b03166104b2856001600160a01b031660009081526001602052604090205490565b02816104c0576104c0611324565b040192915050565b3360006104d3610c56565b90506104dd61084e565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b0291909116939091169290921791909117905561051e8261044b565b6001600160a01b03831660009081526007602052604090206001600160801b038381169216600160801b026001600160801b03191691909117905561056283610d33565b505050565b336000610572610c56565b905061057c61084e565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b029190911693909116929092179190911790556105bd8261044b565b6001600160a01b03831660009081526007602052604081206001600160801b038481169316600160801b026001600160801b031916929092179091556106023361044b565b6001600160801b03169050801561056257336000818152600760205260409081902080546001600160801b0316905560048054915163a9059cbb60e01b815290810192909252602482018390526001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561067c57600080fd5b505af1158015610690573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b49190611201565b6106fe5760405162461bcd60e51b81526020600482015260166024820152751c995dd85c99081d1c985b9cd9995c8819985a5b195960521b60448201526064015b60405180910390fd5b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486906020015b60405180910390a2505050565b816000610744610c56565b905061074e61084e565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b0291909116939091169290921791909117905561078f8261044b565b6001600160a01b03831660009081526007602052604090206001600160801b038381169216600160801b026001600160801b0319169190911790556107d48484610ee1565b50505050565b6003546001600160a01b031633146108045760405162461bcd60e51b81526004016106f5906112ef565b6003546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600380546001600160a01b0319169055565b60065460009042906001600160401b039081169082161061087a576006546001600160401b031661087c565b805b91505090565b61088c3382610739565b50565b6003546001600160a01b031633146108b95760405162461bcd60e51b81526004016106f5906112ef565b6000826001600160801b0316116108cf57600080fd5b6108d7610c56565b600680546001600160801b03928316600160801b029216919091179055600480546040516370a0823160e01b815242926000926001600160a01b0316916370a0823191610935913091016001600160a01b0391909116815260200190565b60206040518083038186803b15801561094d57600080fd5b505afa158015610961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109859190611281565b6002546004549192506001600160a01b03918216911614156109a75760005490035b6006546000906001600160401b03908116908416106109f357836001600160401b0316856001600160801b0316816109e1576109e1611324565b046001600160801b0316600555610a2f565b506006546005546001600160401b0391821684900382169081029185166001600160801b038716830181610a2957610a29611324565b04600555505b8181866001600160801b0316011115610a7e5760405162461bcd60e51b81526020600482015260116024820152706e6f7420656e6f75676820746f6b656e7360781b60448201526064016106f5565b600680546001600160801b031916600160401b6001600160401b038087169190910267ffffffffffffffff191691909117858701919091161790556040516001600160801b03861681527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050505050565b6003546001600160a01b03163314610b265760405162461bcd60e51b81526004016106f5906112ef565b600480546040516370a0823160e01b815230928101929092526001600160a01b03169063a9059cbb90339083906370a082319060240160206040518083038186803b158015610b7457600080fd5b505afa158015610b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bac9190611281565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610bf257600080fd5b505af1158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190611201565b610c3357600080fd5b60006005556006805467ffffffffffffffff1916426001600160401b0316179055565b6000805480610c77575050600654600160801b90046001600160801b031690565b600654600090600160401b90046001600160401b0316610c9561084e565b036001600160401b03169050816005548202670de0b6b3a76400000281610cbe57610cbe611324565b6006546001600160801b03600160801b90910416919004019392505050565b610ce5610567565b33600090815260016020526040902054610cfe906104c8565b565b6003546001600160a01b03163314610d2a5760405162461bcd60e51b81526004016106f5906112ef565b61088c816110b8565b336000908152600160205260409020546001600160801b0382161115610d9b5760405162461bcd60e51b815260206004820152601a60248201527f77697468647261773a2062616c616e6365206973206c6f77657200000000000060448201526064016106f5565b6002543360008181526001602052604080822080546001600160801b0387169081900390915582548190039092555163a9059cbb60e01b8152600481019290925260248201526001600160a01b0390911690819063a9059cbb90604401602060405180830381600087803b158015610e1257600080fd5b505af1158015610e26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4a9190611201565b6040518060400160405280601c81526020017f7374616b656420746f6b656e207472616e73666572206661696c65640000000081525090610e9e5760405162461bcd60e51b81526004016106f5919061129a565b506040516001600160801b038316815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d59060200160405180910390a25050565b6002546001600160a01b03163415610f2a5760405162461bcd60e51b815260206004820152600c60248201526b0dcdedc5af4cae4de40cae8d60a31b60448201526064016106f5565b6000826001600160801b031611610f745760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016106f5565b6040516323b872dd60e01b81523360048201523060248201526001600160801b03831660448201526001600160a01b038216906323b872dd90606401602060405180830381600087803b158015610fca57600080fd5b505af1158015610fde573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110029190611201565b6040518060400160405280601c81526020017f7374616b656420746f6b656e207472616e73666572206661696c656400000000815250906110565760405162461bcd60e51b81526004016106f5919061129a565b50600080546001600160801b03841690810182556001600160a01b038516808352600160209081526040938490208054840190559251918252917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d910161072c565b6001600160a01b03811661111d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106f5565b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461119057600080fd5b919050565b80356001600160801b038116811461119057600080fd5b6000602082840312156111be57600080fd5b6111c782611179565b9392505050565b600080604083850312156111e157600080fd5b6111ea83611179565b91506111f860208401611195565b90509250929050565b60006020828403121561121357600080fd5b815180151581146111c757600080fd5b60006020828403121561123557600080fd5b6111c782611195565b6000806040838503121561125157600080fd5b61125a83611195565b915060208301356001600160401b038116811461127657600080fd5b809150509250929050565b60006020828403121561129357600080fd5b5051919050565b600060208083528351808285015260005b818110156112c7578581018301518582016040015282016112ab565b818111156112d9576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601260045260246000fdfea2646970667358221220a94c1102efe01664e3b1734c1b716c9474c9406d1aabdce82f348a345647e60764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,425 |
0xce6568338708400d03f430d29f2eb40a33a3f4c4
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy( address newPolicy_ ) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_policy = msg.sender;
emit OwnershipTransferred( address(0), _policy );
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require( _policy == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renouncePolicy() public virtual override onlyPolicy() {
emit OwnershipTransferred( _policy, address(0) );
_policy = address(0);
}
function pushPolicy( address newPolicy_ ) public virtual override onlyPolicy() {
require( newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require( msg.sender == _newPolicy );
emit OwnershipTransferred( _policy, _newPolicy );
_policy = _newPolicy;
}
}
interface IStaking {
function stakeOHM( uint amount_ ) external returns ( bool );
}
interface ICirculatingOHM {
function OHMCirculatingSupply() external view returns ( uint );
}
contract OlympusDistributorContract is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
address public OHM;
address public stakingContract;
address public circulatingOHMContract;
uint public nextEpochBlock;
uint public blocksInEpoch;
// reward rate is in ten-thousandths ( 5000 = 0.5% )
uint public rewardRate;
uint public blockMigrationCanOccur;
uint public migrationTimelockInBlocks;
address public DAO;
constructor(
uint _nextEpochBlock,
uint _blocksInEpoch,
uint _rewardRate,
address _stakingContract,
address _circulatingOHMContract,
address _OHM,
uint _migrationTimelock,
address _DAO
) {
nextEpochBlock = _nextEpochBlock;
blocksInEpoch = _blocksInEpoch;
rewardRate = _rewardRate;
require( _stakingContract != address(0) );
stakingContract = _stakingContract;
require( _circulatingOHMContract != address(0) );
circulatingOHMContract = _circulatingOHMContract;
require( _OHM != address(0) );
OHM = _OHM;
migrationTimelockInBlocks = _migrationTimelock;
require( _DAO != address(0) );
DAO = _DAO;
}
/**
@notice send epoch reward to staking contract
@return bool
*/
function distribute() external returns ( bool ) {
require( block.number >= nextEpochBlock, "Epoch not ended" );
nextEpochBlock = nextEpochBlock.add( blocksInEpoch );
IStaking( stakingContract ).stakeOHM( 0 );
IERC20( OHM ).safeTransfer( stakingContract, getCurrentRewardForNextEpoch() );
return true;
}
/**
@notice set reward rate in ten-thousandths ( 5000 = 0.5% )
@return bool
*/
function setRewardRate( uint _rewardRate ) external onlyPolicy() returns ( bool ) {
rewardRate = _rewardRate;
return true;
}
/**
@notice view function for next epoch reward
@return uint
*/
function getCurrentRewardForNextEpoch() public view returns ( uint ) {
uint supply = ICirculatingOHM( circulatingOHMContract ).OHMCirculatingSupply();
return supply.mul( rewardRate ).div( 1000000 );
}
/**
@notice sets timelock for reward migration
@return bool
*/
function setTimelock() external onlyPolicy() returns ( bool ) {
blockMigrationCanOccur = block.number.add( migrationTimelockInBlocks );
return true;
}
/**
@notice migrates rewards when timelock elapsed
@return bool
*/
function migrate() external onlyPolicy() returns ( bool ) {
require( blockMigrationCanOccur != 0, "Must start timelock" );
require( blockMigrationCanOccur <= block.number, "Timelock not complete" );
IERC20( OHM ).safeTransfer( DAO, IERC20( OHM ).balanceOf( address(this) ) );
blockMigrationCanOccur = 0;
return true;
}
/**
@notice allow anyone to send lost tokens (excluding OHM) to the DAO
@return bool
*/
function recoverLostToken( address token_ ) external returns ( bool ) {
require( token_ != OHM );
IERC20( token_ ).safeTransfer( DAO, IERC20( token_ ).balanceOf( address(this) ) );
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101205760003560e01c8063a15ad077116100ad578063c4e34aba11610071578063c4e34aba1461022a578063e4fc6b6d14610232578063ee99205c1461023a578063f1a9a73314610242578063f9f705b31461024a57610120565b8063a15ad077146101c6578063a4b23980146101ec578063a6c41fec146101f4578063b4abccba146101fc578063bded13061461022257610120565b80637332773b116100f45780637332773b146101895780637b0a47ee146101915780638fd3ab801461019957806398fabd3a146101a15780639e447fc6146101a957610120565b8062640c2e146101255780630505c8c91461013f57806329dd0e97146101635780635beede081461017f575b600080fd5b61012d610252565b60408051918252519081900360200190f35b610147610258565b604080516001600160a01b039092168252519081900360200190f35b61016b610267565b604080519115158252519081900360200190f35b6101876102cc565b005b61012d610344565b61012d61034a565b61016b610350565b6101476104d4565b61016b600480360360208110156101bf57600080fd5b50356104e3565b610187600480360360208110156101dc57600080fd5b50356001600160a01b031661053a565b6101876105ee565b610147610685565b61016b6004803603602081101561021257600080fd5b50356001600160a01b0316610694565b61012d61074a565b61012d610750565b61016b610756565b610147610861565b61012d610870565b610147610906565b60055481565b6000546001600160a01b031690565b600080546001600160a01b031633146102b5576040805162461bcd60e51b81526020600482018190526024820152600080516020610d8f833981519152604482015290519081900360640190fd5b6009546102c3904390610915565b60085550600190565b6001546001600160a01b031633146102e357600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60095481565b60075481565b600080546001600160a01b0316331461039e576040805162461bcd60e51b81526020600482018190526024820152600080516020610d8f833981519152604482015290519081900360640190fd5b6008546103e8576040805162461bcd60e51b81526020600482015260136024820152724d7573742073746172742074696d656c6f636b60681b604482015290519081900360640190fd5b436008541115610437576040805162461bcd60e51b815260206004820152601560248201527454696d656c6f636b206e6f7420636f6d706c65746560581b604482015290519081900360640190fd5b600a54600254604080516370a0823160e01b815230600482015290516104c9936001600160a01b039081169316916370a08231916024808301926020929190829003018186803b15801561048a57600080fd5b505afa15801561049e573d6000803e3d6000fd5b505050506040513d60208110156104b457600080fd5b50516002546001600160a01b03169190610978565b506000600855600190565b600a546001600160a01b031681565b600080546001600160a01b03163314610531576040805162461bcd60e51b81526020600482018190526024820152600080516020610d8f833981519152604482015290519081900360640190fd5b50600755600190565b6000546001600160a01b03163314610587576040805162461bcd60e51b81526020600482018190526024820152600080516020610d8f833981519152604482015290519081900360640190fd5b6001600160a01b0381166105cc5760405162461bcd60e51b8152600401808060200182810382526026815260200180610d486026913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461063b576040805162461bcd60e51b81526020600482018190526024820152600080516020610d8f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6002546001600160a01b031681565b6002546000906001600160a01b03838116911614156106b257600080fd5b600a54604080516370a0823160e01b81523060048201529051610742926001600160a01b0390811692908616916370a0823191602480820192602092909190829003018186803b15801561070557600080fd5b505afa158015610719573d6000803e3d6000fd5b505050506040513d602081101561072f57600080fd5b50516001600160a01b0385169190610978565b506001919050565b60085481565b60065481565b60006005544310156107a1576040805162461bcd60e51b815260206004820152600f60248201526e115c1bd8da081b9bdd08195b991959608a1b604482015290519081900360640190fd5b6006546005546107b091610915565b600555600354604080516350ce410960e01b815260006004820181905291516001600160a01b03909316926350ce410992602480840193602093929083900390910190829087803b15801561080457600080fd5b505af1158015610818573d6000803e3d6000fd5b505050506040513d602081101561082e57600080fd5b505060035461085b906001600160a01b0316610848610870565b6002546001600160a01b03169190610978565b50600190565b6003546001600160a01b031681565b600480546040805163170a2ab160e11b8152905160009384936001600160a01b031692632e1455629281830192602092829003018186803b1580156108b457600080fd5b505afa1580156108c8573d6000803e3d6000fd5b505050506040513d60208110156108de57600080fd5b505160075490915061090090620f4240906108fa9084906109cf565b90610a28565b91505090565b6004546001600160a01b031681565b60008282018381101561096f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109ca908490610a6a565b505050565b6000826109de57506000610972565b828202828482816109eb57fe5b041461096f5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d6e6021913960400191505060405180910390fd5b600061096f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b1b565b6060610abf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bbd9092919063ffffffff16565b8051909150156109ca57808060200190516020811015610ade57600080fd5b50516109ca5760405162461bcd60e51b815260040180806020018281038252602a815260200180610daf602a913960400191505060405180910390fd5b60008183610ba75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b6c578181015183820152602001610b54565b50505050905090810190601f168015610b995780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610bb357fe5b0495945050505050565b6060610bcc8484600085610bd4565b949350505050565b6060610bdf85610d41565b610c30576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610c6f5780518252601f199092019160209182019101610c50565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610cd1576040519150601f19603f3d011682016040523d82523d6000602084013e610cd6565b606091505b50915091508115610cea579150610bcc9050565b805115610cfa5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610b6c578181015183820152602001610b54565b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122066958ffd9d3987b958189bb2724fce728aec367b7d36f37d278bf7b2a4de1e3e64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,426 |
0xd8f638bc424efaa66eabc42ba5ce3fea4455c405
|
pragma solidity ^0.4.24;
/**
* @title SafeMath from Zeppelin
* @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 || b == 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);
uint256 c = a / b;
assert(a == b * c + a % b);
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 c) {
c = a + b;
assert(c >= a);
assert(c >= b);
return c;
}
}
/**
* @title ERC20 Interface
*/
contract ERC20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address _owner) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
function allowance(address _owner, address _spender) public view returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* @title Standard ERC20 Token
* @dev This contract is based on Zeppelin StandardToken.sol and MonolithDAO Token.sol
*/
contract StandardERC20Token is ERC20Interface {
using SafeMath for uint256;
// Name of ERC20 token
string public name;
// Symbol of ERC20 token
string public symbol;
// Decimals of ERC20 token
uint8 public decimals;
// Total supply of ERC20 token
uint256 internal supply;
// Mapping of balances
mapping(address => uint256) internal balances;
// Mapping of approval
mapping (address => mapping (address => uint256)) internal allowed;
// Modifier to check the length of msg.data
modifier onlyPayloadSize(uint256 size) {
if(msg.data.length < size.add(4)) {
revert();
}
_;
}
/**
* @dev Don't accept ETH
*/
function () public payable {
revert();
}
/**
* @dev Constructor
*
* @param _issuer The account who owns all tokens
* @param _name The name of the token
* @param _symbol The symbol of the token
* @param _decimals The decimals of the token
* @param _amount The initial amount of the token
*/
constructor(address _issuer, string _name, string _symbol, uint8 _decimals, uint256 _amount) public {
require(_issuer != address(0));
require(bytes(_name).length > 0);
require(bytes(_symbol).length > 0);
require(_decimals <= 18);
require(_amount > 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
supply = _amount.mul(10 ** uint256(decimals));
balances[_issuer] = supply;
}
/**
* @dev Get the total amount of tokens
*
* @return Total amount of tokens
*/
function totalSupply() public view returns (uint256) {
return supply;
}
/**
* @dev Get the balance of the specified address
*
* @param _owner The address from which the balance will be retrieved
* @return The balance
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Transfer token for a specified address
*
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @return Whether the transfer was successful or not
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(64) public returns (bool) {
require(_to != address(0));
require(_value > 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 The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @return Whether the transfer was successful or not
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(96) public returns (bool) {
require(_to != address(0));
require(_value > 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
* To prevent attack described in https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729,
* approve is not allowed when the allowance of specified spender is not zero, call increaseApproval
* or decreaseApproval to change an allowance
*
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @return Whether the approval was successful or not
*/
function approve(address _spender, uint256 _value) onlyPayloadSize(64) public returns (bool) {
require(_value > 0);
require(allowed[msg.sender][_spender] == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
*
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
* @return Amount of remaining tokens allowed to spent
*/
function allowance(address _owner, address _spender) onlyPayloadSize(64) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender
*
* @param _spender The address which will spend the funds
* @param _value The amount of tokens to increase the allowance by
* @return Whether the approval was successful or not
*/
function increaseApproval(address _spender, uint _value) onlyPayloadSize(64) public returns (bool) {
require(_value > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_value);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender
*
* @param _spender The address which will spend the funds
* @param _value The amount of tokens to decrease the allowance by
* @return Whether the approval was successful or not
*/
function decreaseApproval(address _spender, uint _value) onlyPayloadSize(64) public returns (bool) {
require(_value > 0);
uint256 value = allowed[msg.sender][_spender];
if (_value >= value) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = value.sub(_value);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title LongHash ERC20 Token
*/
contract LongHashERC20Token is StandardERC20Token {
// Issuer of tokens
address public issuer;
// Events
event Issuance(address indexed _from, uint256 _amount, uint256 _value);
event Burn(address indexed _from, uint256 _amount, uint256 _value);
// Modifier to check the issuer
modifier onlyIssuer() {
if (msg.sender != issuer) {
revert();
}
_;
}
/**
* @dev Constructor
*
* @param _issuer The account who owns all tokens
* @param _name The name of the token
* @param _symbol The symbol of the token
* @param _decimals The decimals of the token
* @param _amount The initial amount of the token
*/
constructor(address _issuer, string _name, string _symbol, uint8 _decimals, uint256 _amount)
StandardERC20Token(_issuer, _name, _symbol, _decimals, _amount) public {
issuer = _issuer;
}
/**
* @dev Issuing tokens
*
* @param _amount The amount of tokens to be issued
* @return Whether the issuance was successful or not
*/
function issue(uint256 _amount) onlyIssuer() public returns (bool) {
require(_amount > 0);
uint256 value = _amount.mul(10 ** uint256(decimals));
supply = supply.add(value);
balances[issuer] = balances[issuer].add(value);
emit Issuance(msg.sender, _amount, value);
return true;
}
/**
* @dev Burn tokens
*
* @param _amount The amount of tokens to be burned
* @return Whether the burn was successful or not
*/
function burn(uint256 _amount) onlyIssuer() public returns (bool) {
uint256 value;
require(_amount > 0);
value = _amount.mul(10 ** uint256(decimals));
require(supply >= value);
require(balances[issuer] >= value);
supply = supply.sub(value);
balances[issuer] = balances[issuer].sub(value);
emit Burn(msg.sender, _amount, value);
return true;
}
/**
* @dev Change the issuer of tokens
*
* @param _to The new issuer
* @param _transfer Whether transfer the old issuer's tokens to new issuer
* @return Whether the burn was successful or not
*/
function changeIssuer(address _to, bool _transfer) onlyIssuer() public returns (bool) {
require(_to != address(0));
if (_transfer) {
balances[_to] = balances[issuer];
balances[issuer] = 0;
}
issuer = _to;
return true;
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d55780631d1438481461020057806323b872dd14610257578063313ce567146102dc57806342966c681461030d578063661884631461035257806370a08231146103b757806395d89b411461040e578063a9059cbb1461049e578063c1531ecc14610503578063cc872b661461056a578063d73dd623146105af578063dd62ed3e14610614575b600080fd5b3480156100ec57600080fd5b506100f561068b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610729565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea6108dc565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b506102156108e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561026357600080fd5b506102c2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061090c565b604051808215151515815260200191505060405180910390f35b3480156102e857600080fd5b506102f1610d02565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031957600080fd5b5061033860048036038101908080359060200190929190505050610d15565b604051808215151515815260200191505060405180910390f35b34801561035e57600080fd5b5061039d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f82565b604051808215151515815260200191505060405180910390f35b3480156103c357600080fd5b506103f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061124a565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423611293565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610463578082015181840152602081019050610448565b50505050905090810190601f1680156104905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104aa57600080fd5b506104e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611331565b604051808215151515815260200191505060405180910390f35b34801561050f57600080fd5b50610550600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061158c565b604051808215151515815260200191505060405180910390f35b34801561057657600080fd5b5061059560048036038101908080359060200190929190505050611784565b604051808215151515815260200191505060405180910390f35b3480156105bb57600080fd5b506105fa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611970565b604051808215151515815260200191505060405180910390f35b34801561062057600080fd5b50610675600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ba2565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107215780601f106106f657610100808354040283529160200191610721565b820191906000526020600020905b81548152906001019060200180831161070457829003601f168201915b505050505081565b60006040610741600482611c5090919063ffffffff16565b6000369050101561075157600080fd5b60008311151561076057600080fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415156107eb57600080fd5b82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000600354905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006060610924600482611c5090919063ffffffff16565b6000369050101561093457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561097057600080fd5b60008311151561097f57600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156109cd57600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610a5857600080fd5b610aaa83600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7890919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3f83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5090919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c1183600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7890919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600260009054906101000a900460ff1681565b600080600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d7457600080fd5b600083111515610d8357600080fd5b610dab600260009054906101000a900460ff1660ff16600a0a84611c9190919063ffffffff16565b90508060035410151515610dbe57600080fd5b8060046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e2e57600080fd5b610e4381600354611c7890919063ffffffff16565b600381905550610ebd8160046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7890919063ffffffff16565b60046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a8483604051808381526020018281526020019250505060405180910390a26001915050919050565b6000806040610f9b600482611c5090919063ffffffff16565b60003690501015610fab57600080fd5b600084111515610fba57600080fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915081841015156110c9576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061115d565b6110dc8483611c7890919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019250505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113295780601f106112fe57610100808354040283529160200191611329565b820191906000526020600020905b81548152906001019060200180831161130c57829003601f168201915b505050505081565b60006040611349600482611c5090919063ffffffff16565b6000369050101561135957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561139557600080fd5b6000831115156113a457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156113f257600080fd5b61144483600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7890919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114d983600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5090919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115ea57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561162657600080fd5b81156117395760046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600060046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b82600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905092915050565b600080600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e357600080fd5b6000831115156117f257600080fd5b61181a600260009054906101000a900460ff1660ff16600a0a84611c9190919063ffffffff16565b905061183181600354611c5090919063ffffffff16565b6003819055506118ab8160046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5090919063ffffffff16565b60046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fd5b89bc823c11194d40aae5692d8431466d2571ec783854cf60c2f9748aec78b8483604051808381526020018281526020019250505060405180910390a26001915050919050565b60006040611988600482611c5090919063ffffffff16565b6000369050101561199857600080fd5b6000831115156119a757600080fd5b611a3683600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5090919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60006040611bba600482611c5090919063ffffffff16565b60003690501015611bca57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505092915050565b60008183019050828110151515611c6357fe5b818110151515611c6f57fe5b80905092915050565b6000828211151515611c8657fe5b818303905092915050565b600080831480611ca15750600082145b15611caf5760009050611cce565b8183029050818382811515611cc057fe5b04141515611cca57fe5b8090505b929150505600a165627a7a723058204bb4a85385d52629d4e7ccaaec357b5a8ed52780ee579c5bad05cc53d39f6b6e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,427 |
0xedfb3c68b3b116de9c2f2475fe97504e759b9e63
|
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
Couple Inu
https://t.me/coupleinu
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CPINU is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Couple Inu";
string private constant _symbol = 'CPINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152600a81527f436f75706c6520496e7500000000000000000000000000000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612308602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b0316815260208101919091526040016000205491906115ed565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a081611684565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611709565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152600581527f4350494e55000000000000000000000000000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a081611769565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054674563918244f400006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea00000846119b1565b90611a0a565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b815260040180806020018281038252602481526020018061237e6024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806122c56022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123596025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122786023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b81526004018080602001828103825260298152602001806123306029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115905760135477010000000000000000000000000000000000000000000000900460ff16156113e3576001600160a01b038316301480159061131657506001600160a01b0382163014155b801561133057506012546001600160a01b03848116911614155b801561134a57506012546001600160a01b03838116911614155b156113e3576012546001600160a01b03166113636110ce565b6001600160a01b0316148061139257506013546001600160a01b03166113876110ce565b6001600160a01b0316145b6113e3576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b6014548111156113f257600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561143457506001600160a01b03821660009081526007602052604090205460ff16155b61143d57600080fd5b6013546001600160a01b03848116911614801561146857506012546001600160a01b03838116911614155b801561148d57506001600160a01b03821660009081526005602052604090205460ff16155b80156114b6575060135477010000000000000000000000000000000000000000000000900460ff165b156114fe576001600160a01b03821660009081526008602052604090205442116114df57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611509306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff1615801561154657506013546001600160a01b03858116911614155b801561156e5750601354760100000000000000000000000000000000000000000000900460ff165b1561158e5761157c81611769565b47801561158c5761158c47611684565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806115d257506001600160a01b03831660009081526005602052604090205460ff165b156115db575060005b6115e784848484611a4c565b50505050565b6000818484111561167c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611641578181015183820152602001611629565b50505050905090810190601f16801561166e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc61169e836002611a0a565b6040518115909202916000818181858888f193505050501580156116c6573d6000803e3d6000fd5b506011546001600160a01b03166108fc6116e1836002611a0a565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a5482111561174c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061229b602a913960400191505060405180910390fd5b6000611756611b68565b90506117628382611a0a565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055604080516002808252606080830184529260208301908036833701905050905030816000815181106117d757fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561184457600080fd5b505afa158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b505181518290600190811061187f57fe5b6001600160a01b0392831660209182029290920101526012546118a591309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561194457818101518382015260200161192c565b505050509050019650505050505050600060405180830381600087803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b6000826119c057506000610570565b828202828482816119cd57fe5b04146117625760405162461bcd60e51b81526004018080602001828103825260218152602001806122e76021913960400191505060405180910390fd5b600061176283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b8b565b80611a5957611a59611bf0565b6001600160a01b03841660009081526006602052604090205460ff168015611a9a57506001600160a01b03831660009081526006602052604090205460ff16155b15611aaf57611aaa848484611c22565b611b5b565b6001600160a01b03841660009081526006602052604090205460ff16158015611af057506001600160a01b03831660009081526006602052604090205460ff165b15611b0057611aaa848484611d46565b6001600160a01b03841660009081526006602052604090205460ff168015611b4057506001600160a01b03831660009081526006602052604090205460ff165b15611b5057611aaa848484611def565b611b5b848484611e62565b806115e7576115e7611ea6565b6000806000611b75611eb4565b9092509050611b848282611a0a565b9250505090565b60008183611bda5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611641578181015183820152602001611629565b506000838581611be657fe5b0495945050505050565b600c54158015611c005750600d54155b15611c0a57611c20565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c3487612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611c669088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611c959087612090565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cc490866120d2565b6001600160a01b038916600090815260026020526040902055611ce68161212c565b611cf084836121b4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611d5887612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611d8a9087612090565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611dc090846120d2565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611cc490866120d2565b600080600080600080611e0187612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e339088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611d8a9087612090565b600080600080600080611e7487612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c959087612090565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ff357826002600060098481548110611ee457fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611f495750816003600060098481548110611f2257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611f6757600a54683635c9adc5dea000009450945050505061202f565b611fa76002600060098481548110611f7b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612090565b9250611fe96003600060098481548110611fbd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612090565b9150600101611ec8565b50600a5461200a90683635c9adc5dea00000611a0a565b82101561202957600a54683635c9adc5dea0000093509350505061202f565b90925090505b9091565b60008060008060008060008060006120508a600c54600d546121d8565b9250925092506000612060611b68565b905060008060006120738e878787612227565b919e509c509a509598509396509194505050505091939550919395565b600061176283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ed565b600082820183811015611762576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612136611b68565b9050600061214483836119b1565b3060009081526002602052604090205490915061216190826120d2565b3060009081526002602090815260408083209390935560069052205460ff1615610f87573060009081526003602052604090205461219f90846120d2565b30600090815260036020526040902055505050565b600a546121c19083612090565b600a55600b546121d190826120d2565b600b555050565b60008080806121ec606461106389896119b1565b905060006121ff60646110638a896119b1565b90506000612217826122118b86612090565b90612090565b9992985090965090945050505050565b600080808061223688866119b1565b9050600061224488876119b1565b9050600061225288886119b1565b90506000612264826122118686612090565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122054f45f05d12a5fb114da9d61f33c3161bcec29ca5e273df15b549eb7e665ce3264736f6c634300060c0033
|
{"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,428 |
0xf2d8e2e7f355a66d5b05baba3bee295a89796382
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// ----------------------------------------------------------------------------
// US Crypto Bank Token
//
// Deployed to : 0xeD93C9bf1559652dD74CeEFD1192022D32D3DDfe
// Symbol : BANK
// Name : US Crypto Bank
// Total supply: 5,000,000,000
// Decimals :18
//
// Deployed by US Crypto Bank Ecosystem
// ----------------------------------------------------------------------------
/**
* @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 Burn `amount` tokens from 'owner'
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function burn(uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
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;
}
}
/**
* @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 is Context {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
/**
* @dev 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}.
*
* 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 BANK is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimal;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_, uint8 decimal_, uint256 totalSupply_) {
_name = name_;
_symbol = symbol_;
_decimal = decimal_;
_mint(_msgSender(), totalSupply_);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return _decimal;
}
/**
* @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 Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual onlyOwner override returns (bool) {
_burn(_msgSender(), amount);
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);
}
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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342966c681161008c57806395d89b411161006657806395d89b411461019d578063a457c2d7146101a5578063a9059cbb146101b8578063dd62ed3e146101cb576100cf565b806342966c681461016257806370a08231146101755780638da5cb5b14610188576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011257806323b872dd14610127578063313ce5671461013a578063395093511461014f575b600080fd5b6100dc6101de565b6040516100e99190610880565b60405180910390f35b610105610100366004610820565b610270565b6040516100e99190610875565b61011a61028d565b6040516100e99190610b37565b6101056101353660046107e5565b610293565b610142610333565b6040516100e99190610b40565b61010561015d366004610820565b61033c565b610105610170366004610849565b61038b565b61011a610183366004610792565b6103bd565b6101906103d8565b6040516100e99190610861565b6100dc6103e7565b6101056101b3366004610820565b6103f6565b6101056101c6366004610820565b610471565b61011a6101d93660046107b3565b610485565b6060600580546101ed90610b7d565b80601f016020809104026020016040519081016040528092919081815260200182805461021990610b7d565b80156102665780601f1061023b57610100808354040283529160200191610266565b820191906000526020600020905b81548152906001019060200180831161024957829003601f168201915b5050505050905090565b600061028461027d6104b0565b84846104b4565b50600192915050565b60035490565b60006102a0848484610568565b6001600160a01b0384166000908152600260205260408120816102c16104b0565b6001600160a01b03166001600160a01b031681526020019081526020016000205490508281101561030d5760405162461bcd60e51b8152600401610304906109e0565b60405180910390fd5b610328856103196104b0565b6103238685610b66565b6104b4565b506001949350505050565b60045460ff1690565b60006102846103496104b0565b8484600260006103576104b0565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546103239190610b4e565b600080546001600160a01b031633146103a357600080fd5b6103b46103ae6104b0565b83610690565b5060015b919050565b6001600160a01b031660009081526001602052604090205490565b6000546001600160a01b031681565b6060600680546101ed90610b7d565b600080600260006104056104b0565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156104515760405162461bcd60e51b815260040161030490610af2565b61046761045c6104b0565b856103238685610b66565b5060019392505050565b600061028461047e6104b0565b8484610568565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166104da5760405162461bcd60e51b815260040161030490610aae565b6001600160a01b0382166105005760405162461bcd60e51b815260040161030490610958565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061055b908590610b37565b60405180910390a3505050565b6001600160a01b03831661058e5760405162461bcd60e51b815260040161030490610a69565b6001600160a01b0382166105b45760405162461bcd60e51b8152600401610304906108d3565b6105bf838383610776565b6001600160a01b038316600090815260016020526040902054818110156105f85760405162461bcd60e51b81526004016103049061099a565b6106028282610b66565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610638908490610b4e565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106829190610b37565b60405180910390a350505050565b6001600160a01b0382166106b65760405162461bcd60e51b815260040161030490610a28565b6106c282600083610776565b6001600160a01b038216600090815260016020526040902054818110156106fb5760405162461bcd60e51b815260040161030490610916565b6107058282610b66565b6001600160a01b03841660009081526001602052604081209190915560038054849290610733908490610b66565b90915550506040516000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061055b908690610b37565b505050565b80356001600160a01b03811681146103b857600080fd5b6000602082840312156107a3578081fd5b6107ac8261077b565b9392505050565b600080604083850312156107c5578081fd5b6107ce8361077b565b91506107dc6020840161077b565b90509250929050565b6000806000606084860312156107f9578081fd5b6108028461077b565b92506108106020850161077b565b9150604084013590509250925092565b60008060408385031215610832578182fd5b61083b8361077b565b946020939093013593505050565b60006020828403121561085a578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b818110156108ac57858101830151858201604001528201610890565b818111156108bd5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610b6157610b61610bb8565b500190565b600082821015610b7857610b78610bb8565b500390565b600281046001821680610b9157607f821691505b60208210811415610bb257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204aa9e1b7e01806370da826704cf21eb47fb5cc70007f2e0294b7d4e23e26bd0f64736f6c63430008010033
|
{"success": true, "error": null, "results": {}}
| 3,429 |
0x49690541e3f6e933a9aa3cffee6010a7bb5b72d7
|
/*
* @dev This is the Axia Protocol Staking pool 1 contract (Oracle FUND Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 OSP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public OracleIndexFunds;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 86400;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken;
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _oracleindex) public onlyCreator returns (bool success) {
Axiatoken = _axiatoken;
OracleIndexFunds = _oracleindex;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakaingStatus(bool _status) public onlyCreator {
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(OracleIndexFunds).balanceOf(msg.sender) >= _amount, "Insufficient Oracle AFT token balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(OracleIndexFunds).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(OracleIndexFunds).transferFrom(msg.sender, address(this), _amount);
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(OracleIndexFunds).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c806369c18e12116100ad578063b333de2411610071578063b333de24146102da578063b821b6bf146102e2578063c8910913146102ea578063e0287b3e1461033b578063f53d0a8e146103585761012b565b806369c18e12146102525780636b6b6aa41461025a5780637640cb9e14610277578063a43fc87114610294578063aa9a0912146102b15761012b565b80631cfff51b116100f45780631cfff51b146101d95780631e7f87bc146101f55780632bdcd691146101fd578063376edab61461021c5780636387c9491461024a5761012b565b806265318b1461013057806306106eb41461016857806308dbbb031461018c5780631495bf9a146101945780631bf6e00d146101b3575b600080fd5b6101566004803603602081101561014657600080fd5b50356001600160a01b0316610360565b60408051918252519081900360200190f35b6101706103c7565b604080516001600160a01b039092168252519081900360200190f35b6101566103d6565b6101b1600480360360208110156101aa57600080fd5b50356103dc565b005b610156600480360360208110156101c957600080fd5b50356001600160a01b03166103e8565b6101e1610406565b604080519115158252519081900360200190f35b610156610416565b6101b16004803603602081101561021357600080fd5b5035151561041c565b6101e16004803603604081101561023257600080fd5b506001600160a01b0381358116916020013516610483565b6101706104ff565b61015661050e565b6101b16004803603602081101561027057600080fd5b5035610514565b6101e16004803603602081101561028d57600080fd5b503561051d565b6101b1600480360360208110156102aa57600080fd5b5035610592565b610156600480360360608110156102c757600080fd5b50803590602081013590604001356105ea565b61015661069e565b6101566107c8565b6103106004803603602081101561030057600080fd5b50356001600160a01b03166107ce565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101b16004803603602081101561035157600080fd5b5035610825565b610170610873565b6004546001600160a01b0382166000908152600860205260408120600301549091111561038f575060006103c2565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b6001546001600160a01b031681565b60035481565b6103e581610882565b50565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b600a546001600160a01b031633146104655760405162461bcd60e51b8152600401808060200182810382526028815260200180610e326028913960400191505060405180910390fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b600a546000906001600160a01b031633146104cf5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e326028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6000546001600160a01b031681565b60055481565b6103e581610b8f565b600080546001600160a01b031633146105675760405162461bcd60e51b815260040180806020018281038252602b815260200180610d6a602b913960400191505060405180910390fd5b600754600160401b83028161057857fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146105db5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e326028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b60008060006105f98686610d0a565b9150915083811061060657fe5b6000848061061057fe5b868809905082811115610624576001820391505b91829003916000859003851680868161063957fe5b04955080848161064557fe5b04935080816000038161065457fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b6000806106aa33610360565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d602081101561074457600080fd5b505161078c576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b60008060008060006107de610416565b6107e7876103e8565b6107f088610360565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b0316331461086e5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e326028913960400191505060405180910390fd5b600455565b6002546001600160a01b031681565b600254600160a01b900460ff166108e0576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d602081101561095457600080fd5b505110156109935760405162461bcd60e51b8152600401808060200182810382526025815260200180610e0d6025913960400191505060405180910390fd5b600354816109a0336103e8565b0110156109de5760405162461bcd60e51b815260040180806020018281038252603d815260200180610dd0603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610a2e57600080fd5b505afa158015610a42573d6000803e3d6000fd5b505050506040513d6020811015610a5857600080fd5b50511015610a975760405162461bcd60e51b815260040180806020018281038252603b815260200180610d95603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610b2957600080fd5b505af1158015610b3d573d6000803e3d6000fd5b505050506040513d6020811015610b5357600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610b99336103e8565b1015610bd65760405162461bcd60e51b8152600401808060200182810382526032815260200180610d386032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610c5e57600080fd5b505af1158015610c72573d6000803e3d6000fd5b505050506040513d6020811015610c8857600080fd5b5051610cd0576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a350565b6000808060001984860990508385029250828103915082811015610d2f576001820391505b50925092905056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b65496e73756666696369656e74204f7261636c652041465420746f6b656e2062616c616e63654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a26469706673582212208e25232d4ece5d6f73a617f4d36b1ebdd381caee451a12e0317c75a9e8117db164736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,430 |
0x7e124718b46867c758de828a39551d9ac75745df
|
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
contract Context {
constructor () public { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) internal _balances;
mapping (address => mapping (address => uint)) internal _allowances;
mapping (uint => mapping(address => uint)) public tokenHolders;
mapping(uint => address) public addressHolders;
uint internal _totalSupply;
uint public _circulatingSupply;
uint256 count = 1;
uint256 public holdingReward;
address walletAddress = 0xf51690575E82fD91A976A12A9C265651A7B77B3e;
address fundsWallet = 0xfa97Ec471ee2bc062Ba4E13665acc296dFd721BF;
function totalSupply() public view override returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
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);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 _OnePercent = calculateOnePercent(amount);
_burn(msg.sender, _OnePercent);
uint256 _TwoPercent = calculateTwoPercent(amount);
sendToWallet(msg.sender, walletAddress, _TwoPercent);
uint256 _PointTwoPercent = calculatePointTwoPercent(amount);
sendToFundsWallet(msg.sender,fundsWallet,_PointTwoPercent);
divideAmongHolders(_OnePercent, count);
uint256 AmountGranted = amount - ((_OnePercent * 2) + _TwoPercent + _PointTwoPercent);
_balances[recipient] = _balances[recipient].add(AmountGranted);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
tokenHolders[count][recipient] = AmountGranted;
emit Transfer(sender, recipient, AmountGranted);
addressHolders[count] = recipient;
count++;
}
function divideAmongHolders(uint256 _OnePercent, uint256 _count) internal
{
address targetAddress;
holdingReward = _OnePercent / _count;
for(uint256 i = 1; i<=_count ; i++)
{
targetAddress = addressHolders[i];
tokenHolders[i][targetAddress] = tokenHolders[i][targetAddress] + holdingReward;
_balances[targetAddress]= _balances[targetAddress] + holdingReward;
emit Transfer(msg.sender , targetAddress, holdingReward);
}
_balances[msg.sender] = _balances[msg.sender].sub(_OnePercent);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function calculateOnePercent(uint256 amount) internal returns (uint256)
{
uint256 onePercent = 1 * amount / 100;
return onePercent;
}
function calculateTwoPercent(uint256 amount) internal returns (uint256)
{
uint256 twoPercent = 2 * amount / 100;
return twoPercent;
}
function calculatePointTwoPercent(uint256 amount) internal returns (uint256)
{
uint256 twoPercent = amount * 2 / 1000;
return twoPercent;
}
function sendToWallet(address sender, address _wallet, uint256 _TwoPercent) internal
{
_balances[_wallet] = _balances[_wallet].add(_TwoPercent);
_balances[sender] = _balances[sender].sub(_TwoPercent);
emit Transfer(sender, _wallet, _TwoPercent);
}
function sendToFundsWallet(address sender, address _wallet, uint256 _PointTwoPercent) internal
{
_balances[_wallet] = _balances[_wallet].add(_PointTwoPercent);
_balances[sender] = _balances[sender].sub(_PointTwoPercent);
emit Transfer(sender, _wallet, _PointTwoPercent);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
require(_circulatingSupply >= (50000000000000 * (10**18)));
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
_circulatingSupply = _circulatingSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
}
contract ERC20Detailed is ERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract XYZ is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public _owner;
constructor () public ERC20Detailed("DonationToken", "DONO", 18) {
_owner = msg.sender;
_totalSupply = 100000000000000 *(10**uint256(18));
_balances[_owner] = _totalSupply;
// _burn(_owner, 50000000000000 * (10**18));
_circulatingSupply = _totalSupply;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806395d89b4111610097578063adcef8d411610066578063adcef8d414610316578063b2bdfa7b1461031e578063dd62ed3e14610342578063ff0782911461037057610100565b806395d89b41146102ae578063a253c06e146102b6578063a457c2d7146102be578063a9059cbb146102ea57610100565b8063313ce567116100d3578063313ce5671461021257806339509351146102305780635a76665c1461025c57806370a082311461028857610100565b806306fdde0314610105578063095ea7b31461018257806318160ddd146101c257806323b872dd146101dc575b600080fd5b61010d61038d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b038135169060200135610423565b604080519115158252519081900360200190f35b6101ca610440565b60408051918252519081900360200190f35b6101ae600480360360608110156101f257600080fd5b506001600160a01b03813581169160208101359091169060400135610446565b61021a6104cd565b6040805160ff9092168252519081900360200190f35b6101ae6004803603604081101561024657600080fd5b506001600160a01b0381351690602001356104d6565b6101ca6004803603604081101561027257600080fd5b50803590602001356001600160a01b0316610524565b6101ca6004803603602081101561029e57600080fd5b50356001600160a01b0316610541565b61010d61055c565b6101ca6105bd565b6101ae600480360360408110156102d457600080fd5b506001600160a01b0381351690602001356105c3565b6101ae6004803603604081101561030057600080fd5b506001600160a01b03813516906020013561062b565b6101ca61063f565b610326610645565b604080516001600160a01b039092168252519081900360200190f35b6101ca6004803603604081101561035857600080fd5b506001600160a01b0381358116916020013516610659565b6103266004803603602081101561038657600080fd5b5035610684565b600a8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104195780601f106103ee57610100808354040283529160200191610419565b820191906000526020600020905b8154815290600101906020018083116103fc57829003601f168201915b5050505050905090565b600061043761043061069f565b84846106a3565b50600192915050565b60045490565b600061045384848461078f565b6104c38461045f61069f565b6104be85604051806060016040528060288152602001610e14602891396001600160a01b038a1660009081526001602052604081209061049d61069f565b6001600160a01b0316815260208101919091526040016000205491906109b9565b6106a3565b5060019392505050565b600c5460ff1690565b60006104376104e361069f565b846104be85600160006104f461069f565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610a50565b600260209081526000928352604080842090915290825290205481565b6001600160a01b031660009081526020819052604090205490565b600b8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104195780601f106103ee57610100808354040283529160200191610419565b60055481565b60006104376105d061069f565b846104be85604051806060016040528060258152602001610ec660259139600160006105fa61069f565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906109b9565b600061043761063861069f565b848461078f565b60075481565b600c5461010090046001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003602052600090815260409020546001600160a01b031681565b3390565b6001600160a01b0383166106e85760405162461bcd60e51b8152600401808060200182810382526024815260200180610ea26024913960400191505060405180910390fd5b6001600160a01b03821661072d5760405162461bcd60e51b8152600401808060200182810382526022815260200180610dcc6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107d45760405162461bcd60e51b8152600401808060200182810382526025815260200180610e7d6025913960400191505060405180910390fd5b6001600160a01b0382166108195760405162461bcd60e51b8152600401808060200182810382526023815260200180610d876023913960400191505060405180910390fd5b600061082482610ab1565b90506108303382610ac0565b600061083b83610bcb565b6008549091506108569033906001600160a01b031683610bd9565b600061086184610c75565b60095490915061087c9033906001600160a01b031683610bd9565b61088883600654610c84565b6001600160a01b03851660009081526020819052604090205460028402830182018503906108b69082610a50565b600080886001600160a01b03166001600160a01b031681526020019081526020016000208190555061091b85604051806060016040528060268152602001610dee602691396001600160a01b038a1660009081526020819052604090205491906109b9565b6001600160a01b0380891660008181526020818152604080832095909555600654825260028152848220938b16808352938152908490208590558351858152935192939192600080516020610e3c8339815191529281900390910190a3505060068054600090815260036020526040902080546001600160a01b0319166001600160a01b039690961695909517909455505081546001019091555050565b60008184841115610a485760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a0d5781810151838201526020016109f5565b50505050905090810190601f168015610a3a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610aaa576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000806064835b049392505050565b6001600160a01b038216610b055760405162461bcd60e51b8152600401808060200182810382526021815260200180610e5c6021913960400191505060405180910390fd5b6d027716b6a0adc2d677c0800000006005541015610b2257600080fd5b610b5f81604051806060016040528060228152602001610daa602291396001600160a01b03851660009081526020819052604090205491906109b9565b6001600160a01b038316600090815260208190526040902055600454610b859082610d44565b600455600554610b959082610d44565b6005556040805182815290516000916001600160a01b03851691600080516020610e3c8339815191529181900360200190a35050565b600080606460028402610ab8565b6001600160a01b038216600090815260208190526040902054610bfc9082610a50565b6001600160a01b038084166000908152602081905260408082209390935590851681522054610c2b9082610d44565b6001600160a01b03808516600081815260208181526040918290209490945580518581529051928616939192600080516020610e3c833981519152929181900390910190a3505050565b6000806103e860028402610ab8565b6000818381610c8f57fe5b0460075560015b828111610d145760008181526003602090815260408083205460078054600285528386206001600160a01b0390931680875292855283862080549091019055805485855294839020805490950190945592548151908152905192945084923392600080516020610e3c833981519152928290030190a3600101610c96565b5033600090815260208190526040902054610d2f9084610d44565b33600090815260208190526040902055505050565b6000610aaa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506109b956fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122020affff926bc6e882bf198c6770ba1184422fc007b50156d99294450d81c2d3864736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 3,431 |
0xf303506d6853312bc440c5d8b48f56ec620cc167
|
/**
*Submitted for verification at Etherscan.io on 2021-11-19
*
Telegram: t.me/StrongInuEth
Website: https://www.stronginu.com
_____ ___________ _____ _ _ _____ _____ _ _ _ _
/ ___|_ _| ___ \ _ | \ | | __ \ |_ _| \ | | | | |
\ `--. | | | |_/ / | | | \| | | \/ | | | \| | | | |
`--. \ | | | /| | | | . ` | | __ | | | . ` | | | |
/\__/ / | | | |\ \\ \_/ / |\ | |_\ \ _| |_| |\ | |_| |
\____/ \_/ \_| \_|\___/\_| \_/\____/ \___/\_| \_/\___/
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract StrongInu 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 = 'Strong Inu';
string private _symbol = 'SINU ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212206e3fde9ab233e0f95b974c668ca7576e19a4fe9e94ff5912e38bbeb4c38cdbdd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,432 |
0x8646fb0aaf3643b882d34407857f1fed78e604f5
|
pragma solidity ^0.4.21;
// File: contracts/lib/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/lib/token/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/lib/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;
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/lib/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: contracts/lib/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);
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/VLT.sol
contract VLT is StandardToken {
string public name = "VLT Token";
string public symbol = "VLT";
uint public decimals = 18;
address public owner;
mapping(address => bool) admins;
event Mint(address indexed to, uint256 amount);
modifier onlyAdmin() {
require(admins[msg.sender] == true);
_;
}
constructor(uint initialSupply) public {
totalSupply_ = initialSupply;
balances[msg.sender] = initialSupply;
owner = msg.sender;
admins[msg.sender] = true;
}
function addAdmin(address _newAdmin) onlyAdmin public {
require(_newAdmin != 0x0 && !admins[_newAdmin]);
admins[_newAdmin] = true;
}
function revokeAdmin(address _admin) onlyAdmin public {
require(_admin != 0x0 && admins[_admin]);
admins[_admin] = false;
}
/**
* @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) onlyAdmin public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
}
|
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c85780632d345670146101f2578063313ce5671461021557806340c10f191461022a578063661884631461024e578063704802751461027257806370a08231146102935780638da5cb5b146102b457806395d89b41146102e5578063a9059cbb146102fa578063d73dd6231461031e578063dd62ed3e14610342575b600080fd5b3480156100eb57600080fd5b506100f4610369565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a03600435166024356103f7565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b6610461565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a0360043581169060243516604435610467565b3480156101fe57600080fd5b50610213600160a060020a03600435166105e7565b005b34801561022157600080fd5b506101b661066d565b34801561023657600080fd5b5061018d600160a060020a0360043516602435610673565b34801561025a57600080fd5b5061018d600160a060020a0360043516602435610776565b34801561027e57600080fd5b50610213600160a060020a036004351661086f565b34801561029f57600080fd5b506101b6600160a060020a03600435166108f9565b3480156102c057600080fd5b506102c9610914565b60408051600160a060020a039092168252519081900360200190f35b3480156102f157600080fd5b506100f4610923565b34801561030657600080fd5b5061018d600160a060020a036004351660243561097e565b34801561032a57600080fd5b5061018d600160a060020a0360043516602435610a77565b34801561034e57600080fd5b506101b6600160a060020a0360043581169060243516610b19565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ef5780601f106103c4576101008083540402835291602001916103ef565b820191906000526020600020905b8154815290600101906020018083116103d257829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b6000600160a060020a038316151561047e57600080fd5b600160a060020a0384166000908152602081905260409020548211156104a357600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156104d657600080fd5b600160a060020a0384166000908152602081905260409020546104ff908363ffffffff610b4416565b600160a060020a038086166000908152602081905260408082209390935590851681522054610534908363ffffffff610b5616565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461057a908363ffffffff610b4416565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600160a060020a03331660009081526007602052604090205460ff16151560011461061157600080fd5b600160a060020a038116158015906106415750600160a060020a03811660009081526007602052604090205460ff165b151561064c57600080fd5b600160a060020a03166000908152600760205260409020805460ff19169055565b60055481565b600160a060020a03331660009081526007602052604081205460ff16151560011461069d57600080fd5b6001546106b0908363ffffffff610b5616565b600155600160a060020a0383166000908152602081905260409020546106dc908363ffffffff610b5616565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156107d357600160a060020a03338116600090815260026020908152604080832093881683529290529081205561080a565b6107e3818463ffffffff610b4416565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a03331660009081526007602052604090205460ff16151560011461089957600080fd5b600160a060020a038116158015906108ca5750600160a060020a03811660009081526007602052604090205460ff16155b15156108d557600080fd5b600160a060020a03166000908152600760205260409020805460ff19166001179055565b600160a060020a031660009081526020819052604090205490565b600654600160a060020a031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ef5780601f106103c4576101008083540402835291602001916103ef565b6000600160a060020a038316151561099557600080fd5b600160a060020a0333166000908152602081905260409020548211156109ba57600080fd5b600160a060020a0333166000908152602081905260409020546109e3908363ffffffff610b4416565b600160a060020a033381166000908152602081905260408082209390935590851681522054610a18908363ffffffff610b5616565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610aaf908363ffffffff610b5616565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600082821115610b5057fe5b50900390565b81810182811015610b6357fe5b929150505600a165627a7a72305820f50c740bf235848b17ef21eb1497b158afda4ef125786cac7e2d9354c3de7b850029
|
{"success": true, "error": null, "results": {}}
| 3,433 |
0x48Bebfd3252dF641287241652c4d954e54F9a302
|
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event NewGracePeriod(uint indexed newGracePeriod);
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);
address public admin;
address public pendingAdmin;
uint public delay;
uint public gracePeriod;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_, uint gracePeriod_) public {
require(delay_ > 0, "Timelock::constructor: Delay must be larger than 0.");
require(gracePeriod_ > 0, "Timelock::constructor: Delay must be larger than 0.");
admin = admin_;
delay = delay_;
gracePeriod = gracePeriod_;
}
function() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ > 0, "Timelock::setDelay: Delay must be larger than 0.");
delay = delay_;
emit NewDelay(delay);
}
function setGracePeriod(uint gracePeriod_) public {
require(msg.sender == address(this), "Timelock::setGracePeriod: Call must come from Timelock.");
require(gracePeriod_ > 0, "Timelock::setGracePeriod: Grace period must be larger than 0.");
gracePeriod = gracePeriod_;
emit NewGracePeriod(gracePeriod);
}
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) || msg.sender == admin, "Timelock::setPendingAdmin: Call must come from Timelock or admin.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(gracePeriod), "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;
}
}
|
0x6080604052600436106100a75760003560e01c80636a42b8f8116100645780636a42b8f814610583578063a06db7dc14610598578063e177246e146105ad578063f2b06537146105d7578063f2f6596014610615578063f851a4401461063f576100a7565b80630825f38f146100a95780630e18b6811461025e57806326782247146102735780633a66f901146102a45780634dd18bf514610403578063591fcdfe14610436575b005b6101e9600480360360a08110156100bf57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156100ee57600080fd5b82018360208201111561010057600080fd5b803590602001918460018302840111600160201b8311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561017357600080fd5b82018360208201111561018557600080fd5b803590602001918460018302840111600160201b831117156101a657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610654915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022357818101518382015260200161020b565b50505050905090810190601f1680156102505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026a57600080fd5b506100a7610b6e565b34801561027f57600080fd5b50610288610c0a565b604080516001600160a01b039092168252519081900360200190f35b3480156102b057600080fd5b506103f1600480360360a08110156102c757600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156102f657600080fd5b82018360208201111561030857600080fd5b803590602001918460018302840111600160201b8311171561032957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561037b57600080fd5b82018360208201111561038d57600080fd5b803590602001918460018302840111600160201b831117156103ae57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c19915050565b60408051918252519081900360200190f35b34801561040f57600080fd5b506100a76004803603602081101561042657600080fd5b50356001600160a01b0316610f2a565b34801561044257600080fd5b506100a7600480360360a081101561045957600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561048857600080fd5b82018360208201111561049a57600080fd5b803590602001918460018302840111600160201b831117156104bb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561050d57600080fd5b82018360208201111561051f57600080fd5b803590602001918460018302840111600160201b8311171561054057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610fcd915050565b34801561058f57600080fd5b506103f1611283565b3480156105a457600080fd5b506103f1611289565b3480156105b957600080fd5b506100a7600480360360208110156105d057600080fd5b503561128f565b3480156105e357600080fd5b50610601600480360360208110156105fa57600080fd5b503561133f565b604080519115158252519081900360200190f35b34801561062157600080fd5b506100a76004803603602081101561063857600080fd5b5035611354565b34801561064b57600080fd5b50610288611404565b6000546060906001600160a01b031633146106a05760405162461bcd60e51b81526004018080602001828103825260388152602001806114796038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561070f5781810151838201526020016106f7565b50505050905090810190601f16801561073c5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561076f578181015183820152602001610757565b50505050905090810190601f16801561079c5780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291815281516020928301206000818152600490935291205490995060ff16975061080d96505050505050505760405162461bcd60e51b815260040180806020018281038252603d8152602001806115de603d913960400191505060405180910390fd5b82610816611413565b10156108535760405162461bcd60e51b81526004018080602001828103825260458152602001806115996045913960600191505060405180910390fd5b60035461086790849063ffffffff61141716565b61086f611413565b11156108ac5760405162461bcd60e51b81526004018080602001828103825260338152602001806115666033913960400191505060405180910390fd5b6000818152600460205260409020805460ff1916905584516060906108d257508361095f565b85805190602001208560405160200180836001600160e01b0319166001600160e01b031916815260040182805190602001908083835b602083106109275780518252601f199092019160209182019101610908565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b6020831061099e5780518252601f19909201916020918201910161097f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a00576040519150601f19603f3d011682016040523d82523d6000602084013e610a05565b606091505b509150915081610a465760405162461bcd60e51b815260040180806020018281038252603d8152602001806116b9603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610ac3578181015183820152602001610aab565b50505050905090810190601f168015610af05780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b23578181015183820152602001610b0b565b50505050905090810190601f168015610b505780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610bb75760405162461bcd60e51b815260040180806020018281038252603881526020018061161b6038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610c635760405162461bcd60e51b81526004018080602001828103825260368152602001806116836036913960400191505060405180910390fd5b610c7d600254610c71611413565b9063ffffffff61141716565b821015610cbb5760405162461bcd60e51b81526004018080602001828103825260498152602001806116f66049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d2a578181015183820152602001610d12565b50505050905090810190601f168015610d575780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610d8a578181015183820152602001610d72565b50505050905090810190601f168015610db75780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e82578181015183820152602001610e6a565b50505050905090810190601f168015610eaf5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610ee2578181015183820152602001610eca565b50505050905090810190601f168015610f0f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b33301480610f4257506000546001600160a01b031633145b610f7d5760405162461bcd60e51b81526004018080602001828103825260418152602001806114e86041913960600191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b031633146110165760405162461bcd60e51b81526004018080602001828103825260378152602001806114b16037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561108557818101518382015260200161106d565b50505050905090810190601f1680156110b25780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156110e55781810151838201526020016110cd565b50505050905090810190601f1680156111125780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156111dd5781810151838201526020016111c5565b50505050905090810190601f16801561120a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561123d578181015183820152602001611225565b50505050905090810190601f16801561126a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b60035481565b3330146112cd5760405162461bcd60e51b815260040180806020018281038252603181526020018061173f6031913960400191505060405180910390fd5b6000811161130c5760405162461bcd60e51b81526004018080602001828103825260308152602001806116536030913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60046020526000908152604090205460ff1681565b3330146113925760405162461bcd60e51b81526004018080602001828103825260378152602001806117706037913960400191505060405180910390fd5b600081116113d15760405162461bcd60e51b815260040180806020018281038252603d815260200180611529603d913960400191505060405180910390fd5b600381905560405181907f85d1b5a7c3e5a760d339fd0c96173b84d1ccfc4fc4824c1b1b85f6526ee3f2f290600090a250565b6000546001600160a01b031681565b4290565b600082820183811015611471576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b206f722061646d696e2e54696d656c6f636b3a3a7365744772616365506572696f643a20477261636520706572696f64206d757374206265206c6172676572207468616e20302e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206265206c6172676572207468616e20302e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a7365744772616365506572696f643a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a72315820440ed7280eade9d2869cb1be7319c3a5f8c6923b5c0a63f8ea88a4d63b15b9e564736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 3,434 |
0x5f32610817a6c1504baf011770646b81bcaba6ae
|
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
//CheddaTama:Hybrid between Chedda and Saitama the ultimate collaboration
//
//https://www.cheddatama.com
//
//https://t.me/CheddaTama
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CheddaTama is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "CheddaTama";
string private constant _symbol = "CheddaTama";
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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xf64551D7dDDf1Da988Ae9FAACbeDd226a00678b9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000000 * 10**9; //0.5% of total supply per txn
uint256 public _maxWalletSize = 2000000000000 * 10**9; //2% of total supply
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
bots[address(0x00000000000000000000000000000000001)] = 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(preTrader[from], "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) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd79284146104fa578063c3c8cd801461052a578063dd62ed3e1461053f578063ea1644d51461058557600080fd5b806398a5c3151461046a578063a2a957bb1461048a578063a9059cbb146104aa578063bdd795ef146104ca57600080fd5b80638da5cb5b116100d15780638da5cb5b146104165780638f70ccf7146104345780638f9a55c01461045457806395d89b41146101f357600080fd5b8063715018a6146103cb57806374010ece146103e05780637d1db4a51461040057600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103565780636d8aa8f8146103765780636fc3eaec1461039657806370a08231146103ab57600080fd5b80632fd689e314610304578063313ce5671461031a57806349bd5a5e1461033657600080fd5b80631694505e116101a05780631694505e1461026557806318160ddd1461029d57806323b872dd146102c45780632f9c4569146102e457600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023557600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec3660046118cb565b6105a5565b005b3480156101ff57600080fd5b50604080518082018252600a81526943686564646154616d6160b01b6020820152905161022c91906119fd565b60405180910390f35b34801561024157600080fd5b5061025561025036600461189f565b610644565b604051901515815260200161022c565b34801561027157600080fd5b50601454610285906001600160a01b031681565b6040516001600160a01b03909116815260200161022c565b3480156102a957600080fd5b5069152d02c7e14af68000005b60405190815260200161022c565b3480156102d057600080fd5b506102556102df366004611829565b61065b565b3480156102f057600080fd5b506101f16102ff36600461186a565b6106c4565b34801561031057600080fd5b506102b660185481565b34801561032657600080fd5b506040516009815260200161022c565b34801561034257600080fd5b50601554610285906001600160a01b031681565b34801561036257600080fd5b506101f16103713660046117b6565b610788565b34801561038257600080fd5b506101f1610391366004611997565b6107d3565b3480156103a257600080fd5b506101f161081b565b3480156103b757600080fd5b506102b66103c63660046117b6565b610848565b3480156103d757600080fd5b506101f161086a565b3480156103ec57600080fd5b506101f16103fb3660046119b2565b6108de565b34801561040c57600080fd5b506102b660165481565b34801561042257600080fd5b506000546001600160a01b0316610285565b34801561044057600080fd5b506101f161044f366004611997565b61090d565b34801561046057600080fd5b506102b660175481565b34801561047657600080fd5b506101f16104853660046119b2565b610955565b34801561049657600080fd5b506101f16104a53660046119cb565b610984565b3480156104b657600080fd5b506102556104c536600461189f565b6109c2565b3480156104d657600080fd5b506102556104e53660046117b6565b60116020526000908152604090205460ff1681565b34801561050657600080fd5b506102556105153660046117b6565b60106020526000908152604090205460ff1681565b34801561053657600080fd5b506101f16109cf565b34801561054b57600080fd5b506102b661055a3660046117f0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059157600080fd5b506101f16105a03660046119b2565b610a05565b6000546001600160a01b031633146105d85760405162461bcd60e51b81526004016105cf90611a52565b60405180910390fd5b60005b8151811015610640576001601060008484815181106105fc576105fc611b99565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063881611b68565b9150506105db565b5050565b6000610651338484610a34565b5060015b92915050565b6000610668848484610b58565b6106ba84336106b585604051806060016040528060288152602001611bdb602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061105b565b610a34565b5060019392505050565b6000546001600160a01b031633146106ee5760405162461bcd60e51b81526004016105cf90611a52565b6001600160a01b03821660009081526011602052604090205460ff161515811515141561075d5760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105cf565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107b25760405162461bcd60e51b81526004016105cf90611a52565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107fd5760405162461bcd60e51b81526004016105cf90611a52565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461083b57600080fd5b4761084581611095565b50565b6001600160a01b038116600090815260026020526040812054610655906110cf565b6000546001600160a01b031633146108945760405162461bcd60e51b81526004016105cf90611a52565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109085760405162461bcd60e51b81526004016105cf90611a52565b601655565b6000546001600160a01b031633146109375760405162461bcd60e51b81526004016105cf90611a52565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461097f5760405162461bcd60e51b81526004016105cf90611a52565b601855565b6000546001600160a01b031633146109ae5760405162461bcd60e51b81526004016105cf90611a52565b600893909355600a91909155600955600b55565b6000610651338484610b58565b6013546001600160a01b0316336001600160a01b0316146109ef57600080fd5b60006109fa30610848565b905061084581611153565b6000546001600160a01b03163314610a2f5760405162461bcd60e51b81526004016105cf90611a52565b601755565b6001600160a01b038316610a965760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105cf565b6001600160a01b038216610af75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105cf565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bbc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105cf565b6001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105cf565b60008111610c805760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105cf565b6000546001600160a01b03848116911614801590610cac57506000546001600160a01b03838116911614155b15610f4e57601554600160a01b900460ff16610d50576001600160a01b03831660009081526011602052604090205460ff16610d505760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105cf565b601654811115610da25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105cf565b6001600160a01b03831660009081526010602052604090205460ff16158015610de457506001600160a01b03821660009081526010602052604090205460ff16155b610e3c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105cf565b6015546001600160a01b03838116911614610ec15760175481610e5e84610848565b610e689190611af8565b10610ec15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105cf565b6000610ecc30610848565b601854601654919250821015908210610ee55760165491505b808015610efc5750601554600160a81b900460ff16155b8015610f1657506015546001600160a01b03868116911614155b8015610f2b5750601554600160b01b900460ff165b15610f4b57610f3982611153565b478015610f4957610f4947611095565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f9057506001600160a01b03831660009081526005602052604090205460ff165b80610fc257506015546001600160a01b03858116911614801590610fc257506015546001600160a01b03848116911614155b15610fcf57506000611049565b6015546001600160a01b038581169116148015610ffa57506014546001600160a01b03848116911614155b1561100c57600854600c55600954600d555b6015546001600160a01b03848116911614801561103757506014546001600160a01b03858116911614155b1561104957600a54600c55600b54600d555b611055848484846112dc565b50505050565b6000818484111561107f5760405162461bcd60e51b81526004016105cf91906119fd565b50600061108c8486611b51565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610640573d6000803e3d6000fd5b60006006548211156111365760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105cf565b600061114061130a565b905061114c838261132d565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061119b5761119b611b99565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111ef57600080fd5b505afa158015611203573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122791906117d3565b8160018151811061123a5761123a611b99565b6001600160a01b0392831660209182029290920101526014546112609130911684610a34565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611299908590600090869030904290600401611a87565b600060405180830381600087803b1580156112b357600080fd5b505af11580156112c7573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806112e9576112e961136f565b6112f484848461139d565b8061105557611055600e54600c55600f54600d55565b6000806000611317611494565b9092509050611326828261132d565b9250505090565b600061114c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114d8565b600c5415801561137f5750600d54155b1561138657565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806113af87611506565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113e19087611563565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461141090866115a5565b6001600160a01b03891660009081526002602052604090205561143281611604565b61143c848361164e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161148191815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af68000006114b1828261132d565b8210156114cf5750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836114f95760405162461bcd60e51b81526004016105cf91906119fd565b50600061108c8486611b10565b60008060008060008060008060006115238a600c54600d54611672565b925092509250600061153361130a565b905060008060006115468e8787876116c7565b919e509c509a509598509396509194505050505091939550919395565b600061114c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061105b565b6000806115b28385611af8565b90508381101561114c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105cf565b600061160e61130a565b9050600061161c8383611717565b3060009081526002602052604090205490915061163990826115a5565b30600090815260026020526040902055505050565b60065461165b9083611563565b60065560075461166b90826115a5565b6007555050565b600080808061168c60646116868989611717565b9061132d565b9050600061169f60646116868a89611717565b905060006116b7826116b18b86611563565b90611563565b9992985090965090945050505050565b60008080806116d68886611717565b905060006116e48887611717565b905060006116f28888611717565b90506000611704826116b18686611563565b939b939a50919850919650505050505050565b60008261172657506000610655565b60006117328385611b32565b90508261173f8583611b10565b1461114c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105cf565b80356117a181611bc5565b919050565b803580151581146117a157600080fd5b6000602082840312156117c857600080fd5b813561114c81611bc5565b6000602082840312156117e557600080fd5b815161114c81611bc5565b6000806040838503121561180357600080fd5b823561180e81611bc5565b9150602083013561181e81611bc5565b809150509250929050565b60008060006060848603121561183e57600080fd5b833561184981611bc5565b9250602084013561185981611bc5565b929592945050506040919091013590565b6000806040838503121561187d57600080fd5b823561188881611bc5565b9150611896602084016117a6565b90509250929050565b600080604083850312156118b257600080fd5b82356118bd81611bc5565b946020939093013593505050565b600060208083850312156118de57600080fd5b823567ffffffffffffffff808211156118f657600080fd5b818501915085601f83011261190a57600080fd5b81358181111561191c5761191c611baf565b8060051b604051601f19603f8301168101818110858211171561194157611941611baf565b604052828152858101935084860182860187018a101561196057600080fd5b600095505b8386101561198a5761197681611796565b855260019590950194938601938601611965565b5098975050505050505050565b6000602082840312156119a957600080fd5b61114c826117a6565b6000602082840312156119c457600080fd5b5035919050565b600080600080608085870312156119e157600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611a2a57858101830151858201604001528201611a0e565b81811115611a3c576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ad75784516001600160a01b031683529383019391830191600101611ab2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0b57611b0b611b83565b500190565b600082611b2d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b4c57611b4c611b83565b500290565b600082821015611b6357611b63611b83565b500390565b6000600019821415611b7c57611b7c611b83565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461084557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208b1a8f4fcee8a6f932684dd82eeed28c90288c4ba17ade8312ac55f4b6ec04f364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,435 |
0x410cd9c2a530dece8779b261cdeac73fc85d1a3b
|
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
/*
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─██████████████─██████──────────██████─██████████─██████──────────██████─██████████████────██████████─██████──────────██████─██████──██████─
─██░░░░░░░░░░██─██░░██████████──██░░██─██░░░░░░██─██░░██████████████░░██─██░░░░░░░░░░██────██░░░░░░██─██░░██████████──██░░██─██░░██──██░░██─
─██░░██████░░██─██░░░░░░░░░░██──██░░██─████░░████─██░░░░░░░░░░░░░░░░░░██─██░░██████████────████░░████─██░░░░░░░░░░██──██░░██─██░░██──██░░██─
─██░░██──██░░██─██░░██████░░██──██░░██───██░░██───██░░██████░░██████░░██─██░░██──────────────██░░██───██░░██████░░██──██░░██─██░░██──██░░██─
─██░░██████░░██─██░░██──██░░██──██░░██───██░░██───██░░██──██░░██──██░░██─██░░██████████──────██░░██───██░░██──██░░██──██░░██─██░░██──██░░██─
─██░░░░░░░░░░██─██░░██──██░░██──██░░██───██░░██───██░░██──██░░██──██░░██─██░░░░░░░░░░██──────██░░██───██░░██──██░░██──██░░██─██░░██──██░░██─
─██░░██████░░██─██░░██──██░░██──██░░██───██░░██───██░░██──██████──██░░██─██░░██████████──────██░░██───██░░██──██░░██──██░░██─██░░██──██░░██─
─██░░██──██░░██─██░░██──██░░██████░░██───██░░██───██░░██──────────██░░██─██░░██──────────────██░░██───██░░██──██░░██████░░██─██░░██──██░░██─
─██░░██──██░░██─██░░██──██░░░░░░░░░░██─████░░████─██░░██──────────██░░██─██░░██████████────████░░████─██░░██──██░░░░░░░░░░██─██░░██████░░██─
─██░░██──██░░██─██░░██──██████████░░██─██░░░░░░██─██░░██──────────██░░██─██░░░░░░░░░░██────██░░░░░░██─██░░██──██████████░░██─██░░░░░░░░░░██─
─██████──██████─██████──────────██████─██████████─██████──────────██████─██████████████────██████████─██████──────────██████─██████████████─
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ANIME INU has now arrived on the Ethereum blockchain to declare and expand the ever-growing Anime meta verse concept.
The roadmap covers a NFT marketplace, comic books and more following this series.
Telegram :https://t.me/animeinueth
*/
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 ANIMEINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Anime Inu";
string private constant _symbol = "ANIME";
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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0xb8aDD6e816e5AeD7B0cCC8cB107e34dD1C800060);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000000 * 10**9; //1
uint256 public _maxWalletSize = 2000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = 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(preTrader[from], "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) {
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 {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd792841461052a578063c3c8cd801461055a578063dd62ed3e1461056f578063ea1644d5146105b557600080fd5b806398a5c3151461049a578063a2a957bb146104ba578063a9059cbb146104da578063bdd795ef146104fa57600080fd5b80638da5cb5b116100d15780638da5cb5b146104185780638f70ccf7146104365780638f9a55c01461045657806395d89b411461046c57600080fd5b8063715018a6146103cd57806374010ece146103e25780637d1db4a51461040257600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103585780636d8aa8f8146103785780636fc3eaec1461039857806370a08231146103ad57600080fd5b80632fd689e314610306578063313ce5671461031c57806349bd5a5e1461033857600080fd5b80631694505e116101a05780631694505e1461026757806318160ddd1461029f57806323b872dd146102c65780632f9c4569146102e657600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023757600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461191f565b6105d5565b005b3480156101ff57600080fd5b50604080518082019091526009815268416e696d6520496e7560b81b60208201525b60405161022e9190611a49565b60405180910390f35b34801561024357600080fd5b506102576102523660046118f4565b610682565b604051901515815260200161022e565b34801561027357600080fd5b50601454610287906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b3480156102ab57600080fd5b5069152d02c7e14af68000005b60405190815260200161022e565b3480156102d257600080fd5b506102576102e1366004611880565b610699565b3480156102f257600080fd5b506101f16103013660046118c0565b610702565b34801561031257600080fd5b506102b860185481565b34801561032857600080fd5b506040516009815260200161022e565b34801561034457600080fd5b50601554610287906001600160a01b031681565b34801561036457600080fd5b506101f1610373366004611810565b6107c6565b34801561038457600080fd5b506101f16103933660046119e6565b610811565b3480156103a457600080fd5b506101f1610859565b3480156103b957600080fd5b506102b86103c8366004611810565b610886565b3480156103d957600080fd5b506101f16108a8565b3480156103ee57600080fd5b506101f16103fd366004611a00565b61091c565b34801561040e57600080fd5b506102b860165481565b34801561042457600080fd5b506000546001600160a01b0316610287565b34801561044257600080fd5b506101f16104513660046119e6565b61094b565b34801561046257600080fd5b506102b860175481565b34801561047857600080fd5b50604080518082019091526005815264414e494d4560d81b6020820152610221565b3480156104a657600080fd5b506101f16104b5366004611a00565b610993565b3480156104c657600080fd5b506101f16104d5366004611a18565b6109c2565b3480156104e657600080fd5b506102576104f53660046118f4565b610a00565b34801561050657600080fd5b50610257610515366004611810565b60116020526000908152604090205460ff1681565b34801561053657600080fd5b50610257610545366004611810565b60106020526000908152604090205460ff1681565b34801561056657600080fd5b506101f1610a0d565b34801561057b57600080fd5b506102b861058a366004611848565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c157600080fd5b506101f16105d0366004611a00565b610a43565b6000546001600160a01b031633146106085760405162461bcd60e51b81526004016105ff90611a9c565b60405180910390fd5b60005b815181101561067e5760016010600084848151811061063a57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067681611baf565b91505061060b565b5050565b600061068f338484610a72565b5060015b92915050565b60006106a6848484610b96565b6106f884336106f385604051806060016040528060288152602001611c0c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611099565b610a72565b5060019392505050565b6000546001600160a01b0316331461072c5760405162461bcd60e51b81526004016105ff90611a9c565b6001600160a01b03821660009081526011602052604090205460ff161515811515141561079b5760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105ff565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f05760405162461bcd60e51b81526004016105ff90611a9c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461083b5760405162461bcd60e51b81526004016105ff90611a9c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087957600080fd5b47610883816110d3565b50565b6001600160a01b0381166000908152600260205260408120546106939061110d565b6000546001600160a01b031633146108d25760405162461bcd60e51b81526004016105ff90611a9c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109465760405162461bcd60e51b81526004016105ff90611a9c565b601655565b6000546001600160a01b031633146109755760405162461bcd60e51b81526004016105ff90611a9c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109bd5760405162461bcd60e51b81526004016105ff90611a9c565b601855565b6000546001600160a01b031633146109ec5760405162461bcd60e51b81526004016105ff90611a9c565b600893909355600a91909155600955600b55565b600061068f338484610b96565b6013546001600160a01b0316336001600160a01b031614610a2d57600080fd5b6000610a3830610886565b905061088381611191565b6000546001600160a01b03163314610a6d5760405162461bcd60e51b81526004016105ff90611a9c565b601755565b6001600160a01b038316610ad45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ff565b6001600160a01b038216610b355760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ff565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bfa5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ff565b6001600160a01b038216610c5c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ff565b60008111610cbe5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ff565b6000546001600160a01b03848116911614801590610cea57506000546001600160a01b03838116911614155b15610f8c57601554600160a01b900460ff16610d8e576001600160a01b03831660009081526011602052604090205460ff16610d8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ff565b601654811115610de05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ff565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2257506001600160a01b03821660009081526010602052604090205460ff16155b610e7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ff565b6015546001600160a01b03838116911614610eff5760175481610e9c84610886565b610ea69190611b41565b10610eff5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ff565b6000610f0a30610886565b601854601654919250821015908210610f235760165491505b808015610f3a5750601554600160a81b900460ff16155b8015610f5457506015546001600160a01b03868116911614155b8015610f695750601554600160b01b900460ff165b15610f8957610f7782611191565b478015610f8757610f87476110d3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fce57506001600160a01b03831660009081526005602052604090205460ff165b8061100057506015546001600160a01b0385811691161480159061100057506015546001600160a01b03848116911614155b1561100d57506000611087565b6015546001600160a01b03858116911614801561103857506014546001600160a01b03848116911614155b1561104a57600854600c55600954600d555b6015546001600160a01b03848116911614801561107557506014546001600160a01b03858116911614155b1561108757600a54600c55600b54600d555b61109384848484611336565b50505050565b600081848411156110bd5760405162461bcd60e51b81526004016105ff9190611a49565b5060006110ca8486611b98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561067e573d6000803e3d6000fd5b60006006548211156111745760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ff565b600061117e611364565b905061118a8382611387565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123b57600080fd5b505afa15801561124f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611273919061182c565b8160018151811061129457634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112ba9130911684610a72565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f3908590600090869030904290600401611ad1565b600060405180830381600087803b15801561130d57600080fd5b505af1158015611321573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611343576113436113c9565b61134e8484846113f7565b8061109357611093600e54600c55600f54600d55565b60008060006113716114ee565b90925090506113808282611387565b9250505090565b600061118a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611532565b600c541580156113d95750600d54155b156113e057565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061140987611560565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143b90876115bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146a90866115ff565b6001600160a01b03891660009081526002602052604090205561148c8161165e565b61149684836116a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114db91815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af680000061150b8282611387565b8210156115295750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115535760405162461bcd60e51b81526004016105ff9190611a49565b5060006110ca8486611b59565b600080600080600080600080600061157d8a600c54600d546116cc565b925092509250600061158d611364565b905060008060006115a08e878787611721565b919e509c509a509598509396509194505050505091939550919395565b600061118a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611099565b60008061160c8385611b41565b90508381101561118a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ff565b6000611668611364565b905060006116768383611771565b3060009081526002602052604090205490915061169390826115ff565b30600090815260026020526040902055505050565b6006546116b590836115bd565b6006556007546116c590826115ff565b6007555050565b60008080806116e660646116e08989611771565b90611387565b905060006116f960646116e08a89611771565b905060006117118261170b8b866115bd565b906115bd565b9992985090965090945050505050565b60008080806117308886611771565b9050600061173e8887611771565b9050600061174c8888611771565b9050600061175e8261170b86866115bd565b939b939a50919850919650505050505050565b60008261178057506000610693565b600061178c8385611b79565b9050826117998583611b59565b1461118a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ff565b80356117fb81611bf6565b919050565b803580151581146117fb57600080fd5b600060208284031215611821578081fd5b813561118a81611bf6565b60006020828403121561183d578081fd5b815161118a81611bf6565b6000806040838503121561185a578081fd5b823561186581611bf6565b9150602083013561187581611bf6565b809150509250929050565b600080600060608486031215611894578081fd5b833561189f81611bf6565b925060208401356118af81611bf6565b929592945050506040919091013590565b600080604083850312156118d2578182fd5b82356118dd81611bf6565b91506118eb60208401611800565b90509250929050565b60008060408385031215611906578182fd5b823561191181611bf6565b946020939093013593505050565b60006020808385031215611931578182fd5b823567ffffffffffffffff80821115611948578384fd5b818501915085601f83011261195b578384fd5b81358181111561196d5761196d611be0565b8060051b604051601f19603f8301168101818110858211171561199257611992611be0565b604052828152858101935084860182860187018a10156119b0578788fd5b8795505b838610156119d9576119c5816117f0565b8552600195909501949386019386016119b4565b5098975050505050505050565b6000602082840312156119f7578081fd5b61118a82611800565b600060208284031215611a11578081fd5b5035919050565b60008060008060808587031215611a2d578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7557858101830151858201604001528201611a59565b81811115611a865783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b205784516001600160a01b031683529383019391830191600101611afb565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5457611b54611bca565b500190565b600082611b7457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9357611b93611bca565b500290565b600082821015611baa57611baa611bca565b500390565b6000600019821415611bc357611bc3611bca565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c631d3e0251a3df1459c69d0d1e004b58c0d8334eef49615013cee51451bb74f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,436 |
0x76d890706db6ce7591182d406b8f86356c9d7520
|
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
/**
//SPDX-License-Identifier: UNLICENSED
/*
Discordoge is a VoIP, instant messaging and decentralization platform.
Users register for Discordoge with an wallet and must create a username.
With Discordoge, you get accessible, reliable, secure, and most importantly, decentralized P2P messaging.
*/
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 Discordoge 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 = 1e10 * 10**9;
string public constant name = unicode"Discordoge";
string public constant symbol = unicode"Discordoge";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 15;
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 + (5 minutes)) > block.timestamp) {
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;
}
}
uint burnAmount = contractTokenBalance/3;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function 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 burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
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 createNewPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiqNStart() 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;
_maxHeldTokens = 200000000 * 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, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_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 {
require(_msgSender() == _FeeCollectionADD);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101dc5760003560e01c80635996c6b011610102578063a9059cbb11610095578063c3c8cd8011610064578063c3c8cd8014610671578063db92dbb614610688578063dcb0e0ad146106b3578063dd62ed3e146106dc576101e3565b8063a9059cbb146105c9578063b2289c6214610606578063b515566a14610631578063b60e16af1461065a576101e3565b806373f54a11116100d157806373f54a111461051f5780638da5cb5b1461054857806394b8d8f21461057357806395d89b411461059e576101e3565b80635996c6b01461049d5780636fc3eaec146104b457806370a08231146104cb578063715018a614610508576101e3565b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b146103f357806345596e2e1461041e57806349bd5a5e14610447578063590f897e14610472576101e3565b8063313ce5671461033757806331c2d8471461036257806332d873d81461038b5780633bbac579146103b6576101e3565b806318160ddd116101b657806318160ddd146102795780631940d020146102a457806323b872dd146102cf57806327f3a72a1461030c576101e3565b806306fdde03146101e8578063095ea7b3146102135780630b78f9c014610250576101e3565b366101e357005b600080fd5b3480156101f457600080fd5b506101fd610719565b60405161020a9190612770565b60405180910390f35b34801561021f57600080fd5b5061023a6004803603810190610235919061283a565b610752565b6040516102479190612895565b60405180910390f35b34801561025c57600080fd5b50610277600480360381019061027291906128b0565b610770565b005b34801561028557600080fd5b5061028e61086f565b60405161029b91906128ff565b60405180910390f35b3480156102b057600080fd5b506102b961087f565b6040516102c691906128ff565b60405180910390f35b3480156102db57600080fd5b506102f660048036038101906102f1919061291a565b610885565b6040516103039190612895565b60405180910390f35b34801561031857600080fd5b50610321610943565b60405161032e91906128ff565b60405180910390f35b34801561034357600080fd5b5061034c610953565b6040516103599190612989565b60405180910390f35b34801561036e57600080fd5b5061038960048036038101906103849190612aec565b610958565b005b34801561039757600080fd5b506103a0610a4e565b6040516103ad91906128ff565b60405180910390f35b3480156103c257600080fd5b506103dd60048036038101906103d89190612b35565b610a54565b6040516103ea9190612895565b60405180910390f35b3480156103ff57600080fd5b50610408610aaa565b60405161041591906128ff565b60405180910390f35b34801561042a57600080fd5b5061044560048036038101906104409190612b62565b610ab0565b005b34801561045357600080fd5b5061045c610c2c565b6040516104699190612b9e565b60405180910390f35b34801561047e57600080fd5b50610487610c52565b60405161049491906128ff565b60405180910390f35b3480156104a957600080fd5b506104b2610c58565b005b3480156104c057600080fd5b506104c9610f34565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190612b35565b610f45565b6040516104ff91906128ff565b60405180910390f35b34801561051457600080fd5b5061051d610f8e565b005b34801561052b57600080fd5b5061054660048036038101906105419190612b35565b6110e1565b005b34801561055457600080fd5b5061055d6111df565b60405161056a9190612b9e565b60405180910390f35b34801561057f57600080fd5b50610588611208565b6040516105959190612895565b60405180910390f35b3480156105aa57600080fd5b506105b361121b565b6040516105c09190612770565b60405180910390f35b3480156105d557600080fd5b506105f060048036038101906105eb919061283a565b611254565b6040516105fd9190612895565b60405180910390f35b34801561061257600080fd5b5061061b611272565b6040516106289190612bda565b60405180910390f35b34801561063d57600080fd5b5061065860048036038101906106539190612aec565b611298565b005b34801561066657600080fd5b5061066f6114a8565b005b34801561067d57600080fd5b5061068661175e565b005b34801561069457600080fd5b5061069d611777565b6040516106aa91906128ff565b60405180910390f35b3480156106bf57600080fd5b506106da60048036038101906106d59190612c21565b6117a9565b005b3480156106e857600080fd5b5061070360048036038101906106fe9190612c4e565b6118a1565b60405161071091906128ff565b60405180910390f35b6040518060400160405280600a81526020017f446973636f72646f67650000000000000000000000000000000000000000000081525081565b600061076661075f611928565b8484611930565b6001905092915050565b610778611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fc90612cda565b60405180910390fd5b600954821080156108175750600a5481105b61082057600080fd5b8160098190555080600a819055507f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1600954600a54604051610863929190612cfa565b60405180910390a15050565b6000678ac7230489e80000905090565b600c5481565b6000610892848484611af9565b600082600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108de611928565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109239190612d52565b905061093785610931611928565b83611930565b60019150509392505050565b600061094e30610f45565b905090565b600981565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610999611928565b73ffffffffffffffffffffffffffffffffffffffff16146109b957600080fd5b60005b8151811015610a4a576000600560008484815181106109de576109dd612d86565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a4290612db5565b9150506109bc565b5050565b600d5481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60095481565b610ab8611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3c90612cda565b60405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b86611928565b73ffffffffffffffffffffffffffffffffffffffff1614610ba657600080fd5b60008111610be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be090612e49565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b54604051610c2191906128ff565b60405180910390a150565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b610c60611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce490612cda565b60405180910390fd5b600e60009054906101000a900460ff1615610d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3490612eb5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190612eea565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e919190612eea565b6040518363ffffffff1660e01b8152600401610eae929190612f17565b6020604051808303816000875af1158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef19190612eea565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000479050610f42816120e0565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f96611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611023576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101a90612cda565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611122611928565b73ffffffffffffffffffffffffffffffffffffffff161461114257600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d6600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516111d49190612f9f565b60405180910390a150565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600e60029054906101000a900460ff1681565b6040518060400160405280600a81526020017f446973636f72646f67650000000000000000000000000000000000000000000081525081565b6000611268611261611928565b8484611af9565b6001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6112a0611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132490612cda565b60405180910390fd5b60005b81518110156114a457600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061138557611384612d86565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156114195750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106113f8576113f7612d86565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156114915760016005600084848151811061143757611436612d86565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061149c90612db5565b915050611330565b5050565b6114b0611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461153d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153490612cda565b60405180910390fd5b600e60009054906101000a900460ff161561155757600080fd5b61158c30600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16678ac7230489e80000611930565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306115d530610f45565b6000806115e06111df565b426040518863ffffffff1660e01b815260040161160296959493929190612ff5565b60606040518083038185885af1158015611620573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611645919061306b565b505050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016116e79291906130be565b6020604051808303816000875af1158015611706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172a91906130fc565b506001600e60006101000a81548160ff02191690831515021790555042600d819055506702c68af0bb140000600c81905550565b600061176930610f45565b90506117748161214c565b50565b60006117a4600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f45565b905090565b6117b1611928565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612cda565b60405180910390fd5b80600e60026101000a81548160ff0219169083151502179055507ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb600e60029054906101000a900460ff166040516118969190612895565b60405180910390a150565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361199f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119969061319b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a059061322d565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611aec91906128ff565b60405180910390a3505050565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611b5057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611bbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb6906132bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2590613351565b60405180910390fd5b60008111611c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c68906133e3565b60405180910390fd5b6000611c7b6111df565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ce95750611cb96111df565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561201b57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611d995750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611def5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611e8257600e60009054906101000a900460ff16611e43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3a9061344f565b60405180910390fd5b4261012c600d54611e54919061346f565b1115611e7d57600c54611e6684610f45565b83611e71919061346f565b1115611e7c57600080fd5b5b600190505b600e60019054906101000a900460ff16158015611eab5750600e60009054906101000a900460ff165b8015611f055750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561201a576000611f1530610f45565b90506000811115611ffb57600e60029054906101000a900460ff1615611fc8576064600b54611f65600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f45565b611f6f91906134c5565b611f79919061354e565b811115611fc7576064600b54611fb0600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f45565b611fba91906134c5565b611fc4919061354e565b90505b5b6000600382611fd7919061354e565b90508082611fe59190612d52565b9150611ff0816123c5565b611ff98261214c565b505b6000479050600081111561201357612012476120e0565b5b6000925050505b5b600060019050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120c25750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156120cc57600090505b6120d98585858486612415565b5050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612148573d6000803e3d6000fd5b5050565b6001600e60016101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612184576121836129a9565b5b6040519080825280602002602001820160405280156121b25781602001602082028036833780820191505090505b50905030816000815181106121ca576121c9612d86565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122959190612eea565b816001815181106122a9576122a8612d86565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061231030600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611930565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161237495949392919061363d565b600060405180830381600087803b15801561238e57600080fd5b505af11580156123a2573d6000803e3d6000fd5b50505050506000600e60016101000a81548160ff02191690831515021790555050565b6001600e60016101000a81548160ff02191690831515021790555060008111156123f7576123f63061dead83611af9565b5b6000600e60016101000a81548160ff02191690831515021790555050565b60006124218383612437565b905061242f86868684612465565b505050505050565b60008060009050831561245b57821561245457600954905061245a565b600a5490505b5b8091505092915050565b6000806124728484612608565b9150915083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c19190612d52565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254f919061346f565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061259b81612646565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516125f891906128ff565b60405180910390a3505050505050565b60008060006064848661261b91906134c5565b612625919061354e565b9050600081866126359190612d52565b905080829350935050509250929050565b80600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612691919061346f565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600081519050919050565b600082825260208201905092915050565b60005b838110156127115780820151818401526020810190506126f6565b83811115612720576000848401525b50505050565b6000601f19601f8301169050919050565b6000612742826126d7565b61274c81856126e2565b935061275c8185602086016126f3565b61276581612726565b840191505092915050565b6000602082019050818103600083015261278a8184612737565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127d1826127a6565b9050919050565b6127e1816127c6565b81146127ec57600080fd5b50565b6000813590506127fe816127d8565b92915050565b6000819050919050565b61281781612804565b811461282257600080fd5b50565b6000813590506128348161280e565b92915050565b600080604083850312156128515761285061279c565b5b600061285f858286016127ef565b925050602061287085828601612825565b9150509250929050565b60008115159050919050565b61288f8161287a565b82525050565b60006020820190506128aa6000830184612886565b92915050565b600080604083850312156128c7576128c661279c565b5b60006128d585828601612825565b92505060206128e685828601612825565b9150509250929050565b6128f981612804565b82525050565b600060208201905061291460008301846128f0565b92915050565b6000806000606084860312156129335761293261279c565b5b6000612941868287016127ef565b9350506020612952868287016127ef565b925050604061296386828701612825565b9150509250925092565b600060ff82169050919050565b6129838161296d565b82525050565b600060208201905061299e600083018461297a565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6129e182612726565b810181811067ffffffffffffffff82111715612a00576129ff6129a9565b5b80604052505050565b6000612a13612792565b9050612a1f82826129d8565b919050565b600067ffffffffffffffff821115612a3f57612a3e6129a9565b5b602082029050602081019050919050565b600080fd5b6000612a68612a6384612a24565b612a09565b90508083825260208201905060208402830185811115612a8b57612a8a612a50565b5b835b81811015612ab45780612aa088826127ef565b845260208401935050602081019050612a8d565b5050509392505050565b600082601f830112612ad357612ad26129a4565b5b8135612ae3848260208601612a55565b91505092915050565b600060208284031215612b0257612b0161279c565b5b600082013567ffffffffffffffff811115612b2057612b1f6127a1565b5b612b2c84828501612abe565b91505092915050565b600060208284031215612b4b57612b4a61279c565b5b6000612b59848285016127ef565b91505092915050565b600060208284031215612b7857612b7761279c565b5b6000612b8684828501612825565b91505092915050565b612b98816127c6565b82525050565b6000602082019050612bb36000830184612b8f565b92915050565b6000612bc4826127a6565b9050919050565b612bd481612bb9565b82525050565b6000602082019050612bef6000830184612bcb565b92915050565b612bfe8161287a565b8114612c0957600080fd5b50565b600081359050612c1b81612bf5565b92915050565b600060208284031215612c3757612c3661279c565b5b6000612c4584828501612c0c565b91505092915050565b60008060408385031215612c6557612c6461279c565b5b6000612c73858286016127ef565b9250506020612c84858286016127ef565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612cc46020836126e2565b9150612ccf82612c8e565b602082019050919050565b60006020820190508181036000830152612cf381612cb7565b9050919050565b6000604082019050612d0f60008301856128f0565b612d1c60208301846128f0565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612d5d82612804565b9150612d6883612804565b925082821015612d7b57612d7a612d23565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612dc082612804565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612df257612df1612d23565b5b600182019050919050565b7f63616e2774206265207a65726f00000000000000000000000000000000000000600082015250565b6000612e33600d836126e2565b9150612e3e82612dfd565b602082019050919050565b60006020820190508181036000830152612e6281612e26565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612e9f6017836126e2565b9150612eaa82612e69565b602082019050919050565b60006020820190508181036000830152612ece81612e92565b9050919050565b600081519050612ee4816127d8565b92915050565b600060208284031215612f0057612eff61279c565b5b6000612f0e84828501612ed5565b91505092915050565b6000604082019050612f2c6000830185612b8f565b612f396020830184612b8f565b9392505050565b6000819050919050565b6000612f65612f60612f5b846127a6565b612f40565b6127a6565b9050919050565b6000612f7782612f4a565b9050919050565b6000612f8982612f6c565b9050919050565b612f9981612f7e565b82525050565b6000602082019050612fb46000830184612f90565b92915050565b6000819050919050565b6000612fdf612fda612fd584612fba565b612f40565b612804565b9050919050565b612fef81612fc4565b82525050565b600060c08201905061300a6000830189612b8f565b61301760208301886128f0565b6130246040830187612fe6565b6130316060830186612fe6565b61303e6080830185612b8f565b61304b60a08301846128f0565b979650505050505050565b6000815190506130658161280e565b92915050565b6000806000606084860312156130845761308361279c565b5b600061309286828701613056565b93505060206130a386828701613056565b92505060406130b486828701613056565b9150509250925092565b60006040820190506130d36000830185612b8f565b6130e060208301846128f0565b9392505050565b6000815190506130f681612bf5565b92915050565b6000602082840312156131125761311161279c565b5b6000613120848285016130e7565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006131856024836126e2565b915061319082613129565b604082019050919050565b600060208201905081810360008301526131b481613178565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006132176022836126e2565b9150613222826131bb565b604082019050919050565b600060208201905081810360008301526132468161320a565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006132a96025836126e2565b91506132b48261324d565b604082019050919050565b600060208201905081810360008301526132d88161329c565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061333b6023836126e2565b9150613346826132df565b604082019050919050565b6000602082019050818103600083015261336a8161332e565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006133cd6029836126e2565b91506133d882613371565b604082019050919050565b600060208201905081810360008301526133fc816133c0565b9050919050565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b60006134396018836126e2565b915061344482613403565b602082019050919050565b600060208201905081810360008301526134688161342c565b9050919050565b600061347a82612804565b915061348583612804565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134ba576134b9612d23565b5b828201905092915050565b60006134d082612804565b91506134db83612804565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561351457613513612d23565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061355982612804565b915061356483612804565b9250826135745761357361351f565b5b828204905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135b4816127c6565b82525050565b60006135c683836135ab565b60208301905092915050565b6000602082019050919050565b60006135ea8261357f565b6135f4818561358a565b93506135ff8361359b565b8060005b8381101561363057815161361788826135ba565b9750613622836135d2565b925050600181019050613603565b5085935050505092915050565b600060a08201905061365260008301886128f0565b61365f6020830187612fe6565b818103604083015261367181866135df565b90506136806060830185612b8f565b61368d60808301846128f0565b969550505050505056fea264697066735822122043ee900d3ed7ae512b0a58ff9a2062cb8cd2b010d0e50235f72c5eb6943a3c3064736f6c634300080d0033
|
{"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,437 |
0x13e247cdbd067b415120c17c23ad53df83539c1e
|
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @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;
}
}
// import ierc20 & safemath & non-standard
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function 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;
}
}
interface INonStandardERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256 balance);
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transfer does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transfer(address dst, uint256 amount) external;
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transferFrom does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transferFrom(
address src,
address dst,
uint256 amount
) external;
function approve(address spender, uint256 amount)
external
returns (bool success);
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
}
contract Launchpad is Ownable {
using SafeMath for uint256;
event ClaimableAmount(address _user, uint256 _claimableAmount);
// address public owner;
uint256 public rate;
uint256 public allowedUserBalance;
bool public presaleOver;
IERC20 public usdt;
mapping(address => uint256) public claimable;
uint256 public hardcap;
constructor(uint256 _rate, address _usdt, uint256 _hardcap, uint256 _allowedUserBalance) public {
rate = _rate;
usdt = IERC20(_usdt);
presaleOver = true;
// owner = msg.sender;
hardcap = _hardcap;
allowedUserBalance = _allowedUserBalance;
}
modifier isPresaleOver() {
require(presaleOver == true, "The presale is not over");
_;
}
function changeHardCap(uint256 _hardcap) onlyOwner public {
hardcap = _hardcap;
}
function changeAllowedUserBalance(uint256 _allowedUserBalance) onlyOwner public {
allowedUserBalance = _allowedUserBalance;
}
function endPresale() external onlyOwner returns (bool) {
presaleOver = true;
return presaleOver;
}
function startPresale() external onlyOwner returns (bool) {
presaleOver = false;
return presaleOver;
}
function buyTokenWithUSDT(uint256 _amount) external {
// user enter amount of ether which is then transfered into the smart contract and tokens to be given is saved in the mapping
require(presaleOver == false, "presale is over you cannot buy now");
uint256 tokensPurchased = _amount.mul(rate);
uint256 userUpdatedBalance = claimable[msg.sender].add(tokensPurchased);
require( _amount.add(usdt.balanceOf(address(this))) <= hardcap, "Hardcap for the tokens reached");
// for USDT
require(userUpdatedBalance.div(rate) <= allowedUserBalance, "Exceeded allowed user balance");
// usdt.transferFrom(msg.sender, address(this), _amount);
doTransferIn(address(usdt), msg.sender, _amount);
claimable[msg.sender] = userUpdatedBalance;
emit ClaimableAmount(msg.sender, tokensPurchased);
}
// function claim() external isPresaleOver {
// // it checks for user msg.sender claimable amount and transfer them to msg.sender
// require(claimable[msg.sender] > 0, "NO tokens left to be claim");
// usdc.transfer(msg.sender, claimable[msg.sender]);
// claimable[msg.sender] = 0;
// }
function doTransferIn(
address tokenAddress,
address from,
uint256 amount
) internal returns (uint256) {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
uint256 balanceBefore = INonStandardERC20(tokenAddress).balanceOf(address(this));
_token.transferFrom(from, address(this), amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a compliant ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_IN_FAILED");
// Calculate the amount that was actually transferred
uint256 balanceAfter = INonStandardERC20(tokenAddress).balanceOf(address(this));
require(balanceAfter >= balanceBefore, "TOKEN_TRANSFER_IN_OVERFLOW");
return balanceAfter.sub(balanceBefore); // underflow already checked above, just subtract
}
function doTransferOut(
address tokenAddress,
address to,
uint256 amount
) internal {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
_token.transfer(to, amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a complaint ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_OUT_FAILED");
}
function fundsWithdrawal(uint256 _value) external onlyOwner isPresaleOver {
// claimable[owner] = claimable[owner].sub(_value);
// usdt.transfer(_msgSender(), _value);
doTransferOut(address(usdt), _msgSender(), _value);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063bcd2f64a11610066578063bcd2f64a146102ac578063c8d8b6fa146102da578063e3b8686514610308578063f2fde38b14610336576100f5565b8063715018a6146102305780638da5cb5b1461023a578063a43be57b1461026e578063b071cbe61461028e576100f5565b80632f48ab7d116100d35780632f48ab7d14610166578063402914f51461019a5780634738a883146101f257806359ccecc914610212576100f5565b806304c98b2b146100fa57806324f32f821461011a5780632c4e722e14610148575b600080fd5b61010261037a565b60405180821515815260200191505060405180910390f35b6101466004803603602081101561013057600080fd5b8101908080359060200190929190505050610474565b005b610150610546565b6040518082815260200191505060405180910390f35b61016e61054c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101dc600480360360208110156101b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610572565b6040518082815260200191505060405180910390f35b6101fa61058a565b60405180821515815260200191505060405180910390f35b61021a61059d565b6040518082815260200191505060405180910390f35b6102386105a3565b005b610242610729565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610276610752565b60405180821515815260200191505060405180910390f35b61029661084c565b6040518082815260200191505060405180910390f35b6102d8600480360360208110156102c257600080fd5b8101908080359060200190929190505050610852565b005b610306600480360360208110156102f057600080fd5b8101908080359060200190929190505050610bd2565b005b6103346004803603602081101561031e57600080fd5b8101908080359060200190929190505050610d5a565b005b6103786004803603602081101561034c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e2c565b005b6000610384611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610444576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b61047c611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461053c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060058190555050565b60015481565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b600360009054906101000a900460ff1681565b60025481565b6105ab611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061075c611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b60055481565b60001515600360009054906101000a900460ff161515146108be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116716022913960400191505060405180910390fd5b60006108d56001548361103f90919063ffffffff16565b9050600061092b82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110c590919063ffffffff16565b9050600554610a06600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109bc57600080fd5b505afa1580156109d0573d6000803e3d6000fd5b505050506040513d60208110156109e657600080fd5b8101908080519060200190929190505050856110c590919063ffffffff16565b1115610a7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4861726463617020666f722074686520746f6b656e732072656163686564000081525060200191505060405180910390fd5b600254610a92600154836110e190919063ffffffff16565b1115610b06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f457863656564656420616c6c6f77656420757365722062616c616e636500000081525060200191505060405180910390fd5b610b33600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16338561112b565b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f62871c7b30027ac68155027c44a377be338ed75154b830a8b7fb419e2cb9a4533383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b610bda611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600360009054906101000a900460ff16151514610d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5468652070726573616c65206973206e6f74206f76657200000000000000000081525060200191505060405180910390fd5b610d57600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d51611037565b8361145c565b50565b610d62611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060028190555050565b610e34611037565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116936026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b60008083141561105257600090506110bf565b600082840290508284828161106357fe5b04146110ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116b96021913960400191505060405180910390fd5b809150505b92915050565b6000808284019050838110156110d757fe5b8091505092915050565b600061112383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611593565b905092915050565b60008084905060008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561119a57600080fd5b505afa1580156111ae573d6000803e3d6000fd5b505050506040513d60208110156111c457600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff166323b872dd8630876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561126657600080fd5b505af115801561127a573d6000803e3d6000fd5b5050505060003d6000811461129657602081146112a057600080fd5b60001991506112ac565b60206000803e60005191505b5080611320576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f544f4b454e5f5452414e534645525f494e5f4641494c4544000000000000000081525060200191505060405180910390fd5b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d60208110156113b357600080fd5b810190808051906020019092919050505090508281101561143c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f544f4b454e5f5452414e534645525f494e5f4f564552464c4f5700000000000081525060200191505060405180910390fd5b61144f838261165990919063ffffffff16565b9450505050509392505050565b60008390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156114d257600080fd5b505af11580156114e6573d6000803e3d6000fd5b5050505060003d60008114611502576020811461150c57600080fd5b6000199150611518565b60206000803e60005191505b508061158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f544f4b454e5f5452414e534645525f4f55545f4641494c45440000000000000081525060200191505060405180910390fd5b5050505050565b6000808311829061163f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116045780820151818401526020810190506115e9565b50505050905090810190601f1680156116315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161164b57fe5b049050809150509392505050565b60008282111561166557fe5b81830390509291505056fe70726573616c65206973206f76657220796f752063616e6e6f7420627579206e6f774f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220e92b48018c016205087408dd5811f93f89d2f9781145a0a68584bb1db075fdd964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,438 |
0x5278a07e049d1b193a1c73d04dc319259d14d2f6
|
pragma solidity ^0.4.16;
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;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract EBanker is owned {
// Public variables of the token
string public name = "EBanker";
string public symbol = "EBC";
uint8 public decimals = 18;
uint256 public totalSupply = 0;
uint256 public sellPrice = 1065;
uint256 public buyPrice = 1065;
bool public released = false;
/// contract that is allowed to create new tokens and allows unlift the transfer limits on this token
address public crowdsaleAgent;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function EBanker() public {
}
modifier canTransfer() {
require(released);
_;
}
modifier onlyCrowdsaleAgent() {
require(msg.sender == crowdsaleAgent);
_;
}
function releaseTokenTransfer() public onlyCrowdsaleAgent {
released = true;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) canTransfer internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Check if sender is frozen
require(!frozenAccount[_from]);
// Check if recipient is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyCrowdsaleAgent public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) canTransfer public {
require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, this, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
/// @dev Set the contract that can call release and make the token transferable.
/// @param _crowdsaleAgent crowdsale contract address
function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner public {
crowdsaleAgent = _crowdsaleAgent;
}
}
contract Killable is owned {
function kill() onlyOwner {
selfdestruct(owner);
}
}
contract EBankerICO is owned, Killable {
/// The token we are selling
EBanker public token;
/// Current State Name
string public state = "Pre ICO";
/// the UNIX timestamp start date of the crowdsale
uint public startsAt = 1521748800;
/// the UNIX timestamp end date of the crowdsale
uint public endsAt = 1522612800;
/// the price of token
uint256 public TokenPerETH = 1065;
/// per user limit of buying tokens.
uint256 public LimitPerUserEBC = 100000 * 10 ** 18;
/// Has this crowdsale been finalized
bool public finalized = false;
/// the number of tokens already sold through this contract
uint public tokensSold = 0;
/// the number of ETH raised through this contract
uint public weiRaised = 0;
/// How many distinct addresses have invested
uint public investorCount = 0;
/// How much ETH each address has invested to this crowdsale
mapping (address => uint256) public investedAmountOf;
/// How much tokens this crowdsale has credited for each investor address
mapping (address => uint256) public tokenAmountOf;
/// A new investment was made
event Invested(address investor, uint weiAmount, uint tokenAmount);
/// Crowdsale end time has been changed
event EndsAtChanged(uint endsAt);
/// Calculated new price
event RateChanged(uint oldValue, uint newValue);
function EBankerICO(address _token) {
token = EBanker(_token);
}
function investInternal(address receiver) private {
require(!finalized);
require(startsAt <= now && endsAt > now);
require(tokenAmountOf[receiver] + msg.value * TokenPerETH <= LimitPerUserEBC);
if(investedAmountOf[receiver] == 0) {
// A new investor
investorCount++;
}
// Update investor
uint tokensAmount = msg.value * TokenPerETH;
investedAmountOf[receiver] += msg.value;
tokenAmountOf[receiver] += tokensAmount;
// Update totals
tokensSold += tokensAmount;
weiRaised += msg.value;
// Tell us invest was success
Invested(receiver, msg.value, tokensAmount);
token.mintToken(receiver, tokensAmount);
}
function buy() public payable {
investInternal(msg.sender);
}
function() payable {
buy();
}
function setEndsAt(uint time) onlyOwner {
require(!finalized);
endsAt = time;
EndsAtChanged(endsAt);
}
function setRate(uint value) onlyOwner {
require(!finalized);
require(value > 0);
RateChanged(TokenPerETH, value);
TokenPerETH = value;
}
function finalize(address receiver) public onlyOwner {
// Finalized Pre ICO crowdsele.
finalized = true;
// Make tokens Transferable
token.releaseTokenTransfer();
// Transfer Fund to owner's address
receiver.transfer(this.balance);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a09284a146101115780631aae34601461013a57806334fcf437146101875780633f52c660146101aa5780634042b66f146101d357806341c0e1b5146101fc5780634ef39b7514610211578063518ab2a81461024a578063584df977146102735780636e50eb3f1461029c5780638da5cb5b146102bf57806397b150ca14610314578063a6f2ae3a14610361578063af4686821461036b578063b3f05b9714610394578063c19d93fb146103c1578063d7e64c001461044f578063f2fde38b14610478578063fc0c546a146104b1575b61010f610506565b005b341561011c57600080fd5b610124610511565b6040518082815260200191505060405180910390f35b341561014557600080fd5b610171600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610517565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101a8600480803590602001909190505061052f565b005b34156101b557600080fd5b6101bd610600565b6040518082815260200191505060405180910390f35b34156101de57600080fd5b6101e6610606565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61020f61060c565b005b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a1565b005b341561025557600080fd5b61025d610806565b6040518082815260200191505060405180910390f35b341561027e57600080fd5b61028661080c565b6040518082815260200191505060405180910390f35b34156102a757600080fd5b6102bd6004808035906020019091905050610812565b005b34156102ca57600080fd5b6102d26108cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561031f57600080fd5b61034b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108f1565b6040518082815260200191505060405180910390f35b610369610506565b005b341561037657600080fd5b61037e610909565b6040518082815260200191505060405180910390f35b341561039f57600080fd5b6103a761090f565b604051808215151515815260200191505060405180910390f35b34156103cc57600080fd5b6103d4610922565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104145780820151818401526020810190506103f9565b50505050905090810190601f1680156104415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045a57600080fd5b6104626109c0565b6040518082815260200191505060405180910390f35b341561048357600080fd5b6104af600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109c6565b005b34156104bc57600080fd5b6104c4610a64565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61050f33610a8a565b565b60045481565b600b6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561058a57600080fd5b600760009054906101000a900460ff161515156105a657600080fd5b6000811115156105b557600080fd5b7f4ac9052a820bf4f8c02d7588587cae835573b5b99ea7ad4ca002f17f319f718660055482604051808381526020018281526020019250505060405180910390a18060058190555050565b60055481565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106fc57600080fd5b6001600760006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f412d4f6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b151561079c57600080fd5b5af115156107a957600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561080357600080fd5b50565b60085481565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561086d57600080fd5b600760009054906101000a900460ff1615151561088957600080fd5b806004819055507fd34bb772c4ae9baa99db852f622773b31c7827e8ee818449fef20d30980bd3106004546040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c6020528060005260406000206000915090505481565b60035481565b600760009054906101000a900460ff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b85780601f1061098d576101008083540402835291602001916109b8565b820191906000526020600020905b81548152906001019060200180831161099b57829003601f168201915b505050505081565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a2157600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760009054906101000a900460ff16151515610aa857600080fd5b4260035411158015610abb575042600454115b1515610ac657600080fd5b6006546005543402600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151515610b1c57600080fd5b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610b7757600a600081548092919060010191905055505b6005543402905034600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600860008282540192505081905550346009600082825401925050819055507f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c823483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379c6506883836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1515610d6f57600080fd5b5af11515610d7c57600080fd5b50505050505600a165627a7a72305820e67f484e3c174acd31e906420c55477f63423164c76cd9ec511da00c20263d060029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,439 |
0x2cca739c055fbc564b136e3193331b162ffc5732
|
/**
*Submitted for verification at Etherscan.io on 2021-03-01
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
/**
* @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, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
}
contract Pool_4 is Ownable {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint256 amount);
// YPro token contract address
address public tokenAddress = 0xAc9C0F1bFD12cf5c4daDbeAb943473c4C45263A0;
// LP token contract address
address public LPtokenAddress = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
// reward rate 100 % per year
uint256 public rewardRate = 502700 ;
uint256 public rewardInterval = 365 days;
// staking fee 0%
uint256 public stakingFeeRate = 0;
// unstaking fee 0%
uint256 public unstakingFeeRate = 0;
// unstaking possible after 0 days
uint256 public cliffTime = 0 days;
uint256 public farmEnableat;
uint256 public totalClaimedRewards = 0;
uint256 private stakingAndDaoTokens = 100000e18;
bool public farmEnabled = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint256) public depositedTokens;
mapping (address => uint256) public stakingTime;
mapping (address => uint256) public lastClaimedTime;
mapping (address => uint256) public totalEarnedTokens;
function updateAccount(address account) private {
uint256 pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function getPendingDivs(address _holder) public view returns (uint256) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint256 timeDiff = now.sub(lastClaimedTime[_holder]);
uint256 stakedAmount = depositedTokens[_holder];
if (now > farmEnableat + 7 days) {
uint256 pendingDivs = stakedAmount.mul(2010797).mul(timeDiff).div(rewardInterval).div(1e4);
return pendingDivs;
} else if (now <= farmEnableat + 7 days) {
uint256 pendingDivs = stakedAmount.mul(rewardRate).mul(timeDiff).div(rewardInterval).div(1e4);
return pendingDivs;
}
}
function getNumberOfHolders() public view returns (uint256) {
return holders.length();
}
function deposit(uint256 amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(farmEnabled, "Farming is not enabled");
require(Token(LPtokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint256 fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint256 amountAfterFee = amountToStake.sub(fee);
require(Token(LPtokenAddress).transfer(owner, 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 withdraw(uint256 amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
uint256 fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint256 amountAfterFee = amountToWithdraw.sub(fee);
require(Token(LPtokenAddress).transfer(owner, fee), "Could not transfer deposit fee.");
require(Token(LPtokenAddress).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 claimDivs() public {
updateAccount(msg.sender);
}
function getStakingAndDaoAmount() public view returns (uint256) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint256 remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
function setTokenAddress(address _tokenAddressess) public onlyOwner {
tokenAddress = _tokenAddressess;
}
function setLPTokenAddress(address _LPtokenAddressess) public onlyOwner {
LPtokenAddress = _LPtokenAddressess;
}
function setCliffTime(uint256 _time) public onlyOwner {
cliffTime = _time;
}
function setRewardInterval(uint256 _rewardInterval) public onlyOwner {
rewardInterval = _rewardInterval;
}
function setStakingAndDaoTokens(uint256 _stakingAndDaoTokens) public onlyOwner {
stakingAndDaoTokens = _stakingAndDaoTokens;
}
function setStakingFeeRate(uint256 _Fee) public onlyOwner {
stakingFeeRate = _Fee;
}
function setUnstakingFeeRate(uint256 _Fee) public onlyOwner {
unstakingFeeRate = _Fee;
}
function setRewardRate(uint256 _rewardRate) public onlyOwner {
rewardRate = _rewardRate;
}
function enableFarming() external onlyOwner() {
farmEnabled = true;
farmEnableat = now;
}
// function to allow admin to claim *any* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddress, address _to, uint256 _amount) public onlyOwner {
require(_tokenAddress != LPtokenAddress);
Token(_tokenAddress).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c806398896d101161010f578063d578ceab116100a2578063f2fde38b11610071578063f2fde38b14610721578063f3f91fa014610765578063f42ebbe0146107bd578063f9da7db814610801576101f0565b8063d578ceab14610699578063d816c7d5146106b7578063e3e84213146106d5578063e40ccf2714610703576101f0565b8063a9145727116100de578063a9145727146105c7578063b6b55f25146105f5578063bec4de3f14610623578063c326bf4f14610641576101f0565b806398896d10146104ed5780639d76ea58146105455780639e447fc614610579578063a2e656a2146105a7576101f0565b80635ef057be116101875780637b0a47ee116101565780637b0a47ee1461043f5780638a97973f1461045d5780638da5cb5b1461048b57806391e07e7a146104bf576101f0565b80635ef057be146103515780636270cd181461036f5780636a395ccb146103c75780637723c5f114610435576101f0565b80632e1a7d4d116101c35780632e1a7d4d1461027f578063308feec3146102ad578063468b4f10146102cb578063583d42fd146102f9576101f0565b80630f1a6444146101f557806319aa70e714610213578063268cab491461021d57806326a4e8d21461023b575b600080fd5b6101fd610835565b6040518082815260200191505060405180910390f35b61021b61083b565b005b610225610846565b6040518082815260200191505060405180910390f35b61027d6004803603602081101561025157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061087f565b005b6102ab6004803603602081101561029557600080fd5b810190808035906020019092919050505061091b565b005b6102b5610e7c565b6040518082815260200191505060405180910390f35b6102f7600480360360208110156102e157600080fd5b8101908080359060200190929190505050610e8d565b005b61033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eef565b6040518082815260200191505060405180910390f35b610359610f07565b6040518082815260200191505060405180910390f35b6103b16004803603602081101561038557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f0d565b6040518082815260200191505060405180910390f35b610433600480360360608110156103dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f25565b005b61043d61108a565b005b610447611106565b6040518082815260200191505060405180910390f35b6104896004803603602081101561047357600080fd5b810190808035906020019092919050505061110c565b005b61049361116e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104eb600480360360208110156104d557600080fd5b8101908080359060200190929190505050611192565b005b61052f6004803603602081101561050357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111f4565b6040518082815260200191505060405180910390f35b61054d6113e4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105a56004803603602081101561058f57600080fd5b810190808035906020019092919050505061140a565b005b6105af61146c565b60405180821515815260200191505060405180910390f35b6105f3600480360360208110156105dd57600080fd5b810190808035906020019092919050505061147f565b005b6106216004803603602081101561060b57600080fd5b81019080803590602001909291905050506114e1565b005b61062b6119f0565b6040518082815260200191505060405180910390f35b6106836004803603602081101561065757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119f6565b6040518082815260200191505060405180910390f35b6106a1611a0e565b6040518082815260200191505060405180910390f35b6106bf611a14565b6040518082815260200191505060405180910390f35b610701600480360360208110156106eb57600080fd5b8101908080359060200190929190505050611a1a565b005b61070b611a7c565b6040518082815260200191505060405180910390f35b6107636004803603602081101561073757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a82565b005b6107a76004803603602081101561077b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd1565b6040518082815260200191505060405180910390f35b6107ff600480360360208110156107d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611be9565b005b610809611c85565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60075481565b61084433611cab565b565b6000600a546009541061085c576000905061087c565b6000610875600954600a54611f4f90919063ffffffff16565b9050809150505b90565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108d757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b80600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b600754610a25600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611f4f90919063ffffffff16565b11610a7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806121fc6034913960400191505060405180910390fd5b610a8433611cab565b6000610aaf612710610aa160065485611f6690919063ffffffff16565b611f9590919063ffffffff16565b90506000610ac68284611f4f90919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b7b57600080fd5b505af1158015610b8f573d6000803e3d6000fd5b505050506040513d6020811015610ba557600080fd5b8101908080519060200190929190505050610c28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d6020811015610ce557600080fd5b8101908080519060200190929190505050610d68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610dba83600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4f90919063ffffffff16565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1133600c611fae90919063ffffffff16565b8015610e5c57506000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610e7757610e7533600c611fde90919063ffffffff16565b505b505050565b6000610e88600c61200e565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ee557600080fd5b8060058190555050565b600f6020528060005260406000206000915090505481565b60055481565b60116020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7d57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fd857600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561104957600080fd5b505af115801561105d573d6000803e3d6000fd5b505050506040513d602081101561107357600080fd5b810190808051906020019092919050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110e257600080fd5b6001600b60006101000a81548160ff02191690831515021790555042600881905550565b60035481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461116457600080fd5b8060078190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ea57600080fd5b8060068190555050565b600061120a82600c611fae90919063ffffffff16565b61121757600090506113df565b6000600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561126857600090506113df565b60006112bc601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611f4f90919063ffffffff16565b90506000600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905062093a806008540142111561137057600061136361271061135560045461134787611339621eaead89611f6690919063ffffffff16565b611f6690919063ffffffff16565b611f9590919063ffffffff16565b611f9590919063ffffffff16565b90508093505050506113df565b62093a806008540142116113dc5760006113cf6127106113c16004546113b3876113a560035489611f6690919063ffffffff16565b611f6690919063ffffffff16565b611f9590919063ffffffff16565b611f9590919063ffffffff16565b90508093505050506113df565b50505b919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146257600080fd5b8060038190555050565b600b60009054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114d757600080fd5b80600a8190555050565b60008111611557576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b600b60009054906101000a900460ff166115d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4661726d696e67206973206e6f7420656e61626c65640000000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561168a57600080fd5b505af115801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b8101908080519060200190929190505050611737576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61174033611cab565b600061176b61271061175d60055485611f6690919063ffffffff16565b611f9590919063ffffffff16565b905060006117828284611f4f90919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561183757600080fd5b505af115801561184b573d6000803e3d6000fd5b505050506040513d602081101561186157600080fd5b81019080805190602001909291905050506118e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b61193681600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202390919063ffffffff16565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061198d33600c611fae90919063ffffffff16565b6119eb576119a533600c61203f90919063ffffffff16565b5042600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b60045481565b600e6020528060005260406000206000915090505481565b60095481565b60065481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a7257600080fd5b8060048190555050565b60085481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611ada57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b1457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60106020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c4157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611cb6826111f4565b90506000811115611f0757600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611d5457600080fd5b505af1158015611d68573d6000803e3d6000fd5b505050506040513d6020811015611d7e57600080fd5b8101908080519060200190929190505050611e01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611e5381601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202390919063ffffffff16565b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611eab8160095461202390919063ffffffff16565b6009819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600082821115611f5b57fe5b818303905092915050565b60008082840290506000841480611f85575082848281611f8257fe5b04145b611f8b57fe5b8091505092915050565b600080828481611fa157fe5b0490508091505092915050565b6000611fd6836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61206f565b905092915050565b6000612006836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612092565b905092915050565b600061201c8260000161217a565b9050919050565b60008082840190508381101561203557fe5b8091505092915050565b6000612067836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61218b565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461216e57600060018203905060006001866000018054905003905060008660000182815481106120dd57fe5b90600052602060002001549050808760000184815481106120fa57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061213257fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612174565b60009150505b92915050565b600081600001805490509050919050565b6000612197838361206f565b6121f05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506121f5565b600090505b9291505056fe596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea26469706673582212207e63551af99c555460e8f1682f41efa248e39cc63fb9c40a6b1db0c128cdd7d364736f6c634300060c0033
|
{"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,440 |
0x6486813e62ea4efed169941a4bfc8632fdfee8be
|
/**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// SPDX-License-Identifier: Unlicensed
// welcome to dinoverse!
// t.me/Dinoversetoken
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 DINOV is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DINOVERSE";
string private constant _symbol = "DINOV";
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 _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 9;
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(0x6A9ff30A683DC7E6cAde212ee6b911743EA8704d);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5e9 * 10**9;
uint256 public _maxWalletSize = 5e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
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)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0);
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 {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610595578063c5528490146105b5578063dd62ed3e146105d5578063ea1644d51461061b578063f2fde38b1461063b57600080fd5b80638da5cb5b1461051e5780638f9a55c01461053c57806395d89b41146105525780639e78fb4f1461058057600080fd5b8063790ca413116100dc578063790ca413146104bd5780637c519ffb146104d35780637d1db4a5146104e8578063881dce60146104fe57600080fd5b80636fc3eaec1461045357806370a0823114610468578063715018a61461048857806374010ece1461049d57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d35780634bf2c7c9146103f35780635d098b38146104135780636d8aa8f81461043357600080fd5b80632fd689e314610361578063313ce5671461037757806333251a0b1461039357806338eea22d146103b357600080fd5b806318160ddd116101c157806318160ddd146102e357806323b872dd1461030957806327c8f8351461032957806328bb665a1461033f57600080fd5b806306fdde03146101fe578063095ea7b3146102425780630f3a325f146102725780631694505e146102ab57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600981526844494e4f564552534560b81b60208201525b6040516102399190611eb6565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611d61565b61065b565b6040519015158152602001610239565b34801561027e57600080fd5b5061026261028d366004611cad565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b757600080fd5b506016546102cb906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102ef57600080fd5b50683635c9adc5dea000005b604051908152602001610239565b34801561031557600080fd5b50610262610324366004611d20565b610672565b34801561033557600080fd5b506102cb61dead81565b34801561034b57600080fd5b5061035f61035a366004611d8d565b6106db565b005b34801561036d57600080fd5b506102fb601a5481565b34801561038357600080fd5b5060405160098152602001610239565b34801561039f57600080fd5b5061035f6103ae366004611cad565b61077a565b3480156103bf57600080fd5b5061035f6103ce366004611e94565b6107e9565b3480156103df57600080fd5b506017546102cb906001600160a01b031681565b3480156103ff57600080fd5b5061035f61040e366004611e7b565b61081e565b34801561041f57600080fd5b5061035f61042e366004611cad565b61084d565b34801561043f57600080fd5b5061035f61044e366004611e59565b6108a7565b34801561045f57600080fd5b5061035f6108ef565b34801561047457600080fd5b506102fb610483366004611cad565b610919565b34801561049457600080fd5b5061035f61093b565b3480156104a957600080fd5b5061035f6104b8366004611e7b565b6109af565b3480156104c957600080fd5b506102fb600a5481565b3480156104df57600080fd5b5061035f6109de565b3480156104f457600080fd5b506102fb60185481565b34801561050a57600080fd5b5061035f610519366004611e7b565b610a38565b34801561052a57600080fd5b506000546001600160a01b03166102cb565b34801561054857600080fd5b506102fb60195481565b34801561055e57600080fd5b506040805180820190915260058152642224a727ab60d91b602082015261022c565b34801561058c57600080fd5b5061035f610a82565b3480156105a157600080fd5b506102626105b0366004611d61565b610c67565b3480156105c157600080fd5b5061035f6105d0366004611e94565b610c74565b3480156105e157600080fd5b506102fb6105f0366004611ce7565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062757600080fd5b5061035f610636366004611e7b565b610ca9565b34801561064757600080fd5b5061035f610656366004611cad565b610cd8565b6000610668338484610dc2565b5060015b92915050565b600061067f848484610ee6565b6106d184336106cc856040518060600160405280602881526020016120bb602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611540565b610dc2565b5060019392505050565b6000546001600160a01b0316331461070e5760405162461bcd60e51b815260040161070590611f0b565b60405180910390fd5b60005b81518110156107765760016009600084848151811061073257610732612079565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061076e81612048565b915050610711565b5050565b6000546001600160a01b031633146107a45760405162461bcd60e51b815260040161070590611f0b565b6001600160a01b03811660009081526009602052604090205460ff16156107e6576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108135760405162461bcd60e51b815260040161070590611f0b565b600b91909155600d55565b6000546001600160a01b031633146108485760405162461bcd60e51b815260040161070590611f0b565b601155565b6015546001600160a01b0316336001600160a01b03161461086d57600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d15760405162461bcd60e51b815260040161070590611f0b565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461090f57600080fd5b476107e68161157a565b6001600160a01b03811660009081526002602052604081205461066c906115b4565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161070590611f0b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109d95760405162461bcd60e51b815260040161070590611f0b565b601855565b6000546001600160a01b03163314610a085760405162461bcd60e51b815260040161070590611f0b565b601754600160a01b900460ff1615610a1f57600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a5857600080fd5b610a6130610919565b8111158015610a705750600081115b610a7957600080fd5b6107e681611638565b6000546001600160a01b03163314610aac5760405162461bcd60e51b815260040161070590611f0b565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b0c57600080fd5b505afa158015610b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b449190611cca565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8c57600080fd5b505afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc49190611cca565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c0c57600080fd5b505af1158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c449190611cca565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6000610668338484610ee6565b6000546001600160a01b03163314610c9e5760405162461bcd60e51b815260040161070590611f0b565b600c91909155600e55565b6000546001600160a01b03163314610cd35760405162461bcd60e51b815260040161070590611f0b565b601955565b6000546001600160a01b03163314610d025760405162461bcd60e51b815260040161070590611f0b565b6001600160a01b038116610d675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610705565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e245760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610705565b6001600160a01b038216610e855760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610705565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f4a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610705565b6001600160a01b038216610fac5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610705565b6000811161100e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610705565b6001600160a01b03821660009081526009602052604090205460ff16156110475760405162461bcd60e51b815260040161070590611f40565b6001600160a01b03831660009081526009602052604090205460ff16156110805760405162461bcd60e51b815260040161070590611f40565b3360009081526009602052604090205460ff16156110b05760405162461bcd60e51b815260040161070590611f40565b6000546001600160a01b038481169116148015906110dc57506000546001600160a01b03838116911614155b156113ea57601754600160a01b900460ff1661113a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610705565b6017546001600160a01b03838116911614801561116557506016546001600160a01b03848116911614155b15611217576001600160a01b038216301480159061118c57506001600160a01b0383163014155b80156111a657506015546001600160a01b03838116911614155b80156111c057506015546001600160a01b03848116911614155b15611217576018548111156112175760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610705565b6017546001600160a01b0383811691161480159061124357506015546001600160a01b03838116911614155b801561125857506001600160a01b0382163014155b801561126f57506001600160a01b03821661dead14155b156112e4576019548161128184610919565b61128b9190611fd8565b106112e45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610705565b60006112ef30610919565b601a54909150811180801561130e5750601754600160a81b900460ff16155b801561132857506017546001600160a01b03868116911614155b801561133d5750601754600160b01b900460ff165b801561136257506001600160a01b03851660009081526006602052604090205460ff16155b801561138757506001600160a01b03841660009081526006602052604090205460ff16155b156113e757601154600090156113c2576113b760646113b1601154866117c190919063ffffffff16565b90611840565b90506113c281611882565b6113d46113cf8285612031565b611638565b4780156113e4576113e44761157a565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061142c57506001600160a01b03831660009081526006602052604090205460ff165b8061145e57506017546001600160a01b0385811691161480159061145e57506017546001600160a01b03848116911614155b1561146b5750600061152e565b6017546001600160a01b03858116911614801561149657506016546001600160a01b03848116911614155b156114f1576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156114f1576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561151c57506016546001600160a01b03858116911614155b1561152e57600d54600f55600e546010555b61153a8484848461188f565b50505050565b600081848411156115645760405162461bcd60e51b81526004016107059190611eb6565b5060006115718486612031565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610776573d6000803e3d6000fd5b600060075482111561161b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610705565b60006116256118c3565b90506116318382611840565b9392505050565b6017805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061168057611680612079565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156116d457600080fd5b505afa1580156116e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170c9190611cca565b8160018151811061171f5761171f612079565b6001600160a01b0392831660209182029290920101526016546117459130911684610dc2565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac9479061177e908590600090869030904290600401611f67565b600060405180830381600087803b15801561179857600080fd5b505af11580156117ac573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826117d05750600061066c565b60006117dc8385612012565b9050826117e98583611ff0565b146116315760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610705565b600061163183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118e6565b6107e63061dead83610ee6565b8061189c5761189c611914565b6118a7848484611959565b8061153a5761153a601254600f55601354601055601454601155565b60008060006118d0611a50565b90925090506118df8282611840565b9250505090565b600081836119075760405162461bcd60e51b81526004016107059190611eb6565b5060006115718486611ff0565b600f541580156119245750601054155b80156119305750601154155b1561193757565b600f805460125560108054601355601180546014556000928390559082905555565b60008060008060008061196b87611a92565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061199d9087611aef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119cc9086611b31565b6001600160a01b0389166000908152600260205260409020556119ee81611b90565b6119f88483611bda565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a3d91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611a6c8282611840565b821015611a8957505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611aaf8a600f54601054611bfe565b9250925092506000611abf6118c3565b90506000806000611ad28e878787611c4d565b919e509c509a509598509396509194505050505091939550919395565b600061163183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611540565b600080611b3e8385611fd8565b9050838110156116315760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610705565b6000611b9a6118c3565b90506000611ba883836117c1565b30600090815260026020526040902054909150611bc59082611b31565b30600090815260026020526040902055505050565b600754611be79083611aef565b600755600854611bf79082611b31565b6008555050565b6000808080611c1260646113b189896117c1565b90506000611c2560646113b18a896117c1565b90506000611c3d82611c378b86611aef565b90611aef565b9992985090965090945050505050565b6000808080611c5c88866117c1565b90506000611c6a88876117c1565b90506000611c7888886117c1565b90506000611c8a82611c378686611aef565b939b939a50919850919650505050505050565b8035611ca8816120a5565b919050565b600060208284031215611cbf57600080fd5b8135611631816120a5565b600060208284031215611cdc57600080fd5b8151611631816120a5565b60008060408385031215611cfa57600080fd5b8235611d05816120a5565b91506020830135611d15816120a5565b809150509250929050565b600080600060608486031215611d3557600080fd5b8335611d40816120a5565b92506020840135611d50816120a5565b929592945050506040919091013590565b60008060408385031215611d7457600080fd5b8235611d7f816120a5565b946020939093013593505050565b60006020808385031215611da057600080fd5b823567ffffffffffffffff80821115611db857600080fd5b818501915085601f830112611dcc57600080fd5b813581811115611dde57611dde61208f565b8060051b604051601f19603f83011681018181108582111715611e0357611e0361208f565b604052828152858101935084860182860187018a1015611e2257600080fd5b600095505b83861015611e4c57611e3881611c9d565b855260019590950194938601938601611e27565b5098975050505050505050565b600060208284031215611e6b57600080fd5b8135801515811461163157600080fd5b600060208284031215611e8d57600080fd5b5035919050565b60008060408385031215611ea757600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611ee357858101830151858201604001528201611ec7565b81811115611ef5576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fb75784516001600160a01b031683529383019391830191600101611f92565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611feb57611feb612063565b500190565b60008261200d57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561202c5761202c612063565b500290565b60008282101561204357612043612063565b500390565b600060001982141561205c5761205c612063565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122046810cee052fcdd992b17a2141c54f2c183caf024d778c26c1790eeaacb3b39764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,441 |
0x834c47c6b3964ea44d69d2033de67360f583cc4b
|
pragma solidity ^0.4.20;
contract TDP {
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "ThreeDayProfits";
string public symbol = "TDP";
uint8 constant public decimals = 18;
/// @dev 20% dividends for token purchase
uint8 constant internal entryFee_ = 20;
/// @dev 1% dividends for token transfer
uint8 constant internal transferFee_ = 1;
/// @dev 30% dividends for token selling
uint8 constant internal exitFee_ = 30;
/// @dev 15% masternode
uint8 constant internal refferalFee_ = 15;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
/// @dev 250 Medaillions needed for masternode activation
uint256 public stakingRequirement = 250e18;
/*=================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
/**
* @dev Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function() payable public {
purchaseTokens(msg.value, 0x0);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/// @dev Alias of sell() and withdraw().
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/// @dev Withdraws all of the callers earnings.
function withdraw() onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/// @dev Liquifies tokens to ethereum.
function sell(uint256 _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
/**
* @dev Transfer tokens from the caller to a new holder.
* Remember, there's a 1% fee here as well.
*/
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends(true) > 0) {
withdraw();
}
// liquify 1% of the tokens that are transfered
// these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
// is the user referred by a masternode?
if (
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a godly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
// really i know you think you do but you don't
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
/**
* @dev Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
/// @dev This is where all your gas goes.
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @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;
}
}
|
0x6060604052600436106101105763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461011e57806306fdde031461014f57806310d0ffdd146101d957806318160ddd146101ef5780632260937314610202578063313ce567146102185780633ccfd60b146102415780634b7503341461025657806356d399e814610269578063688abbf71461027c5780636b2f46321461029457806370a08231146102a75780638620410b146102c6578063949e8acd146102d957806395d89b41146102ec578063a9059cbb146102ff578063e4849b3214610335578063e9fad8ee1461034b578063f088d5471461035e578063fdb5a03e14610372575b61011b346000610385565b50005b341561012957600080fd5b61013d600160a060020a03600435166105ed565b60405190815260200160405180910390f35b341561015a57600080fd5b610162610628565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019e578082015183820152602001610186565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e457600080fd5b61013d6004356106c6565b34156101fa57600080fd5b61013d6106f9565b341561020d57600080fd5b61013d6004356106ff565b341561022357600080fd5b61022b61073b565b60405160ff909116815260200160405180910390f35b341561024c57600080fd5b610254610740565b005b341561026157600080fd5b61013d61080c565b341561027457600080fd5b61013d610863565b341561028757600080fd5b61013d6004351515610869565b341561029f57600080fd5b61013d6108ac565b34156102b257600080fd5b61013d600160a060020a03600435166108ba565b34156102d157600080fd5b61013d6108d5565b34156102e457600080fd5b61013d610920565b34156102f757600080fd5b610162610932565b341561030a57600080fd5b610321600160a060020a036004351660243561099d565b604051901515815260200160405180910390f35b341561034057600080fd5b610254600435610b48565b341561035657600080fd5b610254610cc4565b61013d600160a060020a0360043516610cfb565b341561037d57600080fd5b610254610d07565b600033818080808080806103a461039d8c6014610dc2565b6064610df8565b96506103b461039d88600f610dc2565b95506103c08787610e0f565b94506103cc8b88610e0f565b93506103d784610e21565b9250680100000000000000008502915060008311801561040157506006546103ff8482610eb3565b115b151561040c57600080fd5b600160a060020a038a1615801590610436575087600160a060020a03168a600160a060020a031614155b801561045c5750600254600160a060020a038b1660009081526003602052604090205410155b156104a257600160a060020a038a166000908152600460205260409020546104849087610eb3565b600160a060020a038b166000908152600460205260409020556104bd565b6104ac8587610eb3565b945068010000000000000000850291505b60006006541115610521576104d460065484610eb3565b60068190556801000000000000000086028115156104ee57fe5b6007805492909104909101905560065468010000000000000000860281151561051357fe5b048302820382039150610527565b60068390555b600160a060020a03881660009081526003602052604090205461054a9084610eb3565b600160a060020a03808a166000818152600360209081526040808320959095556007546005909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426105b46108d5565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a350909998505050505050505050565b600160a060020a0316600090815260056020908152604080832054600390925290912054600754680100000000000000009102919091030490565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106be5780601f10610693576101008083540402835291602001916106be565b820191906000526020600020905b8154815290600101906020018083116106a157829003601f168201915b505050505081565b60008080806106d961039d866014610dc2565b92506106e58584610e0f565b91506106f082610e21565b95945050505050565b60065490565b600080600080600654851115151561071657600080fd5b61071f85610ec2565b925061072f61039d84601e610dc2565b91506106f08383610e0f565b601281565b600080600061074f6001610869565b1161075957600080fd5b3391506107666000610869565b600160a060020a0383166000818152600560209081526040808320805468010000000000000000870201905560049091528082208054929055920192509082156108fc0290839051600060405180830381858888f1935050505015156107cb57600080fd5b81600160a060020a03167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc8260405190815260200160405180910390a25050565b6000806000806006546000141561082a57640218711a00935061085d565b61083b670de0b6b3a7640000610ec2565b925061084b61039d84601e610dc2565b91506108578383610e0f565b90508093505b50505090565b60025481565b6000338261087f5761087a816105ed565b6108a3565b600160a060020a0381166000908152600460205260409020546108a1826105ed565b015b91505b50919050565b600160a060020a0330163190565b600160a060020a031660009081526003602052604090205490565b600080600080600654600014156108f35764028fa6ae00935061085d565b610904670de0b6b3a7640000610ec2565b925061091461039d846014610dc2565b91506108578383610eb3565b60003361092c816108ba565b91505090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106be5780601f10610693576101008083540402835291602001916106be565b6000806000806000806109ae610920565b116109b857600080fd5b33600160a060020a0381166000908152600360205260409020549094508611156109e157600080fd5b60006109ed6001610869565b11156109fb576109fb610740565b610a0961039d876001610dc2565b9250610a158684610e0f565b9150610a2083610ec2565b9050610a2e60065484610e0f565b600655600160a060020a038416600090815260036020526040902054610a549087610e0f565b600160a060020a038086166000908152600360205260408082209390935590891681522054610a839083610eb3565b600160a060020a0388811660008181526003602090815260408083209590955560078054948a16835260059091528482208054948c02909403909355825491815292909220805492850290920190915554600654610af79190680100000000000000008402811515610af157fe5b04610eb3565b600755600160a060020a038088169085167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35060019695505050505050565b6000806000806000806000610b5b610920565b11610b6557600080fd5b33600160a060020a038116600090815260036020526040902054909650871115610b8e57600080fd5b869450610b9a85610ec2565b9350610baa61039d85601e610dc2565b9250610bb68484610e0f565b9150610bc460065486610e0f565b600655600160a060020a038616600090815260036020526040902054610bea9086610e0f565b600160a060020a0387166000908152600360209081526040808320939093556007546005909152918120805492880268010000000000000000860201928390039055600654919250901115610c5b57610c57600754600654680100000000000000008602811515610af157fe5b6007555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442610c916108d5565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b33600160a060020a03811660009081526003602052604081205490811115610cef57610cef81610b48565b610cf7610740565b5050565b60006108a63483610385565b600080600080610d176001610869565b11610d2157600080fd5b610d2b6000610869565b33600160a060020a038116600090815260056020908152604080832080546801000000000000000087020190556004909152812080549082905590920194509250610d77908490610385565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab3615326458848360405191825260208201526040908101905180910390a2505050565b600080831515610dd55760009150610df1565b50828202828482811515610de557fe5b0414610ded57fe5b8091505b5092915050565b6000808284811515610e0657fe5b04949350505050565b600082821115610e1b57fe5b50900390565b6006546000906b204fce5e3e25026110000000908290633b9aca00610ea0610e9a7259aedfc10d7279c5eed140164540000000000088026002850a670de0b6b3a764000002016f0f0bdc21abb48db201e86d40000000008502017704140c78940f6a24fdffc78873d4490d210000000000000001610f2c565b85610e0f565b811515610ea957fe5b0403949350505050565b600082820183811015610ded57fe5b600654600090670de0b6b3a7640000838101918101908390610f19640218711a00828504633b9aca0002018702600283670de0b6b3a763ffff1982890a8b90030104633b9aca0002811515610f1357fe5b04610e0f565b811515610f2257fe5b0495945050505050565b80600260018201045b818110156108a6578091506002818285811515610f4e57fe5b0401811515610f5957fe5b049050610f355600a165627a7a723058204ea56e9f075a644c5bbdaf33d7b6fbe1ebb866e142860e61e1b4db5c670a63430029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,442 |
0xbe1249c8fa0e235a2408b63f9ed5158cd8e6bbb6
|
/**
*/
/**
*/
/**
/**
//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 Kakashi is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Kakashi";
string private constant _symbol = "Kakashi";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x7Ef24C755fe88257a37F83dbF58A93eE5942033F);
_feeAddrWallet2 = payable(0x8b2E6F316bde04BFEA0E8F5957e5B07Ef872d754);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(this), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 11;
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 + (60 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 11;
}
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 = 20000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb14610296578063b515566a146102b6578063c3c8cd80146102d6578063c9567bf9146102eb578063dd62ed3e1461030057600080fd5b806370a0823114610239578063715018a6146102595780638da5cb5b1461026e57806395d89b411461010e57600080fd5b8063273123b7116100d1578063273123b7146101c6578063313ce567146101e85780635932ead1146102045780636fc3eaec1461022457600080fd5b806306fdde031461010e578063095ea7b31461014d57806318160ddd1461017d57806323b872dd146101a657600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201825260078152664b616b6173686960c81b602082015290516101449190611793565b60405180910390f35b34801561015957600080fd5b5061016d610168366004611633565b610346565b6040519015158152602001610144565b34801561018957600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610144565b3480156101b257600080fd5b5061016d6101c13660046115f2565b61035d565b3480156101d257600080fd5b506101e66101e136600461157f565b6103c6565b005b3480156101f457600080fd5b5060405160098152602001610144565b34801561021057600080fd5b506101e661021f36600461172b565b61041a565b34801561023057600080fd5b506101e6610462565b34801561024557600080fd5b5061019861025436600461157f565b61048f565b34801561026557600080fd5b506101e66104b1565b34801561027a57600080fd5b506000546040516001600160a01b039091168152602001610144565b3480156102a257600080fd5b5061016d6102b1366004611633565b610525565b3480156102c257600080fd5b506101e66102d136600461165f565b610532565b3480156102e257600080fd5b506101e66105c8565b3480156102f757600080fd5b506101e66105fe565b34801561030c57600080fd5b5061019861031b3660046115b9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103533384846109c7565b5060015b92915050565b600061036a848484610aeb565b6103bc84336103b78560405180606001604052806028815260200161197f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e36565b6109c7565b5060019392505050565b6000546001600160a01b031633146103f95760405162461bcd60e51b81526004016103f0906117e8565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104445760405162461bcd60e51b81526004016103f0906117e8565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461048257600080fd5b4761048c81610e70565b50565b6001600160a01b03811660009081526002602052604081205461035790610ef5565b6000546001600160a01b031633146104db5760405162461bcd60e51b81526004016103f0906117e8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610353338484610aeb565b6000546001600160a01b0316331461055c5760405162461bcd60e51b81526004016103f0906117e8565b60005b81518110156105c4576001600660008484815181106105805761058061192f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105bc816118fe565b91505061055f565b5050565b600c546001600160a01b0316336001600160a01b0316146105e857600080fd5b60006105f33061048f565b905061048c81610f79565b6000546001600160a01b031633146106285760405162461bcd60e51b81526004016103f0906117e8565b600f54600160a01b900460ff16156106825760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103f0565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106c230826b033b2e3c9fd0803ce80000006109c7565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156106fb57600080fd5b505afa15801561070f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610733919061159c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077b57600080fd5b505afa15801561078f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b3919061159c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107fb57600080fd5b505af115801561080f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610833919061159c565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108638161048f565b6000806108786000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108db57600080fd5b505af11580156108ef573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109149190611765565b5050600f80546a108b2a2c2802909400000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561098f57600080fd5b505af11580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c49190611748565b6001600160a01b038316610a295760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103f0565b6001600160a01b038216610a8a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b4f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103f0565b6001600160a01b038216610bb15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103f0565b60008111610c135760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103f0565b6001600a55600b80556000546001600160a01b03848116911614801590610c4857506000546001600160a01b03838116911614155b15610e26576001600160a01b03831660009081526006602052604090205460ff16158015610c8f57506001600160a01b03821660009081526006602052604090205460ff16155b610c9857600080fd5b600f546001600160a01b038481169116148015610cc35750600e546001600160a01b03838116911614155b8015610ce857506001600160a01b03821660009081526005602052604090205460ff16155b8015610cfd5750600f54600160b81b900460ff165b15610d5a57601054811115610d1157600080fd5b6001600160a01b0382166000908152600760205260409020544211610d3557600080fd5b610d4042603c61188e565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d855750600e546001600160a01b03848116911614155b8015610daa57506001600160a01b03831660009081526005602052604090205460ff16155b15610db9576001600a55600b80555b6000610dc43061048f565b600f54909150600160a81b900460ff16158015610def5750600f546001600160a01b03858116911614155b8015610e045750600f54600160b01b900460ff165b15610e2457610e1281610f79565b478015610e2257610e2247610e70565b505b505b610e31838383611102565b505050565b60008184841115610e5a5760405162461bcd60e51b81526004016103f09190611793565b506000610e6784866118e7565b95945050505050565b600c546001600160a01b03166108fc610e8a83600261110d565b6040518115909202916000818181858888f19350505050158015610eb2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610ecd83600261110d565b6040518115909202916000818181858888f193505050501580156105c4573d6000803e3d6000fd5b6000600854821115610f5c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103f0565b6000610f6661114f565b9050610f72838261110d565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fc157610fc161192f565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561101557600080fd5b505afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d919061159c565b816001815181106110605761106061192f565b6001600160a01b039283166020918202929092010152600e5461108691309116846109c7565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110bf90859060009086903090429060040161181d565b600060405180830381600087803b1580156110d957600080fd5b505af11580156110ed573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e31838383611172565b6000610f7283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611269565b600080600061115c611297565b909250905061116b828261110d565b9250505090565b600080600080600080611184876112df565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111b6908761133c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111e5908661137e565b6001600160a01b038916600090815260026020526040902055611207816113dd565b6112118483611427565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161125691815260200190565b60405180910390a3505050505050505050565b6000818361128a5760405162461bcd60e51b81526004016103f09190611793565b506000610e6784866118a6565b60085460009081906b033b2e3c9fd0803ce80000006112b6828261110d565b8210156112d6575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006112fc8a600a54600b5461144b565b925092509250600061130c61114f565b9050600080600061131f8e8787876114a0565b919e509c509a509598509396509194505050505091939550919395565b6000610f7283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e36565b60008061138b838561188e565b905083811015610f725760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103f0565b60006113e761114f565b905060006113f583836114f0565b30600090815260026020526040902054909150611412908261137e565b30600090815260026020526040902055505050565b600854611434908361133c565b600855600954611444908261137e565b6009555050565b6000808080611465606461145f89896114f0565b9061110d565b90506000611478606461145f8a896114f0565b905060006114908261148a8b8661133c565b9061133c565b9992985090965090945050505050565b60008080806114af88866114f0565b905060006114bd88876114f0565b905060006114cb88886114f0565b905060006114dd8261148a868661133c565b939b939a50919850919650505050505050565b6000826114ff57506000610357565b600061150b83856118c8565b90508261151885836118a6565b14610f725760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103f0565b803561157a8161195b565b919050565b60006020828403121561159157600080fd5b8135610f728161195b565b6000602082840312156115ae57600080fd5b8151610f728161195b565b600080604083850312156115cc57600080fd5b82356115d78161195b565b915060208301356115e78161195b565b809150509250929050565b60008060006060848603121561160757600080fd5b83356116128161195b565b925060208401356116228161195b565b929592945050506040919091013590565b6000806040838503121561164657600080fd5b82356116518161195b565b946020939093013593505050565b6000602080838503121561167257600080fd5b823567ffffffffffffffff8082111561168a57600080fd5b818501915085601f83011261169e57600080fd5b8135818111156116b0576116b0611945565b8060051b604051601f19603f830116810181811085821117156116d5576116d5611945565b604052828152858101935084860182860187018a10156116f457600080fd5b600095505b8386101561171e5761170a8161156f565b8552600195909501949386019386016116f9565b5098975050505050505050565b60006020828403121561173d57600080fd5b8135610f7281611970565b60006020828403121561175a57600080fd5b8151610f7281611970565b60008060006060848603121561177a57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156117c0578581018301518582016040015282016117a4565b818111156117d2576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561186d5784516001600160a01b031683529383019391830191600101611848565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118a1576118a1611919565b500190565b6000826118c357634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156118e2576118e2611919565b500290565b6000828210156118f9576118f9611919565b500390565b600060001982141561191257611912611919565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048c57600080fd5b801515811461048c57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122040241c07d2db855f1a8e932e2cdceccaa49e991cf2b26e0a85bf5761739b032f64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,443 |
0x6a3e9429e255335c13f3d10d8497ef3c4ef55856
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/**
Legit NFT project featuring collection of 2,000 programmatically- generated retro bots. Project details on website.
@mekamasktoken group has more than 1,200 members now
Tokenomics:
🚀 1 Quadrillion total supply
🚀 100% Fair launch
🚀 Anti-bot/whale mechanism
🚀 Safu measure: extended liquidity locked
🚀 Tax proceeds: 3% Buyback & HODL, 4% Development, 5% Channel Calls & Marketing
👽 Website: www.mekamasknft.com
👽 Whitepaper: https://www.mekamasknft.com/whitepaper
👽 Twitter: https://twitter.com/MEKAMASKNFT
👽 Discord: http://discord.gg/N2RcX28vth
*/
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 MekaMask 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**12* 10**18;
string private _name = 'MekaMask';
string private _symbol = 'METAMASK';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c414fe4313857eea7938c04c3bf936948ec22b7d9cdb77597e44b52a11f4fd1a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,444 |
0x979b4bbc1049c21fbb6b857cde5c8b315c264012
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
/*
* @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 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 () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/*
DiffEx utility token presale contract.
20,000,000 DFFX tokens will be allocated (20% of total supply)
for sale in this contract at a base price of 0.0000015 ETH each,
and bonus allocations for higher value purchases. All proceeds
will go to funding the continued development of DiffEx as well
as its ICO.
*/
contract Presale is Ownable, ReentrancyGuard {
address constant TOKEN_ADDRESS = 0x22c88A2824625Dc5829bDBb50F95329183a1aDC3;
address payable constant DEV_ADDRESS = payable(0x9230c72Af8B625f66f31D0C1c1DF0917348A6d74);
uint256 constant MIN_VALUE = 20000000000000000; // 0.02 ETH, minimum purchase (13,000 DFFX)
bool open = true;
receive() external payable nonReentrant {
require(open && msg.value >= MIN_VALUE);
uint256 amount = calculateAmount(msg.value);
IERC20 token = IERC20(TOKEN_ADDRESS);
bool success = token.transfer(msg.sender, amount);
require(success);
}
/*
Calculate number of DFFX tokens purchased, including bonuses
*/
function calculateAmount(uint256 ethSent) internal pure returns (uint256) {
// Calculate bonus if purchase is > 0.1ETH
if (ethSent >= 100000000000000000) {
// Greater than or 1 ETH. Highest bonus tier, 50% bonus (1,012,500 DFFX per ETH)
if (ethSent >= 1000000000000000000) {
return ethSent * 1012500;
}
// Greater than or 0.5 ETH. 30% bonus (877,500 DFFX per ETH)
else if (ethSent >= 500000000000000000) {
return ethSent * 877500;
}
// Greater than or 0.25 ETH. 20% bonus (810,000 DFFX per ETH)
else if (ethSent >= 250000000000000000) {
return ethSent * 810000;
}
else { // Greater than or 0.1 ETH. 15% bonus (776,250 DFFX per ETH)
return ethSent * 776250;
}
}
return ethSent * 675000; // 675,000 DFFX Per ETH
}
/*
Withdraw ETH to dev account
*/
function withdrawETH(uint256 amount) public {
DEV_ADDRESS.transfer(amount);
}
/*
Start/stop the presale
*/
function openCloseSale() public onlyOwner {
open = !open;
}
}
|
0x60806040526004361061004e5760003560e01c8063715018a61461018a5780638da5cb5b146101a1578063d96d12e5146101cd578063f14210a6146101e2578063f2fde38b1461020257600080fd5b3661018557600260015414156100ab5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260018190555460ff1680156100c9575066470de4df8200003410155b6100d257600080fd5b60006100dd34610222565b60405163a9059cbb60e01b8152336004820152602481018290529091507322c88a2824625dc5829bdbb50f95329183a1adc390600090829063a9059cbb90604401602060405180830381600087803b15801561013857600080fd5b505af115801561014c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101709190610562565b90508061017c57600080fd5b50506001805550005b600080fd5b34801561019657600080fd5b5061019f6102a7565b005b3480156101ad57600080fd5b50600054604080516001600160a01b039092168252519081900360200190f35b3480156101d957600080fd5b5061019f610358565b3480156101ee57600080fd5b5061019f6101fd366004610584565b6103c6565b34801561020e57600080fd5b5061019f61021d366004610532565b61040b565b600067016345785d8a0000821061029a57670de0b6b3a764000082106102555761024f82620f731461059d565b92915050565b6706f05b59d3b2000082106102715761024f82620d63bc61059d565b6703782dace9d90000821061028d5761024f82620c5c1061059d565b61024f82620bd83a61059d565b61024f82620a4cb861059d565b6000546001600160a01b031633146103015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100a2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146103b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100a2565b6002805460ff19811660ff90911615179055565b604051739230c72af8b625f66f31d0c1c1df0917348a6d749082156108fc029083906000818181858888f19350505050158015610407573d6000803e3d6000fd5b5050565b6000546001600160a01b031633146104655760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100a2565b6001600160a01b0381166104ca5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100a2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006020828403121561054457600080fd5b81356001600160a01b038116811461055b57600080fd5b9392505050565b60006020828403121561057457600080fd5b8151801515811461055b57600080fd5b60006020828403121561059657600080fd5b5035919050565b60008160001904831182151516156105c557634e487b7160e01b600052601160045260246000fd5b50029056fea2646970667358221220092417b1b650a8fc271dfbfbbb23a634063e416f485723d42bca8226b551336564736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 3,445 |
0x38C39EB589190A9520c9f699BA7F9302170cFB5E
|
// SPDX-License-Identifier: MIT
/**
*
*______ _____ _ _ _ _____ _____ _____ _____
*| _ \ | ___| | | | (_) / __ \| _ |/ __ \| _ |
*| | | |___ __ _ ___ _ __ | |__ | | ___ ___| |_ _ ___ _ __ `' / /'| |/' |`' / /'| |/' |
*| | | / _ \/ _` |/ _ \ '_ \ | __|| |/ _ \/ __| __| |/ _ \| '_ \ / / | /| | / / | /| |
*| |/ / __/ (_| | __/ | | | | |___| | __/ (__| |_| | (_) | | | | ./ /___\ |_/ /./ /___\ |_/ /
*|___/ \___|\__, |\___|_| |_| \____/|_|\___|\___|\__|_|\___/|_| |_| \_____/ \___/ \_____/ \___/
* __/ |
* |___/
*
* dBIDEN
**/
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract dBIDEN is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _burnPercentage;
address private _storeAddress;
uint256 private _maxTransactionAmount;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 totalSupply, uint256 burnPercentage, address storeAddress, uint256 maxTransactionAmount) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_burnPercentage = burnPercentage;
_storeAddress = storeAddress;
_maxTransactionAmount = maxTransactionAmount;
_mint(_msgSender(), totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
if(recipient != owner() && sender != owner() ) {
require(amount <= _maxTransactionAmount, "ERC20: transfer amount exceeds limit");
}
uint256 burnAmount = amount.mul(_burnPercentage).div(100);
uint256 transfAmount = amount.sub(burnAmount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(transfAmount);
_balances[_storeAddress] = _balances[_storeAddress].add(burnAmount);
emit Transfer(sender, recipient, amount);
emit Transfer(sender, _storeAddress, burnAmount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Sets {burnPercentage} to a value.
*
*/
function _setBurnPercentage(uint256 burnPercentage) external onlyOwner returns (bool) {
if(_burnPercentage < 0 || _burnPercentage > 100)
return false;
_burnPercentage = burnPercentage;
return true;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
/**
* @dev See {_burnPercentage}.
*/
function burnPercentage() external view returns (uint256) {
return _burnPercentage;
}
/**
* @dev See {_storeAddress}.
*/
function storeAddress() external view returns (address) {
return _storeAddress;
}
/**
* @dev See {_maxTransactionAmount}.
*/
function maxTransactionAmount() external view returns (uint256) {
return _maxTransactionAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063c8c8ebe411610071578063c8c8ebe414610573578063dd62ed3e14610591578063f01f20df14610609578063f2c4da9314610627578063f2fde38b1461067157610116565b80638da5cb5b146103da57806395d89b4114610424578063a457c2d7146104a7578063a9059cbb1461050d57610116565b806323b872dd116100e957806323b872dd14610268578063313ce567146102ee578063395093511461031257806370a0823114610378578063715018a6146103d057610116565b8063058ee92f1461011b57806306fdde0314610161578063095ea7b3146101e457806318160ddd1461024a575b600080fd5b6101476004803603602081101561013157600080fd5b81019080803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b6101696107b2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a957808201518184015260208101905061018e565b50505050905090810190601f1680156101d65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610230600480360360408110156101fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610854565b604051808215151515815260200191505060405180910390f35b610252610872565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087c565b604051808215151515815260200191505060405180910390f35b6102f6610955565b604051808260ff1660ff16815260200191505060405180910390f35b61035e6004803603604081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061096c565b604051808215151515815260200191505060405180910390f35b6103ba6004803603602081101561038e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1f565b6040518082815260200191505060405180910390f35b6103d8610a68565b005b6103e2610bf0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042c610c19565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561046c578082015181840152602081019050610451565b50505050905090810190601f1680156104995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104f3600480360360408110156104bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cbb565b604051808215151515815260200191505060405180910390f35b6105596004803603604081101561052357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d88565b604051808215151515815260200191505060405180910390f35b61057b610da6565b6040518082815260200191505060405180910390f35b6105f3600480360360408110156105a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610db0565b6040518082815260200191505060405180910390f35b610611610e37565b6040518082815260200191505060405180910390f35b61062f610e41565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106b36004803603602081101561068757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6b565b005b60006106bf611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610780576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600754108061079357506064600754115b156107a157600090506107ad565b81600781905550600190505b919050565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561084a5780601f1061081f5761010080835404028352916020019161084a565b820191906000526020600020905b81548152906001019060200180831161082d57829003601f168201915b5050505050905090565b6000610868610861611078565b8484611080565b6001905092915050565b6000600354905090565b6000610889848484611277565b61094a84610895611078565b61094585604051806060016040528060288152602001611b9860289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108fb611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b611080565b600190509392505050565b6000600660009054906101000a900460ff16905090565b6000610a15610979611078565b84610a10856002600061098a611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b611080565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a70611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cb15780601f10610c8657610100808354040283529160200191610cb1565b820191906000526020600020905b815481529060010190602001808311610c9457829003601f168201915b5050505050905090565b6000610d7e610cc8611078565b84610d7985604051806060016040528060258152602001611c2d6025913960026000610cf2611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b611080565b6001905092915050565b6000610d9c610d95611078565b8484611277565b6001905092915050565b6000600954905090565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600754905090565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610e73611078565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611b096026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611106576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611be56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561118c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b2f6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611bc06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611383576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ae66023913960400191505060405180910390fd5b61138e838383611900565b611396610bf0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561140457506113d4610bf0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561146557600954811115611464576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c096024913960400191505060405180910390fd5b5b600061148f60646114816007548561190590919063ffffffff16565b61198b90919063ffffffff16565b905060006114a682846119d590919063ffffffff16565b905061151483604051806060016040528060268152602001611b5160269139600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b89092919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115a981600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116608260016000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b60016000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b6000838311158290611865576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561182a57808201518184015260208101905061180f565b50505050905090810190601f1680156118575780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156118f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b6000808314156119185760009050611985565b600082840290508284828161192957fe5b0414611980576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b776021913960400191505060405180910390fd5b809150505b92915050565b60006119cd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a1f565b905092915050565b6000611a1783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b8565b905092915050565b60008083118290611acb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a90578082015181840152602081019050611a75565b50505050905090810190601f168015611abd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611ad757fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e742065786365656473206c696d697445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220003f4927e8e990e849f70afd1bb78cdf67ae88a63192ab0c0fd4dc4e9952be7d64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,446 |
0x0fd309da1202e42de75bb57ab65c9b682b4a4e95
|
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-26
* BoredApe Token
*/
/*
The Marketing Platform in Crypto
*/
// 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 BoredApe is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BoredApe Token_T.me/BoredApeToken";
string private constant _symbol = "BoredApe";
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 = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 4;
uint256 private _teamFee = 4;
// 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 = 4;
_teamFee = 4;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function 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 = 10000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612eb4565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129d7565b610441565b6040516101789190612e99565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613056565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612988565b61046e565b6040516101e09190612e99565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128fa565b610547565b005b34801561021e57600080fd5b50610227610637565b60405161023491906130cb565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a54565b610640565b005b34801561027257600080fd5b5061027b6106f2565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128fa565b610764565b6040516102b19190613056565b60405180910390f35b3480156102c657600080fd5b506102cf6107b5565b005b3480156102dd57600080fd5b506102e6610908565b6040516102f39190612dcb565b60405180910390f35b34801561030857600080fd5b50610311610931565b60405161031e9190612eb4565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129d7565b61096e565b60405161035b9190612e99565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a13565b61098c565b005b34801561039957600080fd5b506103a2610adc565b005b3480156103b057600080fd5b506103b9610b56565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612aa6565b6110af565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061294c565b6111f6565b6040516104189190613056565b60405180910390f35b606060405180606001604052806021815260200161378f60219139905090565b600061045561044e61127d565b8484611285565b6001905092915050565b6000662386f26fc10000905090565b600061047b848484611450565b61053c8461048761127d565b610537856040518060600160405280602881526020016137b060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ed61127d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0f9092919063ffffffff16565b611285565b600190509392505050565b61054f61127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d390612f96565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064861127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cc90612f96565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073361127d565b73ffffffffffffffffffffffffffffffffffffffff161461075357600080fd5b600047905061076181611c73565b50565b60006107ae600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6e565b9050919050565b6107bd61127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084190612f96565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f426f726564417065000000000000000000000000000000000000000000000000815250905090565b600061098261097b61127d565b8484611450565b6001905092915050565b61099461127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1890612f96565b60405180910390fd5b60005b8151811015610ad8576001600a6000848481518110610a6c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad09061336c565b915050610a24565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1d61127d565b73ffffffffffffffffffffffffffffffffffffffff1614610b3d57600080fd5b6000610b4830610764565b9050610b5381611ddc565b50565b610b5e61127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610beb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be290612f96565b60405180910390fd5b600f60149054906101000a900460ff1615610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290613016565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc930600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16662386f26fc10000611285565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0f57600080fd5b505afa158015610d23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d479190612923565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da957600080fd5b505afa158015610dbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de19190612923565b6040518363ffffffff1660e01b8152600401610dfe929190612de6565b602060405180830381600087803b158015610e1857600080fd5b505af1158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190612923565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed930610764565b600080610ee4610908565b426040518863ffffffff1660e01b8152600401610f0696959493929190612e38565b6060604051808303818588803b158015610f1f57600080fd5b505af1158015610f33573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f589190612acf565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550662386f26fc100006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611059929190612e0f565b602060405180830381600087803b15801561107357600080fd5b505af1158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190612a7d565b5050565b6110b761127d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611144576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113b90612f96565b60405180910390fd5b60008111611187576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117e90612f56565b60405180910390fd5b6111b460646111a683662386f26fc100006120d690919063ffffffff16565b61215190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111eb9190613056565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ec90612ff6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135c90612f16565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114439190613056565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b790612fd6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152790612ed6565b60405180910390fd5b60008111611573576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156a90612fb6565b60405180910390fd5b61157b610908565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e957506115b9610908565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4c57600f60179054906101000a900460ff161561181c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166b57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c55750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181b57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176561127d565b73ffffffffffffffffffffffffffffffffffffffff1614806117db5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c361127d565b73ffffffffffffffffffffffffffffffffffffffff16145b61181a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181190613036565b60405180910390fd5b5b5b60105481111561182b57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cf5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d857600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119835750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d95750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f15750600f60179054906101000a900460ff165b15611a925742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4157600080fd5b600a42611a4e919061318c565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9d30610764565b9050600f60159054906101000a900460ff16158015611b0a5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b225750600f60169054906101000a900460ff165b15611b4a57611b3081611ddc565b60004790506000811115611b4857611b4747611c73565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf35750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfd57600090505b611c098484848461219b565b50505050565b6000838311158290611c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4e9190612eb4565b60405180910390fd5b5060008385611c66919061326d565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cc360028461215190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cee573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d3f60028461215190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d6a573d6000803e3d6000fd5b5050565b6000600654821115611db5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dac90612ef6565b60405180910390fd5b6000611dbf6121c8565b9050611dd4818461215190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e3a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e685781602001602082028036833780820191505090505b5090503081600081518110611ea6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4857600080fd5b505afa158015611f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f809190612923565b81600181518110611fba577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611285565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612085959493929190613071565b600060405180830381600087803b15801561209f57600080fd5b505af11580156120b3573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120e9576000905061214b565b600082846120f79190613213565b905082848261210691906131e2565b14612146576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213d90612f76565b60405180910390fd5b809150505b92915050565b600061219383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121f3565b905092915050565b806121a9576121a8612256565b5b6121b4848484612287565b806121c2576121c1612452565b5b50505050565b60008060006121d5612464565b915091506121ec818361215190919063ffffffff16565b9250505090565b6000808311829061223a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122319190612eb4565b60405180910390fd5b506000838561224991906131e2565b9050809150509392505050565b600060085414801561226a57506000600954145b1561227457612285565b600060088190555060006009819055505b565b600080600080600080612299876124c0565b9550955095509550955095506122f786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d8816125d0565b6123e2848361268d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161243f9190613056565b60405180910390a3505050505050505050565b60046008819055506004600981905550565b600080600060065490506000662386f26fc100009050612496662386f26fc1000060065461215190919063ffffffff16565b8210156124b357600654662386f26fc100009350935050506124bc565b81819350935050505b9091565b60008060008060008060008060006124dd8a6008546009546126c7565b92509250925060006124ed6121c8565b905060008060006125008e87878761275d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061256a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0f565b905092915050565b6000808284612581919061318c565b9050838110156125c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125bd90612f36565b60405180910390fd5b8091505092915050565b60006125da6121c8565b905060006125f182846120d690919063ffffffff16565b905061264581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126a28260065461252890919063ffffffff16565b6006819055506126bd8160075461257290919063ffffffff16565b6007819055505050565b6000806000806126f360646126e5888a6120d690919063ffffffff16565b61215190919063ffffffff16565b9050600061271d606461270f888b6120d690919063ffffffff16565b61215190919063ffffffff16565b9050600061274682612738858c61252890919063ffffffff16565b61252890919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061277685896120d690919063ffffffff16565b9050600061278d86896120d690919063ffffffff16565b905060006127a487896120d690919063ffffffff16565b905060006127cd826127bf858761252890919063ffffffff16565b61252890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127f96127f48461310b565b6130e6565b9050808382526020820190508285602086028201111561281857600080fd5b60005b85811015612848578161282e8882612852565b84526020840193506020830192505060018101905061281b565b5050509392505050565b60008135905061286181613749565b92915050565b60008151905061287681613749565b92915050565b600082601f83011261288d57600080fd5b813561289d8482602086016127e6565b91505092915050565b6000813590506128b581613760565b92915050565b6000815190506128ca81613760565b92915050565b6000813590506128df81613777565b92915050565b6000815190506128f481613777565b92915050565b60006020828403121561290c57600080fd5b600061291a84828501612852565b91505092915050565b60006020828403121561293557600080fd5b600061294384828501612867565b91505092915050565b6000806040838503121561295f57600080fd5b600061296d85828601612852565b925050602061297e85828601612852565b9150509250929050565b60008060006060848603121561299d57600080fd5b60006129ab86828701612852565b93505060206129bc86828701612852565b92505060406129cd868287016128d0565b9150509250925092565b600080604083850312156129ea57600080fd5b60006129f885828601612852565b9250506020612a09858286016128d0565b9150509250929050565b600060208284031215612a2557600080fd5b600082013567ffffffffffffffff811115612a3f57600080fd5b612a4b8482850161287c565b91505092915050565b600060208284031215612a6657600080fd5b6000612a74848285016128a6565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128bb565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128d0565b91505092915050565b600080600060608486031215612ae457600080fd5b6000612af2868287016128e5565b9350506020612b03868287016128e5565b9250506040612b14868287016128e5565b9150509250925092565b6000612b2a8383612b36565b60208301905092915050565b612b3f816132a1565b82525050565b612b4e816132a1565b82525050565b6000612b5f82613147565b612b69818561316a565b9350612b7483613137565b8060005b83811015612ba5578151612b8c8882612b1e565b9750612b978361315d565b925050600181019050612b78565b5085935050505092915050565b612bbb816132b3565b82525050565b612bca816132f6565b82525050565b6000612bdb82613152565b612be5818561317b565b9350612bf5818560208601613308565b612bfe81613442565b840191505092915050565b6000612c1660238361317b565b9150612c2182613453565b604082019050919050565b6000612c39602a8361317b565b9150612c44826134a2565b604082019050919050565b6000612c5c60228361317b565b9150612c67826134f1565b604082019050919050565b6000612c7f601b8361317b565b9150612c8a82613540565b602082019050919050565b6000612ca2601d8361317b565b9150612cad82613569565b602082019050919050565b6000612cc560218361317b565b9150612cd082613592565b604082019050919050565b6000612ce860208361317b565b9150612cf3826135e1565b602082019050919050565b6000612d0b60298361317b565b9150612d168261360a565b604082019050919050565b6000612d2e60258361317b565b9150612d3982613659565b604082019050919050565b6000612d5160248361317b565b9150612d5c826136a8565b604082019050919050565b6000612d7460178361317b565b9150612d7f826136f7565b602082019050919050565b6000612d9760118361317b565b9150612da282613720565b602082019050919050565b612db6816132df565b82525050565b612dc5816132e9565b82525050565b6000602082019050612de06000830184612b45565b92915050565b6000604082019050612dfb6000830185612b45565b612e086020830184612b45565b9392505050565b6000604082019050612e246000830185612b45565b612e316020830184612dad565b9392505050565b600060c082019050612e4d6000830189612b45565b612e5a6020830188612dad565b612e676040830187612bc1565b612e746060830186612bc1565b612e816080830185612b45565b612e8e60a0830184612dad565b979650505050505050565b6000602082019050612eae6000830184612bb2565b92915050565b60006020820190508181036000830152612ece8184612bd0565b905092915050565b60006020820190508181036000830152612eef81612c09565b9050919050565b60006020820190508181036000830152612f0f81612c2c565b9050919050565b60006020820190508181036000830152612f2f81612c4f565b9050919050565b60006020820190508181036000830152612f4f81612c72565b9050919050565b60006020820190508181036000830152612f6f81612c95565b9050919050565b60006020820190508181036000830152612f8f81612cb8565b9050919050565b60006020820190508181036000830152612faf81612cdb565b9050919050565b60006020820190508181036000830152612fcf81612cfe565b9050919050565b60006020820190508181036000830152612fef81612d21565b9050919050565b6000602082019050818103600083015261300f81612d44565b9050919050565b6000602082019050818103600083015261302f81612d67565b9050919050565b6000602082019050818103600083015261304f81612d8a565b9050919050565b600060208201905061306b6000830184612dad565b92915050565b600060a0820190506130866000830188612dad565b6130936020830187612bc1565b81810360408301526130a58186612b54565b90506130b46060830185612b45565b6130c16080830184612dad565b9695505050505050565b60006020820190506130e06000830184612dbc565b92915050565b60006130f0613101565b90506130fc828261333b565b919050565b6000604051905090565b600067ffffffffffffffff82111561312657613125613413565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613197826132df565b91506131a2836132df565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131d7576131d66133b5565b5b828201905092915050565b60006131ed826132df565b91506131f8836132df565b925082613208576132076133e4565b5b828204905092915050565b600061321e826132df565b9150613229836132df565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613262576132616133b5565b5b828202905092915050565b6000613278826132df565b9150613283836132df565b925082821015613296576132956133b5565b5b828203905092915050565b60006132ac826132bf565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613301826132df565b9050919050565b60005b8381101561332657808201518184015260208101905061330b565b83811115613335576000848401525b50505050565b61334482613442565b810181811067ffffffffffffffff8211171561336357613362613413565b5b80604052505050565b6000613377826132df565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133aa576133a96133b5565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613752816132a1565b811461375d57600080fd5b50565b613769816132b3565b811461377457600080fd5b50565b613780816132df565b811461378b57600080fd5b5056fe426f72656441706520546f6b656e5f542e6d652f426f726564417065546f6b656e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220825a8728b7965f531e9d1b848e6e14aba12a954c8a3bcf33038037e806f7c22164736f6c63430008040033
|
{"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,447 |
0x5db5562a4e880f957b04c18db512f72952cfcb51
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
pragma solidity ^0.6.6;
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;
}
}
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");
}
/**
* @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);
}
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 {
// 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;
}
}
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 DogeXCoinBase is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
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) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610626578063b2bdfa7b1461068c578063dd62ed3e146106d6578063e12681151461074e576100f5565b806352b0f196146103b157806370a082311461050757806380b2122e1461055f57806395d89b41146105a3576100f5565b806318160ddd116100d357806318160ddd1461029b57806323b872dd146102b9578063313ce5671461033f5780634e6ec24714610363576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610806565b005b6101ba6109bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a61565b604051808215151515815260200191505060405180910390f35b6102a3610a7f565b6040518082815260200191505060405180910390f35b610325600480360360608110156102cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a89565b604051808215151515815260200191505060405180910390f35b610347610b62565b604051808260ff1660ff16815260200191505060405180910390f35b6103af6004803603604081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b79565b005b610505600480360360608110156103c757600080fd5b8101908080359060200190929190803590602001906401000000008111156103ee57600080fd5b82018360208201111561040057600080fd5b8035906020019184602083028401116401000000008311171561042257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561048257600080fd5b82018360208201111561049457600080fd5b803590602001918460208302840111640100000000831117156104b657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d98565b005b6105496004803603602081101561051d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f81565b6040518082815260200191505060405180910390f35b6105a16004803603602081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc9565b005b6105ab6110d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105eb5780820151818401526020810190506105d0565b50505050905090810190601f1680156106185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106726004803603604081101561063c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611172565b604051808215151515815260200191505060405180910390f35b610694611190565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b6565b6040518082815260200191505060405180910390f35b6108046004803603602081101561076457600080fd5b810190808035906020019064010000000081111561078157600080fd5b82018360208201111561079357600080fd5b803590602001918460208302840111640100000000831117156107b557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061123d565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156109bb576001600260008484815181106108ea57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061095557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108cf565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a575780601f10610a2c57610100808354040283529160200191610a57565b820191906000526020600020905b815481529060010190602001808311610a3a57829003601f168201915b5050505050905090565b6000610a75610a6e6113f5565b84846113fd565b6001905092915050565b6000600554905090565b6000610a968484846115f4565b610b5784610aa26113f5565b610b5285604051806060016040528060288152602001612eaa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b086113f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6113fd565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c5181600554612db190919063ffffffff16565b600581905550610cca81600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b8251811015610f7b57610e9a838281518110610e7957fe5b6020026020010151838381518110610e8d57fe5b6020026020010151611172565b5083811015610f6e576001806000858481518110610eb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610f6d838281518110610f1c57fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6113fd565b5b8080600101915050610e61565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111685780601f1061113d57610100808354040283529160200191611168565b820191906000526020600020905b81548152906001019060200180831161114b57829003601f168201915b5050505050905090565b600061118661117f6113f5565b84846115f4565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611300576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156113f157600180600084848151811061132057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611306565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611483576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612ef76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611509576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e626022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156116c35750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156119ca5781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611815576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611820868686612e39565b61188b84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce9565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a735750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611acb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611e2657600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b5857508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611b6557806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611beb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611c7c868686612e39565b611ce784604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce8565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561214057600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611f8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611f96868686612e39565b61200184604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612094846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce7565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561255857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122425750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612297576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561231d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156123a3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b6123ae868686612e39565b61241984604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124ac846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce6565b60035481101561292a57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612669576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156126ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612775576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612780868686612e39565b6127eb84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce5565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806129d35750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612b3f868686612e39565b612baa84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c3d846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612d9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d63578082015181840152602081019050612d48565b50505050905090810190601f168015612d905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612e2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122049e65901692558de9804a673231d8668592a417ec86c023dfc29bbb1e8b3701864736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,448 |
0x171a7a92952238d8d432dd3e29b1d78dc8cfaa31
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
/**
_ _ _ _____
| \ | | | | |_ _|
| \| | __ _ ___ | |__ ___ | | _ __ _ _
| . ` | / _` | / __|| '_ \ / _ \ | | | '_ \ | | | |
| |\ || (_| || (__ | | | || (_) | _| |_| | | || |_| |
\_| \_/ \__,_| \___||_| |_| \___/ \___/|_| |_| \__,_|
Nacho Inu: Eat the dip!
Token Information
1. 100,000,000,000 Total Supply
3. NO DEV TOKENS, NO PRESALE TOKENS!
4. Developer provides LP!
5. 30-second buy cooldown at launch, permanent 90-second sell cooldown
6. 2,000,000,000 max buy at launch, permanent 3,000,000,000 max sell (per transaction)
6. 6% redistribution to holders
7. Small ETH fee on sells, split amongst team - NOT TOKENS! NO EFFECT ON CHART!
Telegram: t.me/NachoInu
Twitter: https://twitter.com/NachoInu
*/
// 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 NACHOINU 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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Nacho Inu";
string private constant _symbol = "NACHO";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6; // ...
uint256 private _teamFee = 9; // nice
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private buyCooldownEnabled = false;
bool private sellCooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setBuyCooldownEnabled(bool onoff) external onlyOwner() {
buyCooldownEnabled = onoff;
}
function setSellCooldownEnabled(bool onoff) external onlyOwner() {
sellCooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(amount <= _maxTxAmount, "Too many tokens.");
// to buyer
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && buyCooldownEnabled) {
require(tradingOpen, "Trading not yet enabled.");
require(cooldown[to] < block.timestamp, "Your transaction cooldown has not expired.");
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
// from seller
if (!inSwap && from != uniswapV2Pair && tradingOpen) {
require(amount <= 3e9 * 10**9);
if(sellCooldownEnabled) {
require(cooldown[from] < block.timestamp, "Your transaction cooldown has not expired.");
cooldown[from] = block.timestamp + (90 seconds);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function 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);
buyCooldownEnabled = true;
sellCooldownEnabled = true;
_maxTxAmount = 2e9 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
}
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 _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 setMaxTxAmount(uint256 amount) external onlyOwner() {
require(amount > 0, "Amount must be greater than 0");
_maxTxAmount = amount;
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function maxTxAmount() public view returns (uint) {
return _maxTxAmount;
}
function sellCooldown() public view returns (bool) {
return sellCooldownEnabled;
}
function buyCooldown() public view returns (bool) {
return buyCooldownEnabled;
}
}
|
0x6080604052600436106101395760003560e01c80638c0b5e22116100ab578063c3c8cd801161006f578063c3c8cd8014610411578063c9567bf914610428578063d543dbeb1461043f578063dd62ed3e14610468578063e8078d94146104a5578063ec28438a146104bc57610140565b80638c0b5e221461032a5780638da5cb5b1461035557806395d89b4114610380578063a9059cbb146103ab578063acaf4a80146103e857610140565b8063313ce567116100fd578063313ce5671461024057806356c2c6be1461026b5780636fc3eaec14610294578063704fbfe5146102ab57806370a08231146102d6578063715018a61461031357610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad5780631b2773c2146101d857806323b872dd1461020357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104e5565b6040516101679190612e5d565b60405180910390f35b34801561017c57600080fd5b506101976004803603810190610192919061297b565b610522565b6040516101a49190612e42565b60405180910390f35b3480156101b957600080fd5b506101c2610540565b6040516101cf919061303f565b60405180910390f35b3480156101e457600080fd5b506101ed610551565b6040516101fa9190612e42565b60405180910390f35b34801561020f57600080fd5b5061022a6004803603810190610225919061292c565b610568565b6040516102379190612e42565b60405180910390f35b34801561024c57600080fd5b50610255610641565b60405161026291906130b4565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d91906129b7565b61064a565b005b3480156102a057600080fd5b506102a96106fc565b005b3480156102b757600080fd5b506102c061076e565b6040516102cd9190612e42565b60405180910390f35b3480156102e257600080fd5b506102fd60048036038101906102f8919061289e565b610785565b60405161030a919061303f565b60405180910390f35b34801561031f57600080fd5b506103286107d6565b005b34801561033657600080fd5b5061033f610929565b60405161034c919061303f565b60405180910390f35b34801561036157600080fd5b5061036a610933565b6040516103779190612d74565b60405180910390f35b34801561038c57600080fd5b5061039561095c565b6040516103a29190612e5d565b60405180910390f35b3480156103b757600080fd5b506103d260048036038101906103cd919061297b565b610999565b6040516103df9190612e42565b60405180910390f35b3480156103f457600080fd5b5061040f600480360381019061040a91906129b7565b6109b7565b005b34801561041d57600080fd5b50610426610a69565b005b34801561043457600080fd5b5061043d610ae3565b005b34801561044b57600080fd5b5061046660048036038101906104619190612a09565b610b95565b005b34801561047457600080fd5b5061048f600480360381019061048a91906128f0565b610cde565b60405161049c919061303f565b60405180910390f35b3480156104b157600080fd5b506104ba610d65565b005b3480156104c857600080fd5b506104e360048036038101906104de9190612a09565b6112a6565b005b60606040518060400160405280600981526020017f4e6163686f20496e750000000000000000000000000000000000000000000000815250905090565b600061053661052f6113c1565b84846113c9565b6001905092915050565b6000683635c9adc5dea00000905090565b6000601060179054906101000a900460ff16905090565b6000610575848484611594565b610636846105816113c1565b610631856040518060600160405280602881526020016136f660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105e76113c1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2f9092919063ffffffff16565b6113c9565b600190509392505050565b60006009905090565b6106526113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d690612f5f565b60405180910390fd5b80601060166101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073d6113c1565b73ffffffffffffffffffffffffffffffffffffffff161461075d57600080fd5b600047905061076b81611c93565b50565b6000601060169054906101000a900460ff16905090565b60006107cf600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8e565b9050919050565b6107de6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086290612f5f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000601154905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4e4143484f000000000000000000000000000000000000000000000000000000815250905090565b60006109ad6109a66113c1565b8484611594565b6001905092915050565b6109bf6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390612f5f565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aaa6113c1565b73ffffffffffffffffffffffffffffffffffffffff1614610aca57600080fd5b6000610ad530610785565b9050610ae081611dfc565b50565b610aeb6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612f5f565b60405180910390fd5b6001601060146101000a81548160ff021916908315150217905550565b610b9d6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2190612f5f565b60405180910390fd5b60008111610c6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6490612eff565b60405180910390fd5b610c9c6064610c8e83683635c9adc5dea000006120f690919063ffffffff16565b61217190919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601154604051610cd3919061303f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d6d6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df190612f5f565b60405180910390fd5b601060149054906101000a900460ff1615610e4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4190612fff565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610eda30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113c9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f2057600080fd5b505afa158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906128c7565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff291906128c7565b6040518363ffffffff1660e01b815260040161100f929190612d8f565b602060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106191906128c7565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110ea30610785565b6000806110f5610933565b426040518863ffffffff1660e01b815260040161111796959493929190612de1565b6060604051808303818588803b15801561113057600080fd5b505af1158015611144573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111699190612a32565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550671bc16d674ec80000601181905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611250929190612db8565b602060405180830381600087803b15801561126a57600080fd5b505af115801561127e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a291906129e0565b5050565b6112ae6113c1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461133b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133290612f5f565b60405180910390fd5b6000811161137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137590612eff565b60405180910390fd5b806011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6011546040516113b6919061303f565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611439576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143090612fbf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a090612ebf565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611587919061303f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb90612f9f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166b90612e7f565b60405180910390fd5b600081116116b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ae90612f7f565b60405180910390fd5b6116bf610933565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172d57506116fd610933565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6c57601154811115611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176e90612fdf565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118225750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118785750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118905750601060169054906101000a900460ff165b156119b657601060149054906101000a900460ff166118e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118db9061301f565b60405180910390fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611965576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195c90612f1f565b60405180910390fd5b601e426119729190613124565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006119c130610785565b9050601060159054906101000a900460ff16158015611a2e5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a465750601060149054906101000a900460ff165b15611b6a576729a2241af62c0000821115611a6057600080fd5b601060179054906101000a900460ff1615611b475742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aed90612f1f565b60405180910390fd5b605a42611b039190613124565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611b5081611dfc565b60004790506000811115611b6857611b6747611c93565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c135750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1d57600090505b611c29848484846121bb565b50505050565b6000838311158290611c77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6e9190612e5d565b60405180910390fd5b5060008385611c869190613205565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce360028461217190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d0e573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d5f60028461217190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8a573d6000803e3d6000fd5b5050565b6000600754821115611dd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcc90612e9f565b60405180910390fd5b6000611ddf6121e8565b9050611df4818461217190919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e885781602001602082028036833780820191505090505b5090503081600081518110611ec6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6857600080fd5b505afa158015611f7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa091906128c7565b81600181518110611fda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204130600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113c9565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a595949392919061305a565b600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b600080831415612109576000905061216b565b6000828461211791906131ab565b9050828482612126919061317a565b14612166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215d90612f3f565b60405180910390fd5b809150505b92915050565b60006121b383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612213565b905092915050565b806121c9576121c8612276565b5b6121d48484846122b9565b806121e2576121e1612484565b5b50505050565b60008060006121f5612498565b9150915061220c818361217190919063ffffffff16565b9250505090565b6000808311829061225a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122519190612e5d565b60405180910390fd5b5060008385612269919061317a565b9050809150509392505050565b600060095414801561228a57506000600a54145b15612294576122b7565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b6000806000806000806122cb876124fa565b95509550955095509550955061232986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461256290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123be85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ac90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061240a8161260a565b61241484836126c7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612471919061303f565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea0000090506124ce683635c9adc5dea0000060075461217190919063ffffffff16565b8210156124ed57600754683635c9adc5dea000009350935050506124f6565b81819350935050505b9091565b60008060008060008060008060006125178a600954600a54612701565b92509250925060006125276121e8565b9050600080600061253a8e878787612797565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125a483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c2f565b905092915050565b60008082846125bb9190613124565b905083811015612600576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125f790612edf565b60405180910390fd5b8091505092915050565b60006126146121e8565b9050600061262b82846120f690919063ffffffff16565b905061267f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ac90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126dc8260075461256290919063ffffffff16565b6007819055506126f7816008546125ac90919063ffffffff16565b6008819055505050565b60008060008061272d606461271f888a6120f690919063ffffffff16565b61217190919063ffffffff16565b905060006127576064612749888b6120f690919063ffffffff16565b61217190919063ffffffff16565b9050600061278082612772858c61256290919063ffffffff16565b61256290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127b085896120f690919063ffffffff16565b905060006127c786896120f690919063ffffffff16565b905060006127de87896120f690919063ffffffff16565b90506000612807826127f9858761256290919063ffffffff16565b61256290919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061282f816136b0565b92915050565b600081519050612844816136b0565b92915050565b600081359050612859816136c7565b92915050565b60008151905061286e816136c7565b92915050565b600081359050612883816136de565b92915050565b600081519050612898816136de565b92915050565b6000602082840312156128b057600080fd5b60006128be84828501612820565b91505092915050565b6000602082840312156128d957600080fd5b60006128e784828501612835565b91505092915050565b6000806040838503121561290357600080fd5b600061291185828601612820565b925050602061292285828601612820565b9150509250929050565b60008060006060848603121561294157600080fd5b600061294f86828701612820565b935050602061296086828701612820565b925050604061297186828701612874565b9150509250925092565b6000806040838503121561298e57600080fd5b600061299c85828601612820565b92505060206129ad85828601612874565b9150509250929050565b6000602082840312156129c957600080fd5b60006129d78482850161284a565b91505092915050565b6000602082840312156129f257600080fd5b6000612a008482850161285f565b91505092915050565b600060208284031215612a1b57600080fd5b6000612a2984828501612874565b91505092915050565b600080600060608486031215612a4757600080fd5b6000612a5586828701612889565b9350506020612a6686828701612889565b9250506040612a7786828701612889565b9150509250925092565b6000612a8d8383612a99565b60208301905092915050565b612aa281613239565b82525050565b612ab181613239565b82525050565b6000612ac2826130df565b612acc8185613102565b9350612ad7836130cf565b8060005b83811015612b08578151612aef8882612a81565b9750612afa836130f5565b925050600181019050612adb565b5085935050505092915050565b612b1e8161324b565b82525050565b612b2d8161328e565b82525050565b6000612b3e826130ea565b612b488185613113565b9350612b588185602086016132a0565b612b6181613331565b840191505092915050565b6000612b79602383613113565b9150612b8482613342565b604082019050919050565b6000612b9c602a83613113565b9150612ba782613391565b604082019050919050565b6000612bbf602283613113565b9150612bca826133e0565b604082019050919050565b6000612be2601b83613113565b9150612bed8261342f565b602082019050919050565b6000612c05601d83613113565b9150612c1082613458565b602082019050919050565b6000612c28602a83613113565b9150612c3382613481565b604082019050919050565b6000612c4b602183613113565b9150612c56826134d0565b604082019050919050565b6000612c6e602083613113565b9150612c798261351f565b602082019050919050565b6000612c91602983613113565b9150612c9c82613548565b604082019050919050565b6000612cb4602583613113565b9150612cbf82613597565b604082019050919050565b6000612cd7602483613113565b9150612ce2826135e6565b604082019050919050565b6000612cfa601083613113565b9150612d0582613635565b602082019050919050565b6000612d1d601783613113565b9150612d288261365e565b602082019050919050565b6000612d40601883613113565b9150612d4b82613687565b602082019050919050565b612d5f81613277565b82525050565b612d6e81613281565b82525050565b6000602082019050612d896000830184612aa8565b92915050565b6000604082019050612da46000830185612aa8565b612db16020830184612aa8565b9392505050565b6000604082019050612dcd6000830185612aa8565b612dda6020830184612d56565b9392505050565b600060c082019050612df66000830189612aa8565b612e036020830188612d56565b612e106040830187612b24565b612e1d6060830186612b24565b612e2a6080830185612aa8565b612e3760a0830184612d56565b979650505050505050565b6000602082019050612e576000830184612b15565b92915050565b60006020820190508181036000830152612e778184612b33565b905092915050565b60006020820190508181036000830152612e9881612b6c565b9050919050565b60006020820190508181036000830152612eb881612b8f565b9050919050565b60006020820190508181036000830152612ed881612bb2565b9050919050565b60006020820190508181036000830152612ef881612bd5565b9050919050565b60006020820190508181036000830152612f1881612bf8565b9050919050565b60006020820190508181036000830152612f3881612c1b565b9050919050565b60006020820190508181036000830152612f5881612c3e565b9050919050565b60006020820190508181036000830152612f7881612c61565b9050919050565b60006020820190508181036000830152612f9881612c84565b9050919050565b60006020820190508181036000830152612fb881612ca7565b9050919050565b60006020820190508181036000830152612fd881612cca565b9050919050565b60006020820190508181036000830152612ff881612ced565b9050919050565b6000602082019050818103600083015261301881612d10565b9050919050565b6000602082019050818103600083015261303881612d33565b9050919050565b60006020820190506130546000830184612d56565b92915050565b600060a08201905061306f6000830188612d56565b61307c6020830187612b24565b818103604083015261308e8186612ab7565b905061309d6060830185612aa8565b6130aa6080830184612d56565b9695505050505050565b60006020820190506130c96000830184612d65565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061312f82613277565b915061313a83613277565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561316f5761316e6132d3565b5b828201905092915050565b600061318582613277565b915061319083613277565b9250826131a05761319f613302565b5b828204905092915050565b60006131b682613277565b91506131c183613277565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fa576131f96132d3565b5b828202905092915050565b600061321082613277565b915061321b83613277565b92508282101561322e5761322d6132d3565b5b828203905092915050565b600061324482613257565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329982613277565b9050919050565b60005b838110156132be5780820151818401526020810190506132a3565b838111156132cd576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f596f7572207472616e73616374696f6e20636f6f6c646f776e20686173206e6f60008201527f7420657870697265642e00000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f546f6f206d616e7920746f6b656e732e00000000000000000000000000000000600082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6136b981613239565b81146136c457600080fd5b50565b6136d08161324b565b81146136db57600080fd5b50565b6136e781613277565b81146136f257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220716b51ca8bf572c136c28522bcd9c0f2a0a2b63abe14eeea4b81e4a7352acd3f64736f6c63430008040033
|
{"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,449 |
0xb567277e5cbe40cf4e369ec64fa3c9bd0e3afb7c
|
/*
To all the degens that missed out on MYOBU, this is your chance to redeem yourself! Lock + Renounce
https://t.me/SeishinFox
http://seishinfox.io
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 4 hours period are allowed, refreshes every 24hrs.
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 5-6% developer fee split within the team
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract Seishin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Seishin";
string private constant _symbol = "SEISHIN";
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 = 7;
uint256 private _teamFee = 5;
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 = 6;
_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 + (3 hours);
}
else if (sellnumber[from] == 3) {
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 = 3000000000 * 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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600781526020017f5365697368696e00000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5345495348494e00000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b9190505550612a3042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122088d04e5116af15cf6f44adf7c4ad205f4dea7746c3ef809a7f1c0df9081438ab64736f6c63430008040033
|
{"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,450 |
0xaa53cd897a0d652a10a87a2ce355641752b62b51
|
/**
*Submitted for verification at Etherscan.io on 2020-10-20
*/
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string indexed resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) private _balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_balanceOf[address(this)] = type(uint256).max; // trick to prevent token transfer to contract itself
_mint(manager, managerSupply);
_mint(address(this), saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
uint256 value = msg.value.mul(saleRate);
_transfer(address(this), msg.sender, value);
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceOf(address account) external view returns (uint256) {
return account == address(this) ? 0 : _balanceOf[account];
}
function balanceResolution(address from, address to, uint256 value, string memory resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
_balanceOf[from] = _balanceOf[from].sub(value);
_balanceOf[to] = _balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] memory to, uint256[] memory value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
_balanceOf[to] = _balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] memory to, uint256[] memory value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string memory _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
}
function updateSale(uint256 _saleRate, uint256 saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), saleSupply);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
interface IERC20Transfer { // brief interface for erc20 token transfer
function transfer(address recipient, uint256 value) external returns (bool);
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO;
address public lexDAOtoken;
address payable immutable public template;
uint256 public userReward;
string public details;
event LaunchLexToken(address indexed lexToken, address indexed manager, address indexed resolver, uint256 saleRate, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 indexed userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_resolver,
_decimals,
managerSupply,
_saleRate,
saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!ethCall");
IERC20Transfer(lexDAOtoken).transfer(_manager, userReward);
emit LaunchLexToken(address(lex), _manager, _resolver, _saleRate, _forSale);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string memory _details) external {
require(msg.sender == lexDAO, "!lexDAO");
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
}
|
0x6080604052600436106100705760003560e01c80636f2ddd931161004e5780636f2ddd93146103265780638976263d1461033b578063a994ee2d1461040c578063e5a6c28f1461042157610070565b8063417a1308146100755780634f411f7b1461026b578063565974d31461029c575b600080fd5b610269600480360361018081101561008c57600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b8111156100e257600080fd5b8201836020820111156100f457600080fd5b803590602001918460018302840111600160201b8311171561011557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561016757600080fd5b82018360208201111561017957600080fd5b803590602001918460018302840111600160201b8311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101ec57600080fd5b8201836020820111156101fe57600080fd5b803590602001918460018302840111600160201b8311171561021f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505050803515159150602001351515610448565b005b34801561027757600080fd5b50610280610810565b604080516001600160a01b039092168252519081900360200190f35b3480156102a857600080fd5b506102b161081f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102eb5781810151838201526020016102d3565b50505050905090810190601f1680156103185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033257600080fd5b506102806108ad565b34801561034757600080fd5b506102696004803603608081101561035e57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561039857600080fd5b8201836020820111156103aa57600080fd5b803590602001918460018302840111600160201b831117156103cb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108d1945050505050565b34801561041857600080fd5b50610280610a17565b34801561042d57600080fd5b50610436610a26565b60408051918252519081900360200190f35b60006104737f0000000000000000000000009200c88892ed4f32db9371a45e72bbc34624bb76610a2c565b9050806001600160a01b0316631850f7668e8e8e8e8e8e8e8e8e8e8e8e6040518d63ffffffff1660e01b8152600401808d6001600160a01b031681526020018c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561053357818101518382015260200161051b565b50505050905090810190601f1680156105605780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b8381101561059357818101518382015260200161057b565b50505050905090810190601f1680156105c05780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b838110156105f35781810151838201526020016105db565b50505050905090810190601f1680156106205780820380516001836020036101000a031916815260200191505b509f50505050505050505050505050505050600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b5050600080546040519193506001600160a01b0316915034908381818185875af1925050503d80600081146106b1576040519150601f19603f3d011682016040523d82523d6000602084013e6106b6565b606091505b50509050806106f7576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b600160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb8f6002546040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b8101908080519060200190929190505050508c6001600160a01b03168e6001600160a01b0316836001600160a01b03167f8663caf4d99644a7b67a43c517f166f535c34e993e08c20e4900f7e4521b27598d886040518083815260200182151581526020019250505060405180910390a45050505050505050505050505050565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a55780601f1061087a576101008083540402835291602001916108a5565b820191906000526020600020905b81548152906001019060200180831161088857829003601f168201915b505050505081565b7f0000000000000000000000009200c88892ed4f32db9371a45e72bbc34624bb7681565b6000546001600160a01b0316331461091a576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905560028290558051610962906003906020840190610a7e565b5081836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a59846040518080602001828103825283818151815260200191508051906020019080838360005b838110156109d75781810151838201526020016109bf565b50505050905090810190601f168015610a045780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505050565b6001546001600160a01b031681565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610abf57805160ff1916838001178555610aec565b82800160010185558215610aec579182015b82811115610aec578251825591602001919060010190610ad1565b50610af8929150610afc565b5090565b5b80821115610af85760008155600101610afd56fea264697066735822122052170efbeb0e1915ab3515da271331e952a4f5f7438a246581c4bbd90a573ca864736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,451 |
0xee259dbb0ab2e194a8d8a23e10584b3253f09395
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/*
t.me/shibento
Shiba Bento
$SHIBENTO
███████╗██╗ ██╗██╗██████╗ ███████╗███╗ ██╗████████╗ ██████╗
██╔════╝██║ ██║██║██╔══██╗██╔════╝████╗ ██║╚══██╔══╝██╔═══██╗
███████╗███████║██║██████╔╝█████╗ ██╔██╗ ██║ ██║ ██║ ██║
╚════██║██╔══██║██║██╔══██╗██╔══╝ ██║╚██╗██║ ██║ ██║ ██║
███████║██║ ██║██║██████╔╝███████╗██║ ╚████║ ██║ ╚██████╔╝
╚══════╝╚═╝ ╚═╝╚═╝╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝
The next foodtoken for our incoming ShibaChef Platform.
So so delicious!
Join our general group on telegram => t.me/shibento
Fair launch!
No presale/team/dev tokens!
Designed and developed by the Shiba Ramen core team (@shibaramen) | t.me/shibaramen
LP Lock immediately on launch.
Ownership will be renounced 10 minutes after launch.
Slippage Recommended: 18%+
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 Shibento is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Shiba Bento";
string private constant _symbol = unicode'SHIBENTO🍱';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3.25e9 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d64565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061288e565b61045e565b6040516101789190612d49565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ee6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061283b565b61048d565b6040516101e09190612d49565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127a1565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612f5b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612917565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127a1565b610783565b6040516102b19190612ee6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612c7b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612d64565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061288e565b61098d565b60405161035b9190612d49565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128ce565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612971565b6110ab565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127fb565b6111f4565b6040516104189190612ee6565b60405180910390f35b60606040518060400160405280600b81526020017f53686962612042656e746f000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161363960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b069092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612e46565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612e46565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b6a565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c65565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612e46565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f53484942454e544ff09f8db10000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612e46565b60405180910390fd5b60005b8151811015610ad157600160066000848481518110610a6557610a646132a3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906131fc565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611cd3565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612e46565b60405180910390fd5b601160149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612ec6565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906127ce565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906127ce565b6040518363ffffffff1660e01b8152600401610df9929190612c96565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906127ce565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612ce8565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f53919061299e565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550672d1a51c7e00500006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612cbf565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612944565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612e46565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e06565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611f5b90919063ffffffff16565b611fd690919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111e99190612ee6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612ea6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612dc6565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612ee6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612e86565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612d86565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612e66565b60405180910390fd5b6005600a81905550600a600b81905550611589610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f757506115c7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4357600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116a05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116a957600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117545750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117aa5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117c25750601160179054906101000a900460ff165b15611872576012548111156117d657600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182157600080fd5b601e4261182e919061301c565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561191d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119735750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611989576005600a819055506014600b819055505b600061199430610783565b9050601160159054906101000a900460ff16158015611a015750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a195750601160169054906101000a900460ff165b15611a4157611a2781611cd3565b60004790506000811115611a3f57611a3e47611b6a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611aea5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611af457600090505b611b0084848484612020565b50505050565b6000838311158290611b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b459190612d64565b60405180910390fd5b5060008385611b5d91906130fd565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bba600284611fd690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be5573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c36600284611fd690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c61573d6000803e3d6000fd5b5050565b6000600854821115611cac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca390612da6565b60405180910390fd5b6000611cb661204d565b9050611ccb8184611fd690919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d0b57611d0a6132d2565b5b604051908082528060200260200182016040528015611d395781602001602082028036833780820191505090505b5090503081600081518110611d5157611d506132a3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611df357600080fd5b505afa158015611e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2b91906127ce565b81600181518110611e3f57611e3e6132a3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ea630601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f0a959493929190612f01565b600060405180830381600087803b158015611f2457600080fd5b505af1158015611f38573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f6e5760009050611fd0565b60008284611f7c91906130a3565b9050828482611f8b9190613072565b14611fcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc290612e26565b60405180910390fd5b809150505b92915050565b600061201883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612078565b905092915050565b8061202e5761202d6120db565b5b61203984848461211e565b80612047576120466122e9565b5b50505050565b600080600061205a6122fd565b915091506120718183611fd690919063ffffffff16565b9250505090565b600080831182906120bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b69190612d64565b60405180910390fd5b50600083856120ce9190613072565b9050809150509392505050565b6000600a541480156120ef57506000600b54145b156120f95761211c565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121308761235f565b95509550955095509550955061218e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226f8161246f565b612279848361252c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122d69190612ee6565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea000009050612333683635c9adc5dea00000600854611fd690919063ffffffff16565b82101561235257600854683635c9adc5dea0000093509350505061235b565b81819350935050505b9091565b600080600080600080600080600061237c8a600a54600b54612566565b925092509250600061238c61204d565b9050600080600061239f8e8787876125fc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b06565b905092915050565b6000808284612420919061301c565b905083811015612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245c90612de6565b60405180910390fd5b8091505092915050565b600061247961204d565b905060006124908284611f5b90919063ffffffff16565b90506124e481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612541826008546123c790919063ffffffff16565b60088190555061255c8160095461241190919063ffffffff16565b6009819055505050565b6000806000806125926064612584888a611f5b90919063ffffffff16565b611fd690919063ffffffff16565b905060006125bc60646125ae888b611f5b90919063ffffffff16565b611fd690919063ffffffff16565b905060006125e5826125d7858c6123c790919063ffffffff16565b6123c790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126158589611f5b90919063ffffffff16565b9050600061262c8689611f5b90919063ffffffff16565b905060006126438789611f5b90919063ffffffff16565b9050600061266c8261265e85876123c790919063ffffffff16565b6123c790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061269861269384612f9b565b612f76565b905080838252602082019050828560208602820111156126bb576126ba613306565b5b60005b858110156126eb57816126d188826126f5565b8452602084019350602083019250506001810190506126be565b5050509392505050565b600081359050612704816135f3565b92915050565b600081519050612719816135f3565b92915050565b600082601f83011261273457612733613301565b5b8135612744848260208601612685565b91505092915050565b60008135905061275c8161360a565b92915050565b6000815190506127718161360a565b92915050565b60008135905061278681613621565b92915050565b60008151905061279b81613621565b92915050565b6000602082840312156127b7576127b6613310565b5b60006127c5848285016126f5565b91505092915050565b6000602082840312156127e4576127e3613310565b5b60006127f28482850161270a565b91505092915050565b6000806040838503121561281257612811613310565b5b6000612820858286016126f5565b9250506020612831858286016126f5565b9150509250929050565b60008060006060848603121561285457612853613310565b5b6000612862868287016126f5565b9350506020612873868287016126f5565b925050604061288486828701612777565b9150509250925092565b600080604083850312156128a5576128a4613310565b5b60006128b3858286016126f5565b92505060206128c485828601612777565b9150509250929050565b6000602082840312156128e4576128e3613310565b5b600082013567ffffffffffffffff8111156129025761290161330b565b5b61290e8482850161271f565b91505092915050565b60006020828403121561292d5761292c613310565b5b600061293b8482850161274d565b91505092915050565b60006020828403121561295a57612959613310565b5b600061296884828501612762565b91505092915050565b60006020828403121561298757612986613310565b5b600061299584828501612777565b91505092915050565b6000806000606084860312156129b7576129b6613310565b5b60006129c58682870161278c565b93505060206129d68682870161278c565b92505060406129e78682870161278c565b9150509250925092565b60006129fd8383612a09565b60208301905092915050565b612a1281613131565b82525050565b612a2181613131565b82525050565b6000612a3282612fd7565b612a3c8185612ffa565b9350612a4783612fc7565b8060005b83811015612a78578151612a5f88826129f1565b9750612a6a83612fed565b925050600181019050612a4b565b5085935050505092915050565b612a8e81613143565b82525050565b612a9d81613186565b82525050565b6000612aae82612fe2565b612ab8818561300b565b9350612ac8818560208601613198565b612ad181613315565b840191505092915050565b6000612ae960238361300b565b9150612af482613326565b604082019050919050565b6000612b0c602a8361300b565b9150612b1782613375565b604082019050919050565b6000612b2f60228361300b565b9150612b3a826133c4565b604082019050919050565b6000612b52601b8361300b565b9150612b5d82613413565b602082019050919050565b6000612b75601d8361300b565b9150612b808261343c565b602082019050919050565b6000612b9860218361300b565b9150612ba382613465565b604082019050919050565b6000612bbb60208361300b565b9150612bc6826134b4565b602082019050919050565b6000612bde60298361300b565b9150612be9826134dd565b604082019050919050565b6000612c0160258361300b565b9150612c0c8261352c565b604082019050919050565b6000612c2460248361300b565b9150612c2f8261357b565b604082019050919050565b6000612c4760178361300b565b9150612c52826135ca565b602082019050919050565b612c668161316f565b82525050565b612c7581613179565b82525050565b6000602082019050612c906000830184612a18565b92915050565b6000604082019050612cab6000830185612a18565b612cb86020830184612a18565b9392505050565b6000604082019050612cd46000830185612a18565b612ce16020830184612c5d565b9392505050565b600060c082019050612cfd6000830189612a18565b612d0a6020830188612c5d565b612d176040830187612a94565b612d246060830186612a94565b612d316080830185612a18565b612d3e60a0830184612c5d565b979650505050505050565b6000602082019050612d5e6000830184612a85565b92915050565b60006020820190508181036000830152612d7e8184612aa3565b905092915050565b60006020820190508181036000830152612d9f81612adc565b9050919050565b60006020820190508181036000830152612dbf81612aff565b9050919050565b60006020820190508181036000830152612ddf81612b22565b9050919050565b60006020820190508181036000830152612dff81612b45565b9050919050565b60006020820190508181036000830152612e1f81612b68565b9050919050565b60006020820190508181036000830152612e3f81612b8b565b9050919050565b60006020820190508181036000830152612e5f81612bae565b9050919050565b60006020820190508181036000830152612e7f81612bd1565b9050919050565b60006020820190508181036000830152612e9f81612bf4565b9050919050565b60006020820190508181036000830152612ebf81612c17565b9050919050565b60006020820190508181036000830152612edf81612c3a565b9050919050565b6000602082019050612efb6000830184612c5d565b92915050565b600060a082019050612f166000830188612c5d565b612f236020830187612a94565b8181036040830152612f358186612a27565b9050612f446060830185612a18565b612f516080830184612c5d565b9695505050505050565b6000602082019050612f706000830184612c6c565b92915050565b6000612f80612f91565b9050612f8c82826131cb565b919050565b6000604051905090565b600067ffffffffffffffff821115612fb657612fb56132d2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130278261316f565b91506130328361316f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561306757613066613245565b5b828201905092915050565b600061307d8261316f565b91506130888361316f565b92508261309857613097613274565b5b828204905092915050565b60006130ae8261316f565b91506130b98361316f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130f2576130f1613245565b5b828202905092915050565b60006131088261316f565b91506131138361316f565b92508282101561312657613125613245565b5b828203905092915050565b600061313c8261314f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131918261316f565b9050919050565b60005b838110156131b657808201518184015260208101905061319b565b838111156131c5576000848401525b50505050565b6131d482613315565b810181811067ffffffffffffffff821117156131f3576131f26132d2565b5b80604052505050565b60006132078261316f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561323a57613239613245565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135fc81613131565b811461360757600080fd5b50565b61361381613143565b811461361e57600080fd5b50565b61362a8161316f565b811461363557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220098311e4ce44e42b49da58349a9eaf8e59472872f767841288f18786446a040564736f6c63430008060033
|
{"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,452 |
0x52cf5e40061f334ae758494c565a61a37ba498ee
|
/**
*Submitted for verification at Etherscan.io on 2020-11-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pVaultV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), amount);
Reward memory reward;
reward = Reward(amount, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amount);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426bd116100a2578063d86e1ef711610071578063d86e1ef714610579578063e2aa2a851461059c578063e4186aa6146105a4578063fab980b7146105ca576101f0565b8063c6e426bd1461050f578063c78b6dea14610535578063cbeb7ef214610552578063d21220a714610571576101f0565b8063b79ea884116100de578063b79ea884146104b6578063b8f6e841146104dc578063b8f79288146104e4578063c45c4f5814610507576101f0565b8063adc3b31b1461044e578063ae169a5014610474578063b5984a3614610491578063b6b55f2514610499576101f0565b806344264d3d1161018757806385535cc51161015657806385535cc5146103a15780638705fcd4146103c75780638f1e9405146103ed578063ab033ea914610428576101f0565b806344264d3d1461033657806344a040f514610357578063501883011461037d578063637830ca14610399576101f0565b806327b5b6a0116101c357806327b5b6a0146102e35780632e1a7d4d146103095780634127535814610326578063430bf08a1461032e576101f0565b80630dfe1681146101f557806311cc66b21461021957806312d43a51146102c15780631c69ad00146102c9575b600080fd5b6101fd610647565b604080516001600160a01b039092168252519081900360200190f35b6102bf6004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184600183028401116401000000008311171561027e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610656945050505050565b005b6101fd6106bf565b6102d16106d3565b60408051918252519081900360200190f35b6102d1600480360360208110156102f957600080fd5b50356001600160a01b031661074f565b6102bf6004803603602081101561031f57600080fd5b5035610761565b6101fd61096d565b6101fd61097c565b61033e61098b565b6040805163ffffffff9092168252519081900360200190f35b6102d16004803603602081101561036d57600080fd5b50356001600160a01b031661099e565b610385610b41565b604080519115158252519081900360200190f35b6102bf610b4a565b6102bf600480360360208110156103b757600080fd5b50356001600160a01b0316610baa565b6102bf600480360360208110156103dd57600080fd5b50356001600160a01b0316610c1e565b61040a6004803603602081101561040357600080fd5b5035610c92565b60408051938452602084019290925282820152519081900360600190f35b6102bf6004803603602081101561043e57600080fd5b50356001600160a01b0316610cc5565b6102d16004803603602081101561046457600080fd5b50356001600160a01b0316610d3f565b6102bf6004803603602081101561048a57600080fd5b5035610d51565b6102d1610db9565b6102bf600480360360208110156104af57600080fd5b5035610dbf565b6102bf600480360360208110156104cc57600080fd5b50356001600160a01b0316610ec2565b6102d1610f36565b6102bf600480360360208110156104fa57600080fd5b503563ffffffff16610f3c565b6102d1610fb4565b6102bf6004803603602081101561052557600080fd5b50356001600160a01b0316610fff565b6102bf6004803603602081101561054b57600080fd5b5035611073565b6102bf6004803603602081101561056857600080fd5b50351515611214565b6101fd611279565b6102bf6004803603602081101561058f57600080fd5b503563ffffffff16611288565b6102d16112e5565b6102d1600480360360208110156105ba57600080fd5b50356001600160a01b03166112eb565b6105d26112fd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561060c5781810151838201526020016105f4565b50505050905090810190601f1680156106395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6006546001600160a01b031681565b600b5461010090046001600160a01b031633146106a8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106bb906005906020840190611975565b5050565b600b5461010090046001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b505afa158015610732573d6000803e3d6000fd5b505050506040513d602081101561074857600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b50511161081f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610869576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108723361138b565b3360009081526002602052604090205481111561089b5750336000908152600260205260409020545b600081116108e3576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6006546108fa906001600160a01b03163383611493565b3360009081526002602052604090205461091490826114e5565b3360009081526002602052604090205560035461093190826114e5565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6008546001600160a01b031681565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610b3a578115610a9257600454600019015b600481815481106109e357fe5b906000526020600020906003020160010154831015610a9057610a7b610a7460048381548110610a0f57fe5b906000526020600020906003020160020154610a6e600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b600091825260209091206003909102015490611530565b90611589565b83906115cb565b915080610a8757610a90565b600019016109d6565b505b600454600019015b610acd600a5460048381548110610aad57fe5b9060005260206000209060030201600101546115cb90919063ffffffff16565b421015610b38576000610ae660048381548110610a0f57fe5b9050610b15600a54610a6e610b0e42610b08600a5460048981548110610aad57fe5b906114e5565b8490611530565b9050610b2183826114e5565b925081610b2e5750610b38565b5060001901610a9a565b505b9392505050565b600b5460ff1681565b610b533361138b565b6000610b5e3361099e565b33600090815260016020526040902054909150610b7b90826114e5565b33600081815260016020526040902091909155600754610ba7916001600160a01b039091169083611493565b50565b600b5461010090046001600160a01b03163314610bfc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b5461010090046001600160a01b03163314610c70576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610ca257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600b5461010090046001600160a01b03163314610d17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60016020526000908152604090205481565b610d5a3361138b565b6000610d653361099e565b905080821115610d73578091505b33600090815260016020526040902054610d8d90836114e5565b336000818152600160205260409020919091556007546106bb916001600160a01b039091169084611493565b600a5481565b610dc83361138b565b600954600090610df2906103e890610a6e90859063ffffffff600160a01b90910481169061153016565b90506000610e0083836114e5565b90508115610e2757600854600654610e27916001600160a01b039182169133911685611625565b8015610ebd57600954600654610e4c916001600160a01b039182169133911684611625565b33600090815260026020526040902054610e6690826115cb565b33600090815260026020526040902055600354610e8390826115cb565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600b5461010090046001600160a01b03163314610f14576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600b5461010090046001600160a01b03163314610f8e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b600b5461010090046001600160a01b03163314611051576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116110b9576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611110576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600754611128906001600160a01b0316333084611625565b611130611a01565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a15050565b600b5461010090046001600160a01b03163314611266576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600b5461010090046001600160a01b031633146112da576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b600c5481565b60026020526000908152604090205481565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156113835780601f1061135857610100808354040283529160200191611383565b820191906000526020600020905b81548152906001019060200180831161136657829003601f168201915b505050505081565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906113be575060045415155b1561146357600454600019015b600481815481106113d857fe5b9060005260206000209060030201600101548310156114615761144c610a746004838154811061140457fe5b906000526020600020906003020160020154610a6e60026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b91508061145857611461565b600019016113cb565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ebd908490611685565b600061152783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061183d565b90505b92915050565b60008261153f5750600061152a565b8282028284828161154c57fe5b04146115275760405162461bcd60e51b8152600401808060200182810382526021815260200180611a386021913960400191505060405180910390fd5b600061152783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118d4565b600082820183811015611527576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261167f908590611685565b50505050565b611697826001600160a01b0316611939565b6116e8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117265780518252601f199092019160209182019101611707565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b5091509150816117e4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561167f5780806020019051602081101561180057600080fd5b505161167f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a59602a913960400191505060405180910390fd5b600081848411156118cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611891578181015183820152602001611879565b50505050905090810190601f1680156118be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119235760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611891578181015183820152602001611879565b50600083858161192f57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061196d5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826119ab57600085556119f1565b82601f106119c457805160ff19168380011785556119f1565b828001600101855582156119f1579182015b828111156119f15782518255916020019190600101906119d6565b506119fd929150611a22565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b808211156119fd5760008155600101611a2356fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e73f50c87f41747254a3abcf8ee6e0e7ca53ebca5aba193ed436370f6d5ce37964736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,453 |
0xbc944ac853f62ad10d354b9cdbbdecac14e263c0
|
pragma solidity ^0.4.24;
// submitted by @dev-xu
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice 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;
}
// @notice 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;
}
// @notice 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;
}
// @notice 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;
}
// @notice Returns fractional amount
function getFractionalAmount(uint256 _amount, uint256 _percentage)
internal
pure
returns (uint256) {
return div(mul(_amount, _percentage), 100);
}
}
// Database interface
interface DBInterface {
function setContractManager(address _contractManager)
external;
// --------------------Set Functions------------------------
function setAddress(bytes32 _key, address _value)
external;
function setUint(bytes32 _key, uint _value)
external;
function setString(bytes32 _key, string _value)
external;
function setBytes(bytes32 _key, bytes _value)
external;
function setBytes32(bytes32 _key, bytes32 _value)
external;
function setBool(bytes32 _key, bool _value)
external;
function setInt(bytes32 _key, int _value)
external;
// -------------- Deletion Functions ------------------
function deleteAddress(bytes32 _key)
external;
function deleteUint(bytes32 _key)
external;
function deleteString(bytes32 _key)
external;
function deleteBytes(bytes32 _key)
external;
function deleteBytes32(bytes32 _key)
external;
function deleteBool(bytes32 _key)
external;
function deleteInt(bytes32 _key)
external;
// ----------------Variable Getters---------------------
function uintStorage(bytes32 _key)
external
view
returns (uint);
function stringStorage(bytes32 _key)
external
view
returns (string);
function addressStorage(bytes32 _key)
external
view
returns (address);
function bytesStorage(bytes32 _key)
external
view
returns (bytes);
function bytes32Storage(bytes32 _key)
external
view
returns (bytes32);
function boolStorage(bytes32 _key)
external
view
returns (bool);
function intStorage(bytes32 _key)
external
view
returns (bool);
}
contract Events {
DBInterface public database;
constructor(address _database) public{
database = DBInterface(_database);
}
function message(string _message)
external
onlyApprovedContract {
emit LogEvent(_message, keccak256(abi.encodePacked(_message)), tx.origin);
}
function transaction(string _message, address _from, address _to, uint _amount, address _token)
external
onlyApprovedContract {
emit LogTransaction(_message, keccak256(abi.encodePacked(_message)), _from, _to, _amount, _token, tx.origin);
}
function registration(string _message, address _account)
external
onlyApprovedContract {
emit LogAddress(_message, keccak256(abi.encodePacked(_message)), _account, tx.origin);
}
function contractChange(string _message, address _account, string _name)
external
onlyApprovedContract {
emit LogContractChange(_message, keccak256(abi.encodePacked(_message)), _account, _name, tx.origin);
}
function asset(string _message, string _uri, address _assetAddress, address _manager)
external
onlyApprovedContract {
emit LogAsset(_message, keccak256(abi.encodePacked(_message)), _uri, keccak256(abi.encodePacked(_uri)), _assetAddress, _manager, tx.origin);
}
function escrow(string _message, address _assetAddress, bytes32 _escrowID, address _manager, uint _amount)
external
onlyApprovedContract {
emit LogEscrow(_message, keccak256(abi.encodePacked(_message)), _assetAddress, _escrowID, _manager, _amount, tx.origin);
}
function order(string _message, bytes32 _orderID, uint _amount, uint _price)
external
onlyApprovedContract {
emit LogOrder(_message, keccak256(abi.encodePacked(_message)), _orderID, _amount, _price, tx.origin);
}
function exchange(string _message, bytes32 _orderID, address _assetAddress, address _account)
external
onlyApprovedContract {
emit LogExchange(_message, keccak256(abi.encodePacked(_message)), _orderID, _assetAddress, _account, tx.origin);
}
function operator(string _message, bytes32 _id, string _name, string _ipfs, address _account)
external
onlyApprovedContract {
emit LogOperator(_message, keccak256(abi.encodePacked(_message)), _id, _name, _ipfs, _account, tx.origin);
}
function consensus(string _message, bytes32 _executionID, bytes32 _votesID, uint _votes, uint _tokens, uint _quorum)
external
onlyApprovedContract {
emit LogConsensus(_message, keccak256(abi.encodePacked(_message)), _executionID, _votesID, _votes, _tokens, _quorum, tx.origin);
}
//Generalized events
event LogEvent(string message, bytes32 indexed messageID, address indexed origin);
event LogTransaction(string message, bytes32 indexed messageID, address indexed from, address indexed to, uint amount, address token, address origin); //amount and token will be empty on some events
event LogAddress(string message, bytes32 indexed messageID, address indexed account, address indexed origin);
event LogContractChange(string message, bytes32 indexed messageID, address indexed account, string name, address indexed origin);
event LogAsset(string message, bytes32 indexed messageID, string uri, bytes32 indexed assetID, address asset, address manager, address indexed origin);
event LogEscrow(string message, bytes32 indexed messageID, address asset, bytes32 escrowID, address indexed manager, uint amount, address indexed origin);
event LogOrder(string message, bytes32 indexed messageID, bytes32 indexed orderID, uint amount, uint price, address indexed origin);
event LogExchange(string message, bytes32 indexed messageID, bytes32 orderID, address indexed asset, address account, address indexed origin);
event LogOperator(string message, bytes32 indexed messageID, bytes32 id, string name, string ipfs, address indexed account, address indexed origin);
event LogConsensus(string message, bytes32 indexed messageID, bytes32 executionID, bytes32 votesID, uint votes, uint tokens, uint quorum, address indexed origin);
// --------------------------------------------------------------------------------------
// Caller must be registered as a contract through ContractManager.sol
// --------------------------------------------------------------------------------------
modifier onlyApprovedContract() {
require(database.boolStorage(keccak256(abi.encodePacked("contract", msg.sender))));
_;
}
}
// @notice Trade via the Kyber Proxy Contract
interface KyberInterface {
function getExpectedRate(address src, address dest, uint srcQty) external view returns (uint expectedRate, uint slippageRate);
function trade(address src, uint srcAmount, address dest, address destAddress, uint maxDestAmount,uint minConversionRate, address walletId) external payable returns(uint);
}
interface MinterInterface {
function cloneToken(string _uri, address _erc20Address) external returns (address asset);
function mintAssetTokens(address _assetAddress, address _receiver, uint256 _amount) external returns (bool);
function changeTokenController(address _assetAddress, address _newController) external returns (bool);
}
interface CrowdsaleGeneratorETH_ERC20 {
function balanceOf(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 transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
}
// @title A crowdsale generator contract
// @author Kyle Dewhurst & Roy Xu, MyBit Foundation
// @notice AssetManagers can initiate a crowdsale that accepts Ether as payment here
contract CrowdsaleGeneratorETH {
using SafeMath for uint256;
DBInterface public database;
Events public events;
KyberInterface private kyber;
MinterInterface private minter;
//uint constant scalingFactor = 1e32; // Used to avoid rounding errors
// @notice This contract
// @param: The address for the database contract used by this platform
constructor(address _database, address _events, address _kyber)
public{
database = DBInterface(_database);
events = Events(_events);
kyber = KyberInterface(_kyber);
minter = MinterInterface(database.addressStorage(keccak256(abi.encodePacked("contract", "Minter"))));
}
// @notice Do not send ether to this contract, this is for kyber exchange to get return
// @dev After collecting listing fee in token, remaining ether gets refunded from kyber
function() public payable {
}
// @notice AssetManagers can initiate a crowdfund for a new asset here
// @dev the crowdsaleETH contract is granted rights to mint asset-tokens as it receives funding
// @param (string) _assetURI = The location where information about the asset can be found
// @param (uint) _fundingLength = The number of seconds this crowdsale is to go on for until it fails
// @param (uint) _amountToRaise = The amount of WEI required to raise for the crowdsale to be a success
// @param (uint) _assetManagerPerc = The percentage of the total revenue which is to go to the AssetManager if asset is a success
function createAssetOrderETH(string _assetURI, string _ipfs, uint _fundingLength, uint _amountToRaise, uint _assetManagerPerc, uint _escrowAndFee, address _paymentToken)
external
payable {
if(_paymentToken == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)){
require(msg.value == _escrowAndFee);
} else {
require(msg.value == 0);
CrowdsaleGeneratorETH_ERC20(_paymentToken).transferFrom(msg.sender, address(this), _escrowAndFee);
}
require(_amountToRaise >= 100, "Crowdsale goal is too small");
require((_assetManagerPerc + database.uintStorage(keccak256(abi.encodePacked("platform.percentage")))) < 100, "Manager percent need to be less than 100");
require(!database.boolStorage(keccak256(abi.encodePacked("asset.uri", _assetURI))), "Asset URI is not unique"); //Check that asset URI is unique
uint escrow = processListingFee(_paymentToken, _escrowAndFee);
address assetAddress = minter.cloneToken(_assetURI, address(0));
require(setCrowdsaleValues(assetAddress, _fundingLength, _amountToRaise));
require(setAssetValues(assetAddress, _assetURI, _ipfs, msg.sender, _assetManagerPerc, _amountToRaise));
//Lock escrow
if(escrow > 0) {
require(lockEscrowETH(msg.sender, assetAddress, _paymentToken, escrow));
}
events.asset('Asset funding started', _assetURI, assetAddress, msg.sender);
events.asset('New asset ipfs', _ipfs, assetAddress, msg.sender);
}
function updateIPFS(address _assetAddress, string _ipfs)
external {
require(msg.sender == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress))));
database.setString(keccak256(abi.encodePacked("asset.ipfs", _assetAddress)), _ipfs);
events.asset('New asset ipfs', _ipfs, _assetAddress, msg.sender);
}
// @notice platform owners can destroy contract here
function destroy()
onlyOwner
external {
events.transaction('CrowdsaleGeneratorETH destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal/ Private Functions
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setCrowdsaleValues(address _assetAddress, uint _fundingLength, uint _amountToRaise)
private
returns (bool){
database.setUint(keccak256(abi.encodePacked("crowdsale.start", _assetAddress)), now);
database.setUint(keccak256(abi.encodePacked("crowdsale.deadline", _assetAddress)), now.add(_fundingLength));
database.setUint(keccak256(abi.encodePacked("crowdsale.goal", _assetAddress)), _amountToRaise);
database.setUint(keccak256(abi.encodePacked("crowdsale.remaining", _assetAddress)), _amountToRaise.mul(uint(100).add(database.uintStorage(keccak256(abi.encodePacked("platform.fee"))))).div(100));
return true;
}
function setAssetValues(address _assetAddress, string _assetURI, string _ipfs, address _assetManager, uint _assetManagerPerc, uint _amountToRaise)
private
returns (bool){
uint totalTokens = _amountToRaise.mul(100).div(uint(100).sub(_assetManagerPerc).sub(database.uintStorage(keccak256(abi.encodePacked("platform.percentage")))));
//database.setUint(keccak256(abi.encodePacked("asset.managerTokens", assetAddress)), _amountToRaise.mul(uint(100).mul(scalingFactor).div(uint(100).sub(_assetManagerPerc)).sub(scalingFactor)).div(scalingFactor));
database.setUint(keccak256(abi.encodePacked("asset.managerTokens", _assetAddress)), totalTokens.getFractionalAmount(_assetManagerPerc));
database.setUint(keccak256(abi.encodePacked("asset.platformTokens", _assetAddress)), totalTokens.getFractionalAmount(database.uintStorage(keccak256(abi.encodePacked("platform.percentage")))));
database.setAddress(keccak256(abi.encodePacked("asset.manager", _assetAddress)), _assetManager);
database.setString(keccak256(abi.encodePacked("asset.ipfs", _assetAddress)), _ipfs);
database.setBool(keccak256(abi.encodePacked("asset.uri", _assetURI)), true); //Set to ensure a unique asset URI
return true;
}
function processListingFee(address _paymentTokenAddress, uint _fromAmount)
private
returns (uint) { // returns left amount
uint listingFee = database.uintStorage(keccak256(abi.encodePacked("platform.listingFee")));
address listingFeeTokenAddress = database.addressStorage(keccak256(abi.encodePacked("platform.listingFeeToken")));
address platformFundsWallet = database.addressStorage(keccak256(abi.encodePacked("platform.wallet.funds")));
uint usedAmount;
uint balanceBefore;
uint listingFeePaid;
uint expectedRate;
uint estimation;
CrowdsaleGeneratorETH_ERC20 paymentToken;
if (_paymentTokenAddress != listingFeeTokenAddress) {
//Convert the payment token into the listing fee token
( expectedRate, ) = kyber.getExpectedRate(listingFeeTokenAddress, _paymentTokenAddress, listingFee);
estimation = expectedRate * listingFee / 0.8 ether; // giving slippage rate of 0.8
if(_paymentTokenAddress == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)){
balanceBefore = address(this).balance;
listingFeePaid = kyber.trade.value(estimation)(_paymentTokenAddress, estimation, listingFeeTokenAddress, platformFundsWallet, listingFee, 0, 0);
usedAmount = balanceBefore - address(this).balance; // used eth by kyber for swapping with token
} else {
paymentToken = CrowdsaleGeneratorETH_ERC20(_paymentTokenAddress);
balanceBefore = paymentToken.balanceOf(address(this));
require(paymentToken.approve(address(kyber), estimation));
listingFeePaid = kyber.trade(_paymentTokenAddress, estimation, listingFeeTokenAddress, platformFundsWallet, listingFee, 0, 0); //Currently no minimum rate is set, so watch out for slippage!
paymentToken.approve(address(kyber), 0);
usedAmount = balanceBefore - paymentToken.balanceOf(address(this));
}
} else {
paymentToken = CrowdsaleGeneratorETH_ERC20(_paymentTokenAddress);
require(paymentToken.transfer(platformFundsWallet, listingFee), "Listing fee not paid");
usedAmount = listingFee;
listingFeePaid = listingFee;
}
require(_fromAmount >= usedAmount && listingFeePaid >= listingFee, "Listing fee not paid");
return _fromAmount - usedAmount;
}
function lockEscrowETH(address _assetManager, address _assetAddress, address _paymentTokenAddress, uint _amount)
private
returns (bool) {
uint amount;
bytes32 assetManagerEscrowID = keccak256(abi.encodePacked(_assetAddress, _assetManager));
address platformTokenAddress = database.addressStorage(keccak256(abi.encodePacked("platform.token")));
if(_paymentTokenAddress != platformTokenAddress){
//Convert the payment token into the platform token
if(_paymentTokenAddress == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)){
amount = kyber.trade.value(_amount)(_paymentTokenAddress, _amount, platformTokenAddress, address(this), 2**255, 0, 0); //Currently no minimum rate is set, so watch out for slippage!
} else {
CrowdsaleGeneratorETH_ERC20 paymentToken = CrowdsaleGeneratorETH_ERC20(_paymentTokenAddress);
require(paymentToken.approve(address(kyber), _amount));
amount = kyber.trade(_paymentTokenAddress, _amount, platformTokenAddress, address(this), 2**255, 0, 0); //Currently no minimum rate is set, so watch out for slippage!
}
} else {
amount = _amount;
}
require(CrowdsaleGeneratorETH_ERC20(platformTokenAddress).transfer(database.addressStorage(keccak256(abi.encodePacked("contract", "EscrowReserve"))), amount));
database.setUint(keccak256(abi.encodePacked("asset.escrow", assetManagerEscrowID)), amount);
events.escrow('Escrow locked', _assetAddress, assetManagerEscrowID, _assetManager, amount);
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Modifiers
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// // @notice reverts if asset manager is unable to burn pp
// modifier burnRequired {
// //emit LogSig(msg.sig);
// require(burner.burn(msg.sender, database.uintStorage(keccak256(abi.encodePacked(msg.sig, address(this))))));
// _;
// }
// @notice Sender must be a registered owner
modifier onlyOwner {
require(database.boolStorage(keccak256(abi.encodePacked("owner", msg.sender))), "Not owner");
_;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//event LogAssetFundingStarted(address indexed _assetManager, string _assetURI, address indexed _tokenAddress);
//event LogSig(bytes4 _sig);
}
|
0x6080604052600436106100535763ffffffff60e060020a600035041663713b563f811461005557806383197ef014610086578063b5f8558c1461009b578063d3f5b664146100b0578063f217caed146100e7575b005b34801561006157600080fd5b5061006a610114565b60408051600160a060020a039092168252519081900360200190f35b34801561009257600080fd5b50610053610123565b3480156100a757600080fd5b5061006a61035d565b610053602460048035828101929082013591813591820191013560443560643560843560a435600160a060020a0360c4351661036c565b3480156100f357600080fd5b5061005360048035600160a060020a03169060248035908101910135610b25565b600054600160a060020a031681565b600054604080517f6f776e6572000000000000000000000000000000000000000000000000000000602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b602083106101b15780518252601f199092019160209182019101610192565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561021257600080fd5b505af1158015610226573d6000803e3d6000fd5b505050506040513d602081101561023c57600080fd5b50511515610294576040805160e560020a62461bcd02815260206004820152600960248201527f4e6f74206f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600154604080517f42b425aa000000000000000000000000000000000000000000000000000000008152306024820181905233604483015231606482015260006084820181905260a06004830152601f60a48301527f43726f776473616c6547656e657261746f724554482064657374726f7965640060c48301529151600160a060020a03909316926342b425aa9260e48084019391929182900301818387803b15801561034157600080fd5b505af1158015610355573d6000803e3d6000fd5b503392505050ff5b600154600160a060020a031681565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156103a5573484146103a057600080fd5b61044b565b34156103b057600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018690529051600160a060020a038516916323b872dd9160648083019260209291908290030181600087803b15801561041e57600080fd5b505af1158015610432573d6000803e3d6000fd5b505050506040513d602081101561044857600080fd5b50505b60648610156104a4576040805160e560020a62461bcd02815260206004820152601b60248201527f43726f776473616c6520676f616c20697320746f6f20736d616c6c0000000000604482015290519081900360640190fd5b600054604080517f706c6174666f726d2e70657263656e7461676500000000000000000000000000602080830191909152825180830360130181526033909201928390528151606494600160a060020a03169363a855d4ce9392909182918401908083835b602083106105285780518252601f199092019160209182019101610509565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561058957600080fd5b505af115801561059d573d6000803e3d6000fd5b505050506040513d60208110156105b357600080fd5b5051860110610632576040805160e560020a62461bcd02815260206004820152602860248201527f4d616e616765722070657263656e74206e65656420746f206265206c6573732060448201527f7468616e20313030000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000546040517f61737365742e757269000000000000000000000000000000000000000000000060208201908152600160a060020a0390921691633b7bfda0918e918e916029018383808284378201915050925050506040516020818303038152906040526040518082805190602001908083835b602083106106c65780518252601f1990920191602091820191016106a7565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b505050506040513d602081101561075157600080fd5b5051156107a8576040805160e560020a62461bcd02815260206004820152601760248201527f417373657420555249206973206e6f7420756e69717565000000000000000000604482015290519081900360640190fd5b6107b28385610e6c565b600354604080517fdc111bbf00000000000000000000000000000000000000000000000000000000815260006024820181905260048201928352604482018f9052939550600160a060020a039092169263dc111bbf928f928f929181906064018585808284378201915050945050505050602060405180830381600087803b15801561083d57600080fd5b505af1158015610851573d6000803e3d6000fd5b505050506040513d602081101561086757600080fd5b505190506108768188886117f4565b151561088157600080fd5b6108f3818c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505033898b611da8565b15156108fe57600080fd5b600082111561091e5761091333828585612647565b151561091e57600080fd5b600160009054906101000a9004600160a060020a0316600160a060020a03166378576a918c8c84336040518563ffffffff1660e060020a02815260040180806020018060200185600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a03168152602001838103835260158152602001807f41737365742066756e64696e6720737461727465640000000000000000000000815250602001838103825287878281815260200192508082843782019150509650505050505050600060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b50505050600160009054906101000a9004600160a060020a0316600160a060020a03166378576a918a8a84336040518563ffffffff1660e060020a02815260040180806020018060200185600160a060020a0316600160a060020a0316815260200184600160a060020a0316600160a060020a031681526020018381038352600e8152602001807f4e65772061737365742069706673000000000000000000000000000000000000815250602001838103825287878281815260200192508082843782019150509650505050505050600060405180830381600087803b158015610b0057600080fd5b505af1158015610b14573d6000803e3d6000fd5b505050505050505050505050505050565b600054604080517f61737365742e6d616e6167657200000000000000000000000000000000000000602080830191909152600160a060020a03878116606060020a02602d8401528351808403602101815260419093019384905282519416936304f49a3a93918291908401908083835b60208310610bb45780518252601f199092019160209182019101610b95565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610c1557600080fd5b505af1158015610c29573d6000803e3d6000fd5b505050506040513d6020811015610c3f57600080fd5b5051600160a060020a03163314610c5557600080fd5b600054604080517f61737365742e6970667300000000000000000000000000000000000000000000602080830191909152600160a060020a03878116606060020a02602a8401528351808403601e018152603e909301938490528251941693636e89955093918291908401908083835b60208310610ce45780518252601f199092019160209182019101610cc5565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820181815260248301948552604483018a90529095508994508893909250906064018484808284378201915050945050505050600060405180830381600087803b158015610d6d57600080fd5b505af1158015610d81573d6000803e3d6000fd5b50506001546040517f78576a91000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660448301523360648301819052608060048401908152600e60848501527f4e6577206173736574206970667300000000000000000000000000000000000060a485015260c06024850190815260c485018990529290941695506378576a919450879387938a93829160e40187878082843782019150509650505050505050600060405180830381600087803b158015610e4f57600080fd5b505af1158015610e63573d6000803e3d6000fd5b50505050505050565b6000806000806000806000806000806000809054906101000a9004600160a060020a0316600160a060020a031663a855d4ce60405160200180807f706c6174666f726d2e6c697374696e674665650000000000000000000000000081525060130190506040516020818303038152906040526040518082805190602001908083835b60208310610f0d5780518252601f199092019160209182019101610eee565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610f6e57600080fd5b505af1158015610f82573d6000803e3d6000fd5b505050506040513d6020811015610f9857600080fd5b5051600054604080517f706c6174666f726d2e6c697374696e67466565546f6b656e0000000000000000602082810191909152825180830360180181526038909201928390528151949d50600160a060020a03909316936304f49a3a939192918291908401908083835b602083106110215780518252601f199092019160209182019101611002565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561108257600080fd5b505af1158015611096573d6000803e3d6000fd5b505050506040513d60208110156110ac57600080fd5b5051600054604080517f706c6174666f726d2e77616c6c65742e66756e64730000000000000000000000602082810191909152825180830360150181526035909201928390528151949c50600160a060020a03909316936304f49a3a939192918291908401908083835b602083106111355780518252601f199092019160209182019101611116565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561119657600080fd5b505af11580156111aa573d6000803e3d6000fd5b505050506040513d60208110156111c057600080fd5b50519650600160a060020a038c81169089161461168657600254604080517f809a9e55000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301528f81166024830152604482018d9052825193169263809a9e55926064808401939192918290030181600087803b15801561124a57600080fd5b505af115801561125e573d6000803e3d6000fd5b505050506040513d604081101561127457600080fd5b50519250670b1a2bc2ec500000898402049150600160a060020a038c1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611369576002546040805160e060020a63cb3c28c7028152600160a060020a038f81166004830152602482018690528b811660448301528a81166064830152608482018d9052600060a4830181905260c4830152915130319850929091169163cb3c28c791859160e480830192602092919082900301818588803b15801561132f57600080fd5b505af1158015611343573d6000803e3d6000fd5b50505050506040513d602081101561135a57600080fd5b50513031860396509350611681565b50604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290518c91600160a060020a038316916370a08231916024808201926020929091908290030181600087803b1580156113ce57600080fd5b505af11580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b5051600254604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810186905290519297509083169163095ea7b3916044808201926020929091908290030181600087803b15801561146c57600080fd5b505af1158015611480573d6000803e3d6000fd5b505050506040513d602081101561149657600080fd5b505115156114a357600080fd5b6002546040805160e060020a63cb3c28c7028152600160a060020a038f81166004830152602482018690528b811660448301528a81166064830152608482018d9052600060a4830181905260c48301819052925193169263cb3c28c79260e480840193602093929083900390910190829087803b15801561152357600080fd5b505af1158015611537573d6000803e3d6000fd5b505050506040513d602081101561154d57600080fd5b5051600254604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260006024820181905291519397509184169263095ea7b3926044808201936020939283900390910190829087803b1580156115c357600080fd5b505af11580156115d7573d6000803e3d6000fd5b505050506040513d60208110156115ed57600080fd5b5050604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038316916370a082319160248083019260209291908290030181600087803b15801561165057600080fd5b505af1158015611664573d6000803e3d6000fd5b505050506040513d602081101561167a57600080fd5b5051850395505b61177c565b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152602482018b905291518d9283169163a9059cbb9160448083019260209291908290030181600087803b1580156116f357600080fd5b505af1158015611707573d6000803e3d6000fd5b505050506040513d602081101561171d57600080fd5b50511515611775576040805160e560020a62461bcd02815260206004820152601460248201527f4c697374696e6720666565206e6f742070616964000000000000000000000000604482015290519081900360640190fd5b8895508893505b858b1015801561178c5750888410155b15156117e2576040805160e560020a62461bcd02815260206004820152601460248201527f4c697374696e6720666565206e6f742070616964000000000000000000000000604482015290519081900360640190fd5b50505091909603979650505050505050565b60008054604080517f63726f776473616c652e73746172740000000000000000000000000000000000602080830191909152600160a060020a03888116606060020a02602f84015283518084036023018152604390930193849052825194169363e2a4853a93918291908401908083835b602083106118845780518252601f199092019160209182019101611865565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152426024820152915160448084019550600094509092839003019050818387803b1580156118ef57600080fd5b505af1158015611903573d6000803e3d6000fd5b5050600054604080517f63726f776473616c652e646561646c696e650000000000000000000000000000602080830191909152600160a060020a038a8116606060020a0260328401528351808403602601815260469093019384905282519416955063e2a4853a9450909282918401908083835b602083106119965780518252601f199092019160209182019101611977565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206119d68642612e3790919063ffffffff16565b6040518363ffffffff1660e060020a02815260040180836000191660001916815260200182815260200192505050600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b5050600054604080517f63726f776473616c652e676f616c000000000000000000000000000000000000602080830191909152600160a060020a038a8116606060020a02602e8401528351808403602201815260429093019384905282519416955063e2a4853a9450909282918401908083835b60208310611ac55780518252601f199092019160209182019101611aa6565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a028252600482015260248101899052915160448084019550600094509092839003019050818387803b158015611b3157600080fd5b505af1158015611b45573d6000803e3d6000fd5b5050600054604080517f63726f776473616c652e72656d61696e696e6700000000000000000000000000602080830191909152600160a060020a038a8116606060020a0260338401528351808403602701815260479093019384905282519416955063e2a4853a9450909282918401908083835b60208310611bd85780518252601f199092019160209182019101611bb9565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206000547f706c6174666f726d2e6665650000000000000000000000000000000000000000848401528551600c818603018152602c909401958690528351919750611d3e9650606495611d329550611d2594600160a060020a039092169363a855d4ce9382918401908083835b60208310611c8a5780518252601f199092019160209182019101611c6b565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015611ceb57600080fd5b505af1158015611cff573d6000803e3d6000fd5b505050506040513d6020811015611d1557600080fd5b505160649063ffffffff612e3716565b889063ffffffff612e5116565b9063ffffffff612e7c16565b6040518363ffffffff1660e060020a02815260040180836000191660001916815260200182815260200192505050600060405180830381600087803b158015611d8657600080fd5b505af1158015611d9a573d6000803e3d6000fd5b506001979650505050505050565b60008054604080517f706c6174666f726d2e70657263656e74616765000000000000000000000000006020808301919091528251808303601301815260339092019283905281518594611eee94611edd94600160a060020a039092169363a855d4ce9382918401908083835b60208310611e335780518252601f199092019160209182019101611e14565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015611e9457600080fd5b505af1158015611ea8573d6000803e3d6000fd5b505050506040513d6020811015611ebe57600080fd5b5051611ed160648863ffffffff612e9116565b9063ffffffff612e9116565b611d3285606463ffffffff612e5116565b600054604080517f61737365742e6d616e61676572546f6b656e7300000000000000000000000000602080830191909152600160a060020a038d8116606060020a0260338401528351808403602701815260479093019384905282519596509093169363e2a4853a939192918291908401908083835b60208310611f835780518252601f199092019160209182019101611f64565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020611fc38785612ea390919063ffffffff16565b6040518363ffffffff1660e060020a02815260040180836000191660001916815260200182815260200192505050600060405180830381600087803b15801561200b57600080fd5b505af115801561201f573d6000803e3d6000fd5b5050600054604080517f61737365742e706c6174666f726d546f6b656e73000000000000000000000000602080830191909152600160a060020a038e8116606060020a0260348401528351808403602801815260489093019384905282519416955063e2a4853a9450909282918401908083835b602083106120b25780518252601f199092019160209182019101612093565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206000547f706c6174666f726d2e70657263656e7461676500000000000000000000000000848401528551601381860301815260339094019586905283519197506121f39650600160a060020a03169463a855d4ce9450918291908401908083835b602083106121595780518252601f19909201916020918201910161213a565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156121ba57600080fd5b505af11580156121ce573d6000803e3d6000fd5b505050506040513d60208110156121e457600080fd5b5051859063ffffffff612ea316565b6040518363ffffffff1660e060020a02815260040180836000191660001916815260200182815260200192505050600060405180830381600087803b15801561223b57600080fd5b505af115801561224f573d6000803e3d6000fd5b5050600054604080517f61737365742e6d616e6167657200000000000000000000000000000000000000602080830191909152600160a060020a038e8116606060020a02602d8401528351808403602101815260419093019384905282519416955063ca446dd99450909282918401908083835b602083106122e25780518252601f1990920191602091820191016122c3565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a038c166024820152915160448084019550600094509092839003019050818387803b15801561235657600080fd5b505af115801561236a573d6000803e3d6000fd5b5050600054604080517f61737365742e6970667300000000000000000000000000000000000000000000602080830191909152600160a060020a038e8116606060020a02602a8401528351808403601e018152603e90930193849052825194169550636e8995509450909282918401908083835b602083106123fd5780518252601f1990920191602091820191016123de565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a02835260048301818152602484019586528f5160448501528f519197508f96509493506064909201919085019080838360005b8381101561247b578181015183820152602001612463565b50505050905090810190601f1680156124a85780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156124c857600080fd5b505af11580156124dc573d6000803e3d6000fd5b50506000546040517f61737365742e757269000000000000000000000000000000000000000000000060208083019182528c51600160a060020a03909416955063abfdcced94508c93919260290191908401908083835b602083106125525780518252601f199092019160209182019101612533565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106125b55780518252601f199092019160209182019101612596565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a028252600482015260016024820152915160448084019550600094509092839003019050818387803b15801561262157600080fd5b505af1158015612635573d6000803e3d6000fd5b5060019b9a5050505050505050505050565b600080600080600087896040516020018083600160a060020a0316600160a060020a0316606060020a02815260140182600160a060020a0316600160a060020a0316606060020a028152601401925050506040516020818303038152906040526040518082805190602001908083835b602083106126d65780518252601f1990920191602091820191016126b7565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206000547f706c6174666f726d2e746f6b656e000000000000000000000000000000000000848401528551600e818603018152602e909401958690528351919a50600160a060020a031696506304f49a3a9550919392508291908401908083835b6020831061277c5780518252601f19909201916020918201910161275d565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156127dd57600080fd5b505af11580156127f1573d6000803e3d6000fd5b505050506040513d602081101561280757600080fd5b50519150600160a060020a0387811690831614612a8c57600160a060020a03871673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612914576002546040805160e060020a63cb3c28c7028152600160a060020a038a81166004830152602482018a905285811660448301523060648301527f80000000000000000000000000000000000000000000000000000000000000006084830152600060a4830181905260c48301529151919092169163cb3c28c791899160e48082019260209290919082900301818588803b1580156128e057600080fd5b505af11580156128f4573d6000803e3d6000fd5b50505050506040513d602081101561290b57600080fd5b50519350612a87565b50600254604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018890529051889283169163095ea7b39160448083019260209291908290030181600087803b15801561298457600080fd5b505af1158015612998573d6000803e3d6000fd5b505050506040513d60208110156129ae57600080fd5b505115156129bb57600080fd5b6002546040805160e060020a63cb3c28c7028152600160a060020a038a81166004830152602482018a905285811660448301523060648301527f80000000000000000000000000000000000000000000000000000000000000006084830152600060a4830181905260c48301819052925193169263cb3c28c79260e480840193602093929083900390910190829087803b158015612a5857600080fd5b505af1158015612a6c573d6000803e3d6000fd5b505050506040513d6020811015612a8257600080fd5b505193505b612a90565b8593505b600054604080517f636f6e74726163740000000000000000000000000000000000000000000000006020808301919091527f457363726f7752657365727665000000000000000000000000000000000000006028830152825160158184030181526035909201928390528151600160a060020a038088169563a9059cbb959116936304f49a3a93909282918401908083835b60208310612b415780518252601f199092019160209182019101612b22565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015612ba257600080fd5b505af1158015612bb6573d6000803e3d6000fd5b505050506040513d6020811015612bcc57600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a039092166004830152602482018890525160448083019260209291908290030181600087803b158015612c1a57600080fd5b505af1158015612c2e573d6000803e3d6000fd5b505050506040513d6020811015612c4457600080fd5b50511515612c5157600080fd5b600054604080517f61737365742e657363726f770000000000000000000000000000000000000000602080830191909152602c80830188905283518084039091018152604c909201928390528151600160a060020a039094169363e2a4853a93918291908401908083835b60208310612cdb5780518252601f199092019160209182019101612cbc565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152602481018b9052915160448084019550600094509092839003019050818387803b158015612d4757600080fd5b505af1158015612d5b573d6000803e3d6000fd5b5050600154604080517f0b94df4c000000000000000000000000000000000000000000000000000000008152600160a060020a038d81166024830152604482018990528e81166064830152608482018a905260a06004830152600d60a48301527f457363726f77206c6f636b65640000000000000000000000000000000000000060c48301529151919092169350630b94df4c925060e480830192600092919082900301818387803b158015612e1057600080fd5b505af1158015612e24573d6000803e3d6000fd5b5060019c9b505050505050505050505050565b600082820183811015612e4657fe5b8091505b5092915050565b600080831515612e645760009150612e4a565b50828202828482811515612e7457fe5b0414612e4657fe5b60008183811515612e8957fe5b049392505050565b600082821115612e9d57fe5b50900390565b6000612eb9612eb28484612e51565b6064612e7c565b93925050505600a165627a7a72305820d98e000be0e912f93c466a087554c34a7afbd03649bc2942f5ce4c90ad92065b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,454 |
0x4720f2468eeb7a795945c5ffbc3b0178e32250e0
|
pragma solidity ^0.4.23;
/**
* Preparing contracts
*
**/
// Ownable contract with CFO
contract Ownable {
address public owner;
address public cfoAddress;
constructor() public{
owner = msg.sender;
cfoAddress = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyCFO() {
require(msg.sender == cfoAddress);
_;
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function setCFO(address newCFO) external onlyOwner {
require(newCFO != address(0));
cfoAddress = newCFO;
}
}
// Pausable contract which allows children to implement an emergency stop mechanism.
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
// Modifier to make a function callable only when the contract is not paused.
modifier whenNotPaused() {
require(!paused);
_;
}
// Modifier to make a function callable only when the contract is paused.
modifier whenPaused() {
require(paused);
_;
}
// called by the owner to pause, triggers stopped state
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
// called by the owner to unpause, returns to normal state
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// Gen mixer
contract MixGenInterface {
function isMixGen() public pure returns (bool);
function openEgg(uint64 userNumber, uint16 eggQuality) public returns (uint256 genes, uint16 quality);
function uniquePet(uint64 newPetId) public returns (uint256 genes, uint16 quality);
}
contract RewardContract {
function get(address receiver, uint256 ethValue) external;
}
// Configuration of external contracts
contract ExternalContracts is Ownable {
MixGenInterface public geneScience;
RewardContract public reward;
address public storeAddress;
function setMixGenAddress(address _address) external onlyOwner {
MixGenInterface candidateContract = MixGenInterface(_address);
require(candidateContract.isMixGen());
geneScience = candidateContract;
}
function setStoreAddress(address _address) external onlyOwner {
storeAddress = _address;
}
function setRewardAddress(address _address) external onlyOwner {
reward = RewardContract(_address);
}
}
// Population settings and base functions
contract PopulationControl is Pausable {
// start breed timeout is 12 hours
uint32 public breedTimeout = 12 hours;
uint32 maxTimeout = 178 days;
function setBreedTimeout(uint32 timeout) external onlyOwner {
require(timeout <= maxTimeout);
breedTimeout = timeout;
}
}
/**
* Presale main contracts
*
**/
// Pet base contract
contract PetBase is PopulationControl{
// events
event Birth(address owner, uint64 petId, uint16 quality, uint256 genes);
event Death(uint64 petId);
event Transfer(address from, address to, uint256 tokenId);
// data storage
struct Pet {
uint256 genes;
uint64 birthTime;
uint16 quality;
}
mapping (uint64 => Pet) pets;
mapping (uint64 => address) petIndexToOwner;
mapping (address => uint256) public ownershipTokenCount;
mapping (uint64 => uint64) breedTimeouts;
uint64 tokensCount;
uint64 lastTokenId;
// pet creation
function createPet(
uint256 _genes,
uint16 _quality,
address _owner
)
internal
returns (uint64)
{
Pet memory _pet = Pet({
genes: _genes,
birthTime: uint64(now),
quality: _quality
});
lastTokenId++;
tokensCount++;
uint64 newPetId = lastTokenId;
pets[newPetId] = _pet;
_transfer(0, _owner, newPetId);
breedTimeouts[newPetId] = uint64( now + (breedTimeout / 2) );
emit Birth(_owner, newPetId, _quality, _genes);
return newPetId;
}
// transfer pet function
function _transfer(address _from, address _to, uint256 _tokenId) internal {
uint64 _tokenId64bit = uint64(_tokenId);
ownershipTokenCount[_to]++;
petIndexToOwner[_tokenId64bit] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
}
emit Transfer(_from, _to, _tokenId);
}
// calculation of recommended price
function recommendedPrice(uint16 quality) public pure returns(uint256 price) {
require(quality <= uint16(0xF000));
require(quality >= uint16(0x1000));
uint256 startPrice = 1000;
price = startPrice;
uint256 revertQuality = uint16(0xF000) - quality;
uint256 oneLevel = uint16(0x2000);
uint256 oneQuart = oneLevel/4;
uint256 fullLevels = revertQuality/oneLevel;
uint256 fullQuarts = (revertQuality % oneLevel) / oneQuart ;
uint256 surplus = revertQuality - (fullLevels*oneLevel) - (fullQuarts*oneQuart);
// coefficeint is 4.4 per level
price = price * 44**fullLevels;
price = price / 10**fullLevels;
// quart coefficient is sqrt(sqrt(4.4))
if(fullQuarts != 0)
{
price = price * 14483154**fullQuarts;
price = price / 10**(7 * fullQuarts);
}
// for surplus we using next quart coefficient
if(surplus != 0)
{
uint256 nextQuartPrice = (price * 14483154) / 10**7;
uint256 surPlusCoefficient = surplus * 10**6 /oneQuart;
uint256 surPlusPrice = ((nextQuartPrice - price) * surPlusCoefficient) / 10**6;
price+= surPlusPrice;
}
price*= 50 szabo;
}
// grade calculation based on parrot quality
function getGradeByQuailty(uint16 quality) public pure returns (uint8 grade) {
require(quality <= uint16(0xF000));
require(quality >= uint16(0x1000));
if(quality == uint16(0xF000))
return 7;
quality+= uint16(0x1000);
return uint8 ( quality / uint16(0x2000) );
}
}
// Ownership
contract PetOwnership is PetBase {
// function for the opportunity to gift parrots before the start of the game
function transfer(
address _to,
uint256 _tokenId
)
external
whenNotPaused
{
require(_to != address(0));
require(_to != address(this));
require(_owns(msg.sender, uint64(_tokenId)));
_transfer(msg.sender, _to, _tokenId);
}
// checks if a given address is the current owner of a particular pet
function _owns(address _claimant, uint64 _tokenId) internal view returns (bool) {
return petIndexToOwner[_tokenId] == _claimant;
}
// returns the address currently assigned ownership of a given pet
function ownerOf(uint256 _tokenId) external view returns (address owner) {
uint64 _tokenId64bit = uint64(_tokenId);
owner = petIndexToOwner[_tokenId64bit];
require(owner != address(0));
}
}
// Settings for eggs minted by administration
contract EggMinting is PetOwnership{
uint8 public uniquePetsCount = 100;
uint16 public globalPresaleLimit = 1500;
mapping (uint16 => uint16) public eggLimits;
mapping (uint16 => uint16) public purchesedEggs;
constructor() public {
eggLimits[55375] = 200;
eggLimits[47780] = 400;
eggLimits[38820] = 100;
eggLimits[31201] = 50;
}
function totalSupply() public view returns (uint) {
return tokensCount;
}
function setEggLimit(uint16 quality, uint16 limit) external onlyOwner {
eggLimits[quality] = limit;
}
function eggAvailable(uint16 quality) constant public returns(bool) {
// first 100 eggs - only cheap
if( quality < 47000 && tokensCount < ( 100 + uniquePetsCount ) )
return false;
return (eggLimits[quality] > purchesedEggs[quality]);
}
}
// Buying eggs from the company
contract EggPurchase is EggMinting, ExternalContracts {
uint16[4] discountThresholds = [20, 100, 250, 500];
uint8[4] discountPercents = [75, 50, 30, 20 ];
// purchasing egg
function purchaseEgg(uint64 userNumber, uint16 quality) external payable whenNotPaused {
require(tokensCount >= uniquePetsCount);
// checking egg availablity
require(eggAvailable(quality));
// checking total count of presale eggs
require(tokensCount <= globalPresaleLimit);
// calculating price
uint256 eggPrice = ( recommendedPrice(quality) * (100 - getCurrentDiscountPercent()) ) / 100;
// checking payment amount
require(msg.value >= eggPrice);
// increment egg counter
purchesedEggs[quality]++;
// initialize variables for store child genes and quility
uint256 childGenes;
uint16 childQuality;
// get genes and quality of new pet by opening egg through external interface
(childGenes, childQuality) = geneScience.openEgg(userNumber, quality);
// creating new pet
createPet(
childGenes, // genes string
childQuality, // child quality by open egg
msg.sender // owner
);
reward.get(msg.sender, recommendedPrice(quality));
}
function getCurrentDiscountPercent() constant public returns (uint8 discount) {
for(uint8 i = 0; i <= 3; i++)
{
if(tokensCount < (discountThresholds[i] + uniquePetsCount ))
return discountPercents[i];
}
return 10;
}
}
// Launch it
contract PreSale is EggPurchase {
constructor() public {
paused = true;
}
function generateUniquePets(uint8 count) external onlyOwner whenNotPaused {
require(storeAddress != address(0));
require(address(geneScience) != address(0));
require(tokensCount < uniquePetsCount);
uint256 childGenes;
uint16 childQuality;
uint64 newPetId;
for(uint8 i = 0; i< count; i++)
{
if(tokensCount >= uniquePetsCount)
continue;
newPetId = tokensCount+1;
(childGenes, childQuality) = geneScience.uniquePet(newPetId);
createPet(childGenes, childQuality, storeAddress);
}
}
function getPet(uint256 _id) external view returns (
uint64 birthTime,
uint256 genes,
uint64 breedTimeout,
uint16 quality,
address owner
) {
uint64 _tokenId64bit = uint64(_id);
Pet storage pet = pets[_tokenId64bit];
birthTime = pet.birthTime;
genes = pet.genes;
breedTimeout = uint64(breedTimeouts[_tokenId64bit]);
quality = pet.quality;
owner = petIndexToOwner[_tokenId64bit];
}
function unpause() public onlyOwner whenPaused {
require(address(geneScience) != address(0));
require(address(reward) != address(0));
super.unpause();
}
function withdrawBalance(uint256 summ) external onlyCFO {
cfoAddress.transfer(summ);
}
}
|
0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630519ce791461019b57806318160ddd146101f2578063205d6c861461021d578063228cb733146102555780632d6c25fa146102ac5780632dd9ecd2146102f1578063349d3dc51461033e5780633bf1a4ef146103755780633f4ba83a146103b85780634e0a3379146103cf57806359d55194146104125780635c975abb146104cb5780635e00e679146104fa5780636352211e1461053d5780636559e59a146105aa5780638456cb59146105ed5780638a39ebdc146106045780638aadf70a146106375780638d86e0d3146106675780638da5cb5b146106b457806390ca9dbf1461070b578063927635851461075657806399348f8e14610787578063a9059cbb146107d0578063be782f581461081d578063cec21acb14610850578063da76d5cd146108a7578063e3524d36146108d4578063efa726e814610905578063f2b47d5214610944578063f2c4da931461099b578063f2fde38b146109f2575b600080fd5b3480156101a757600080fd5b506101b0610a35565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fe57600080fd5b50610207610a5b565b6040518082815260200191505060405180910390f35b610253600480360381019080803567ffffffffffffffff169060200190929190803561ffff169060200190929190505050610a83565b005b34801561026157600080fd5b5061026a610db8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102b857600080fd5b506102db600480360381019080803561ffff169060200190929190505050610dde565b6040518082815260200191505060405180910390f35b3480156102fd57600080fd5b50610320600480360381019080803561ffff169060200190929190505050610f28565b604051808261ffff1661ffff16815260200191505060405180910390f35b34801561034a57600080fd5b50610353610f49565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561038157600080fd5b506103b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5f565b005b3480156103c457600080fd5b506103cd6110ae565b005b3480156103db57600080fd5b50610410600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ea565b005b34801561041e57600080fd5b5061043d600480360381019080803590602001909291905050506112c5565b604051808667ffffffffffffffff1667ffffffffffffffff1681526020018581526020018467ffffffffffffffff1667ffffffffffffffff1681526020018361ffff1661ffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b3480156104d757600080fd5b506104e06113c6565b604051808215151515815260200191505060405180910390f35b34801561050657600080fd5b5061053b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d9565b005b34801561054957600080fd5b5061056860048036038101908080359060200190929190505050611478565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b657600080fd5b506105eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061150a565b005b3480156105f957600080fd5b506106026115a9565b005b34801561061057600080fd5b50610619611668565b604051808261ffff1661ffff16815260200191505060405180910390f35b34801561064357600080fd5b50610665600480360381019080803560ff16906020019092919050505061167c565b005b34801561067357600080fd5b50610696600480360381019080803561ffff169060200190929190505050611998565b604051808261ffff1661ffff16815260200191505060405180910390f35b3480156106c057600080fd5b506106c96119b9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071757600080fd5b5061073a600480360381019080803561ffff1690602001909291905050506119de565b604051808260ff1660ff16815260200191505060405180910390f35b34801561076257600080fd5b5061076b611a52565b604051808260ff1660ff16815260200191505060405180910390f35b34801561079357600080fd5b506107b6600480360381019080803561ffff169060200190929190505050611a65565b604051808215151515815260200191505060405180910390f35b3480156107dc57600080fd5b5061081b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b23565b005b34801561082957600080fd5b5061084e600480360381019080803563ffffffff169060200190929190505050611bda565b005b34801561085c57600080fd5b50610891600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c86565b6040518082815260200191505060405180910390f35b3480156108b357600080fd5b506108d260048036038101908080359060200190929190505050611c9e565b005b3480156108e057600080fd5b506108e9611d66565b604051808260ff1660ff16815260200191505060405180910390f35b34801561091157600080fd5b50610942600480360381019080803561ffff169060200190929190803561ffff169060200190929190505050611e2b565b005b34801561095057600080fd5b50610959611ec0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109a757600080fd5b506109b0611ee6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109fe57600080fd5b50610a33600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f0c565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff16905090565b6000806000600160149054906101000a900460ff16151515610aa457600080fd5b600660109054906101000a900460ff1660ff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff1610151515610ae557600080fd5b610aee84611a65565b1515610af957600080fd5b600660119054906101000a900461ffff1661ffff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff1611151515610b3c57600080fd5b6064610b46611d66565b60640360ff16610b5586610dde565b02811515610b5f57fe5b049250823410151515610b7157600080fd5b600860008561ffff1661ffff168152602001908152602001600020600081819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff16021790555050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e733baa86866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808367ffffffffffffffff1667ffffffffffffffff1681526020018261ffff1661ffff168152602001925050506040805180830381600087803b158015610c7357600080fd5b505af1158015610c87573d6000803e3d6000fd5b505050506040513d6040811015610c9d57600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050610ccb828233611fe1565b50600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b464631b33610d1487610dde565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610d9957600080fd5b505af1158015610dad573d6000803e3d6000fd5b505050505050505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600080600061f00061ffff168c61ffff1611151515610e0857600080fd5b61100061ffff168c61ffff1610151515610e2157600080fd5b6103e89950899a508b61f0000361ffff16985061200061ffff169750600488811515610e4957fe5b0496508789811515610e5757fe5b04955086888a811515610e6657fe5b06811515610e7057fe5b0494508685028887028a0303935085602c0a8b029a5085600a0a8b811515610e9457fe5b049a50600085141515610ec0578462dcfed20a8b029a5084600702600a0a8b811515610ebc57fe5b049a505b600084141515610f0e576298968062dcfed28c02811515610edd57fe5b04925086620f42408502811515610ef057fe5b049150620f4240828c850302811515610f0557fe5b049050808b019a505b652d79883d20008b029a5050505050505050505050919050565b60086020528060005260406000206000915054906101000a900461ffff1681565b600160159054906101000a900463ffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fbc57600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff16633a7bd7b56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561102357600080fd5b505af1158015611037573d6000803e3d6000fd5b505050506040513d602081101561104d57600080fd5b8101908080519060200190929190505050151561106957600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561110957600080fd5b600160149054906101000a900460ff16151561112457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561118257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156111e057600080fd5b6111e861227a565b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561128157600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000806000806000879150600260008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900467ffffffffffffffff16965080600001549550600560008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900467ffffffffffffffff1694508060010160089054906101000a900461ffff169350600360008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250505091939590929450565b600160149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143457600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080829050600360008267ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561150457600080fd5b50919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561156557600080fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160457600080fd5b600160149054906101000a900460ff1615151561162057600080fd5b60018060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600660119054906101000a900461ffff1681565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116dd57600080fd5b600160149054906101000a900460ff161515156116f957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561175757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156117b557600080fd5b600660109054906101000a900460ff1660ff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff161015156117f557600080fd5b600090505b8460ff168160ff16101561199157600660109054906101000a900460ff1660ff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff1610151561184857611984565b6001600660009054906101000a900467ffffffffffffffff16019150600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a9d1fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff1681526020019150506040805180830381600087803b15801561190857600080fd5b505af115801561191c573d6000803e3d6000fd5b505050506040513d604081101561193257600080fd5b81019080805190602001909291908051906020019092919050505080945081955050506119828484600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611fe1565b505b80806001019150506117fa565b5050505050565b60076020528060005260406000206000915054906101000a900461ffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061f00061ffff168261ffff16111515156119f957600080fd5b61100061ffff168261ffff1610151515611a1257600080fd5b61f00061ffff168261ffff161415611a2d5760079050611a4d565b6110008201915061200061ffff168261ffff16811515611a4957fe5b0490505b919050565b600660109054906101000a900460ff1681565b600061b7988261ffff16108015611ab05750600660109054906101000a900460ff1660640160ff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff16105b15611abe5760009050611b1e565b600860008361ffff1661ffff16815260200190815260200160002060009054906101000a900461ffff1661ffff16600760008461ffff1661ffff16815260200190815260200160002060009054906101000a900461ffff1661ffff161190505b919050565b600160149054906101000a900460ff16151515611b3f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611b7b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611bb657600080fd5b611bc03382612339565b1515611bcb57600080fd5b611bd63383836123b9565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3557600080fd5b600160199054906101000a900463ffffffff1663ffffffff168163ffffffff1611151515611c6257600080fd5b80600160156101000a81548163ffffffff021916908363ffffffff16021790555050565b60046020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cfa57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d62573d6000803e3d6000fd5b5050565b600080600090505b60038160ff16111515611e2257600660109054906101000a900460ff1660ff16600c8260ff16600481101515611da057fe5b601091828204019190066002029054906101000a900461ffff160161ffff16600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff161015611e1557600d8160ff16600481101515611df857fe5b602091828204019190069054906101000a900460ff169150611e27565b8080600101915050611d6e565b600a91505b5090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e8657600080fd5b80600760008461ffff1661ffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f6757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611fde57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000611feb61259f565b60006060604051908101604052808781526020014267ffffffffffffffff1681526020018661ffff1681525091506006600881819054906101000a900467ffffffffffffffff168092919060010191906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550506006600081819054906101000a900467ffffffffffffffff168092919060010191906101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050600660089054906101000a900467ffffffffffffffff16905081600260008367ffffffffffffffff1667ffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060408201518160010160086101000a81548161ffff021916908361ffff16021790555090505061215d6000858367ffffffffffffffff166123b9565b6002600160159054906101000a900463ffffffff1663ffffffff1681151561218157fe5b0463ffffffff164201600560008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507f594c7a1753e9997a119d5384bcf2c79eb041566feac9c4ec9a88b521c17958c784828789604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018361ffff1661ffff16815260200182815260200194505050505060405180910390a180925050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122d557600080fd5b600160149054906101000a900460ff1615156122f057600080fd5b6000600160146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60008273ffffffffffffffffffffffffffffffffffffffff16600360008467ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b6000819050600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050555082600360008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415156124fa57600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055505b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b60606040519081016040528060008152602001600067ffffffffffffffff168152602001600061ffff16815250905600a165627a7a72305820c84697ea55fd83554f3c595153a66c7be35708fe6d1bf6607f067f0ab0f25f120029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,455 |
0xa58d366f2078900E76Bea7f3dBb64766BB9614f4
|
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.4;
interface ITrollbox {
function withdrawWinnings(uint voterId) external;
function updateAccount(uint voterId, uint tournamentId, uint roundId) external;
function isSynced(uint voterId, uint tournamentId, uint roundId) external view returns (bool);
function roundAlreadyResolved(uint tournamentId, uint roundId) external view returns (bool);
function resolveRound(uint tournamentId, uint roundId, uint winningOption) external;
function getCurrentRoundId(uint tournamentId) external view returns (uint);
}
/**
* @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);
}
interface KeeperCompatibleInterface {
/**
* @notice method that is simulated by the keepers to see if any work actually
* needs to be performed. This method does does not actually need to be
* executable, and since it is only ever simulated it can consume lots of gas.
* @dev To ensure that it is never called, you may want to add the
* cannotExecute modifier from KeeperBase to your implementation of this
* method.
* @param checkData specified in the upkeep registration so it is always the
* same for a registered upkeep. This can easily be broken down into specific
* arguments using `abi.decode`, so multiple upkeeps can be registered on the
* same contract and easily differentiated by the contract.
* @return upkeepNeeded boolean to indicate whether the keeper should call
* performUpkeep or not.
* @return performData bytes that the keeper should call performUpkeep with, if
* upkeep is needed. If you would like to encode data to decode later, try
* `abi.encode`.
*/
function checkUpkeep(
bytes calldata checkData
)
external
returns (
bool upkeepNeeded,
bytes memory performData
);
/**
* @notice method that is actually executed by the keepers, via the registry.
* The data returned by the checkUpkeep simulation will be passed into
* this method to actually be executed.
* @dev The input to this method should not be trusted, and the caller of the
* method should not even be restricted to any single registry. Anyone should
* be able call it, and the input should be validated, there is no guarantee
* that the data passed in is the performData returned from checkUpkeep. This
* could happen due to malicious keepers, racing keepers, or simply a state
* change while the performUpkeep transaction is waiting for confirmation.
* Always validate the data passed in.
* @param performData is the data which was passed back from the checkData
* simulation. If it is encoded, it can easily be decoded into other types by
* calling `abi.decode`. This data should not be trusted, and should be
* validated against the contract's current state.
*/
function performUpkeep(
bytes calldata performData
) external;
}
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract ChainLinkOracle2 is KeeperCompatibleInterface {
struct Proposal {
uint id;
uint time;
bool confirmed;
uint roundId;
uint winnerIndex;
uint challengeWinnerIndex;
address challenger;
bytes32 challengeEvidence;
bytes32 confirmationEvidence;
}
mapping (bytes32 => address) public feedMap; // ticker symbol => price aggregator address
mapping (bytes32 => int) public prices; // symbol => price
mapping (uint => Proposal) public proposals;
address public management;
ITrollbox public trollbox;
IERC20 public token;
int constant public PRECISION = 1000000;
uint public numProposals = 0;
uint public challengeDeposit = 0;
uint public challengePeriodSeconds = 60 * 60 * 24;
uint public tournamentId = 1;
uint public startingRoundId = 0;
bytes32[] public tickerSymbols;
// mgmt events
event FeedUpdated(bytes32 indexed key, address indexed feedAddr);
event ManagementUpdated(address oldManagement, address newManagement);
event DepositUpdated(uint oldDeposit, uint newDeposit);
event ChallengePeriodUpdated(uint oldPeriod, uint newPeriod);
event TickerSymbolsUpdated(bytes32[] oldKeys, bytes32[] newKeys, int[] newPrices);
// winner events
event WinnerProposed(uint indexed roundId, uint indexed proposalId, uint winnerIndex, int[] prices);
event WinnerConfirmed(uint indexed roundId, uint indexed proposalId, int[] prices);
// challenger events
event ChallengeMade(uint indexed proposalId, address indexed challenger, uint indexed claimedWinner, bytes32 evidence);
event ChallengerSlashed(uint indexed proposalId, address indexed challenger, uint indexed slashAmount, bytes32 evidence);
event ChallengerVindicated(uint indexed proposalId, address indexed challenger, bytes32 evidence);
modifier managementOnly() {
require (msg.sender == management, 'Only management may call this');
_;
}
modifier latestProposalConfirmed() {
require (proposals[numProposals].confirmed == true || numProposals == 0, 'Unconfirmed proposal present');
_;
}
constructor(address mgmt, address trollboxAddr, address tokenAddr, uint tournament, uint roundId, bytes32[] memory initialSymbols, int[] memory initialPrices) {
management = mgmt;
trollbox = ITrollbox(trollboxAddr);
token = IERC20(tokenAddr);
tournamentId = tournament;
startingRoundId = roundId;
tickerSymbols = initialSymbols;
setPricesInternal(initialPrices);
}
function setManagement(address newMgmt) public managementOnly {
address oldMgmt = management;
management = newMgmt;
emit ManagementUpdated(oldMgmt, newMgmt);
}
function setChallengeDeposit(uint newDeposit) public managementOnly latestProposalConfirmed {
uint oldDeposit = challengeDeposit;
challengeDeposit = newDeposit;
emit DepositUpdated(oldDeposit, newDeposit);
}
function setChallengePeriod(uint newPeriod) public managementOnly latestProposalConfirmed {
uint oldPeriod = challengePeriodSeconds;
challengePeriodSeconds = newPeriod;
emit ChallengePeriodUpdated(oldPeriod, newPeriod);
}
function setPricesInternal(int[] memory newPrices) internal {
for (uint i = 0; i < tickerSymbols.length; i++) {
prices[tickerSymbols[i]] = newPrices[i];
}
}
function getTickerSymbols() public view returns (bytes32[] memory) {
return tickerSymbols;
}
function getCurrentRoundId() public view returns (uint) {
if (numProposals == 0) {
return startingRoundId;
} else {
return proposals[numProposals].roundId;
}
}
function setTickerSymbols(bytes32[] memory newKeys, int[] memory newPrices) public managementOnly latestProposalConfirmed {
bytes32[] memory oldKeys = tickerSymbols;
tickerSymbols = newKeys;
setPricesInternal(newPrices);
// test that this function does not fail before setting
getWinner();
emit TickerSymbolsUpdated(oldKeys, newKeys, newPrices);
}
function addFeed(bytes32 key, address feedAddr) public managementOnly {
feedMap[key] = feedAddr;
emit FeedUpdated(key, feedAddr);
}
function getWinner() public view returns (int[] memory, uint) {
int256 maxPriceDiff = -100 * PRECISION;
uint winnerIndex = 0;
int[] memory pricesLocal = new int[](tickerSymbols.length);
for (uint i = 0; i < tickerSymbols.length; i++) {
bytes32 key = tickerSymbols[i];
int priceBefore = prices[key];
address feedAddr = feedMap[key];
require(feedAddr != address(0), 'Must set feed for all ticker symbols');
AggregatorV3Interface chainlink = AggregatorV3Interface(feedAddr);
(,int256 priceNow,,,) = chainlink.latestRoundData();
pricesLocal[i] = priceNow;
int256 priceDiff = ((priceNow - priceBefore) * PRECISION) / priceBefore;
if (priceDiff > maxPriceDiff) {
maxPriceDiff = priceDiff;
// add one to index to account for 1 based indexing on Trollbox contract
winnerIndex = i + 1;
}
}
return (pricesLocal, winnerIndex);
}
function proposeWinner() public latestProposalConfirmed {
uint roundId = getCurrentRoundId() + 1;
require(trollbox.roundAlreadyResolved(tournamentId, roundId) == false, 'Round already resolve');
require(trollbox.getCurrentRoundId(tournamentId) > roundId + 1, 'Round not ready to resolve');
Proposal storage proposal = proposals[++numProposals];
proposal.id = numProposals;
proposal.time = block.timestamp;
proposal.roundId = roundId;
(int[] memory newPrices, uint winnerIndex) = getWinner();
setPricesInternal(newPrices);
proposal.winnerIndex = winnerIndex;
emit WinnerProposed(roundId, numProposals, proposal.winnerIndex, newPrices);
}
function challengeWinner(uint claimedWinner, bytes32 evidence) public {
token.transferFrom(msg.sender, address(this), challengeDeposit);
Proposal storage proposal = proposals[numProposals];
require(proposal.challenger == address(0), 'Proposal already challenged');
require(claimedWinner != proposal.winnerIndex, 'Must claim different winner than proposed winner');
require(block.timestamp - proposal.time < challengePeriodSeconds, 'Challenge period has passed');
proposal.challenger = msg.sender;
proposal.challengeWinnerIndex = claimedWinner;
proposal.challengeEvidence = evidence;
emit ChallengeMade(numProposals, msg.sender, claimedWinner, evidence);
}
function confirmWinnerUnchallenged() public {
Proposal memory proposal = proposals[numProposals];
require(proposal.challenger == address(0), 'Proposal has been challenged');
require(block.timestamp - proposal.time > challengePeriodSeconds, 'Challenge period has not passed');
confirmWinnerInternal();
}
function confirmWinnerChallenged(uint chosenWinnerIndex, int[] memory localPrices, bytes32 evidence) public managementOnly {
Proposal storage proposal = proposals[numProposals];
require(proposal.challenger != address(0), 'Proposal has not been challenged');
require(chosenWinnerIndex <= tickerSymbols.length, 'Winner index out of range');
require(chosenWinnerIndex > 0, 'Winner index must be positive');
require(localPrices.length == tickerSymbols.length, 'Must specify prices for all ticker symbols');
// set official winner
proposal.winnerIndex = chosenWinnerIndex;
proposal.confirmationEvidence = evidence;
// record prices
setPricesInternal(localPrices);
confirmWinnerInternal();
// if challenger failed, slash their deposit
if (chosenWinnerIndex != proposal.challengeWinnerIndex) {
token.transfer(address(0), challengeDeposit);
emit ChallengerSlashed(numProposals, proposal.challenger, challengeDeposit, evidence);
// else send it back to them
} else {
token.transfer(proposal.challenger, challengeDeposit);
emit ChallengerVindicated(numProposals, proposal.challenger, evidence);
}
}
function confirmWinnerInternal() internal {
Proposal storage proposal = proposals[numProposals];
require(proposal.id == numProposals, 'Invalid proposalId');
require(proposal.confirmed == false, 'Already confirmed proposal');
proposal.confirmed = true;
int[] memory pricesLocal = new int[](tickerSymbols.length);
for (uint i = 0; i < tickerSymbols.length; i++) {
pricesLocal[i] = prices[tickerSymbols[i]];
}
emit WinnerConfirmed(proposal.roundId, proposal.id, pricesLocal);
trollbox.resolveRound(tournamentId, proposal.roundId, proposal.winnerIndex);
}
// K3PR functions
function checkUpkeep(bytes calldata checkData) external view override returns (bool, bytes memory) {
Proposal storage currentProposal = proposals[numProposals];
// if it's confirmed, we may need to propose a new one
if (currentProposal.confirmed || numProposals == 0) {
uint roundId = getCurrentRoundId() + 1;
bool roundAlreadyResolved = trollbox.roundAlreadyResolved(tournamentId, roundId);
bool roundResolvable = trollbox.getCurrentRoundId(tournamentId) > roundId + 1;
return (!roundAlreadyResolved && roundResolvable, abi.encode(false));
// otherwise if there is no challenger
} else {
bool unchallenged = currentProposal.challenger == address(0);
bool pastChallengePeriod = block.timestamp - currentProposal.time > challengePeriodSeconds;
return (unchallenged && pastChallengePeriod, abi.encode(true));
}
}
function performUpkeep(bytes calldata performData) external override {
bool confirm = abi.decode(performData, (bool));
// confirm
if (confirm) {
confirmWinnerUnchallenged();
// propose
} else {
proposeWinner();
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c806388a8d602116100f9578063dfa94da811610097578063f382b4cc11610071578063f382b4cc14610987578063f809ab43146109a5578063fb601294146109c3578063fc0c546a146109e1576101a9565b8063dfa94da814610721578063e51ffcf5146107ed578063ece5cbdf14610939576101a9565b80639d3f3101116100d35780639d3f310114610673578063aaf5eb68146106b5578063cdf4545d146106d3578063d4a22bde146106dd576101a9565b806388a8d602146105a55780638e7ea5b2146105d95780639938ddc81461063f576101a9565b806351e147411161016657806360846bc61161014057806360846bc6146103e25780636e04ff0d1461042457806375520e1b1461051f57806379ed2b5b14610577576101a9565b806351e147411461038c5780635727e25d146103965780635d475fdd146103b4576101a9565b8063013cf08b146101ae57806307625835146102405780630d13fd7b1461027857806330324f3614610296578063400e3949146102f55780634585e33b14610313575b600080fd5b6101da600480360360208110156101c457600080fd5b8101908080359060200190929190505050610a15565b604051808a815260200189815260200188151581526020018781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001995050505050505050505060405180910390f35b6102766004803603604081101561025657600080fd5b810190808035906020019092919080359060200190929190505050610a90565b005b610280610de4565b6040518082815260200191505060405180910390f35b61029e610dea565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102e15780820151818401526020810190506102c6565b505050509050019250505060405180910390f35b6102fd610e42565b6040518082815260200191505060405180910390f35b61038a6004803603602081101561032957600080fd5b810190808035906020019064010000000081111561034657600080fd5b82018360208201111561035857600080fd5b8035906020019184600183028401116401000000008311171561037a57600080fd5b9091929391929390505050610e48565b005b610394610e90565b005b61039e6110a0565b6040518082815260200191505060405180910390f35b6103e0600480360360208110156103ca57600080fd5b81019080803590602001909291905050506110d5565b005b61040e600480360360208110156103f857600080fd5b8101908080359060200190929190505050611295565b6040518082815260200191505060405180910390f35b61049b6004803603602081101561043a57600080fd5b810190808035906020019064010000000081111561045757600080fd5b82018360208201111561046957600080fd5b8035906020019184600183028401116401000000008311171561048b57600080fd5b90919293919293905050506112ad565b60405180831515815260200180602001828103825283818151815260200191508051906020019080838360005b838110156104e35780820151818401526020810190506104c8565b50505050905090810190601f1680156105105780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b61054b6004803603602081101561053557600080fd5b810190808035906020019092919050505061154f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105a36004803603602081101561058d57600080fd5b8101908080359060200190929190505050611582565b005b6105ad611742565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e1611768565b6040518080602001838152602001828103825284818151815260200191508051906020019060200280838360005b8381101561062a57808201518184015260208101905061060f565b50505050905001935050505060405180910390f35b6106476119ff565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61069f6004803603602081101561068957600080fd5b8101908080359060200190929190505050611a25565b6040518082815260200191505060405180910390f35b6106bd611a49565b6040518082815260200191505060405180910390f35b6106db611a50565b005b61071f600480360360208110156106f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e55565b005b6107eb6004803603606081101561073757600080fd5b81019080803590602001909291908035906020019064010000000081111561075e57600080fd5b82018360208201111561077057600080fd5b8035906020019184602083028401116401000000008311171561079257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611fef565b005b6109376004803603604081101561080357600080fd5b810190808035906020019064010000000081111561082057600080fd5b82018360208201111561083257600080fd5b8035906020019184602083028401116401000000008311171561085457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156108b457600080fd5b8201836020820111156108c657600080fd5b803590602001918460208302840111640100000000831117156108e857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506125cf565b005b6109856004803603604081101561094f57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128cc565b005b61098f612a28565b6040518082815260200191505060405180910390f35b6109ad612a2e565b6040518082815260200191505060405180910390f35b6109cb612a34565b6040518082815260200191505060405180910390f35b6109e9612a3a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60026020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900460ff16908060030154908060040154908060050154908060060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060070154908060080154905089565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33306007546040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610b4357600080fd5b505af1158015610b57573d6000803e3d6000fd5b505050506040513d6020811015610b6d57600080fd5b81019080805190602001909291905050505060006002600060065481526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f50726f706f73616c20616c7265616479206368616c6c656e676564000000000081525060200191505060405180910390fd5b8060040154831415610cbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612eb26030913960400191505060405180910390fd5b6008548160010154420310610d38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4368616c6c656e676520706572696f642068617320706173736564000000000081525060200191505060405180910390fd5b338160060160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550828160050181905550818160070181905550823373ffffffffffffffffffffffffffffffffffffffff166006547f73a0b440448d90f8a025399c3578fd03b31d63d3e610614e1c0cf01178e2e197856040518082815260200191505060405180910390a4505050565b60075481565b6060600b805480602002602001604051908101604052809291908181526020018280548015610e3857602002820191906000526020600020905b815481526020019060010190808311610e24575b5050505050905090565b60065481565b600082826020811015610e5a57600080fd5b8101908080351515906020019092919050505090508015610e8257610e7d610e90565b610e8b565b610e8a611a50565b5b505050565b610e98612ddd565b6002600060065481526020019081526020016000206040518061012001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff161515151581526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600782015481526020016008820154815250509050600073ffffffffffffffffffffffffffffffffffffffff168160c0015173ffffffffffffffffffffffffffffffffffffffff1614611018576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f50726f706f73616c20686173206265656e206368616c6c656e6765640000000081525060200191505060405180910390fd5b6008548160200151420311611095576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4368616c6c656e676520706572696f6420686173206e6f74207061737365640081525060200191505060405180910390fd5b61109d612a60565b50565b60008060065414156110b657600a5490506110d2565b6002600060065481526020019081526020016000206003015490505b90565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6001151560026000600654815260200190815260200160002060020160009054906101000a900460ff16151514806111d257506000600654145b611244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e636f6e6669726d65642070726f706f73616c2070726573656e740000000081525060200191505060405180910390fd5b60006008549050816008819055507f6faeedb0dbe08f71a52ddff592571aafec07972ce3a25c4a30e6b161329466928183604051808381526020018281526020019250505060405180910390a15050565b60016020528060005260406000206000915090505481565b60006060600060026000600654815260200190815260200160002090508060020160009054906101000a900460ff16806112e957506000600654145b156114ad57600060016112fa6110a0565b0190506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b303f325600954846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561137c57600080fd5b505afa158015611390573d6000803e3d6000fd5b505050506040513d60208110156113a657600080fd5b81019080805190602001909291905050509050600060018301600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663209380366009546040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561143457600080fd5b505afa158015611448573d6000803e3d6000fd5b505050506040513d602081101561145e57600080fd5b81019080805190602001909291905050501190508115801561147d5750805b60006040516020018082151581526020019150506040516020818303038152906040529550955050505050611548565b60008073ffffffffffffffffffffffffffffffffffffffff168260060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905060006008548360010154420311905081801561151d5750805b6001604051602001808215158152602001915050604051602081830303815290604052945094505050505b9250929050565b60006020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6001151560026000600654815260200190815260200160002060020160009054906101000a900460ff161515148061167f57506000600654145b6116f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e636f6e6669726d65642070726f706f73616c2070726573656e740000000081525060200191505060405180910390fd5b60006007549050816007819055507f4c0c144abc1788db200c21df3378b55ee4ab0980465c120061c995a62f7626d88183604051808381526020018281526020019250505060405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600080620f42407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c02905060006060600b8054905067ffffffffffffffff811180156117b557600080fd5b506040519080825280602002602001820160405280156117e45781602001602082028036833780820191505090505b50905060005b600b805490508110156119f1576000600b828154811061180657fe5b90600052602060002001549050600060016000838152602001908152602001600020549050600080600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118e8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612ee26024913960400191505060405180910390fd5b600081905060008173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561193557600080fd5b505afa158015611949573d6000803e3d6000fd5b505050506040513d60a081101561195f57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050505050915050808787815181106119ab57fe5b602002602001018181525050600084620f424086840302816119c957fe5b059050898113156119de578099506001870198505b50505050505080806001019150506117ea565b508082945094505050509091565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b8181548110611a3557600080fd5b906000526020600020016000915090505481565b620f424081565b6001151560026000600654815260200190815260200160002060020160009054906101000a900460ff1615151480611a8a57506000600654145b611afc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e636f6e6669726d65642070726f706f73616c2070726573656e740000000081525060200191505060405180910390fd5b60006001611b086110a0565b01905060001515600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b303f325600954846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611b8c57600080fd5b505afa158015611ba0573d6000803e3d6000fd5b505050506040513d6020811015611bb657600080fd5b8101908080519060200190929190505050151514611c3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f526f756e6420616c7265616479207265736f6c7665000000000000000000000081525060200191505060405180910390fd5b60018101600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663209380366009546040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611cb557600080fd5b505afa158015611cc9573d6000803e3d6000fd5b505050506040513d6020811015611cdf57600080fd5b810190808051906020019092919050505011611d63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f526f756e64206e6f7420726561647920746f207265736f6c766500000000000081525060200191505060405180910390fd5b60006002600060066000815460010191905081905581526020019081526020016000209050600654816000018190555042816001018190555081816003018190555060606000611db1611768565b91509150611dbe82612d7a565b808360040181905550600654847f7c57cdc8772794257a39bfbe0eea988f6e5918da816edd4bfa596694d68ab9ac8560040154856040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015611e3b578082015181840152602081019050611e20565b50505050905001935050505060405180910390a350505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f8caf0a9df2e1da9becb3ebfb8a56e83121a5b3f6c5622f715a939ec29c54dfdf8183604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146120b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b60006002600060065481526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612192576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f50726f706f73616c20686173206e6f74206265656e206368616c6c656e67656481525060200191505060405180910390fd5b600b8054905084111561220d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f57696e6e657220696e646578206f7574206f662072616e67650000000000000081525060200191505060405180910390fd5b60008411612283576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f57696e6e657220696e646578206d75737420626520706f73697469766500000081525060200191505060405180910390fd5b600b805490508351146122e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612f06602a913960400191505060405180910390fd5b8381600401819055508181600801819055506122fc83612d7a565b612304612a60565b8060050154841461245e57600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60006007546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a557600080fd5b505af11580156123b9573d6000803e3d6000fd5b505050506040513d60208110156123cf57600080fd5b8101908080519060200190929190505050506007548160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166006547f09a391e37667fb2996370e3134d468d2f7ec4a51019d377dd997343b82b28479856040518082815260200191505060405180910390a46125c9565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8260060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561251757600080fd5b505af115801561252b573d6000803e3d6000fd5b505050506040513d602081101561254157600080fd5b8101908080519060200190929190505050508060060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166006547fc163963ab55a686f4e29efde91e0af5de4d22dd4a88d04de03d5b69eed0ee9fb846040518082815260200191505060405180910390a35b50505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b6001151560026000600654815260200190815260200160002060020160009054906101000a900460ff16151514806126cc57506000600654145b61273e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e636f6e6669726d65642070726f706f73616c2070726573656e740000000081525060200191505060405180910390fd5b6060600b80548060200260200160405190810160405280929190818152602001828054801561278c57602002820191906000526020600020905b815481526020019060010190808311612778575b5050505050905082600b90805190602001906127a9929190612e47565b506127b382612d7a565b6127bb611768565b50507f2f533d07823fbe30f975d870556449c3c089e70a28aa379564acc5fa51c2e68d81848460405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561282c578082015181840152602081019050612811565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561286e578082015181840152602081019050612853565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156128b0578082015181840152602081019050612895565b50505050905001965050505050505060405180910390a1505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461298f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f6e6c79206d616e6167656d656e74206d61792063616c6c207468697300000081525060200191505060405180910390fd5b8060008084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16827f45ee15c8b444d8b7d362757167c96bbb5aa4dee29d7d3166063c9c0af180615a60405160405180910390a35050565b600a5481565b60095481565b60085481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006002600060065481526020019081526020016000209050600654816000015414612af4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f496e76616c69642070726f706f73616c4964000000000000000000000000000081525060200191505060405180910390fd5b600015158160020160009054906101000a900460ff16151514612b7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f416c726561647920636f6e6669726d65642070726f706f73616c00000000000081525060200191505060405180910390fd5b60018160020160006101000a81548160ff0219169083151502179055506060600b8054905067ffffffffffffffff81118015612bba57600080fd5b50604051908082528060200260200182016040528015612be95781602001602082028036833780820191505090505b50905060005b600b80549050811015612c4c5760016000600b8381548110612c0d57fe5b9060005260206000200154815260200190815260200160002054828281518110612c3357fe5b6020026020010181815250508080600101915050612bef565b50816000015482600301547f9a8af3b1e54cfb033bf0c00e2cc8176f3b42914d55111159655abdc2d2db5062836040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015612cbc578082015181840152602081019050612ca1565b505050509050019250505060405180910390a3600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663928b7c99600954846003015485600401546040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b158015612d5e57600080fd5b505af1158015612d72573d6000803e3d6000fd5b505050505050565b60005b600b80549050811015612dd957818181518110612d9657fe5b602002602001015160016000600b8481548110612daf57fe5b90600052602060002001548152602001908152602001600020819055508080600101915050612d7d565b5050565b6040518061012001604052806000815260200160008152602001600015158152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008019168152602001600080191681525090565b828054828255906000526020600020908101928215612e83579160200282015b82811115612e82578251825591602001919060010190612e67565b5b509050612e909190612e94565b5090565b5b80821115612ead576000816000905550600101612e95565b509056fe4d75737420636c61696d20646966666572656e742077696e6e6572207468616e2070726f706f7365642077696e6e65724d75737420736574206665656420666f7220616c6c207469636b65722073796d626f6c734d75737420737065636966792070726963657320666f7220616c6c207469636b65722073796d626f6c73a26469706673582212201c9f85e3aab1e4b293ad3961628319593dc10c65c440273ec1a9cce734bff71e64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,456 |
0x799cfdf086e2511c48b5a6487f6f726e7d001dc5
|
/**
*Submitted for verification at Etherscan.io on 2021-10-18
*/
/**
* https://t.me/Reiinu
**/
//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 ReiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0x9bc568a028D967B6DeCB5c3d7eE9c2F49F993585);
address payable private _feeAddrWallet2 = payable(0x8805EE01ADFf743daaFbF403191606E322C47495);
string private constant _name = "Rei Inu";
string private constant _symbol = "REI";
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a1461031b578063c3c8cd801461033b578063c9567bf914610350578063cfe81ba014610365578063dd62ed3e1461038557600080fd5b8063715018a614610272578063842b7c08146102875780638da5cb5b146102a757806395d89b41146102cf578063a9059cbb146102fb57600080fd5b8063273123b7116100e7578063273123b7146101df578063313ce567146102015780635932ead11461021d5780636fc3eaec1461023d57806370a082311461025257600080fd5b806306fdde0314610124578063095ea7b31461016657806318160ddd1461019657806323b872dd146101bf57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600781526652656920496e7560c81b60208201525b60405161015d9190611877565b60405180910390f35b34801561017257600080fd5b506101866101813660046116fe565b6103cb565b604051901515815260200161015d565b3480156101a257600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161015d565b3480156101cb57600080fd5b506101866101da3660046116bd565b6103e2565b3480156101eb57600080fd5b506101ff6101fa36600461164a565b61044b565b005b34801561020d57600080fd5b506040516009815260200161015d565b34801561022957600080fd5b506101ff6102383660046117f6565b61049f565b34801561024957600080fd5b506101ff6104e7565b34801561025e57600080fd5b506101b161026d36600461164a565b610514565b34801561027e57600080fd5b506101ff610536565b34801561029357600080fd5b506101ff6102a2366004611830565b6105aa565b3480156102b357600080fd5b506000546040516001600160a01b03909116815260200161015d565b3480156102db57600080fd5b5060408051808201909152600381526252454960e81b6020820152610150565b34801561030757600080fd5b506101866103163660046116fe565b610601565b34801561032757600080fd5b506101ff61033636600461172a565b61060e565b34801561034757600080fd5b506101ff6106a4565b34801561035c57600080fd5b506101ff6106da565b34801561037157600080fd5b506101ff610380366004611830565b610aa3565b34801561039157600080fd5b506101b16103a0366004611684565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103d8338484610afa565b5060015b92915050565b60006103ef848484610c1e565b610441843361043c85604051806060016040528060288152602001611a63602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f01565b610afa565b5060019392505050565b6000546001600160a01b0316331461047e5760405162461bcd60e51b8152600401610475906118cc565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104c95760405162461bcd60e51b8152600401610475906118cc565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050757600080fd5b4761051181610f3b565b50565b6001600160a01b0381166000908152600260205260408120546103dc90610fc0565b6000546001600160a01b031633146105605760405162461bcd60e51b8152600401610475906118cc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146105fc5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610475565b600a55565b60006103d8338484610c1e565b6000546001600160a01b031633146106385760405162461bcd60e51b8152600401610475906118cc565b60005b81518110156106a05760016006600084848151811061065c5761065c611a13565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610698816119e2565b91505061063b565b5050565b600c546001600160a01b0316336001600160a01b0316146106c457600080fd5b60006106cf30610514565b905061051181611044565b6000546001600160a01b031633146107045760405162461bcd60e51b8152600401610475906118cc565b600f54600160a01b900460ff161561075e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610475565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561079e30826b033b2e3c9fd0803ce8000000610afa565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d757600080fd5b505afa1580156107eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080f9190611667565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561085757600080fd5b505afa15801561086b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088f9190611667565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108d757600080fd5b505af11580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190611667565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061093f81610514565b6000806109546000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109b757600080fd5b505af11580156109cb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109f09190611849565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a6b57600080fd5b505af1158015610a7f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a09190611813565b600d546001600160a01b0316336001600160a01b031614610af55760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610475565b600b55565b6001600160a01b038316610b5c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610475565b6001600160a01b038216610bbd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610475565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c825760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610475565b6001600160a01b038216610ce45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610475565b60008111610d465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610475565b6000546001600160a01b03848116911614801590610d7257506000546001600160a01b03838116911614155b15610ef1576001600160a01b03831660009081526006602052604090205460ff16158015610db957506001600160a01b03821660009081526006602052604090205460ff16155b610dc257600080fd5b600f546001600160a01b038481169116148015610ded5750600e546001600160a01b03838116911614155b8015610e1257506001600160a01b03821660009081526005602052604090205460ff16155b8015610e275750600f54600160b81b900460ff165b15610e8457601054811115610e3b57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e5f57600080fd5b610e6a42601e611972565b6001600160a01b0383166000908152600760205260409020555b6000610e8f30610514565b600f54909150600160a81b900460ff16158015610eba5750600f546001600160a01b03858116911614155b8015610ecf5750600f54600160b01b900460ff165b15610eef57610edd81611044565b478015610eed57610eed47610f3b565b505b505b610efc8383836111cd565b505050565b60008184841115610f255760405162461bcd60e51b81526004016104759190611877565b506000610f3284866119cb565b95945050505050565b600c546001600160a01b03166108fc610f558360026111d8565b6040518115909202916000818181858888f19350505050158015610f7d573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f988360026111d8565b6040518115909202916000818181858888f193505050501580156106a0573d6000803e3d6000fd5b60006008548211156110275760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610475565b600061103161121a565b905061103d83826111d8565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061108c5761108c611a13565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110e057600080fd5b505afa1580156110f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190611667565b8160018151811061112b5761112b611a13565b6001600160a01b039283166020918202929092010152600e546111519130911684610afa565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061118a908590600090869030904290600401611901565b600060405180830381600087803b1580156111a457600080fd5b505af11580156111b8573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610efc83838361123d565b600061103d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611334565b6000806000611227611362565b909250905061123682826111d8565b9250505090565b60008060008060008061124f876113aa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112819087611407565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112b09086611449565b6001600160a01b0389166000908152600260205260409020556112d2816114a8565b6112dc84836114f2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161132191815260200190565b60405180910390a3505050505050505050565b600081836113555760405162461bcd60e51b81526004016104759190611877565b506000610f32848661198a565b60085460009081906b033b2e3c9fd0803ce800000061138182826111d8565b8210156113a1575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113c78a600a54600b54611516565b92509250925060006113d761121a565b905060008060006113ea8e87878761156b565b919e509c509a509598509396509194505050505091939550919395565b600061103d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f01565b6000806114568385611972565b90508381101561103d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610475565b60006114b261121a565b905060006114c083836115bb565b306000908152600260205260409020549091506114dd9082611449565b30600090815260026020526040902055505050565b6008546114ff9083611407565b60085560095461150f9082611449565b6009555050565b6000808080611530606461152a89896115bb565b906111d8565b90506000611543606461152a8a896115bb565b9050600061155b826115558b86611407565b90611407565b9992985090965090945050505050565b600080808061157a88866115bb565b9050600061158888876115bb565b9050600061159688886115bb565b905060006115a8826115558686611407565b939b939a50919850919650505050505050565b6000826115ca575060006103dc565b60006115d683856119ac565b9050826115e3858361198a565b1461103d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610475565b803561164581611a3f565b919050565b60006020828403121561165c57600080fd5b813561103d81611a3f565b60006020828403121561167957600080fd5b815161103d81611a3f565b6000806040838503121561169757600080fd5b82356116a281611a3f565b915060208301356116b281611a3f565b809150509250929050565b6000806000606084860312156116d257600080fd5b83356116dd81611a3f565b925060208401356116ed81611a3f565b929592945050506040919091013590565b6000806040838503121561171157600080fd5b823561171c81611a3f565b946020939093013593505050565b6000602080838503121561173d57600080fd5b823567ffffffffffffffff8082111561175557600080fd5b818501915085601f83011261176957600080fd5b81358181111561177b5761177b611a29565b8060051b604051601f19603f830116810181811085821117156117a0576117a0611a29565b604052828152858101935084860182860187018a10156117bf57600080fd5b600095505b838610156117e9576117d58161163a565b8552600195909501949386019386016117c4565b5098975050505050505050565b60006020828403121561180857600080fd5b813561103d81611a54565b60006020828403121561182557600080fd5b815161103d81611a54565b60006020828403121561184257600080fd5b5035919050565b60008060006060848603121561185e57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118a457858101830151858201604001528201611888565b818111156118b6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119515784516001600160a01b03168352938301939183019160010161192c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611985576119856119fd565b500190565b6000826119a757634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119c6576119c66119fd565b500290565b6000828210156119dd576119dd6119fd565b500390565b60006000198214156119f6576119f66119fd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051157600080fd5b801515811461051157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122082f2dffd2ace658ad004a04d70c83aa48bfcf9a18e1c8254cdac373d90494dd964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,457 |
0xc87e2b27f7477668cc7b97e929953802590049f7
|
/**██████▌▌▒▒▒▒µ▒▒▒╖ ─, ,,▄▄██▄`▀╣▓▓▓▓▓▓▓▓▓╬╬╣╣▒╫╬▒╢╫╬╬╬▓╬▓▓▓▓▓▓▒▓▀,███▄▄, ,= ,@░▒▓φ░▒▒▒▓██████
███████▓░▒╟╠▓▓▒▒▒▓ `,╝` ▓▓%╖▄▄▄▄▄,,,`'``` ,▄, ```'`,,,▄▄▄▄╓HÖ▓░ ▀Ü'` a▒▒▒▒▓▓▒▒▒▓▓██████
████████▓W▓▓▓▒▓▒▒╡ W ' ,,gÑ████▀`██████████████████████████▀▀████▓N▄, ` ,╣ ▒▓▓▒╟▓▓W▓▓███████
███████████▓▓▓██▓▓▒H▒▓▒▒▓▒╣║▒╕ └██▌ ' █▌└▐█▌ ▐█ ▐█ `▐█ ██ █▌ ██▌ ╢▒▒▓▒▓▒▓▓H▓▒▓▓██▓▓▓██████████
██████████████▓▓▓▒▒▒▒▒▒▓░▒▒▒╢▒W "█▌ ▐██`▓██ ██▌ ██▌ ██ ╓██ ▐██ █▌ ╓╢▒▒╣▒▒▒▓▒▒╢▒▒▓▓▓██████████████
████████████▓▒▒▒▒▒▒▒▒▒║╣▓╢▒░▒▒░░╖▐█, ██████████████████████████▌ ▄█ ╣░▒▒╜░░▒▒╬▒▒▒▒╨▒▒▒▒▓████████████
████████████▓▒▒▒▒▒▒▒▓▓▒▒▒╣▓▒╖▒▒▒╫W████████████████████████████████▌╫▒▒▒░@▒▒▒▒▒▓▓▒▒▒░░▒▒╟████████████
█████████████▓▒░▒ ╟╟▒µ▒▓╬▒▒▒]░░▒▒▓▐███▌▐██╙██▀██▀██▀██▀███▐██`████j@▒╫░║░░▒▓╫[╢╟▒░`╓░╜╓▓████████████
█████████████▓▄,,,╢▒▓▒░▒▓╣wæ▒g░▒╜] ███` ██ ▐█,▐█,▐█ ▐█ ▐█`▐█▌ ▐██▌▐░▒▒▓░Ñw▒▓░║░▒▌░╖,,▄▓█████████████
██████████████▓▓▓╥╥@▒░▒▓▒▒▀╜░░▒@▒▓ ███▌╓` "░,▀,,"`,░▀,`░,"' ╙,███▌▐░╢╖░░▀▀▀░▒▒░╖╙wwg╣▓▓█████████████
████████████████▓▓▓▓█Ü@▓▓▄╫▓▓███▒▓▓▌`▀ ,@▒▒▓▓▓▓▄▒▒▒▒▒▄▓▓▓▓▒▓W `▓ █▓░▓██▓▄╣╫▄▓▓p▓█▓▄▄████████████████
██▀███ ▄▄▄ ██▓ ▄▄▄██▀▀▀██▓ ███▄ █
▓██ ▒ ██▒▒████▄ ▓██▒ ▒██ ▓██▒ ██ ▀█ █
▓██ ░▄█ ▒▒██ ▀█▄ ▒██▒ ░██ ▒██▒▓██ ▀█ ██▒
▒██▀▀█▄ ░██▄▄▄▄██ ░██░▓██▄██▓ ░██░▓██▒ ▐▌██▒
░██▓ ▒██▒ ▓█ ▓██▒░██░ ▓███▒ ░██░▒██░ ▓██░
░ ▒▓ ░▒▓░ ▒▒ ▓▒█░░▓ ▒▓▒▒░ ░▓ ░ ▒░ ▒ ▒
░▒ ░ ▒░ ▒ ▒▒ ░ ▒ ░ ▒ ░▒░ ▒ ░░ ░░ ░ ▒░
░░ ░ ░ ▒ ▒ ░ ░ ░ ░ ▒ ░ ░ ░ ░
(scroll down) ░ ░ ░ ░ ░ ░ ░ ░
💻 Website: https://raijin.games
📨 Telegram: https://t.me/RaijinGames
🐥 Twitter: https://twitter.com/Raijin_Games
📘 Medium: https://medium.com/@raijingames
Hello Warriors 👊
We introduce the greatest and unique RPG game based on Ethereum blockchain.
Earn $Raijin tokens by playing and use them to decide the future of the game.
Total supply: 10 000 000
Rewards: 5 000 000
Uniswap liquidity: 4 500 000
Team tokens: 300 000
Airdrop: 200 000
also 2% fee from each transaction will be spread as airdrop to all hodlers.
Good luck! 👊
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
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) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract RaijinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 internal _liquidityFee;
string private _name = 'Raijin';
string private _symbol = 'RAIJIN';
uint8 private _decimals = 9;
uint256 public _taxFeePercent = 2;
bool public swapAndLiquifyEnabled = true;
bool public buyBackEnabled = true;
address internal uniV2router;
address internal uniV2factory;
string telegramAddress;
string websiteAddress;
string twitterAddress;
event RewardLiquidityProviders(uint256 tokenAmount);
event BuyBackEnabledUpdated(bool enabled);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
constructor (address router, address factory) {
telegramAddress = "https://t.me/RaijinGames";
websiteAddress = "https://raijin.games";
twitterAddress = "https://twitter.com/Raijin_Games";
uniV2router = router;
uniV2factory = factory;
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcluded[_msgSender()] = true;
_excluded.push(_msgSender());
}
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 pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].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 isExcludedFromGameReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromGameReward(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInGameReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {_transferStandard(sender, recipient, amount);}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(1000).mul(2);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFeePercent = taxFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
_liquidityFee = liquidityFee;
}
function TelegramLink() public view returns (string memory) {
return telegramAddress;
}
function WebsiteLink() public view returns (string memory) {
return websiteAddress;
}
function TwitterLink() public view returns (string memory) {
return twitterAddress;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80634a74bb02116101045780638ee88c53116100a2578063ab24182111610071578063ab24182114610548578063c1cd710414610566578063dd62ed3e14610582578063f2fde38b146105b2576101cf565b80638ee88c53146104ae57806395d89b41146104ca578063a457c2d7146104e8578063a9059cbb14610518576101cf565b8063715018a6116100de578063715018a61461044a57806371e93aff146104545780638255a8c0146104725780638da5cb5b14610490576101cf565b80634a74bb02146103de5780636053a0e3146103fc57806370a082311461041a576101cf565b8063288cd3f611610171578063395093511161014b57806339509351146103325780633b7a253b146103625780633ee8abfd1461037e5780634549b039146103ae576101cf565b8063288cd3f6146102c65780632d838119146102e4578063313ce56714610314576101cf565b8063095ea7b3116101ad578063095ea7b31461022a57806313114a9d1461025a57806318160ddd1461027857806323b872dd14610296576101cf565b8063053ab182146101d4578063061c82d0146101f057806306fdde031461020c575b600080fd5b6101ee60048036038101906101e9919061324d565b6105ce565b005b61020a6004803603810190610205919061324d565b610748565b005b6102146107e7565b6040516102219190613524565b60405180910390f35b610244600480360381019061023f9190613211565b610879565b6040516102519190613509565b60405180910390f35b610262610897565b60405161026f91906136e6565b60405180910390f35b6102806108a1565b60405161028d91906136e6565b60405180910390f35b6102b060048036038101906102ab91906131c2565b6108b0565b6040516102bd9190613509565b60405180910390f35b6102ce610989565b6040516102db9190613524565b60405180910390f35b6102fe60048036038101906102f9919061324d565b610a1b565b60405161030b91906136e6565b60405180910390f35b61031c610a89565b6040516103299190613701565b60405180910390f35b61034c60048036038101906103479190613211565b610aa0565b6040516103599190613509565b60405180910390f35b61037c6004803603810190610377919061315d565b610b53565b005b6103986004803603810190610393919061315d565b610e07565b6040516103a59190613509565b60405180910390f35b6103c860048036038101906103c39190613276565b610e5d565b6040516103d591906136e6565b60405180910390f35b6103e6610ee4565b6040516103f39190613509565b60405180910390f35b610404610ef7565b6040516104119190613509565b60405180910390f35b610434600480360381019061042f919061315d565b610f0a565b60405161044191906136e6565b60405180910390f35b610452610ff5565b005b61045c611148565b6040516104699190613524565b60405180910390f35b61047a6111da565b6040516104879190613524565b60405180910390f35b61049861126c565b6040516104a591906134ee565b60405180910390f35b6104c860048036038101906104c3919061324d565b611295565b005b6104d2611334565b6040516104df9190613524565b60405180910390f35b61050260048036038101906104fd9190613211565b6113c6565b60405161050f9190613509565b60405180910390f35b610532600480360381019061052d9190613211565b611493565b60405161053f9190613509565b60405180910390f35b6105506114b1565b60405161055d91906136e6565b60405180910390f35b610580600480360381019061057b919061315d565b6114b7565b005b61059c60048036038101906105979190613186565b61189e565b6040516105a991906136e6565b60405180910390f35b6105cc60048036038101906105c7919061315d565b611925565b005b60006105d8611b7b565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610667576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065e906136c6565b60405180910390fd5b600061067283611b83565b5050505090506106ca81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061072281600654611b3190919063ffffffff16565b60068190555061073d83600754611bdb90919063ffffffff16565b600781905550505050565b610750611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d490613646565b60405180910390fd5b80600c8190555050565b6060600980546107f6906138d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610822906138d5565b801561086f5780601f106108445761010080835404028352916020019161086f565b820191906000526020600020905b81548152906001019060200180831161085257829003601f168201915b5050505050905090565b600061088d610886611b7b565b8484611c39565b6001905092915050565b6000600754905090565b6000662386f26fc10000905090565b60006108bd848484611e04565b61097e846108c9611b7b565b61097985604051806060016040528060288152602001613d9f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092f611b7b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221b9092919063ffffffff16565b611c39565b600190509392505050565b606060118054610998906138d5565b80601f01602080910402602001604051908101604052809291908181526020018280546109c4906138d5565b8015610a115780601f106109e657610100808354040283529160200191610a11565b820191906000526020600020905b8154815290600101906020018083116109f457829003601f168201915b5050505050905090565b6000600654821115610a62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5990613566565b60405180910390fd5b6000610a6c61227f565b9050610a818184611ae790919063ffffffff16565b915050919050565b6000600b60009054906101000a900460ff16905090565b6000610b49610aad611b7b565b84610b448560036000610abe611b7b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b611c39565b6001905092915050565b610b5b611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90613646565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6c906135e6565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610d4957610d05600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a1b565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000662386f26fc10000831115610ea9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea090613606565b60405180910390fd5b81610ec8576000610eb984611b83565b50505050905080915050610ede565b6000610ed384611b83565b505050915050809150505b92915050565b600d60009054906101000a900460ff1681565b600d60019054906101000a900460ff1681565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fa557600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610ff0565b610fed600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a1b565b90505b919050565b610ffd611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461108a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108190613646565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060108054611157906138d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611183906138d5565b80156111d05780601f106111a5576101008083540402835291602001916111d0565b820191906000526020600020905b8154815290600101906020018083116111b357829003601f168201915b5050505050905090565b6060600f80546111e9906138d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611215906138d5565b80156112625780601f1061123757610100808354040283529160200191611262565b820191906000526020600020905b81548152906001019060200180831161124557829003601f168201915b5050505050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61129d611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461132a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132190613646565b60405180910390fd5b8060088190555050565b6060600a8054611343906138d5565b80601f016020809104026020016040519081016040528092919081815260200182805461136f906138d5565b80156113bc5780601f10611391576101008083540402835291602001916113bc565b820191906000526020600020905b81548152906001019060200180831161139f57829003601f168201915b5050505050905090565b60006114896113d3611b7b565b8461148485604051806060016040528060258152602001613dc760259139600360006113fd611b7b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221b9092919063ffffffff16565b611c39565b6001905092915050565b60006114a76114a0611b7b565b8484611e04565b6001905092915050565b600c5481565b6114bf611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461154c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154390613646565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166115d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115cf906135e6565b60405180910390fd5b60005b60058054905081101561189a578173ffffffffffffffffffffffffffffffffffffffff1660058281548110611639577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561188757600560016005805490506116949190613819565b815481106116cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058281548110611730577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600580548061184d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905561189a565b808061189290613907565b9150506115db565b5050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61192d611b7b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b190613646565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2190613586565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000611b2983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122aa565b905092915050565b6000611b7383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061221b565b905092915050565b600033905090565b6000806000806000806000611b978861230d565b915091506000611ba561227f565b90506000806000611bb78c8686612360565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b6000808284611bea9190613738565b905083811015611c2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c26906135c6565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ca9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca0906136a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d10906135a6565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611df791906136e6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b90613686565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ee4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611edb90613546565b60405180910390fd5b60008111611f27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1e90613666565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015611fca5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611fdf57611fda8383836123be565b612216565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156120825750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561209757612092838383612611565b612215565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561213b5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121505761214b838383612864565b612214565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121f25750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561220757612202838383612a22565b612213565b612212838383612864565b5b5b5b5b505050565b6000838311158290612263576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225a9190613524565b60405180910390fd5b50600083856122729190613819565b9050809150509392505050565b600080600061228c612d0a565b915091506122a38183611ae790919063ffffffff16565b9250505090565b600080831182906122f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e89190613524565b60405180910390fd5b5060008385612300919061378e565b9050809150509392505050565b600080600061233a600261232c6103e887611ae790919063ffffffff16565b61306990919063ffffffff16565b905060006123518286611b3190919063ffffffff16565b90508082935093505050915091565b600080600080612379858861306990919063ffffffff16565b90506000612390868861306990919063ffffffff16565b905060006123a78284611b3190919063ffffffff16565b905082818395509550955050505093509350939050565b60008060008060006123cf86611b83565b9450945094509450945061242b86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124c085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255584600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125a283826130e4565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516125ff91906136e6565b60405180910390a35050505050505050565b600080600080600061262286611b83565b9450945094509450945061267e85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061271382600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127a884600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f583826130e4565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161285291906136e6565b60405180910390a35050505050505050565b600080600080600061287586611b83565b945094509450945094506128d185600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061296684600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129b383826130e4565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612a1091906136e6565b60405180910390a35050505050505050565b6000806000806000612a3386611b83565b94509450945094509450612a8f86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b2485600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3190919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bb982600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c4e84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdb90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c9b83826130e4565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612cf891906136e6565b60405180910390a35050505050505050565b600080600060065490506000662386f26fc10000905060005b60058054905081101561302257826001600060058481548110612d6f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612e835750816002600060058481548110612e1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612e9f57600654662386f26fc1000094509450505050613065565b612f556001600060058481548110612ee0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611b3190919063ffffffff16565b925061300d6002600060058481548110612f98577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611b3190919063ffffffff16565b9150808061301a90613907565b915050612d23565b5061303f662386f26fc10000600654611ae790919063ffffffff16565b82101561305c57600654662386f26fc10000935093505050613065565b81819350935050505b9091565b60008083141561307c57600090506130de565b6000828461308a91906137bf565b9050828482613099919061378e565b146130d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130d090613626565b60405180910390fd5b809150505b92915050565b6130f982600654611b3190919063ffffffff16565b60068190555061311481600754611bdb90919063ffffffff16565b6007819055505050565b60008135905061312d81613d59565b92915050565b60008135905061314281613d70565b92915050565b60008135905061315781613d87565b92915050565b60006020828403121561316f57600080fd5b600061317d8482850161311e565b91505092915050565b6000806040838503121561319957600080fd5b60006131a78582860161311e565b92505060206131b88582860161311e565b9150509250929050565b6000806000606084860312156131d757600080fd5b60006131e58682870161311e565b93505060206131f68682870161311e565b925050604061320786828701613148565b9150509250925092565b6000806040838503121561322457600080fd5b60006132328582860161311e565b925050602061324385828601613148565b9150509250929050565b60006020828403121561325f57600080fd5b600061326d84828501613148565b91505092915050565b6000806040838503121561328957600080fd5b600061329785828601613148565b92505060206132a885828601613133565b9150509250929050565b6132bb8161384d565b82525050565b6132ca8161385f565b82525050565b60006132db8261371c565b6132e58185613727565b93506132f58185602086016138a2565b6132fe816139dd565b840191505092915050565b6000613316602383613727565b9150613321826139ee565b604082019050919050565b6000613339602a83613727565b915061334482613a3d565b604082019050919050565b600061335c602683613727565b915061336782613a8c565b604082019050919050565b600061337f602283613727565b915061338a82613adb565b604082019050919050565b60006133a2601b83613727565b91506133ad82613b2a565b602082019050919050565b60006133c5601b83613727565b91506133d082613b53565b602082019050919050565b60006133e8601f83613727565b91506133f382613b7c565b602082019050919050565b600061340b602183613727565b915061341682613ba5565b604082019050919050565b600061342e602083613727565b915061343982613bf4565b602082019050919050565b6000613451602983613727565b915061345c82613c1d565b604082019050919050565b6000613474602583613727565b915061347f82613c6c565b604082019050919050565b6000613497602483613727565b91506134a282613cbb565b604082019050919050565b60006134ba602c83613727565b91506134c582613d0a565b604082019050919050565b6134d98161388b565b82525050565b6134e881613895565b82525050565b600060208201905061350360008301846132b2565b92915050565b600060208201905061351e60008301846132c1565b92915050565b6000602082019050818103600083015261353e81846132d0565b905092915050565b6000602082019050818103600083015261355f81613309565b9050919050565b6000602082019050818103600083015261357f8161332c565b9050919050565b6000602082019050818103600083015261359f8161334f565b9050919050565b600060208201905081810360008301526135bf81613372565b9050919050565b600060208201905081810360008301526135df81613395565b9050919050565b600060208201905081810360008301526135ff816133b8565b9050919050565b6000602082019050818103600083015261361f816133db565b9050919050565b6000602082019050818103600083015261363f816133fe565b9050919050565b6000602082019050818103600083015261365f81613421565b9050919050565b6000602082019050818103600083015261367f81613444565b9050919050565b6000602082019050818103600083015261369f81613467565b9050919050565b600060208201905081810360008301526136bf8161348a565b9050919050565b600060208201905081810360008301526136df816134ad565b9050919050565b60006020820190506136fb60008301846134d0565b92915050565b600060208201905061371660008301846134df565b92915050565b600081519050919050565b600082825260208201905092915050565b60006137438261388b565b915061374e8361388b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561378357613782613950565b5b828201905092915050565b60006137998261388b565b91506137a48361388b565b9250826137b4576137b361397f565b5b828204905092915050565b60006137ca8261388b565b91506137d58361388b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561380e5761380d613950565b5b828202905092915050565b60006138248261388b565b915061382f8361388b565b92508282101561384257613841613950565b5b828203905092915050565b60006138588261386b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156138c05780820151818401526020810190506138a5565b838111156138cf576000848401525b50505050565b600060028204905060018216806138ed57607f821691505b60208210811415613901576139006139ae565b5b50919050565b60006139128261388b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561394557613944613950565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4163636f756e7420697320616c7265616479206578636c756465640000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b613d628161384d565b8114613d6d57600080fd5b50565b613d798161385f565b8114613d8457600080fd5b50565b613d908161388b565b8114613d9b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122085c35bac785937da6aeb4b7652d62116b5a748d4f9676979862858bd42123cb564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,458 |
0xb7a9274bd3751b4b619a9a05177b6f67ab11bfd3
|
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2020 Hydro Money
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.
*/
pragma solidity 0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
*/
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
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);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
_owner = msg.sender;
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Hydro ERC20-BEP20 Swap Contract
*/
contract HydroTokenSwap is Ownable {
using SafeMath for uint256;
uint256 public contractTotalAmountSwapped;
address constant Hydro_ADDRESS= 0x946112efaB61C3636CBD52DE2E1392D7A75A6f01;
address Main_ADDRESS= 0x4aE8bfB81205837DE1437De26D02E5ca87694714;
bool public isActive;
struct User {
address userAdd;
uint256 totalAmountSwapped;
}
//a mapping to keep the details of users
mapping(address => User) public userDetails;
//main event that is emitted after a successful deposit
event SwapDeposit(address indexed depositor, uint256 outputAmount);
//check if the contract is open to swaps
function isSwapActive() public view returns (bool) {
return isActive;
}
//make sure contract is open to swaps
modifier hasActiveSwap {
require(isSwapActive(), "Swapping is currently paused");
_;
}
/**
* @dev Allows the user to deposit some amount of Hydro tokens. Records user/swap data and emits a SwapDeposit event.
* @param amount Amount of input tokens to be swapped.
*/
function swap( uint256 amount) external hasActiveSwap {
require(amount > 0, "Input amount must be positive.");
uint256 outputAmount = amount;
require(outputAmount > 0, "Amount too small.");
require(IERC20(Hydro_ADDRESS).transferFrom(msg.sender, Main_ADDRESS, amount), "Transferring Hydro tokens from user failed");
userDetails[msg.sender].totalAmountSwapped+=amount;
userDetails[msg.sender].userAdd=msg.sender;
contractTotalAmountSwapped+=amount;
emit SwapDeposit(msg.sender,amount);
}
function totalAmountSwappedInContract(address _user) public view returns(uint256){
return userDetails[_user].totalAmountSwapped;
}
function grossAmountSwapped() public view returns(uint256){
return contractTotalAmountSwapped;
}
//allow the owner to activate the escrow contract
function openEscrow() public onlyOwner hasActiveSwap returns(bool){
isActive=true;
}
//allow the owner to deactivate the escrow contract
function closeEscrow() public onlyOwner returns(bool){
isActive=false;
}
//allow owner to rescue any tokens sent to the contract
function transferOut(address _token) public onlyOwner returns(bool){
IERC20 token= IERC20(_token);
uint256 balance= token.balanceOf(address(this));
require(token.transfer(msg.sender,balance),"HydroSwap: Token Transfer error");
return true;
}
/**
!!!!!!!!!!!!!!!!!!
!!!!!CAUTION!!!!!!
!!!!!!!!!!!!!!!!!!
**/
//allow owner to change central wallet
function changeCentralWallet(address _newWallet) public onlyOwner returns(bool){
require(_newWallet!=address(0),"Error: Burn address not supported");
Main_ADDRESS=_newWallet;
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806394b918de11610097578063c163de3d11610066578063c163de3d14610246578063e35bff961461024e578063f2fde38b14610256578063f8667bd51461027c576100f5565b806394b918de146101c35780639894ba7c146101e0578063aa915e6914610206578063b1d36ee114610220576100f5565b80637116406b116100d35780637116406b14610167578063715018a61461018d5780638da5cb5b146101975780638f32d59b146101bb576100f5565b806322f3e2d4146100fa578063269fadb31461011657806348dec2a71461011e575b600080fd5b610102610284565b604080519115158252519081900360200190f35b610102610294565b6101446004803603602081101561013457600080fd5b50356001600160a01b0316610316565b604080516001600160a01b03909316835260208301919091528051918290030190f35b6101026004803603602081101561017d57600080fd5b50356001600160a01b031661033b565b6101956103b8565b005b61019f610411565b604080516001600160a01b039092168252519081900360200190f35b610102610420565b610195600480360360208110156101d957600080fd5b5035610431565b610102600480360360208110156101f657600080fd5b50356001600160a01b0316610663565b61020e6107c7565b60408051918252519081900360200190f35b61020e6004803603602081101561023657600080fd5b50356001600160a01b03166107cd565b6101026107eb565b61010261080e565b6101956004803603602081101561026c57600080fd5b50356001600160a01b031661081e565b61020e61083b565b600254600160a01b900460ff1681565b600061029e610420565b6102a757600080fd5b6102af61080e565b610300576040805162461bcd60e51b815260206004820152601c60248201527f5377617070696e672069732063757272656e746c792070617573656400000000604482015290519081900360640190fd5b6002805460ff60a01b1916600160a01b17905590565b600360205260009081526040902080546001909101546001600160a01b039091169082565b6000610345610420565b61034e57600080fd5b6001600160a01b0382166103935760405162461bcd60e51b81526004018080602001828103825260218152602001806108da6021913960400191505060405180910390fd5b50600280546001600160a01b0383166001600160a01b03199091161790556001919050565b6103c0610420565b6103c957600080fd5b600080546040516001600160a01b03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a2600080546001600160a01b0319169055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b61043961080e565b61048a576040805162461bcd60e51b815260206004820152601c60248201527f5377617070696e672069732063757272656e746c792070617573656400000000604482015290519081900360640190fd5b600081116104df576040805162461bcd60e51b815260206004820152601e60248201527f496e70757420616d6f756e74206d75737420626520706f7369746976652e0000604482015290519081900360640190fd5b8080610526576040805162461bcd60e51b815260206004820152601160248201527020b6b7bab73a103a37b79039b6b0b6361760791b604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201526001600160a01b039092166024830152604482018490525173946112efab61c3636cbd52de2e1392d7a75a6f01916323b872dd9160648083019260209291908290030181600087803b15801561059257600080fd5b505af11580156105a6573d6000803e3d6000fd5b505050506040513d60208110156105bc57600080fd5b50516105f95760405162461bcd60e51b815260040180806020018281038252602a8152602001806108b0602a913960400191505060405180910390fd5b33600081815260036020908152604091829020600180820180548801905581546001600160a01b0319168517909155805486019055815185815291517ffe680bd633ae867a4504b82e127494f973d26840939652b54fbbc4752628d20f9281900390910190a25050565b600061066d610420565b61067657600080fd5b604080516370a0823160e01b8152306004820152905183916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156106c157600080fd5b505afa1580156106d5573d6000803e3d6000fd5b505050506040513d60208110156106eb57600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519192506001600160a01b0384169163a9059cbb916044808201926020929091908290030181600087803b15801561074057600080fd5b505af1158015610754573d6000803e3d6000fd5b505050506040513d602081101561076a57600080fd5b50516107bd576040805162461bcd60e51b815260206004820152601f60248201527f487964726f537761703a20546f6b656e205472616e73666572206572726f7200604482015290519081900360640190fd5b5060019392505050565b60015490565b6001600160a01b031660009081526003602052604090206001015490565b60006107f5610420565b6107fe57600080fd5b6002805460ff60a01b1916905590565b600254600160a01b900460ff1690565b610826610420565b61082f57600080fd5b61083881610841565b50565b60015481565b6001600160a01b03811661085457600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe5472616e7366657272696e6720487964726f20746f6b656e732066726f6d2075736572206661696c65644572726f723a204275726e2061646472657373206e6f7420737570706f72746564a2646970667358221220eba88c2bc0252b5d7967e01a1d8446c606024f4b289a1b59e0c43d3eeeb0fe2064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,459 |
0xd0839f4032f42f937da73d7d282ededdc4264203
|
pragma solidity ^ 0.4.25;
/* 创建一个父类, 账户管理员 */
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
/* modifier是修改标志 */
modifier onlyOwner {
require(msg.sender == owner);
_;
}
/* 修改管理员账户, onlyOwner代表只能是用户管理员来修改 */
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
contract lepaitoken is owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public systemprice;
struct putusers{
address puser;//竞拍人
uint addtime;//竞拍时间
uint addmoney; //竞拍价格
string useraddr; //竞拍人地址
}
struct auctionlist{
address adduser;//添加人0
uint opentime;//开始时间1
uint endtime;//结束时间2
uint openprice;//起拍价格3
uint endprice;//最高价格4
uint onceprice;//每次加价5
uint currentprice;//当前价格6
string goodsname; //商品名字7
string goodspic; //商品图片8
bool ifend;//是否结束9
uint ifsend;//是否发货10
uint lastid;//竞拍数11
mapping(uint => putusers) aucusers;//竞拍人的数据组
mapping(address => uint) ausers;//竞拍人的竞拍价格
}
auctionlist[] public auctionlisting; //竞拍中的
auctionlist[] public auctionlistend; //竞拍结束的
auctionlist[] public auctionlistts; //竞拍投诉
mapping(address => uint[]) userlist;//用户所有竞拍的订单
mapping(address => uint[]) mypostauct;//发布者所有发布的订单
mapping(address => uint) balances;
//管理员帐号
mapping(address => bool) public admins;
//0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA
address btycaddress = 0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA;
btycInterface constant private btyc = btycInterface(0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA);
/* 通知 */
event auctconfim(address target, uint tokens);//竞拍成功通知
event getmoneys(address target, uint tokens);//获取返利通知
event Transfer(address indexed from, address indexed to, uint tokens);
/* modifier是修改标志 */
modifier onlyadmin {
require(admins[msg.sender] == true);
_;
}
constructor() public {
symbol = "BTYClepai";
name = "BTYC lepai";
decimals = 18;
systemprice = 20000 ether;
admins[owner] = true;
}
/*添加拍卖 */
function addauction(address addusers,uint opentimes, uint endtimes, uint onceprices, uint openprices, uint endprices, string goodsnames, string goodspics) public returns(uint){
uint _now = now;
require(opentimes >= _now - 1 hours);
require(opentimes < _now + 2 days);
require(endtimes > opentimes);
//require(endtimes > _now + 2 days);
require(endtimes < opentimes + 2 days);
require(btyc.balanceOf(addusers) >= systemprice);
auctionlisting.push(auctionlist(addusers, opentimes, endtimes, openprices, endprices, onceprices, openprices, goodsnames, goodspics, false, 0, 0));
uint lastid = auctionlisting.length;
mypostauct[addusers].push(lastid);
return(lastid);
}
//发布者发布的数量
function getmypostlastid() public view returns(uint){
return(mypostauct[msg.sender].length);
}
//发布者发布的订单id
function getmypost(uint ids) public view returns(uint){
return(mypostauct[msg.sender][ids]);
}
/* 获取用户金额 */
function balanceOf(address tokenOwner) public view returns(uint balance) {
return balances[tokenOwner];
}
//btyc用户余额
function btycBalanceOf(address addr) public view returns(uint) {
return(btyc.balanceOf(addr));
}
/* 私有的交易函数 */
function _transfer(address _from, address _to, uint _value) private {
// 防止转移到0x0
require(_to != 0x0);
// 检测发送者是否有足够的资金
require(balances[_from] >= _value);
// 检查是否溢出(数据类型的溢出)
require(balances[_to] + _value > balances[_to]);
// 将此保存为将来的断言, 函数最后会有一个检验
uint previousBalances = balances[_from] + balances[_to];
// 减少发送者资产
balances[_from] -= _value;
// 增加接收者的资产
balances[_to] += _value;
emit Transfer(_from, _to, _value);
// 断言检测, 不应该为错
assert(balances[_from] + balances[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns(bool){
_transfer(msg.sender, _to, _value);
}
function transferadmin(address _from, address _to, uint _value) public onlyadmin{
_transfer(_from, _to, _value);
}
function transferto(uint256 _value) public returns(bool){
_transfer(msg.sender, this, _value);
}
function() payable public {
address to = msg.sender;
balances[to] = balances[to].add(msg.value);
emit Transfer(msg.sender, this, msg.value);
}
//用户可用余额
function canuse(address addr) public view returns(uint) {
return(btyc.getcanuse(addr));
}
//合约现有余额
function btycownerof() public view returns(uint) {
return(btyc.balanceOf(this));
}
function ownerof() public view returns(uint) {
return(balances[this]);
}
//把合约余额转出
function sendleftmoney(address _to, uint _value) public onlyadmin{
_transfer(this, _to, _value);
}
/*用户竞拍*/
function inputauction(uint auctids, address pusers, uint addmoneys,string useraddrs) public payable{
uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(c.ifend == false);
require(c.ifsend == 0);
uint userbalance = balances[pusers];
require(addmoneys > c.currentprice);
require(addmoneys <= c.endprice);
// uint userhasmoney = c.ausers[pusers];
require(addmoneys > c.ausers[pusers]);
uint money = addmoneys - c.ausers[pusers];
require(userbalance >= money);
if(c.endtime < _now) {
c.ifend = true;
}else{
if(addmoneys == c.endprice){
c.ifend = true;
}
transferto(money);
c.ausers[pusers] = addmoneys;
c.currentprice = addmoneys;
c.aucusers[c.lastid++] = putusers(pusers, _now, addmoneys, useraddrs);
userlist[pusers].push(auctids);
//emit auctconfim(pusers, money);
}
//}
}
//获取用户自己竞拍的总数
function getuserlistlength(address uaddr) public view returns(uint len) {
len = userlist[uaddr].length;
}
//查看单个订单
function viewauction(uint aid) public view returns(address addusers,uint opentimes, uint endtimes, uint onceprices, uint openprices, uint endprices, uint currentprices, string goodsnames, string goodspics, bool ifends, uint ifsends, uint anum){
auctionlist storage c = auctionlisting[aid];
addusers = c.adduser;//0
opentimes = c.opentime;//1
endtimes = c.endtime;//2
onceprices = c.onceprice;//3
openprices = c.openprice;//4
endprices = c.endprice;//5
currentprices = c.currentprice;//6
goodspics = c.goodspic;//7
goodsnames = c.goodsname;//8
ifends = c.ifend;//9
ifsends = c.ifsend;//10
anum = c.lastid;//11
}
//获取单个订单的竞拍者数据
function viewauctionlist(uint aid, uint uid) public view returns(address pusers,uint addtimes,uint addmoneys){
auctionlist storage c = auctionlisting[aid];
putusers storage u = c.aucusers[uid];
pusers = u.puser;//0
addtimes = u.addtime;//1
addmoneys = u.addmoney;//2
}
//获取所有竞拍商品的总数
function getactlen() public view returns(uint) {
return(auctionlisting.length);
}
//获取投诉订单的总数
function getacttslen() public view returns(uint) {
return(auctionlistts.length);
}
//获取竞拍完结的总数
function getactendlen() public view returns(uint) {
return(auctionlistend.length);
}
//发布者设定发货
function setsendgoods(uint auctids) public {
uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(c.adduser == msg.sender);
require(c.endtime < _now);
require(c.ifsend == 0);
c.ifsend = 1;
c.ifend = true;
}
//竞拍者收到货物后动作
function setgetgoods(uint auctids) public {
uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(c.endtime < _now);
require(c.ifend == true);
require(c.ifsend == 1);
putusers storage lasttuser = c.aucusers[c.lastid];
require(lasttuser.puser == msg.sender);
c.ifsend = 2;
uint getmoney = lasttuser.addmoney*70/100;
btyc.mintToken(c.adduser, getmoney);
auctionlistend.push(c);
}
//获取用户的发货地址(发布者)
function getuseraddress(uint auctids) public view returns(string){
auctionlist storage c = auctionlisting[auctids];
require(c.adduser == msg.sender);
//putusers memory mdata = c.aucusers[c.lastid];
return(c.aucusers[c.lastid].useraddr);
}
function editusetaddress(uint aid, string setaddr) public returns(bool){
auctionlist storage c = auctionlisting[aid];
putusers storage data = c.aucusers[c.lastid];
require(data.puser == msg.sender);
data.useraddr = setaddr;
return(true);
}
/*用户获取拍卖金额和返利,只能返利一次 */
function endauction(uint auctids) public {
//uint _now = now;
auctionlist storage c = auctionlisting[auctids];
require(c.ifsend == 2);
uint len = c.lastid;
putusers storage firstuser = c.aucusers[0];
address suser = msg.sender;
require(c.ifend == true);
require(len > 1);
require(c.ausers[suser] > 0);
uint sendmoney = 0;
if(len == 2) {
require(firstuser.puser == suser);
sendmoney = c.currentprice*3/10 + c.ausers[suser];
}else{
if(firstuser.puser == suser) {
sendmoney = c.currentprice*1/10 + c.ausers[suser];
}else{
uint onemoney = (c.currentprice*2/10)/(len-2);
sendmoney = onemoney + c.ausers[suser];
}
}
require(sendmoney > 0);
c.ausers[suser] = 0;
btyc.mintToken(suser, sendmoney);
emit getmoneys(suser, sendmoney);
}
//设定拍卖标准价
function setsystemprice(uint price) public onlyadmin{
systemprice = price;
}
//管理员冻结发布者和商品
function setauctionother(uint auctids) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, true);
c.ifend = true;
c.ifsend = 3;
}
//设定商品状态
function setauctionsystem(uint auctids, uint setnum) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
c.ifend = true;
c.ifsend = setnum;
}
//设定商品正常
function setauctionotherfree(uint auctids) public onlyadmin{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, false);
c.ifsend = 2;
}
//投诉发布者未发货或货物不符
function tsauction(uint auctids) public{
auctionlist storage c = auctionlisting[auctids];
uint _now = now;
require(c.endtime > _now);
require(c.endtime + 2 days < _now);
require(c.aucusers[c.lastid].puser == msg.sender);
if(c.endtime + 2 days < _now && c.ifsend == 0) {
c.ifsend = 5;
c.ifend = true;
auctionlistts.push(c);
}
if(c.endtime + 9 days < _now && c.ifsend == 1) {
c.ifsend = 5;
c.ifend = true;
auctionlistts.push(c);
}
}
//管理员设定违规竞拍返还竞拍者
function endauctionother(uint auctids) public {
//uint _now = now;
auctionlist storage c = auctionlisting[auctids];
address suser = msg.sender;
require(c.ifsend == 3);
require(c.ausers[suser] > 0);
btyc.mintToken(suser,c.ausers[suser]);
c.ausers[suser] = 0;
emit getmoneys(suser, c.ausers[suser]);
}
/*
* 设置管理员
* @param {Object} address
*/
function admAccount(address target, bool freeze) onlyOwner public {
admins[target] = freeze;
}
}
//btyc接口类
interface btycInterface {
function balanceOf(address _addr) external view returns (uint256);
function mintToken(address target, uint256 mintedAmount) external returns (bool);
//function transfer(address to, uint tokens) external returns (bool);
function freezeAccount(address target, bool freeze) external returns (bool);
function getcanuse(address tokenOwner) external view returns(uint);
//function getprice() external view returns(uint addtime, uint outtime, uint bprice, uint spice, uint sprice, uint sper, uint givefrom, uint giveto, uint giveper, uint sdfrozen, uint sdper1, uint sdper2, uint sdper3);
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns(uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns(uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns(uint c) {
require(b > 0);
c = a / b;
}
}
|
0x6080604052600436106101f85763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461027157806307822f7d146102fb5780630d0c529a1461033e57806312cd57c9146103655780631754de57146103c9578063313ce567146103ed578063334fb22e14610418578063429b62e51461056a5780634b079fa61461059f5780634e285acb146105b4578063540ea6db146105cc5780635a6e8980146105e457806365e16a09146106425780636a83b9241461066c57806370a08231146106815780637196a769146106a25780637d564f11146106ba5780638d3ef87d146106d25780638da5cb5b146106f357806390cfce5a1461072457806395d89b411461073c578063997ce600146107515780639d134185146107695780639fbdcef014610784578063a8243ff41461079c578063a9059cbb146107b1578063ac838774146107d5578063b0a8489e14610890578063b139275f146108b1578063b1a00406146108c9578063b7cc6f50146108de578063c4041bc5146108f6578063c88dbfeb1461090e578063c9ba73a314610923578063cb3797651461093b578063ceaf0bfb14610953578063e259d07414610979578063e97e490c14610991578063ee9c26d6146109b2578063f2fde38b146109c7578063fa53bb1b146109e8575b336000818152600a6020526040902054610218903463ffffffff610a0016565b600160a060020a0382166000908152600a60209081526040918290209290925580513481529051309233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350005b34801561027d57600080fd5b50610286610a16565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c05781810151838201526020016102a8565b50505050905090810190601f1680156102ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561030757600080fd5b50610316600435602435610aa1565b60408051600160a060020a039094168452602084019290925282820152519081900360600190f35b34801561034a57600080fd5b50610353610afd565b60408051918252519081900360200190f35b604080516020601f6064356004818101359283018490048402850184019095528184526103c794803594600160a060020a036024803591909116956044359536956084949301918190840183828082843750949750610b049650505050505050565b005b3480156103d557600080fd5b506103c7600160a060020a0360043516602435610d06565b3480156103f957600080fd5b50610402610d36565b6040805160ff9092168252519081900360200190f35b34801561042457600080fd5b50610430600435610d3f565b604051808d600160a060020a0316600160a060020a031681526020018c81526020018b81526020018a8152602001898152602001888152602001878152602001806020018060200186151515158152602001858152602001848152602001838103835288818151815260200191508051906020019080838360005b838110156104c35781810151838201526020016104ab565b50505050905090810190601f1680156104f05780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b8381101561052357818101518382015260200161050b565b50505050905090810190601f1680156105505780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b34801561057657600080fd5b5061058b600160a060020a0360043516610ed1565b604080519115158252519081900360200190f35b3480156105ab57600080fd5b50610353610ee6565b3480156105c057600080fd5b506103c7600435610ef9565b3480156105d857600080fd5b50610286600435610f71565b3480156105f057600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261058b9583359536956044949193909101919081908401838280828437509497506110579650505050505050565b34801561064e57600080fd5b506103c7600160a060020a03600435811690602435166044356110ca565b34801561067857600080fd5b506103536110fb565b34801561068d57600080fd5b50610353600160a060020a036004351661119b565b3480156106ae57600080fd5b506104306004356111ba565b3480156106c657600080fd5b506103c76004356111c8565b3480156106de57600080fd5b50610353600160a060020a03600435166111ee565b3480156106ff57600080fd5b50610708611209565b60408051600160a060020a039092168252519081900360200190f35b34801561073057600080fd5b506103c7600435611218565b34801561074857600080fd5b5061028661156b565b34801561075d57600080fd5b506103c76004356115c5565b34801561077557600080fd5b506103c760043560243561184e565b34801561079057600080fd5b506103c76004356118a8565b3480156107a857600080fd5b506103536119a2565b3480156107bd57600080fd5b5061058b600160a060020a03600435166024356119a8565b3480156107e157600080fd5b50604080516020601f60c43560048181013592830184900484028501840190955281845261035394600160a060020a0381351694602480359560443595606435956084359560a435953695919460e494919390920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506119b59650505050505050565b34801561089c57600080fd5b50610353600160a060020a0360043516611d28565b3480156108bd57600080fd5b5061058b600435611dd2565b3480156108d557600080fd5b50610353611ddf565b3480156108ea57600080fd5b50610430600435611de5565b34801561090257600080fd5b50610430600435611df3565b34801561091a57600080fd5b50610353611fcb565b34801561092f57600080fd5b50610353600435611fd1565b34801561094757600080fd5b506103c7600435611ffe565b34801561095f57600080fd5b506103c7600160a060020a036004351660243515156124e0565b34801561098557600080fd5b506103c7600435612522565b34801561099d57600080fd5b50610353600160a060020a0360043516612693565b3480156109be57600080fd5b5061035361270b565b3480156109d357600080fd5b506103c7600160a060020a036004351661271e565b3480156109f457600080fd5b506103c7600435612764565b81810182811015610a1057600080fd5b92915050565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610a995780601f10610a6e57610100808354040283529160200191610a99565b820191906000526020600020905b815481529060010190602001808311610a7c57829003601f168201915b505050505081565b6000806000806000600587815481101515610ab857fe5b60009182526020808320988352600c600e909202909801019096525050604090932080546001820154600290920154600160a060020a03909116969195509350915050565b6007545b90565b600080600080429350600588815481101515610b1c57fe5b60009182526020909120600e90910201600981015490935060ff1615610b4157600080fd5b600a83015415610b5057600080fd5b600160a060020a0387166000908152600a602052604090205460068401549092508611610b7c57600080fd5b6004830154861115610b8d57600080fd5b600160a060020a0387166000908152600d840160205260409020548611610bb357600080fd5b50600160a060020a0386166000908152600d83016020526040902054850380821015610bde57600080fd5b8383600201541015610bfe5760098301805460ff19166001179055610cfc565b8260040154861415610c1a5760098301805460ff191660011790555b610c2381611dd2565b50600160a060020a038781166000818152600d8601602090815260408083208b9055600688018b905580516080810182529384528382018981528482018c8152606086018c8152600b8b01805460018082019092558752600c8c018652939095208651815473ffffffffffffffffffffffffffffffffffffffff1916981697909717875590519186019190915551600285015590518051929392610ccd9260038501920190612974565b505050600160a060020a0387166000908152600860209081526040822080546001810182559083529120018890555b5050505050505050565b336000908152600b602052604090205460ff161515600114610d2757600080fd5b610d3230838361286d565b5050565b60035460ff1681565b6007805482908110610d4d57fe5b6000918252602091829020600e909102018054600180830154600280850154600386015460048701546005880154600689015460078a01805460408051601f6000199c841615610100029c909c0190921698909804998a018d90048d0281018d01909752888752600160a060020a039099169b5095999398929791969095949293830182828015610e1f5780601f10610df457610100808354040283529160200191610e1f565b820191906000526020600020905b815481529060010190602001808311610e0257829003601f168201915b5050505060088301805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152949594935090830182828015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b505050506009830154600a840154600b90940154929360ff909116929091508c565b600b6020526000908152604090205460ff1681565b306000908152600a602052604090205490565b60058054429160009184908110610f0c57fe5b60009182526020909120600e909102018054909150600160a060020a03163314610f3557600080fd5b60028101548211610f4557600080fd5b600a81015415610f5457600080fd5b6001600a82018190556009909101805460ff191690911790555050565b60606000600583815481101515610f8457fe5b60009182526020909120600e909102018054909150600160a060020a03163314610fad57600080fd5b600b8101546000908152600c8201602090815260409182902060030180548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452909183018282801561104a5780601f1061101f5761010080835404028352916020019161104a565b820191906000526020600020905b81548152906001019060200180831161102d57829003601f168201915b5050505050915050919050565b600080600060058581548110151561106b57fe5b60009182526020808320600b600e90930201918201548352600c82019052604090912080549193509150600160a060020a031633146110a957600080fd5b83516110be9060038301906020870190612974565b50600195945050505050565b336000908152600b602052604090205460ff1615156001146110eb57600080fd5b6110f683838361286d565b505050565b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa916370a082319160248082019260209290919082900301818787803b15801561116a57600080fd5b505af115801561117e573d6000803e3d6000fd5b505050506040513d602081101561119457600080fd5b5051905090565b600160a060020a0381166000908152600a60205260409020545b919050565b6006805482908110610d4d57fe5b336000908152600b602052604090205460ff1615156001146111e957600080fd5b600455565b600160a060020a031660009081526008602052604090205490565b600054600160a060020a031681565b60008060008042935060058581548110151561123057fe5b90600052602060002090600e0201925083836002015410151561125257600080fd5b600983015460ff16151560011461126857600080fd5b600a83015460011461127957600080fd5b600b8301546000908152600c8401602052604090208054909250600160a060020a031633146112a757600080fd5b506002600a83018190558101548254604080517f79c65068000000000000000000000000000000000000000000000000000000008152600160a060020a03909216600483015260646046909302929092046024820181905291517356f527c3f4a24bb2beba449ffd766331da840ffa916379c650689160448083019260209291908290030181600087803b15801561133e57600080fd5b505af1158015611352573d6000803e3d6000fd5b505050506040513d602081101561136857600080fd5b505060068054600181810180845560008490528654600e9093027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909516949094178455828801547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d408201556002808901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4183015560038901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4283015560048901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4383015560058901547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d44830155948801547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d45820155600788018054929589959461150b947ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d469094019390811615610100026000190116046129f2565b50600882018160080190805460018160011615610100020316600290046115339291906129f2565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b91820154910155505050505050565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a995780601f10610a6e57610100808354040283529160200191610a99565b6000806000806000806005878154811015156115dd57fe5b90600052602060002090600e0201955085600a0154600214151561160057600080fd5b600b8601546000808052600c8801602052604090206009880154919650945033935060ff16151560011461163357600080fd5b6001851161164057600080fd5b600160a060020a0383166000908152600d870160205260408120541161166557600080fd5b6000915084600214156116bb578354600160a060020a0384811691161461168b57600080fd5b600160a060020a0383166000908152600d870160205260409020546006870154600a906003025b04019150611739565b8354600160a060020a03848116911614156116f857600160a060020a0383166000908152600d870160205260409020546006870154600a906116b2565b6006860154600119860190600a906002020481151561171357fe5b600160a060020a0385166000908152600d89016020526040902054919004908101925090505b6000821161174657600080fd5b600160a060020a0383166000818152600d88016020908152604080832083905580517f79c65068000000000000000000000000000000000000000000000000000000008152600481019490945260248401869052517356f527c3f4a24bb2beba449ffd766331da840ffa936379c650689360448083019493928390030190829087803b1580156117d557600080fd5b505af11580156117e9573d6000803e3d6000fd5b505050506040513d60208110156117ff57600080fd5b505060408051600160a060020a03851681526020810184905281517fc09831ac53c3b4bb7ef8a6bc27ff4d38b619e41641ea37b8c2804773b230da4b929181900390910190a150505050505050565b336000908152600b602052604081205460ff16151560011461186f57600080fd5b600580548490811061187d57fe5b600091825260209091206009600e90920201908101805460ff19166001179055600a01919091555050565b336000908152600b602052604081205460ff1615156001146118c957600080fd5b60058054839081106118d757fe5b60009182526020808320600e9092029091018054604080517fe724529c000000000000000000000000000000000000000000000000000000008152600160a060020a0392909216600483015260248201859052519194507356f527c3f4a24bb2beba449ffd766331da840ffa9363e724529c9360448084019491939192918390030190829087803b15801561196b57600080fd5b505af115801561197f573d6000803e3d6000fd5b505050506040513d602081101561199557600080fd5b50506002600a9091015550565b60055490565b6000610a1033848461286d565b60004281610e0f1982018a10156119cb57600080fd5b6202a30082018a106119dc57600080fd5b8989116119e857600080fd5b6202a3008a0189106119f957600080fd5b6004547356f527c3f4a24bb2beba449ffd766331da840ffa600160a060020a03166370a082318d6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015611a8457600080fd5b505af1158015611a98573d6000803e3d6000fd5b505050506040513d6020811015611aae57600080fd5b50511015611abb57600080fd5b6040805161018081018252600160a060020a038d8116825260208083018e81529383018d8152606084018c8152608085018c815260a086018f815260c087018f815260e088018e815261010089018e905260006101208a018190526101408a018190526101608a018190526005805460018101808355919092528a517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0600e909302928301805473ffffffffffffffffffffffffffffffffffffffff191691909b16178a559a517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db182015595517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db287015593517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db386015591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db4850155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db5840155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db6830155518051611c98937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db7909301929190910190612974565b506101008201518051611cb5916008840191602090910190612974565b506101208201516009828101805460ff191692151592909217909155610140830151600a83015561016090920151600b90910155600554600160a060020a039d909d1660009081526020918252604081208054600181018255908252919020018c905550999a9950505050505050505050565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038316600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa916370a082319160248082019260209290919082900301818787803b158015611da057600080fd5b505af1158015611db4573d6000803e3d6000fd5b505050506040513d6020811015611dca57600080fd5b505192915050565b60006111b533308461286d565b60065490565b6005805482908110610d4d57fe5b600080600080600080600060608060008060008060058e815481101515611e1657fe5b90600052602060002090600e020190508060000160009054906101000a9004600160a060020a03169c5080600101549b5080600201549a5080600501549950806003015498508060040154975080600601549650806008018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f025780601f10611ed757610100808354040283529160200191611f02565b820191906000526020600020905b815481529060010190602001808311611ee557829003601f168201915b5050505060078301805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152949950919250830182828015611f925780601f10611f6757610100808354040283529160200191611f92565b820191906000526020600020905b815481529060010190602001808311611f7557829003601f168201915b505050505095508060090160009054906101000a900460ff16935080600a0154925080600b015491505091939597999b5091939597999b565b60045481565b336000908152600960205260408120805483908110611fec57fe5b90600052602060002001549050919050565b60008060058381548110151561201057fe5b90600052602060002090600e0201915042905080826002015411151561203557600080fd5b60028201546202a30001811161204a57600080fd5b600b8201546000908152600c83016020526040902054600160a060020a0316331461207457600080fd5b8082600201546202a3000110801561208e5750600a820154155b156122a7576005600a830181905560098301805460ff191660019081179091556007805480830180835560008390528654600e9092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909416939093178355848801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6898201556002808901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a83015560038901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b83015560048901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c830155958801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d82015560068801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e820155928701805491958895939461224d947fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f9091019390811615610100026000190116046129f2565b50600882018160080190805460018160011615610100020316600290046122759291906129f2565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b91820154910155505b808260020154620bdd80011080156122c3575081600a01546001145b156110f6576005600a830181905560098301805460ff191660019081179091556007805480830180835560008390528654600e9092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909416939093178355848801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6898201556002808901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a83015560038901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b83015560048901547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c830155958801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d82015560068801547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e8201559287018054919588959394612482947fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f9091019390811615610100026000190116046129f2565b50600882018160080190805460018160011615610100020316600290046124aa9291906129f2565b50600982810154908201805460ff191660ff9092161515919091179055600a8083015490820155600b9182015491015550505050565b600054600160a060020a031633146124f757600080fd5b600160a060020a03919091166000908152600b60205260409020805460ff1916911515919091179055565b60008060058381548110151561253457fe5b90600052602060002090600e0201915033905081600a0154600314151561255a57600080fd5b600160a060020a0381166000908152600d830160205260408120541161257f57600080fd5b600160a060020a0381166000818152600d8401602090815260408083205481517f79c6506800000000000000000000000000000000000000000000000000000000815260048101959095526024850152517356f527c3f4a24bb2beba449ffd766331da840ffa936379c650689360448083019493928390030190829087803b15801561260a57600080fd5b505af115801561261e573d6000803e3d6000fd5b505050506040513d602081101561263457600080fd5b5050600160a060020a0381166000818152600d84016020908152604080832083905580519384529083019190915280517fc09831ac53c3b4bb7ef8a6bc27ff4d38b619e41641ea37b8c2804773b230da4b9281900390910190a1505050565b604080517f332559d3000000000000000000000000000000000000000000000000000000008152600160a060020a038316600482015290516000917356f527c3f4a24bb2beba449ffd766331da840ffa9163332559d39160248082019260209290919082900301818787803b158015611da057600080fd5b3360009081526009602052604090205490565b600054600160a060020a0316331461273557600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000908152600b602052604081205460ff16151560011461278557600080fd5b600580548390811061279357fe5b60009182526020808320600e9092029091018054604080517fe724529c000000000000000000000000000000000000000000000000000000008152600160a060020a0392909216600483015260016024830152519194507356f527c3f4a24bb2beba449ffd766331da840ffa9363e724529c9360448084019491939192918390030190829087803b15801561282757600080fd5b505af115801561283b573d6000803e3d6000fd5b505050506040513d602081101561285157600080fd5b505060098101805460ff191660011790556003600a9091015550565b6000600160a060020a038316151561288457600080fd5b600160a060020a0384166000908152600a60205260409020548211156128a957600080fd5b600160a060020a0383166000908152600a6020526040902054828101116128cf57600080fd5b50600160a060020a038083166000818152600a60209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a038084166000908152600a602052604080822054928716825290205401811461296e57fe5b50505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106129b557805160ff19168380011785556129e2565b828001600101855582156129e2579182015b828111156129e25782518255916020019190600101906129c7565b506129ee929150612a67565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612a2b57805485556129e2565b828001600101855582156129e257600052602060002091601f016020900482015b828111156129e2578254825591600101919060010190612a4c565b610b0191905b808211156129ee5760008155600101612a6d5600a165627a7a7230582034d5b21775d911736a2d343ebbe7693512a2e835f1fa5fa505871657eed0a8ee0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,460 |
0xdb0cafc3630b23d331fb4a18294cb65d4919794d
|
/**
$$$$$$$$\ $$$$$$$\
$$ _____|$$ __$$\
$$ | $$ | $$ |
$$$$$\ $$ | $$ |
$$ __| $$ | $$ |
$$ | $$ | $$ |
$$ | $$$$$$$ |
\__| \_______/
Telegram: https://t.me/freedomdao_fd
*/
// 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 FREEDOMDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FREEDOM DAO";
string private constant _symbol = "FD";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 21000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x87a08022279a928D8e9827Ca42A036368b6dACbb);
address payable private _marketingAddress = payable(0x87a08022279a928D8e9827Ca42A036368b6dACbb);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 210000 * 10**9; //1%
uint256 public _maxWalletSize = 840000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 840000 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051b578063dd62ed3e1461053b578063ea1644d514610581578063f2fde38b146105a157600080fd5b8063a2a957bb14610496578063a9059cbb146104b6578063bfd79284146104d6578063c3c8cd801461050657600080fd5b80638f70ccf7116100d15780638f70ccf7146104155780638f9a55c01461043557806395d89b411461044b57806398a5c3151461047657600080fd5b806374010ece146103c15780637d1db4a5146103e15780638da5cb5b146103f757600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103575780636fc3eaec1461037757806370a082311461038c578063715018a6146103ac57600080fd5b8063313ce567146102fb57806349bd5a5e146103175780636b9990531461033757600080fd5b80631694505e116101a05780631694505e1461026957806318160ddd146102a157806323b872dd146102c55780632fd689e3146102e557600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023957600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae5565b6105c1565b005b3480156101ff57600080fd5b5060408051808201909152600b81526a46524545444f4d2044414f60a81b60208201525b6040516102309190611c0f565b60405180910390f35b34801561024557600080fd5b50610259610254366004611a3b565b61066e565b6040519015158152602001610230565b34801561027557600080fd5b50601454610289906001600160a01b031681565b6040516001600160a01b039091168152602001610230565b3480156102ad57600080fd5b50664a9b63844880005b604051908152602001610230565b3480156102d157600080fd5b506102596102e03660046119fb565b610685565b3480156102f157600080fd5b506102b760185481565b34801561030757600080fd5b5060405160098152602001610230565b34801561032357600080fd5b50601554610289906001600160a01b031681565b34801561034357600080fd5b506101f161035236600461198b565b6106ee565b34801561036357600080fd5b506101f1610372366004611bac565b610739565b34801561038357600080fd5b506101f1610781565b34801561039857600080fd5b506102b76103a736600461198b565b6107cc565b3480156103b857600080fd5b506101f16107ee565b3480156103cd57600080fd5b506101f16103dc366004611bc6565b610862565b3480156103ed57600080fd5b506102b760165481565b34801561040357600080fd5b506000546001600160a01b0316610289565b34801561042157600080fd5b506101f1610430366004611bac565b610891565b34801561044157600080fd5b506102b760175481565b34801561045757600080fd5b50604080518082019091526002815261119160f21b6020820152610223565b34801561048257600080fd5b506101f1610491366004611bc6565b6108d9565b3480156104a257600080fd5b506101f16104b1366004611bde565b610908565b3480156104c257600080fd5b506102596104d1366004611a3b565b610946565b3480156104e257600080fd5b506102596104f136600461198b565b60106020526000908152604090205460ff1681565b34801561051257600080fd5b506101f1610953565b34801561052757600080fd5b506101f1610536366004611a66565b6109a7565b34801561054757600080fd5b506102b76105563660046119c3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058d57600080fd5b506101f161059c366004611bc6565b610a56565b3480156105ad57600080fd5b506101f16105bc36600461198b565b610a85565b6000546001600160a01b031633146105f45760405162461bcd60e51b81526004016105eb90611c62565b60405180910390fd5b60005b815181101561066a5760016010600084848151811061062657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066281611d75565b9150506105f7565b5050565b600061067b338484610b6f565b5060015b92915050565b6000610692848484610c93565b6106e484336106df85604051806060016040528060288152602001611dd2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111cf565b610b6f565b5060019392505050565b6000546001600160a01b031633146107185760405162461bcd60e51b81526004016105eb90611c62565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107635760405162461bcd60e51b81526004016105eb90611c62565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b657506013546001600160a01b0316336001600160a01b0316145b6107bf57600080fd5b476107c981611209565b50565b6001600160a01b03811660009081526002602052604081205461067f9061128e565b6000546001600160a01b031633146108185760405162461bcd60e51b81526004016105eb90611c62565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088c5760405162461bcd60e51b81526004016105eb90611c62565b601655565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016105eb90611c62565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109035760405162461bcd60e51b81526004016105eb90611c62565b601855565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016105eb90611c62565b600893909355600a91909155600955600b55565b600061067b338484610c93565b6012546001600160a01b0316336001600160a01b0316148061098857506013546001600160a01b0316336001600160a01b0316145b61099157600080fd5b600061099c306107cc565b90506107c981611312565b6000546001600160a01b031633146109d15760405162461bcd60e51b81526004016105eb90611c62565b60005b82811015610a50578160056000868685818110610a0157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a16919061198b565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4881611d75565b9150506109d4565b50505050565b6000546001600160a01b03163314610a805760405162461bcd60e51b81526004016105eb90611c62565b601755565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b81526004016105eb90611c62565b6001600160a01b038116610b145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105eb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105eb565b6001600160a01b038216610c325760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105eb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105eb565b6001600160a01b038216610d595760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105eb565b60008111610dbb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105eb565b6000546001600160a01b03848116911614801590610de757506000546001600160a01b03838116911614155b156110c857601554600160a01b900460ff16610e80576000546001600160a01b03848116911614610e805760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105eb565b601654811115610ed25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105eb565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1457506001600160a01b03821660009081526010602052604090205460ff16155b610f6c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105eb565b6015546001600160a01b03838116911614610ff15760175481610f8e846107cc565b610f989190611d07565b10610ff15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105eb565b6000610ffc306107cc565b6018546016549192508210159082106110155760165491505b80801561102c5750601554600160a81b900460ff16155b801561104657506015546001600160a01b03868116911614155b801561105b5750601554600160b01b900460ff165b801561108057506001600160a01b03851660009081526005602052604090205460ff16155b80156110a557506001600160a01b03841660009081526005602052604090205460ff16155b156110c5576110b382611312565b4780156110c3576110c347611209565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110a57506001600160a01b03831660009081526005602052604090205460ff165b8061113c57506015546001600160a01b0385811691161480159061113c57506015546001600160a01b03848116911614155b15611149575060006111c3565b6015546001600160a01b03858116911614801561117457506014546001600160a01b03848116911614155b1561118657600854600c55600954600d555b6015546001600160a01b0384811691161480156111b157506014546001600160a01b03858116911614155b156111c357600a54600c55600b54600d555b610a50848484846114b7565b600081848411156111f35760405162461bcd60e51b81526004016105eb9190611c0f565b5060006112008486611d5e565b95945050505050565b6012546001600160a01b03166108fc6112238360026114e5565b6040518115909202916000818181858888f1935050505015801561124b573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112668360026114e5565b6040518115909202916000818181858888f1935050505015801561066a573d6000803e3d6000fd5b60006006548211156112f55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105eb565b60006112ff611527565b905061130b83826114e5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113bc57600080fd5b505afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f491906119a7565b8160018151811061141557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143b9130911684610b6f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611474908590600090869030904290600401611c97565b600060405180830381600087803b15801561148e57600080fd5b505af11580156114a2573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c4576114c461154a565b6114cf848484611578565b80610a5057610a50600e54600c55600f54600d55565b600061130b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166f565b600080600061153461169d565b909250905061154382826114e5565b9250505090565b600c5415801561155a5750600d54155b1561156157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158a876116db565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115bc9087611738565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115eb908661177a565b6001600160a01b03891660009081526002602052604090205561160d816117d9565b6116178483611823565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165c91815260200190565b60405180910390a3505050505050505050565b600081836116905760405162461bcd60e51b81526004016105eb9190611c0f565b5060006112008486611d1f565b6006546000908190664a9b63844880006116b782826114e5565b8210156116d257505060065492664a9b638448800092509050565b90939092509050565b60008060008060008060008060006116f88a600c54600d54611847565b9250925092506000611708611527565b9050600080600061171b8e87878761189c565b919e509c509a509598509396509194505050505091939550919395565b600061130b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111cf565b6000806117878385611d07565b90508381101561130b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105eb565b60006117e3611527565b905060006117f183836118ec565b3060009081526002602052604090205490915061180e908261177a565b30600090815260026020526040902055505050565b6006546118309083611738565b600655600754611840908261177a565b6007555050565b6000808080611861606461185b89896118ec565b906114e5565b90506000611874606461185b8a896118ec565b9050600061188c826118868b86611738565b90611738565b9992985090965090945050505050565b60008080806118ab88866118ec565b905060006118b988876118ec565b905060006118c788886118ec565b905060006118d9826118868686611738565b939b939a50919850919650505050505050565b6000826118fb5750600061067f565b60006119078385611d3f565b9050826119148583611d1f565b1461130b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105eb565b803561197681611dbc565b919050565b8035801515811461197657600080fd5b60006020828403121561199c578081fd5b813561130b81611dbc565b6000602082840312156119b8578081fd5b815161130b81611dbc565b600080604083850312156119d5578081fd5b82356119e081611dbc565b915060208301356119f081611dbc565b809150509250929050565b600080600060608486031215611a0f578081fd5b8335611a1a81611dbc565b92506020840135611a2a81611dbc565b929592945050506040919091013590565b60008060408385031215611a4d578182fd5b8235611a5881611dbc565b946020939093013593505050565b600080600060408486031215611a7a578283fd5b833567ffffffffffffffff80821115611a91578485fd5b818601915086601f830112611aa4578485fd5b813581811115611ab2578586fd5b8760208260051b8501011115611ac6578586fd5b602092830195509350611adc918601905061197b565b90509250925092565b60006020808385031215611af7578182fd5b823567ffffffffffffffff80821115611b0e578384fd5b818501915085601f830112611b21578384fd5b813581811115611b3357611b33611da6565b8060051b604051601f19603f83011681018181108582111715611b5857611b58611da6565b604052828152858101935084860182860187018a1015611b76578788fd5b8795505b83861015611b9f57611b8b8161196b565b855260019590950194938601938601611b7a565b5098975050505050505050565b600060208284031215611bbd578081fd5b61130b8261197b565b600060208284031215611bd7578081fd5b5035919050565b60008060008060808587031215611bf3578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3b57858101830151858201604001528201611c1f565b81811115611c4c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce65784516001600160a01b031683529383019391830191600101611cc1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1a57611d1a611d90565b500190565b600082611d3a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5957611d59611d90565b500290565b600082821015611d7057611d70611d90565b500390565b6000600019821415611d8957611d89611d90565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bbffc37ff35268f6a544cd26d278ef38a2ba697c0d2fbe651ad55ab31707019064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,461 |
0x9c3D00cBd1B4467424D4F1F27fB4A0f2dfcDd2f2
|
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 ShakaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shaka Token";
string private constant _symbol = "SHAKA";
uint8 private constant _decimals = 18;
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**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
//Sell Fee
uint256 private _redisFeeOnSell = 3;
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 => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xDd8a36d9BC80E15a35816e5272b028a8430c4C12);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**18; //0.75
uint256 public _maxWalletSize = 150000000000 * 10**18; //1.5
uint256 public _swapTokensAtAmount = 100000000000 * 10**18; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
//bot addresses to block
//bots[address(0x66f049111958809841Bbe4b81c034Da2D953AA0c)] = 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(preTrader[from], "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) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610626578063c3c8cd8014610663578063dd62ed3e1461067a578063ea1644d5146106b7576101cc565b806398a5c3151461055a578063a2a957bb14610583578063a9059cbb146105ac578063bdd795ef146105e9576101cc565b80638da5cb5b116100d15780638da5cb5b146104b05780638f70ccf7146104db5780638f9a55c01461050457806395d89b411461052f576101cc565b8063715018a61461044557806374010ece1461045c5780637d1db4a514610485576101cc565b80632fd689e3116101645780636b9990531161013e5780636b9990531461039f5780636d8aa8f8146103c85780636fc3eaec146103f157806370a0823114610408576101cc565b80632fd689e31461031e578063313ce5671461034957806349bd5a5e14610374576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632f9c4569146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612b1c565b6106e0565b005b34801561020657600080fd5b5061020f61080a565b60405161021c9190612f79565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612adc565b610847565b6040516102599190612f43565b60405180910390f35b34801561026e57600080fd5b50610277610865565b6040516102849190612f5e565b60405180910390f35b34801561029957600080fd5b506102a261088b565b6040516102af919061315b565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612a49565b6108a0565b6040516102ec9190612f43565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612a9c565b610979565b005b34801561032a57600080fd5b50610333610afc565b604051610340919061315b565b60405180910390f35b34801561035557600080fd5b5061035e610b02565b60405161036b91906131d0565b60405180910390f35b34801561038057600080fd5b50610389610b0b565b6040516103969190612f28565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c191906129af565b610b31565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612b65565b610c21565b005b3480156103fd57600080fd5b50610406610cd3565b005b34801561041457600080fd5b5061042f600480360381019061042a91906129af565b610d45565b60405161043c919061315b565b60405180910390f35b34801561045157600080fd5b5061045a610d96565b005b34801561046857600080fd5b50610483600480360381019061047e9190612b92565b610ee9565b005b34801561049157600080fd5b5061049a610f88565b6040516104a7919061315b565b60405180910390f35b3480156104bc57600080fd5b506104c5610f8e565b6040516104d29190612f28565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd9190612b65565b610fb7565b005b34801561051057600080fd5b50610519611069565b604051610526919061315b565b60405180910390f35b34801561053b57600080fd5b5061054461106f565b6040516105519190612f79565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190612b92565b6110ac565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612bbf565b61114b565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190612adc565b611202565b6040516105e09190612f43565b60405180910390f35b3480156105f557600080fd5b50610610600480360381019061060b91906129af565b611220565b60405161061d9190612f43565b60405180910390f35b34801561063257600080fd5b5061064d600480360381019061064891906129af565b611240565b60405161065a9190612f43565b60405180910390f35b34801561066f57600080fd5b50610678611260565b005b34801561068657600080fd5b506106a1600480360381019061069c9190612a09565b6112da565b6040516106ae919061315b565b60405180910390f35b3480156106c357600080fd5b506106de60048036038101906106d99190612b92565b611361565b005b6106e8611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c906130bb565b60405180910390fd5b60005b81518110156108065760016010600084848151811061079a5761079961354e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107fe906134a7565b915050610778565b5050565b60606040518060400160405280600b81526020017f5368616b6120546f6b656e000000000000000000000000000000000000000000815250905090565b600061085b610854611400565b8484611408565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006c0c9f2c9cd04674edea40000000905090565b60006108ad8484846115d3565b61096e846108b9611400565b610969856040518060600160405280602881526020016139d160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061091f611400565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dc39092919063ffffffff16565b611408565b600190509392505050565b610981611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a05906130bb565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610aa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a989061307b565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60185481565b60006012905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b39611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbd906130bb565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c29611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cad906130bb565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d14611400565b73ffffffffffffffffffffffffffffffffffffffff1614610d3457600080fd5b6000479050610d4281611e27565b50565b6000610d8f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e93565b9050919050565b610d9e611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e22906130bb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ef1611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f75906130bb565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610fbf611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461104c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611043906130bb565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f5348414b41000000000000000000000000000000000000000000000000000000815250905090565b6110b4611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611141576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611138906130bb565b60405180910390fd5b8060188190555050565b611153611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d7906130bb565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061121661120f611400565b84846115d3565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112a1611400565b73ffffffffffffffffffffffffffffffffffffffff16146112c157600080fd5b60006112cc30610d45565b90506112d781611f01565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611369611400565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ed906130bb565b60405180910390fd5b8060178190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146f9061313b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114df9061301b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115c6919061315b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163a906130fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116aa90612f9b565b60405180910390fd5b600081116116f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ed906130db565b60405180910390fd5b6116fe610f8e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561176c575061173c610f8e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ac257601560149054906101000a900460ff1661181257601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180890612fbb565b60405180910390fd5b5b601654811115611857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184e90612ffb565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118fb5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61193a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119319061303b565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146119e7576017548161199c84610d45565b6119a69190613291565b106119e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119dd9061311b565b60405180910390fd5b5b60006119f230610d45565b9050600060185482101590506016548210611a0d5760165491505b808015611a25575060158054906101000a900460ff16155b8015611a7f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611a975750601560169054906101000a900460ff165b15611abf57611aa582611f01565b60004790506000811115611abd57611abc47611e27565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b695750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611c1c5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611c1b5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611c2a5760009050611db1565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611cd55750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ced57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d985750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611db057600a54600c81905550600b54600d819055505b5b611dbd84848484612187565b50505050565b6000838311158290611e0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e029190612f79565b60405180910390fd5b5060008385611e1a9190613372565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e8f573d6000803e3d6000fd5b5050565b6000600654821115611eda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed190612fdb565b60405180910390fd5b6000611ee46121b4565b9050611ef981846121df90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f3857611f3761357d565b5b604051908082528060200260200182016040528015611f665781602001602082028036833780820191505090505b5090503081600081518110611f7e57611f7d61354e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561202057600080fd5b505afa158015612034573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205891906129dc565b8160018151811061206c5761206b61354e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120d330601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611408565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612137959493929190613176565b600060405180830381600087803b15801561215157600080fd5b505af1158015612165573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061219557612194612229565b5b6121a084848461226c565b806121ae576121ad612437565b5b50505050565b60008060006121c161244b565b915091506121d881836121df90919063ffffffff16565b9250505090565b600061222183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124b9565b905092915050565b6000600c5414801561223d57506000600d54145b156122475761226a565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061227e8761251c565b9550955095509550955095506122dc86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ce90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123bd8161262c565b6123c784836126e9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612424919061315b565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600654905060006c0c9f2c9cd04674edea4000000090506124896c0c9f2c9cd04674edea400000006006546121df90919063ffffffff16565b8210156124ac576006546c0c9f2c9cd04674edea400000009350935050506124b5565b81819350935050505b9091565b60008083118290612500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f79190612f79565b60405180910390fd5b506000838561250f91906132e7565b9050809150509392505050565b60008060008060008060008060006125398a600c54600d54612723565b92509250925060006125496121b4565b9050600080600061255c8e8787876127b9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125c683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611dc3565b905092915050565b60008082846125dd9190613291565b905083811015612622576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126199061305b565b60405180910390fd5b8091505092915050565b60006126366121b4565b9050600061264d828461284290919063ffffffff16565b90506126a181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ce90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126fe8260065461258490919063ffffffff16565b600681905550612719816007546125ce90919063ffffffff16565b6007819055505050565b60008060008061274f6064612741888a61284290919063ffffffff16565b6121df90919063ffffffff16565b90506000612779606461276b888b61284290919063ffffffff16565b6121df90919063ffffffff16565b905060006127a282612794858c61258490919063ffffffff16565b61258490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127d2858961284290919063ffffffff16565b905060006127e9868961284290919063ffffffff16565b90506000612800878961284290919063ffffffff16565b905060006128298261281b858761258490919063ffffffff16565b61258490919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561285557600090506128b7565b600082846128639190613318565b905082848261287291906132e7565b146128b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128a99061309b565b60405180910390fd5b809150505b92915050565b60006128d06128cb84613210565b6131eb565b905080838252602082019050828560208602820111156128f3576128f26135b1565b5b60005b858110156129235781612909888261292d565b8452602084019350602083019250506001810190506128f6565b5050509392505050565b60008135905061293c8161398b565b92915050565b6000815190506129518161398b565b92915050565b600082601f83011261296c5761296b6135ac565b5b813561297c8482602086016128bd565b91505092915050565b600081359050612994816139a2565b92915050565b6000813590506129a9816139b9565b92915050565b6000602082840312156129c5576129c46135bb565b5b60006129d38482850161292d565b91505092915050565b6000602082840312156129f2576129f16135bb565b5b6000612a0084828501612942565b91505092915050565b60008060408385031215612a2057612a1f6135bb565b5b6000612a2e8582860161292d565b9250506020612a3f8582860161292d565b9150509250929050565b600080600060608486031215612a6257612a616135bb565b5b6000612a708682870161292d565b9350506020612a818682870161292d565b9250506040612a928682870161299a565b9150509250925092565b60008060408385031215612ab357612ab26135bb565b5b6000612ac18582860161292d565b9250506020612ad285828601612985565b9150509250929050565b60008060408385031215612af357612af26135bb565b5b6000612b018582860161292d565b9250506020612b128582860161299a565b9150509250929050565b600060208284031215612b3257612b316135bb565b5b600082013567ffffffffffffffff811115612b5057612b4f6135b6565b5b612b5c84828501612957565b91505092915050565b600060208284031215612b7b57612b7a6135bb565b5b6000612b8984828501612985565b91505092915050565b600060208284031215612ba857612ba76135bb565b5b6000612bb68482850161299a565b91505092915050565b60008060008060808587031215612bd957612bd86135bb565b5b6000612be78782880161299a565b9450506020612bf88782880161299a565b9350506040612c098782880161299a565b9250506060612c1a8782880161299a565b91505092959194509250565b6000612c328383612c3e565b60208301905092915050565b612c47816133a6565b82525050565b612c56816133a6565b82525050565b6000612c678261324c565b612c71818561326f565b9350612c7c8361323c565b8060005b83811015612cad578151612c948882612c26565b9750612c9f83613262565b925050600181019050612c80565b5085935050505092915050565b612cc3816133b8565b82525050565b612cd2816133fb565b82525050565b612ce18161340d565b82525050565b6000612cf282613257565b612cfc8185613280565b9350612d0c818560208601613443565b612d15816135c0565b840191505092915050565b6000612d2d602383613280565b9150612d38826135d1565b604082019050919050565b6000612d50603f83613280565b9150612d5b82613620565b604082019050919050565b6000612d73602a83613280565b9150612d7e8261366f565b604082019050919050565b6000612d96601c83613280565b9150612da1826136be565b602082019050919050565b6000612db9602283613280565b9150612dc4826136e7565b604082019050919050565b6000612ddc602383613280565b9150612de782613736565b604082019050919050565b6000612dff601b83613280565b9150612e0a82613785565b602082019050919050565b6000612e22601783613280565b9150612e2d826137ae565b602082019050919050565b6000612e45602183613280565b9150612e50826137d7565b604082019050919050565b6000612e68602083613280565b9150612e7382613826565b602082019050919050565b6000612e8b602983613280565b9150612e968261384f565b604082019050919050565b6000612eae602583613280565b9150612eb98261389e565b604082019050919050565b6000612ed1602383613280565b9150612edc826138ed565b604082019050919050565b6000612ef4602483613280565b9150612eff8261393c565b604082019050919050565b612f13816133e4565b82525050565b612f22816133ee565b82525050565b6000602082019050612f3d6000830184612c4d565b92915050565b6000602082019050612f586000830184612cba565b92915050565b6000602082019050612f736000830184612cc9565b92915050565b60006020820190508181036000830152612f938184612ce7565b905092915050565b60006020820190508181036000830152612fb481612d20565b9050919050565b60006020820190508181036000830152612fd481612d43565b9050919050565b60006020820190508181036000830152612ff481612d66565b9050919050565b6000602082019050818103600083015261301481612d89565b9050919050565b6000602082019050818103600083015261303481612dac565b9050919050565b6000602082019050818103600083015261305481612dcf565b9050919050565b6000602082019050818103600083015261307481612df2565b9050919050565b6000602082019050818103600083015261309481612e15565b9050919050565b600060208201905081810360008301526130b481612e38565b9050919050565b600060208201905081810360008301526130d481612e5b565b9050919050565b600060208201905081810360008301526130f481612e7e565b9050919050565b6000602082019050818103600083015261311481612ea1565b9050919050565b6000602082019050818103600083015261313481612ec4565b9050919050565b6000602082019050818103600083015261315481612ee7565b9050919050565b60006020820190506131706000830184612f0a565b92915050565b600060a08201905061318b6000830188612f0a565b6131986020830187612cd8565b81810360408301526131aa8186612c5c565b90506131b96060830185612c4d565b6131c66080830184612f0a565b9695505050505050565b60006020820190506131e56000830184612f19565b92915050565b60006131f5613206565b90506132018282613476565b919050565b6000604051905090565b600067ffffffffffffffff82111561322b5761322a61357d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061329c826133e4565b91506132a7836133e4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132dc576132db6134f0565b5b828201905092915050565b60006132f2826133e4565b91506132fd836133e4565b92508261330d5761330c61351f565b5b828204905092915050565b6000613323826133e4565b915061332e836133e4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613367576133666134f0565b5b828202905092915050565b600061337d826133e4565b9150613388836133e4565b92508282101561339b5761339a6134f0565b5b828203905092915050565b60006133b1826133c4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134068261341f565b9050919050565b6000613418826133e4565b9050919050565b600061342a82613431565b9050919050565b600061343c826133c4565b9050919050565b60005b83811015613461578082015181840152602081019050613446565b83811115613470576000848401525b50505050565b61347f826135c0565b810181811067ffffffffffffffff8211171561349e5761349d61357d565b5b80604052505050565b60006134b2826133e4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134e5576134e46134f0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613994816133a6565b811461399f57600080fd5b50565b6139ab816133b8565b81146139b657600080fd5b50565b6139c2816133e4565b81146139cd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207545f04550546c6038f8a30ed83259922184fdfba2a0b73d1835870519ea196664736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,462 |
0x1905ad9f818cabf6e0ca2a22c8bbcb8b2f12fb85
|
/**
*Submitted for verification at Etherscan.io on 2020-11-10
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-09
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-08
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
// ----------------------------------------------------------------------------
// 'Hype' Staking smart contract. 2.5% deposit and withdrawal fees are rewarded to all staking members based on their staking amount.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "ERC20: sending to the zero address");
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 transferFromStake(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 HypeStake is Owned {
using SafeMath for uint256;
address public Hype = 0x01dB9CF9E6D4F4624723f982Dc096D2D07612fCe;
address rewardMaker = 0x181b3a5c476fEecC97Cf7f31Ea51093f324B726f;
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;
uint256 public maxAllowed = 2000000000000000000000;
uint public blockPerDay = 6539;
uint public locktime = 1 * blockPerDay; //1days lock to test
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = false; // withdraw can be lock,, default unlocked
mapping(address => uint) public farmLock; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
event WithdrawalLockDurationSet(uint256 value, address sender);
function setBreaker(bool _breaker) external onlyOwner {
//require(msg.sender == admin, "admin only");
breaker = _breaker;
}
function calculateReward(address _stakeholder)
public
view
returns(uint256)
{
uint256 bal = yourStakedHype(_stakeholder);
return bal.div(totalStakes);
}
function distributeRewards(uint256 tokens)
public
{
require(msg.sender == address(rewardMaker), "ERC20: You'r not allowed to use this function");
require(IERC20(Hype).transferFromStake(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
function isStakeholder(address _address)
public
view
returns(bool)
{
for (uint256 s = 0; s < stakeholders.length; s += 1){
if (_address == stakeholders[s]) return (true);
}
return (false);
}
function addStakeholder(address _stakeholder)
public
{
(bool _isStakeholder) = isStakeholder(_stakeholder);
if(!_isStakeholder) stakeholders.push(_stakeholder);
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(totalStakes <= maxAllowed, "Total Stakes amount exceed");
require(IERC20(Hype).transferFromStake(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;
(bool _isStakeholder) = isStakeholder(msg.sender);
if(!_isStakeholder) farmLock[msg.sender] = block.timestamp;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
addStakeholder(msg.sender);
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
function calculateExitBlock(address _staker) public view returns (uint256){
require(_staker != address(0), "ERC20: sending to the zero address");
// uint enterBlock = farmLock[msg.sender];
//uint exitBlock = enterBlock.add(locktime)
return farmLock[msg.sender];
}
// ------------------------------------------------------------------------
// 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(Hype).transferFromStake(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(Hype).transferFromStake(address(this), 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) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount.add(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(breaker == false, "Admin Restricted WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
//uint exitBlock = calculateExitBlock(msg.sender);
require(farmLock[msg.sender]+30 days <= block.timestamp, "Withdraw can only be done after 30 days");
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(Hype).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 yourStakedHype(address staker) public view returns(uint256 stakedHype){
require(staker != address(0), "ERC20: sending to the zero address");
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the Hype balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourHypeBalance(address user) external view returns(uint256 HypeBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(Hype).balanceOf(user);
}
// -------------------- LOCK CODE ------------------------------------------------------------------------
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638d4c7129116100de578063ca39967111610097578063e49352fe11610071578063e49352fe146105da578063e5c42fd1146105f8578063ef037b901461063c578063f2fde38b1461069657610173565b8063ca39967114610536578063ca84d59114610554578063d82e39621461058257610173565b80638d4c7129146103e85780638da5cb5b14610440578063951ef20214610474578063997664d7146104cc578063b53d6c24146104ea578063bf9befb11461051857610173565b806359974e381161013057806359974e38146102885780635c0aeb0e146102b65780635d7f64a3146102e657806361c533b41461033e57806369673c7e1461035c5780636b4fa3421461039057610173565b80630f41e0d214610178578063146ca5311461019857806329652e86146101b65780632c75bcda146101f85780634baf782e146102265780634df9d6ba14610230575b600080fd5b6101806106da565b60405180821515815260200191505060405180910390f35b6101a06106ed565b6040518082815260200191505060405180910390f35b6101e2600480360360208110156101cc57600080fd5b81019080803590602001909291905050506106f3565b6040518082815260200191505060405180910390f35b6102246004803603602081101561020e57600080fd5b810190808035906020019092919050505061070b565b005b61022e610cf0565b005b6102726004803603602081101561024657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061105b565b6040518082815260200191505060405180910390f35b6102b46004803603602081101561029e57600080fd5b81019080803590602001909291905050506112ac565b005b6102e4600480360360208110156102cc57600080fd5b8101908080351515906020019092919050505061149f565b005b610328600480360360208110156102fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611514565b6040518082815260200191505060405180910390f35b6103466115e5565b6040518082815260200191505060405180910390f35b6103646115eb565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d2600480360360208110156103a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611611565b6040518082815260200191505060405180910390f35b61042a600480360360208110156103fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116df565b6040518082815260200191505060405180910390f35b610448611831565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104b66004803603602081101561048a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611855565b6040518082815260200191505060405180910390f35b6104d461186d565b6040518082815260200191505060405180910390f35b6105166004803603602081101561050057600080fd5b8101908080359060200190929190505050611873565b005b6105206119c0565b6040518082815260200191505060405180910390f35b61053e6119c6565b6040518082815260200191505060405180910390f35b6105806004803603602081101561056a57600080fd5b81019080803590602001909291905050506119cc565b005b6105c46004803603602081101561059857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ec0565b6040518082815260200191505060405180910390f35b6105e2611eeb565b6040518082815260200191505060405180910390f35b61063a6004803603602081101561060e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ef1565b005b61067e6004803603602081101561065257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f6b565b60405180821515815260200191505060405180910390f35b6106d8600480360360208110156106ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061200b565b005b600d60009054906101000a900460ff1681565b60095481565b60116020528060005260406000206000915090505481565b60001515600d60009054906101000a900460ff16151514610794576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f41646d696e20526573747269637465642057495448445241570000000000000081525060200191505060405180910390fd5b80601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154101580156107e65750600081115b610858576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b4262278d00600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111156108f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180612a166027913960400191505060405180910390fd5b6000610927600a61091960055461090b86612186565b6121da90919063ffffffff16565b61226090919063ffffffff16565b90506000610934336122aa565b905080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336109d885876124f290919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a2b57600080fd5b505af1158015610a3f573d6000803e3d6000fd5b505050506040513d6020811015610a5557600080fd5b8101908080519060200190929190505050610ad8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b610b2d83601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546124f290919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550610c61836003546124f290919063ffffffff16565b60038190555060006003541115610c7c57610c7b8261253c565b5b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa233610cb184866124f290919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546006541115611059576000610d47336122aa565b9050610d9e601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548261267290919063ffffffff16565b90506000601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93033846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610e9957600080fd5b505af1158015610ead573d6000803e3d6000fd5b505050506040513d6020811015610ec357600080fd5b8101908080519060200190929190505050610f29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806129a7602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505b565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154905060006111be6008546111b0601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546111a260116000600189038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b61226090919063ffffffff16565b9050600854611242601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015461123460116000600188038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b8161124957fe5b06810190506112a3601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548261267290919063ffffffff16565b92505050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611352576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180612a9b602d913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561140357600080fd5b505af1158015611417573d6000803e3d6000fd5b505050506040513d602081101561142d57600080fd5b8101908080519060200190929190505050611493576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612a6b6030913960400191505060405180910390fd5b61149c8161253c565b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114f757600080fd5b80600d60006101000a81548160ff02191690831515021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561159b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611698576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611766576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156117ef57600080fd5b505afa158015611803573d6000803e3d6000fd5b505050506040513d602081101561181957600080fd5b81019080805190602001909291905050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e6020528060005260406000206000915090505481565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561192457600080fd5b505af1158015611938573d6000803e3d6000fd5b505050506040513d602081101561194e57600080fd5b81019080805190602001909291905050506119b4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612a6b6030913960400191505060405180910390fd5b6119bd8161253c565b50565b60035481565b600a5481565b600a546003541115611a46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f546f74616c205374616b657320616d6f756e742065786365656400000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313bbe5b93330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611af757600080fd5b505af1158015611b0b573d6000803e3d6000fd5b505050506040513d6020811015611b2157600080fd5b8101908080519060200190929190505050611b87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612a3d602e913960400191505060405180910390fd5b6000806003541115611bc657611bc3600a611bb5600454611ba786612186565b6121da90919063ffffffff16565b61226090919063ffffffff16565b90505b60006003541115611bdb57611bda8161253c565b5b6000611be6336122aa565b905080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550611c9f601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611c9184866124f290919063ffffffff16565b61267290919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600654601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600954601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506000611dc933611f6b565b905080611e155742600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611e3c611e2b84866124f290919063ffffffff16565b60035461267290919063ffffffff16565b600381905550611e4b33611ef1565b7f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c33611e8085876124f290919063ffffffff16565b85604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b600080611ecc83611514565b9050611ee36003548261226090919063ffffffff16565b915050919050565b600b5481565b6000611efc82611f6b565b905080611f6757600f829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5050565b600080600090505b600f8054905081101561200057600f8181548110611f8d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ff5576001915050612006565b600181019050611f73565b50600090505b919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461206357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b60008061219d6064846126fa90919063ffffffff16565b905060006121ce6002600a0a6064026121c06064856121da90919063ffffffff16565b61226090919063ffffffff16565b90508092505050919050565b6000808314156121ed576000905061225a565b60008284029050828482816121fe57fe5b0414612255576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806129f56021913960400191505060405180910390fd5b809150505b92915050565b60006122a283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612715565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612331576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129d36022913960400191505060405180910390fd5b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050600061240d6008546123ff601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546123f160116000600189038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b61226090919063ffffffff16565b9050600854612491601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015461248360116000600188038152602001908152602001600020546006546124f290919063ffffffff16565b6121da90919063ffffffff16565b8161249857fe5b06601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055508092505050919050565b600061253483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506127db565b905092915050565b6000612567600754612559600854856121da90919063ffffffff16565b61267290919063ffffffff16565b905060006125806003548361226090919063ffffffff16565b90506125976003548361289b90919063ffffffff16565b6007819055506125b28160065461267290919063ffffffff16565b6006819055506125e3816011600060016009540381526020019081526020016000205461267290919063ffffffff16565b601160006009548152602001908152602001600020819055507fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b66009548433604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1600960008154809291906001019190505550505050565b6000808284019050838110156126f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600081826001848601038161270b57fe5b0402905092915050565b600080831182906127c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561278657808201518184015260208101905061276b565b50505050905090810190601f1680156127b35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816127cd57fe5b049050809150509392505050565b6000838311158290612888576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561284d578082015181840152602081019050612832565b50505050905090810190601f16801561287a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60006128dd83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506128e5565b905092915050565b6000808314158290612992576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561295757808201518184015260208101905061293c565b50505050905090810190601f1680156129845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082848161299c57fe5b069050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e747261637445524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7757697468647261772063616e206f6e6c7920626520646f6e652061667465722033302064617973546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e7445524332303a20596f752772206e6f7420616c6c6f77656420746f2075736520746869732066756e6374696f6ea26469706673582212208f92d6a604d02e865181276275c99aa58baaa9e56c1e55690ddbc211cf3dfd5764736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,463 |
0xe381ca6611ca3e2b4883236d83cb655dc0de39ed
|
/*
https://t.me/freespeechmusk
https://twitter.com/elonmusk/status/1507259709224632344
MUSK PLAY
Final Contract
*/
// 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 muskstoken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Free Speech Inu";
string private constant _symbol = "FINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
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(0x3a03363F4787b482b9e22157fEf9153689326488);
address payable private _marketingAddress = payable(0x3a03363F4787b482b9e22157fEf9153689326488);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055a578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e057600080fd5b8063a2a957bb146104d5578063a9059cbb146104f5578063bfd7928414610515578063c3c8cd801461054557600080fd5b80638f70ccf7116100d15780638f70ccf7146104525780638f9a55c01461047257806395d89b411461048857806398a5c315146104b557600080fd5b80637d1db4a5146103f15780637f2feddc146104075780638da5cb5b1461043457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038757806370a082311461039c578063715018a6146103bc57806374010ece146103d157600080fd5b8063313ce5671461030b57806349bd5a5e146103275780636b999053146103475780636d8aa8f81461036757600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d55780632fd689e3146102f557600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611964565b610600565b005b34801561020a57600080fd5b5060408051808201909152600f81526e467265652053706565636820496e7560881b60208201525b60405161023f9190611a29565b60405180910390f35b34801561025457600080fd5b50610268610263366004611a7e565b61069f565b604051901515815260200161023f565b34801561028457600080fd5b50601454610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50670de0b6b3a76400005b60405190815260200161023f565b3480156102e157600080fd5b506102686102f0366004611aaa565b6106b6565b34801561030157600080fd5b506102c760185481565b34801561031757600080fd5b506040516009815260200161023f565b34801561033357600080fd5b50601554610298906001600160a01b031681565b34801561035357600080fd5b506101fc610362366004611aeb565b61071f565b34801561037357600080fd5b506101fc610382366004611b18565b61076a565b34801561039357600080fd5b506101fc6107b2565b3480156103a857600080fd5b506102c76103b7366004611aeb565b6107fd565b3480156103c857600080fd5b506101fc61081f565b3480156103dd57600080fd5b506101fc6103ec366004611b33565b610893565b3480156103fd57600080fd5b506102c760165481565b34801561041357600080fd5b506102c7610422366004611aeb565b60116020526000908152604090205481565b34801561044057600080fd5b506000546001600160a01b0316610298565b34801561045e57600080fd5b506101fc61046d366004611b18565b6108c2565b34801561047e57600080fd5b506102c760175481565b34801561049457600080fd5b5060408051808201909152600481526346494e5560e01b6020820152610232565b3480156104c157600080fd5b506101fc6104d0366004611b33565b61090a565b3480156104e157600080fd5b506101fc6104f0366004611b4c565b610939565b34801561050157600080fd5b50610268610510366004611a7e565b610977565b34801561052157600080fd5b50610268610530366004611aeb565b60106020526000908152604090205460ff1681565b34801561055157600080fd5b506101fc610984565b34801561056657600080fd5b506101fc610575366004611b7e565b6109d8565b34801561058657600080fd5b506102c7610595366004611c02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506101fc6105db366004611b33565b610a79565b3480156105ec57600080fd5b506101fc6105fb366004611aeb565b610aa8565b6000546001600160a01b031633146106335760405162461bcd60e51b815260040161062a90611c3b565b60405180910390fd5b60005b815181101561069b5760016010600084848151811061065757610657611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069381611c9c565b915050610636565b5050565b60006106ac338484610b92565b5060015b92915050565b60006106c3848484610cb6565b610715843361071085604051806060016040528060288152602001611db6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f2565b610b92565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b815260040161062a90611c3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161062a90611c3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e757506013546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b476107fa8161122c565b50565b6001600160a01b0381166000908152600260205260408120546106b090611266565b6000546001600160a01b031633146108495760405162461bcd60e51b815260040161062a90611c3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161062a90611c3b565b601655565b6000546001600160a01b031633146108ec5760405162461bcd60e51b815260040161062a90611c3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161062a90611c3b565b601855565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161062a90611c3b565b600893909355600a91909155600955600b55565b60006106ac338484610cb6565b6012546001600160a01b0316336001600160a01b031614806109b957506013546001600160a01b0316336001600160a01b0316145b6109c257600080fd5b60006109cd306107fd565b90506107fa816112ea565b6000546001600160a01b03163314610a025760405162461bcd60e51b815260040161062a90611c3b565b60005b82811015610a73578160056000868685818110610a2457610a24611c70565b9050602002016020810190610a399190611aeb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6b81611c9c565b915050610a05565b50505050565b6000546001600160a01b03163314610aa35760405162461bcd60e51b815260040161062a90611c3b565b601755565b6000546001600160a01b03163314610ad25760405162461bcd60e51b815260040161062a90611c3b565b6001600160a01b038116610b375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062a565b6001600160a01b038216610c555760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062a565b6001600160a01b038216610d7c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062a565b60008111610dde5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062a565b6000546001600160a01b03848116911614801590610e0a57506000546001600160a01b03838116911614155b156110eb57601554600160a01b900460ff16610ea3576000546001600160a01b03848116911614610ea35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062a565b601654811115610ef55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062a565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3757506001600160a01b03821660009081526010602052604090205460ff16155b610f8f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062a565b6015546001600160a01b038381169116146110145760175481610fb1846107fd565b610fbb9190611cb7565b106110145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062a565b600061101f306107fd565b6018546016549192508210159082106110385760165491505b80801561104f5750601554600160a81b900460ff16155b801561106957506015546001600160a01b03868116911614155b801561107e5750601554600160b01b900460ff165b80156110a357506001600160a01b03851660009081526005602052604090205460ff16155b80156110c857506001600160a01b03841660009081526005602052604090205460ff16155b156110e8576110d6826112ea565b4780156110e6576110e64761122c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112d57506001600160a01b03831660009081526005602052604090205460ff165b8061115f57506015546001600160a01b0385811691161480159061115f57506015546001600160a01b03848116911614155b1561116c575060006111e6565b6015546001600160a01b03858116911614801561119757506014546001600160a01b03848116911614155b156111a957600854600c55600954600d555b6015546001600160a01b0384811691161480156111d457506014546001600160a01b03858116911614155b156111e657600a54600c55600b54600d555b610a7384848484611473565b600081848411156112165760405162461bcd60e51b815260040161062a9190611a29565b5060006112238486611ccf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069b573d6000803e3d6000fd5b60006006548211156112cd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062a565b60006112d76114a1565b90506112e383826114c4565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133257611332611c70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be9190611ce6565b816001815181106113d1576113d1611c70565b6001600160a01b0392831660209182029290920101526014546113f79130911684610b92565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611430908590600090869030904290600401611d03565b600060405180830381600087803b15801561144a57600080fd5b505af115801561145e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148057611480611506565b61148b848484611534565b80610a7357610a73600e54600c55600f54600d55565b60008060006114ae61162b565b90925090506114bd82826114c4565b9250505090565b60006112e383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166b565b600c541580156115165750600d54155b1561151d57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154687611699565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157890876116f6565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a79086611738565b6001600160a01b0389166000908152600260205260409020556115c981611797565b6115d384836117e1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161891815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164682826114c4565b82101561166257505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168c5760405162461bcd60e51b815260040161062a9190611a29565b5060006112238486611d74565b60008060008060008060008060006116b68a600c54600d54611805565b92509250925060006116c66114a1565b905060008060006116d98e87878761185a565b919e509c509a509598509396509194505050505091939550919395565b60006112e383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f2565b6000806117458385611cb7565b9050838110156112e35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062a565b60006117a16114a1565b905060006117af83836118aa565b306000908152600260205260409020549091506117cc9082611738565b30600090815260026020526040902055505050565b6006546117ee90836116f6565b6006556007546117fe9082611738565b6007555050565b600080808061181f606461181989896118aa565b906114c4565b9050600061183260646118198a896118aa565b9050600061184a826118448b866116f6565b906116f6565b9992985090965090945050505050565b600080808061186988866118aa565b9050600061187788876118aa565b9050600061188588886118aa565b905060006118978261184486866116f6565b939b939a50919850919650505050505050565b6000826118b9575060006106b0565b60006118c58385611d96565b9050826118d28583611d74565b146112e35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fa57600080fd5b803561195f8161193f565b919050565b6000602080838503121561197757600080fd5b823567ffffffffffffffff8082111561198f57600080fd5b818501915085601f8301126119a357600080fd5b8135818111156119b5576119b5611929565b8060051b604051601f19603f830116810181811085821117156119da576119da611929565b6040529182528482019250838101850191888311156119f857600080fd5b938501935b82851015611a1d57611a0e85611954565b845293850193928501926119fd565b98975050505050505050565b600060208083528351808285015260005b81811015611a5657858101830151858201604001528201611a3a565b81811115611a68576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9157600080fd5b8235611a9c8161193f565b946020939093013593505050565b600080600060608486031215611abf57600080fd5b8335611aca8161193f565b92506020840135611ada8161193f565b929592945050506040919091013590565b600060208284031215611afd57600080fd5b81356112e38161193f565b8035801515811461195f57600080fd5b600060208284031215611b2a57600080fd5b6112e382611b08565b600060208284031215611b4557600080fd5b5035919050565b60008060008060808587031215611b6257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9357600080fd5b833567ffffffffffffffff80821115611bab57600080fd5b818601915086601f830112611bbf57600080fd5b813581811115611bce57600080fd5b8760208260051b8501011115611be357600080fd5b602092830195509350611bf99186019050611b08565b90509250925092565b60008060408385031215611c1557600080fd5b8235611c208161193f565b91506020830135611c308161193f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb057611cb0611c86565b5060010190565b60008219821115611cca57611cca611c86565b500190565b600082821015611ce157611ce1611c86565b500390565b600060208284031215611cf857600080fd5b81516112e38161193f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d535784516001600160a01b031683529383019391830191600101611d2e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db057611db0611c86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208cacd4d2e56ddf9675e0e73d767eb0f9d9919c09ad8de676d27142de2073a25764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,464 |
0xa6A18f8eA618AA7AfD5E9dd7939cc6468e920a6B
|
/*
Telegram: https://t.me/zominuofficial
Twitter: https://twitter.com/zominuofficial
Website: https://zombieinu.org/
*/
// 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 ZombieInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ZombieInu";
string private constant _symbol = "ZOMINU";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 12);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e9f565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129a6565b61045e565b6040516101789190612e84565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613041565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612953565b61048d565b6040516101e09190612e84565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128b9565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130b6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a2f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128b9565b610783565b6040516102b19190613041565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612db6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e9f565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129a6565b61098d565b60405161035b9190612e84565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129e6565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a89565b6110ab565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612913565b6111f4565b6040516104189190613041565b60405180910390f35b60606040518060400160405280600981526020017f5a6f6d626965496e750000000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b610556856040518060600160405280602881526020016137bd60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f81565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f81565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f81565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5a4f4d494e550000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f81565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a646133fe565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990613357565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611e00565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612f81565b60405180910390fd5b600f60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90613001565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906128e6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906128e6565b6040518363ffffffff1660e01b8152600401610df9929190612dd1565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906128e6565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612e23565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612ab6565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612dfa565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612a5c565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612f81565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612f41565b60405180910390fd5b6111b260646111a483683635c9adc5dea0000061208890919063ffffffff16565b61210390919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111e99190613041565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612fe1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612f01565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190613041565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612ec1565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612fa1565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600f60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90613021565b60405180910390fd5b5b5b60105481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600f60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c9190613177565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600f60159054906101000a900460ff16158015611b085750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600f60169054906101000a900460ff165b15611b4857611b2e81611e00565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c078484848461214d565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612e9f565b60405180910390fd5b5060008385611c649190613258565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd4600a611cc660048661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d63600a611d5560068661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612ee1565b60405180910390fd5b6000611de361217a565b9050611df8818461210390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e3857611e3761342d565b5b604051908082528060200260200182016040528015611e665781602001602082028036833780820191505090505b5090503081600081518110611e7e57611e7d6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2057600080fd5b505afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5891906128e6565b81600181518110611f6c57611f6b6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd330600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203795949392919061305c565b600060405180830381600087803b15801561205157600080fd5b505af1158015612065573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561209b57600090506120fd565b600082846120a991906131fe565b90508284826120b891906131cd565b146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90612f61565b60405180910390fd5b809150505b92915050565b600061214583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a5565b905092915050565b8061215b5761215a612208565b5b612166848484612239565b8061217457612173612404565b5b50505050565b6000806000612187612416565b9150915061219e818361210390919063ffffffff16565b9250505090565b600080831182906121ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e39190612e9f565b60405180910390fd5b50600083856121fb91906131cd565b9050809150509392505050565b600060085414801561221c57506000600954145b1561222657612237565b600060088190555060006009819055505b565b60008060008060008061224b87612478565b9550955095509550955095506122a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238a81612587565b6123948483612644565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123f19190613041565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea00000905061244c683635c9adc5dea0000060065461210390919063ffffffff16565b82101561246b57600654683635c9adc5dea00000935093505050612474565b81819350935050505b9091565b60008060008060008060008060006124948a600854600c61267e565b92509250925060006124a461217a565b905060008060006124b78e878787612714565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061252183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b60008082846125389190613177565b90508381101561257d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257490612f21565b60405180910390fd5b8091505092915050565b600061259161217a565b905060006125a8828461208890919063ffffffff16565b90506125fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612659826006546124df90919063ffffffff16565b6006819055506126748160075461252990919063ffffffff16565b6007819055505050565b6000806000806126aa606461269c888a61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126d460646126c6888b61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126fd826126ef858c6124df90919063ffffffff16565b6124df90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061272d858961208890919063ffffffff16565b90506000612744868961208890919063ffffffff16565b9050600061275b878961208890919063ffffffff16565b905060006127848261277685876124df90919063ffffffff16565b6124df90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127b06127ab846130f6565b6130d1565b905080838252602082019050828560208602820111156127d3576127d2613461565b5b60005b8581101561280357816127e9888261280d565b8452602084019350602083019250506001810190506127d6565b5050509392505050565b60008135905061281c81613777565b92915050565b60008151905061283181613777565b92915050565b600082601f83011261284c5761284b61345c565b5b813561285c84826020860161279d565b91505092915050565b6000813590506128748161378e565b92915050565b6000815190506128898161378e565b92915050565b60008135905061289e816137a5565b92915050565b6000815190506128b3816137a5565b92915050565b6000602082840312156128cf576128ce61346b565b5b60006128dd8482850161280d565b91505092915050565b6000602082840312156128fc576128fb61346b565b5b600061290a84828501612822565b91505092915050565b6000806040838503121561292a5761292961346b565b5b60006129388582860161280d565b92505060206129498582860161280d565b9150509250929050565b60008060006060848603121561296c5761296b61346b565b5b600061297a8682870161280d565b935050602061298b8682870161280d565b925050604061299c8682870161288f565b9150509250925092565b600080604083850312156129bd576129bc61346b565b5b60006129cb8582860161280d565b92505060206129dc8582860161288f565b9150509250929050565b6000602082840312156129fc576129fb61346b565b5b600082013567ffffffffffffffff811115612a1a57612a19613466565b5b612a2684828501612837565b91505092915050565b600060208284031215612a4557612a4461346b565b5b6000612a5384828501612865565b91505092915050565b600060208284031215612a7257612a7161346b565b5b6000612a808482850161287a565b91505092915050565b600060208284031215612a9f57612a9e61346b565b5b6000612aad8482850161288f565b91505092915050565b600080600060608486031215612acf57612ace61346b565b5b6000612add868287016128a4565b9350506020612aee868287016128a4565b9250506040612aff868287016128a4565b9150509250925092565b6000612b158383612b21565b60208301905092915050565b612b2a8161328c565b82525050565b612b398161328c565b82525050565b6000612b4a82613132565b612b548185613155565b9350612b5f83613122565b8060005b83811015612b90578151612b778882612b09565b9750612b8283613148565b925050600181019050612b63565b5085935050505092915050565b612ba68161329e565b82525050565b612bb5816132e1565b82525050565b6000612bc68261313d565b612bd08185613166565b9350612be08185602086016132f3565b612be981613470565b840191505092915050565b6000612c01602383613166565b9150612c0c82613481565b604082019050919050565b6000612c24602a83613166565b9150612c2f826134d0565b604082019050919050565b6000612c47602283613166565b9150612c528261351f565b604082019050919050565b6000612c6a601b83613166565b9150612c758261356e565b602082019050919050565b6000612c8d601d83613166565b9150612c9882613597565b602082019050919050565b6000612cb0602183613166565b9150612cbb826135c0565b604082019050919050565b6000612cd3602083613166565b9150612cde8261360f565b602082019050919050565b6000612cf6602983613166565b9150612d0182613638565b604082019050919050565b6000612d19602583613166565b9150612d2482613687565b604082019050919050565b6000612d3c602483613166565b9150612d47826136d6565b604082019050919050565b6000612d5f601783613166565b9150612d6a82613725565b602082019050919050565b6000612d82601183613166565b9150612d8d8261374e565b602082019050919050565b612da1816132ca565b82525050565b612db0816132d4565b82525050565b6000602082019050612dcb6000830184612b30565b92915050565b6000604082019050612de66000830185612b30565b612df36020830184612b30565b9392505050565b6000604082019050612e0f6000830185612b30565b612e1c6020830184612d98565b9392505050565b600060c082019050612e386000830189612b30565b612e456020830188612d98565b612e526040830187612bac565b612e5f6060830186612bac565b612e6c6080830185612b30565b612e7960a0830184612d98565b979650505050505050565b6000602082019050612e996000830184612b9d565b92915050565b60006020820190508181036000830152612eb98184612bbb565b905092915050565b60006020820190508181036000830152612eda81612bf4565b9050919050565b60006020820190508181036000830152612efa81612c17565b9050919050565b60006020820190508181036000830152612f1a81612c3a565b9050919050565b60006020820190508181036000830152612f3a81612c5d565b9050919050565b60006020820190508181036000830152612f5a81612c80565b9050919050565b60006020820190508181036000830152612f7a81612ca3565b9050919050565b60006020820190508181036000830152612f9a81612cc6565b9050919050565b60006020820190508181036000830152612fba81612ce9565b9050919050565b60006020820190508181036000830152612fda81612d0c565b9050919050565b60006020820190508181036000830152612ffa81612d2f565b9050919050565b6000602082019050818103600083015261301a81612d52565b9050919050565b6000602082019050818103600083015261303a81612d75565b9050919050565b60006020820190506130566000830184612d98565b92915050565b600060a0820190506130716000830188612d98565b61307e6020830187612bac565b81810360408301526130908186612b3f565b905061309f6060830185612b30565b6130ac6080830184612d98565b9695505050505050565b60006020820190506130cb6000830184612da7565b92915050565b60006130db6130ec565b90506130e78282613326565b919050565b6000604051905090565b600067ffffffffffffffff8211156131115761311061342d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613182826132ca565b915061318d836132ca565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131c2576131c16133a0565b5b828201905092915050565b60006131d8826132ca565b91506131e3836132ca565b9250826131f3576131f26133cf565b5b828204905092915050565b6000613209826132ca565b9150613214836132ca565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561324d5761324c6133a0565b5b828202905092915050565b6000613263826132ca565b915061326e836132ca565b925082821015613281576132806133a0565b5b828203905092915050565b6000613297826132aa565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132ec826132ca565b9050919050565b60005b838110156133115780820151818401526020810190506132f6565b83811115613320576000848401525b50505050565b61332f82613470565b810181811067ffffffffffffffff8211171561334e5761334d61342d565b5b80604052505050565b6000613362826132ca565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613395576133946133a0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137808161328c565b811461378b57600080fd5b50565b6137978161329e565b81146137a257600080fd5b50565b6137ae816132ca565b81146137b957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122071b2a3f30c322b19ea5eb49cf3cde61614d94a9a052c5c7484bdbedf9cc7abeb64736f6c63430008060033
|
{"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,465 |
0x2b79d8dcbf26c5b690145130006be06d1324c2b2
|
/*
* @dev This is the Axia Protocol Staking pool 2 contract (Defi Fund Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 DSP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public DefiIndexFunds;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 18 hours;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _defiindex) public onlyCreator returns (bool success) {
require(_axiatoken != _defiindex, "Insertion of same address is not supported");
require(_axiatoken != address(0) && _defiindex != address(0), "Insertion of address(0) is not supported");
Axiatoken = _axiatoken;
DefiIndexFunds = _defiindex;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakingStatus(bool _status) public onlyCreator {
require(Axiatoken != address(0) && DefiIndexFunds != address(0), "Pool addresses are not yet setup");
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(DefiIndexFunds).balanceOf(msg.sender) >= _amount, "Insufficient DeFi AFT balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(DefiIndexFunds).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(DefiIndexFunds).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(DefiIndexFunds).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
TakeDividends();
}
function TakeDividends() public returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c80637640cb9e116100ad578063b821b6bf11610071578063b821b6bf146102c5578063c8910913146102cd578063e0287b3e1461031e578063f3c756dc1461033b578063f53d0a8e146103585761012b565b80637640cb9e1461023b578063a43fc87114610258578063aa9a091214610275578063ac3c85351461029e578063b333de24146102bd5761012b565b8063368a36c4116100f4578063368a36c4146101ba578063376edab6146101d957806342d41964146102075780636387c9491461022b57806369c18e12146102335761012b565b806265318b1461013057806308dbbb03146101685780631bf6e00d146101705780631cfff51b146101965780631e7f87bc146101b2575b600080fd5b6101566004803603602081101561014657600080fd5b50356001600160a01b0316610360565b60408051918252519081900360200190f35b6101566103c7565b6101566004803603602081101561018657600080fd5b50356001600160a01b03166103cd565b61019e6103eb565b604080519115158252519081900360200190f35b6101566103fb565b6101d7600480360360208110156101d057600080fd5b5035610401565b005b61019e600480360360408110156101ef57600080fd5b506001600160a01b038135811691602001351661040d565b61020f610535565b604080516001600160a01b039092168252519081900360200190f35b61020f610544565b610156610553565b61019e6004803603602081101561025157600080fd5b5035610559565b6101d76004803603602081101561026e57600080fd5b50356105ce565b6101566004803603606081101561028b57600080fd5b5080359060208101359060400135610626565b6101d7600480360360208110156102b457600080fd5b503515156106da565b6101566107b6565b6101566108e0565b6102f3600480360360208110156102e357600080fd5b50356001600160a01b03166108e6565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101d76004803603602081101561033457600080fd5b503561093d565b6101d76004803603602081101561035157600080fd5b503561098b565b61020f610994565b6004546001600160a01b0382166000908152600860205260408120600301549091111561038f575060006103c2565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b60035481565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b61040a816109a3565b50565b600a546000906001600160a01b031633146104595760405162461bcd60e51b8152600401808060200182810382526028815260200180610f4d6028913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b031614156104aa5760405162461bcd60e51b815260040180806020018281038252602a815260200180610f9d602a913960400191505060405180910390fd5b6001600160a01b038316158015906104ca57506001600160a01b03821615155b6105055760405162461bcd60e51b8152600401808060200182810382526028815260200180610f756028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6001546001600160a01b031681565b6000546001600160a01b031681565b60055481565b600080546001600160a01b031633146105a35760405162461bcd60e51b815260040180806020018281038252602b815260200180610eaa602b913960400191505060405180910390fd5b600754600160401b8302816105b457fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146106175760405162461bcd60e51b8152600401808060200182810382526028815260200180610f4d6028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b60008060006106358686610b27565b9150915083811061064257fe5b6000848061064c57fe5b868809905082811115610660576001820391505b91829003916000859003851680868161067557fe5b04955080848161068157fe5b04935080816000038161069057fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b600a546001600160a01b031633146107235760405162461bcd60e51b8152600401808060200182810382526028815260200180610f4d6028913960400191505060405180910390fd5b6000546001600160a01b03161580159061074757506001546001600160a01b031615155b610798576040805162461bcd60e51b815260206004820181905260248201527f506f6f6c2061646472657373657320617265206e6f7420796574207365747570604482015290519081900360640190fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b6000806107c233610360565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b50516108a4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b60008060008060006108f66103fb565b6108ff876103cd565b61090888610360565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b031633146109865760405162461bcd60e51b8152600401808060200182810382526028815260200180610f4d6028913960400191505060405180910390fd5b600455565b61040a81610b54565b6002546001600160a01b031681565b806109ad336103cd565b10156109ea5760405162461bcd60e51b8152600401808060200182810382526032815260200180610e786032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610a7257600080fd5b505af1158015610a86573d6000803e3d6000fd5b505050506040513d6020811015610a9c57600080fd5b5051610ae4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a3610b236107b6565b5050565b6000808060001984860990508385029250828103915082811015610b4c576001820391505b509250929050565b600254600160a01b900460ff16610bb2576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610bfc57600080fd5b505afa158015610c10573d6000803e3d6000fd5b505050506040513d6020811015610c2657600080fd5b50511015610c7b576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742044654669204146542062616c616e6365000000604482015290519081900360640190fd5b60035481610c88336103cd565b011015610cc65760405162461bcd60e51b815260040180806020018281038252603d815260200180610f10603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610d1657600080fd5b505afa158015610d2a573d6000803e3d6000fd5b505050506040513d6020811015610d4057600080fd5b50511015610d7f5760405162461bcd60e51b815260040180806020018281038252603b815260200180610ed5603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610e1157600080fd5b505af1158015610e25573d6000803e3d6000fd5b505050506040513d6020811015610e3b57600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a35056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72496e73657274696f6e206f662061646472657373283029206973206e6f7420737570706f72746564496e73657274696f6e206f662073616d652061646472657373206973206e6f7420737570706f72746564a264697066735822122087d927e1d24ea4eba7ce5e591d19c5491801982383d7c9a4e1e1ef5aac942fec64736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,466 |
0xa214100607182f41056960f872dbc032646c28d1
|
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'Powerplay Token' Smart Contract
//
// OwnerAddress : 0x59082Ba1F17cFe655DF7D295BD6C3c651c09e97e
// Symbol : PWRS
// Name : Powerplay Token
// Total Supply : 100,000,000,000 CRACK
// Decimals : 18
// Copyrights of 'Powerplay Token' With 'PWRS' Symbol October 20, 2020.
// The MIT Licence.
// Prepared and Compiled By: https://bit.ly/3ixlO2e
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// Ownership contract
// _newOwner is address of new owner
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = 0x59082Ba1F17cFe655DF7D295BD6C3c651c09e97e;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// transfer Ownership to other address
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0x0));
emit OwnershipTransferred(owner,_newOwner);
owner = _newOwner;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract PowerplayToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public RATE;
uint public DENOMINATOR;
bool public isStopped = false;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Mint(address indexed to, uint256 amount);
event ChangeRate(uint256 amount);
modifier onlyWhenRunning {
require(!isStopped);
_;
}
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "PWRS";
name = "Powerplay Token";
decimals = 18;
_totalSupply = 100000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
RATE = 380000; // 1 ETH = 38 PWRS
DENOMINATOR = 10000;
emit Transfer(address(0), owner, _totalSupply);
}
// ----------------------------------------------------------------------------
// requires enough gas for execution
// ----------------------------------------------------------------------------
function() public payable {
buyTokens();
}
// ----------------------------------------------------------------------------
// Function to handle eth and token transfers
// tokens are transferred to user
// ETH are transferred to current owner
// ----------------------------------------------------------------------------
function buyTokens() onlyWhenRunning public payable {
require(msg.value > 0);
uint tokens = msg.value.mul(RATE).div(DENOMINATOR);
require(balances[owner] >= tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
balances[owner] = balances[owner].sub(tokens);
emit Transfer(owner, msg.sender, tokens);
owner.transfer(msg.value);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply;
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
require(to != address(0));
require(tokens > 0);
require(balances[msg.sender] >= tokens);
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
require(spender != address(0));
require(tokens > 0);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(from != address(0));
require(to != address(0));
require(tokens > 0);
require(balances[from] >= tokens);
require(allowed[from][msg.sender] >= tokens);
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;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// 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)
// _spender The address which will spend the funds.
// _addedValue The amount of tokens to increase the allowance by.
// ------------------------------------------------------------------------
function increaseApproval(address _spender, uint _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;
}
// ------------------------------------------------------------------------
// 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)
// _spender The address which will spend the funds.
// _subtractedValue The amount of tokens to decrease the allowance by.
// ------------------------------------------------------------------------
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
require(_spender != address(0));
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;
}
// ------------------------------------------------------------------------
// Change the ETH to IO rate
// ------------------------------------------------------------------------
function changeRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
RATE =_rate;
emit ChangeRate(_rate);
}
// ------------------------------------------------------------------------
// _to The address that will receive the minted tokens.
// _amount The amount of tokens to mint.
// A boolean that indicates if the operation was successful.
// ------------------------------------------------------------------------
function mint(address _to, uint256 _amount) onlyOwner public returns (bool) {
require(_to != address(0));
require(_amount > 0);
uint newamount = _amount * 10**uint(decimals);
_totalSupply = _totalSupply.add(newamount);
balances[_to] = balances[_to].add(newamount);
emit Mint(_to, newamount);
emit Transfer(address(0), _to, newamount);
return true;
}
// ------------------------------------------------------------------------
// function to stop the ICO
// ------------------------------------------------------------------------
function stopICO() onlyOwner public {
isStopped = true;
}
// ------------------------------------------------------------------------
// function to resume ICO
// ------------------------------------------------------------------------
function resumeICO() onlyOwner public {
isStopped = false;
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610132578063095ea7b3146101c257806318160ddd1461022757806323b872dd14610252578063313ce567146102d75780633eaaf86b146103085780633f683b6a1461033357806340c10f191461036257806366188463146103c7578063664e97041461042c57806370a082311461045757806374e7493b146104ae5780638da5cb5b146104db578063918f86741461053257806395d89b411461055d5780639cbd7da5146105ed578063a9059cbb14610604578063c8e569a814610669578063d0febe4c14610680578063d73dd6231461068a578063dd62ed3e146106ef578063f2fde38b14610766575b6101306107a9565b005b34801561013e57600080fd5b50610147610acd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018757808201518184015260208101905061016c565b50505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ce57600080fd5b5061020d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b6b565b604051808215151515815260200191505060405180910390f35b34801561023357600080fd5b5061023c610ca7565b6040518082815260200191505060405180910390f35b34801561025e57600080fd5b506102bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cb1565b604051808215151515815260200191505060405180910390f35b3480156102e357600080fd5b506102ec6110bb565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031457600080fd5b5061031d6110ce565b6040518082815260200191505060405180910390f35b34801561033f57600080fd5b506103486110d4565b604051808215151515815260200191505060405180910390f35b34801561036e57600080fd5b506103ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e7565b604051808215151515815260200191505060405180910390f35b3480156103d357600080fd5b50610412600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611319565b604051808215151515815260200191505060405180910390f35b34801561043857600080fd5b506104416115e6565b6040518082815260200191505060405180910390f35b34801561046357600080fd5b50610498600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ec565b6040518082815260200191505060405180910390f35b3480156104ba57600080fd5b506104d960048036038101908080359060200190929190505050611635565b005b3480156104e757600080fd5b506104f06116e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561053e57600080fd5b50610547611705565b6040518082815260200191505060405180910390f35b34801561056957600080fd5b5061057261170b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b2578082015181840152602081019050610597565b50505050905090810190601f1680156105df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105f957600080fd5b506106026117a9565b005b34801561061057600080fd5b5061064f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611821565b604051808215151515815260200191505060405180910390f35b34801561067557600080fd5b5061067e611a54565b005b6106886107a9565b005b34801561069657600080fd5b506106d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611acc565b604051808215151515815260200191505060405180910390f35b3480156106fb57600080fd5b50610750600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d03565b6040518082815260200191505060405180910390f35b34801561077257600080fd5b506107a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d8a565b005b6000600760009054906101000a900460ff161515156107c757600080fd5b6000341115156107d657600080fd5b6107ff6006546107f160055434611edf90919063ffffffff16565b611f1090919063ffffffff16565b905080600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561087057600080fd5b6108c281600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3490919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097881600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f5090919063ffffffff16565b600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610ac9573d6000803e3d6000fd5b5050565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b635780601f10610b3857610100808354040283529160200191610b63565b820191906000526020600020905b815481529060010190602001808311610b4657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ba857600080fd5b600082111515610bb757600080fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610cee57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d2a57600080fd5b600082111515610d3957600080fd5b81600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d8757600080fd5b81600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e1257600080fd5b610e6482600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f5090919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f3682600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f5090919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100882600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3490919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60045481565b600760009054906101000a900460ff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561118157600080fd5b60008311151561119057600080fd5b600360009054906101000a900460ff1660ff16600a0a830290506111bf81600454611f3490919063ffffffff16565b60048190555061121781600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3490919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600191505092915050565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561135857600080fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611466576000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114fa565b6114798382611f5090919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60055481565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169057600080fd5b60008111151561169f57600080fd5b806005819055507f5a75aa1ccd5244c76a14e60301b7bc29e02263de78b6af4606269d5e1db08513816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117a15780601f10611776576101008083540402835291602001916117a1565b820191906000526020600020905b81548152906001019060200180831161178457829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180457600080fd5b6000600760006101000a81548160ff021916908315150217905550565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561185e57600080fd5b60008211151561186d57600080fd5b81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156118bb57600080fd5b61190d82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f5090919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119a282600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3490919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aaf57600080fd5b6001600760006101000a81548160ff021916908315150217905550565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b0957600080fd5b611b9882600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611de557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e2157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081830290506000831480611eff5750818382811515611efc57fe5b04145b1515611f0a57600080fd5b92915050565b60008082111515611f2057600080fd5b8183811515611f2b57fe5b04905092915050565b60008183019050828110151515611f4a57600080fd5b92915050565b6000828211151515611f6157600080fd5b8183039050929150505600a165627a7a723058204426d7f81fe458aa65f3868b719123724116e3e6d73ac4b32f040cd451c9ade50029
|
{"success": true, "error": null, "results": {}}
| 3,467 |
0xe9c5c1c7da613ef0749492da01129dddba484857
|
pragma solidity 0.4.19;
contract Ownable {
address public owner;
/**
* The address whcih deploys this contrcat is automatically assgined ownership.
* */
function Ownable() public {
owner = msg.sender;
}
/**
* Functions with this modifier can only be executed by the owner of the contract.
* */
modifier onlyOwner {
require(msg.sender == owner);
_;
}
event OwnershipTransferred(address indexed from, address indexed to);
/**
* Transfers ownership to new Ethereum address. This function can only be called by the
* owner.
* @param _newOwner the address to be granted ownership.
**/
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != 0x0);
OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20TransferInterface {
function transfer(address to, uint256 value) public returns (bool);
function balanceOf(address who) constant public returns (uint256);
}
contract ICO is Ownable {
using SafeMath for uint256;
event TokenAddressSet(address indexed tokenAddress);
event FirstPreIcoActivated(uint256 startTime, uint256 endTime, uint256 bonus);
event SecondPreIcoActivated(uint256 startTime, uint256 endTime, uint256 bonus);
event MainIcoActivated(uint256 startTime, uint256 endTime, uint256 bonus);
event TokenPriceChanged(uint256 newTokenPrice, uint256 newExchangeRate);
event ExchangeRateChanged(uint256 newExchangeRate, uint256 newTokenPrice);
event BonuseChanged(uint256 newBonus);
event OffchainPurchaseMade(address indexed recipient, uint256 tokensPurchased);
event TokensPurchased(address indexed recipient, uint256 tokensPurchased, uint256 weiSent);
event UnsoldTokensWithdrawn(uint256 tokensWithdrawn);
event ICOPaused(uint256 timeOfPause);
event ICOUnpaused(uint256 timeOfUnpause);
event IcoDeadlineExtended(State currentState, uint256 newDeadline);
event IcoDeadlineShortened(State currentState, uint256 newDeadline);
event IcoTerminated(uint256 terminationTime);
event AirdropInvoked();
uint256 public endTime;
uint256 private pausedTime;
bool public IcoPaused;
uint256 public tokenPrice;
uint256 public rate;
uint256 public bonus;
uint256 public minInvestment;
ERC20TransferInterface public MSTCOIN;
address public multiSigWallet;
uint256 public tokensSold;
mapping (address => uint256) public investmentOf;
enum State {FIRST_PRE_ICO, SECOND_PRE_ICO, MAIN_ICO, TERMINATED}
State public icoState;
uint256[4] public mainIcoBonusStages;
function ICO() public {
endTime = now.add(7 days);
pausedTime = 0;
IcoPaused = false;
tokenPrice = 89e12; // tokenPrice is rate / 1e18
rate = 11235; // rate is 1e18 / tokenPrice
bonus = 100;
minInvestment = 1e17;
multiSigWallet = 0xE1377e465121776d8810007576034c7E0798CD46;
tokensSold = 0;
icoState = State.FIRST_PRE_ICO;
FirstPreIcoActivated(now, endTime, bonus);
}
/**
* Sets the address of the token. This function can only be executed by the
* owner of the contract.
**/
function setTokenAddress(address _tokenAddress) public onlyOwner {
require(_tokenAddress != 0x0);
MSTCOIN = ERC20TransferInterface(_tokenAddress);
TokenAddressSet(_tokenAddress);
}
/**
* Returns the address of the token.
**/
function getTokenAddress() public view returns(address) {
return address(MSTCOIN);
}
/**
* Allows the owner to activate the second pre ICO. This function can only be
* executed once the first pre ICO has finished.
**/
function activateSecondPreIco() public onlyOwner {
require(now >= endTime && icoState == State.FIRST_PRE_ICO);
icoState = State.SECOND_PRE_ICO;
endTime = now.add(4 days);
bonus = 50;
SecondPreIcoActivated(now, endTime, bonus);
}
/**
* Allows the owner to activate the main public ICO stage. This function can only be
* executed once the second pre ICO has finished.
**/
function activateMainIco() public onlyOwner {
require(now >= endTime && icoState == State.SECOND_PRE_ICO);
icoState = State.MAIN_ICO;
mainIcoBonusStages[0] = now.add(7 days);
mainIcoBonusStages[1] = now.add(14 days);
mainIcoBonusStages[2] = now.add(21 days);
mainIcoBonusStages[3] = now.add(31 days);
endTime = now.add(31 days);
bonus = 35;
MainIcoActivated(now, endTime, bonus);
}
/**
* Allows the owner to change the price of the token.
*
* @param _newTokenPrice The new price per token.
**/
function changeTokenPrice(uint256 _newTokenPrice) public onlyOwner {
require(tokenPrice != _newTokenPrice && _newTokenPrice > 0);
tokenPrice = _newTokenPrice;
uint256 eth = 1e18;
rate = eth.div(tokenPrice);
TokenPriceChanged(tokenPrice, rate);
}
/**
* Allows the owner to change the exchange rate of the token.
*
* @param _newRate The new exchange rate
**/
function changeRate(uint256 _newRate) public onlyOwner {
require(rate != _newRate && _newRate > 0);
rate = _newRate;
uint256 x = 1e12;
tokenPrice = x.div(rate);
ExchangeRateChanged(rate, tokenPrice);
}
/**
* Allows the owner to change the bonus of the current ICO stage.
*
* @param _newBonus The new bonus percentage investors will receive.
**/
function changeBonus(uint256 _newBonus) public onlyOwner {
require(bonus != _newBonus && _newBonus > 0);
bonus = _newBonus;
BonuseChanged(bonus);
}
/**
* Allows the owner to sell tokens with other forms of payment including fiat and all other
* cryptos.
*
* @param _recipient The address to send tokens to.
* @param _value The amount of tokens to be sent.
**/
function processOffchainTokenPurchase(address _recipient, uint256 _value) public onlyOwner {
require(MSTCOIN.balanceOf(address(this)) >= _value);
require(_recipient != 0x0 && _value > 0);
MSTCOIN.transfer(_recipient, _value);
tokensSold = tokensSold.add(_value);
OffchainPurchaseMade(_recipient, _value);
}
/**
* Fallback function calls the buyTokens function automatically when an investment is made.
**/
function() public payable {
buyTokens(msg.sender);
}
/**
* Allows investors to send their ETH and automatically receive tokens in return.
*
* @param _recipient The addrewss which will receive tokens
**/
function buyTokens(address _recipient) public payable {
uint256 msgVal = msg.value.div(1e12); //because token has 6 decimals
require(MSTCOIN.balanceOf(address(this)) >= msgVal.mul(rate.mul(getBonus()).div(100)).add(rate) ) ;
require(msg.value >= minInvestment && withinPeriod());
require(_recipient != 0x0);
uint256 toTransfer = msgVal.mul(rate.mul(getBonus()).div(100).add(rate));
MSTCOIN.transfer(_recipient, toTransfer);
tokensSold = tokensSold.add(toTransfer);
investmentOf[msg.sender] = investmentOf[msg.sender].add(msg.value);
TokensPurchased(_recipient, toTransfer, msg.value);
forwardFunds();
}
/**
* This function is internally called by the buyTokens function to automatically forward
* all investments made to the multi signature wallet.
**/
function forwardFunds() internal {
multiSigWallet.transfer(msg.value);
}
/**
* This function is internally called by the buyTokens function to ensure that investments
* are made during times when the ICO is not paused and when the duration of the current
* phase has not finished.
**/
function withinPeriod() internal view returns(bool) {
return IcoPaused == false && now < endTime && icoState != State.TERMINATED;
}
/**
* Calculates and returns the bonus of the current ICO stage. During the main public ICO, the
* first ICO the bonus stages are set as such:
*
* week 1: bonus = 35%
* week 2: bonus = 25%
* week 3: bonus = 15%
* week 4: bonus = 5%
**/
function getBonus() public view returns(uint256 _bonus) {
_bonus = bonus;
if(icoState == State.MAIN_ICO) {
if(now > mainIcoBonusStages[3]) {
_bonus = 0;
} else {
uint256 timeStamp = now;
for(uint i = 0; i < mainIcoBonusStages.length; i++) {
if(timeStamp <= mainIcoBonusStages[i]) {
break;
} else {
if(_bonus >= 15) {
_bonus = _bonus.sub(10);
}
}
}
}
}
return _bonus;
}
/**
* Allows the owner of the contract to withdraw all unsold tokens. This function can
* only be executed once the ICO contract has been terminated after the main public
* ICO has finished.
*
* @param _recipient The address to withdraw all unsold tokens to. If this field is
* left empty, then the tokens will just be sent to the owner of the contract.
**/
function withdrawUnsoldTokens(address _recipient) public onlyOwner {
require(icoState == State.TERMINATED);
require(now >= endTime && MSTCOIN.balanceOf(address(this)) > 0);
if(_recipient == 0x0) {
_recipient = owner;
}
UnsoldTokensWithdrawn(MSTCOIN.balanceOf(address(this)));
MSTCOIN.transfer(_recipient, MSTCOIN.balanceOf(address(this)));
}
/**
* Allows the owner to pause the ICO contract. While the ICO is paused investments cannot
* be made.
**/
function pauseICO() public onlyOwner {
require(!IcoPaused);
IcoPaused = true;
pausedTime = now;
ICOPaused(now);
}
/**
* Allows the owner to unpause the ICO only when the ICO contract has been paused. Once
* invoked, the deadline will automatically be extended by the duration the ICO was
* paused for.
**/
function unpauseICO() public onlyOwner {
require(IcoPaused);
IcoPaused = false;
endTime = endTime.add(now.sub(pausedTime));
ICOUnpaused(now);
}
/**
* Allows the owner of the ICO to extend the deadline of the current ICO stage. This
* function can only be executed if the ICO contract has not been terminated.
*
* @param _days The number of days to increase the duration of the ICO by.
**/
function extendDeadline(uint256 _days) public onlyOwner {
require(icoState != State.TERMINATED);
endTime = endTime.add(_days.mul(1 days));
if(icoState == State.MAIN_ICO) {
uint256 blocks = 0;
uint256 stage = 0;
for(uint i = 0; i < mainIcoBonusStages.length; i++) {
if(now < mainIcoBonusStages[i]) {
stage = i;
}
}
blocks = (_days.mul(1 days)).div(mainIcoBonusStages.length.sub(stage));
for(uint x = stage; x < mainIcoBonusStages.length; x++) {
mainIcoBonusStages[x] = mainIcoBonusStages[x].add(blocks);
}
}
IcoDeadlineExtended(icoState, endTime);
}
/**
* Allows the owner of the contract to shorten the deadline of the current ICO stage.
*
* @param _days The number of days to reduce the druation of the ICO by.
**/
function shortenDeadline(uint256 _days) public onlyOwner {
if(now.add(_days.mul(1 days)) >= endTime) {
revert();
} else {
endTime = endTime.sub(_days.mul(1 days));
if(icoState == State.MAIN_ICO) {
uint256 blocks = 0;
uint256 stage = 0;
for(uint i = 0; i < mainIcoBonusStages.length; i++) {
if(now < mainIcoBonusStages[i]) {
stage = i;
}
}
blocks = (_days.mul(1 days)).div(mainIcoBonusStages.length.sub(stage));
for(uint x = stage; x < mainIcoBonusStages.length; x++) {
mainIcoBonusStages[x] = mainIcoBonusStages[x].sub(blocks);
}
}
}
IcoDeadlineShortened(icoState, endTime);
}
/**
* Terminates the ICO early permanently. This function can only be called by the
* owner of the contract during the main public ICO.
**/
function terminateIco() public onlyOwner {
require(icoState == State.MAIN_ICO);
require(now < endTime);
endTime = now;
icoState = State.TERMINATED;
IcoTerminated(now);
}
/**
* Returns the amount of tokens that have been sold.
**/
function getTokensSold() public view returns(uint256) {
return tokensSold;
}
/**
* Airdrops tokens to up to 100 ETH addresses.
*
* @param _addrs The list of addresses to send tokens to
* @param _values The list of amounts of tokens to send to each corresponding address.
**/
function airdrop(address[] _addrs, uint256[] _values) public onlyOwner returns(bool) {
require(_addrs.length == _values.length && _addrs.length <= 100);
require(MSTCOIN.balanceOf(address(this)) >= getSumOfValues(_values));
for (uint i = 0; i < _addrs.length; i++) {
if (_addrs[i] != 0x0 && _values[i] > 0) {
MSTCOIN.transfer(_addrs[i], _values[i]);
}
}
AirdropInvoked();
return true;
}
/**
* Called internally by the airdrop function to ensure the contract holds enough tokens
* to succesfully execute the airdrop.
*
* @param _values The list of values representing the amount of tokens which will be airdroped.
**/
function getSumOfValues(uint256[] _values) internal pure returns(uint256) {
uint256 sum = 0;
for(uint i=0; i < _values.length; i++) {
sum = sum.add(_values[i]);
}
return sum;
}
}
|
0x60606040526004361061017c5763ffffffff60e060020a60003504166310fe9ae8811461018757806326a4e8d2146101b65780632c4e722e146101d55780632fd4ec28146101fa5780633197cbb61461020d57806333c77a6d14610220578063389b75331461023357806344f38756146102495780634b8feb4f14610280578063518ab2a8146102935780635b511030146102a657806363d177e6146102b957806367243482146102cc578063680a50cb1461036f57806372f57f1f1461038557806374e7493b146103a457806375b4d78c146103ba57806375ee7315146103cd5780637ff9b596146103e05780638ac2c680146103f35780638bdff161146104065780638da5cb5b14610419578063907535331461042c57806395c08f921461043f5780639b4b2d771461045e578063c1ff808d14610480578063cc6e70e814610496578063e03b88d8146104a9578063ec8ac4d8146104bf578063ee7c0db0146104d3578063f2fde38b146104e6578063fbc94f2414610505575b6101853361051b565b005b341561019257600080fd5b61019a610794565b604051600160a060020a03909116815260200160405180910390f35b34156101c157600080fd5b610185600160a060020a03600435166107a3565b34156101e057600080fd5b6101e861082d565b60405190815260200160405180910390f35b341561020557600080fd5b610185610833565b341561021857600080fd5b6101e86108c1565b341561022b57600080fd5b6101856108c7565b341561023e57600080fd5b61018560043561093a565b341561025457600080fd5b61025c610abf565b6040518082600381111561026c57fe5b60ff16815260200191505060405180910390f35b341561028b57600080fd5b61019a610ac8565b341561029e57600080fd5b6101e8610ad7565b34156102b157600080fd5b610185610add565b34156102c457600080fd5b610185610b94565b34156102d757600080fd5b61035b600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610c1a95505050505050565b604051901515815260200160405180910390f35b341561037a57600080fd5b610185600435610e17565b341561039057600080fd5b610185600160a060020a0360043516610f7a565b34156103af57600080fd5b6101856004356111ec565b34156103c557600080fd5b6101e8611286565b34156103d857600080fd5b61035b61128c565b34156103eb57600080fd5b6101e8611295565b34156103fe57600080fd5b6101e861129b565b341561041157600080fd5b6101e86112a1565b341561042457600080fd5b61019a611326565b341561043757600080fd5b610185611335565b341561044a57600080fd5b6101e8600160a060020a036004351661142c565b341561046957600080fd5b610185600160a060020a036004351660243561143e565b341561048b57600080fd5b6101856004356115d0565b34156104a157600080fd5b61019a611643565b34156104b457600080fd5b6101e8600435611652565b610185600160a060020a036004351661051b565b34156104de57600080fd5b6101e8611666565b34156104f157600080fd5b610185600160a060020a036004351661166c565b341561051057600080fd5b610185600435611707565b6000806105333464e8d4a5100063ffffffff6117a416565b9150610582600554610576610569606461055d61054e6112a1565b6005549063ffffffff6117bb16565b9063ffffffff6117a416565b859063ffffffff6117bb16565b9063ffffffff6117e616565b600854600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156105db57600080fd5b6102c65a03f115156105ec57600080fd5b505050604051805190501015151561060357600080fd5b600754341015801561061857506106186117f5565b151561062357600080fd5b600160a060020a038316151561063857600080fd5b61065e610651600554610576606461055d61054e6112a1565b839063ffffffff6117bb16565b600854909150600160a060020a031663a9059cbb848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156106c057600080fd5b6102c65a03f115156106d157600080fd5b50505060405180515050600a546106ee908263ffffffff6117e616565b600a55600160a060020a0333166000908152600b602052604090205461071a903463ffffffff6117e616565b600b600033600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a03167f8fafebcaf9d154343dad25669bfa277f4fbacd7ac6b0c4fed522580e040a0f33823460405191825260208201526040908101905180910390a261078f61182e565b505050565b600854600160a060020a031690565b60005433600160a060020a039081169116146107be57600080fd5b600160a060020a03811615156107d357600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091557fd82cad5fdc98633445b90f806f2e1a61a5409f92187ee9cd87f1da18c906926660405160405180910390a250565b60055481565b60005433600160a060020a0390811691161461084e57600080fd5b6002600c5460ff16600381111561086157fe5b1461086b57600080fd5b600154421061087957600080fd5b426001819055600c805460ff191660031790557fd51de4f597d61f31b7ba926908a009dbff3f0dc80c09a1b7bd9f3c8003a5cf2f9060405190815260200160405180910390a1565b60015481565b60005433600160a060020a039081169116146108e257600080fd5b60035460ff16156108f257600080fd5b6003805460ff191660011790554260028190557f4ca05c662440ebbd9770baf1f74a03a475da9d4a86cd29272742973a58efdf519060405190815260200160405180910390a1565b6000805481908190819033600160a060020a0390811691161461095c57600080fd5b6003600c5460ff16600381111561096f57fe5b141561097a57600080fd5b61099f610990866201518063ffffffff6117bb16565b6001549063ffffffff6117e616565b6001556002600c5460ff1660038111156109b557fe5b1415610a62576000935060009250600091505b60048210156109f657600d82600481106109de57fe5b01544210156109eb578192505b6001909101906109c8565b610a1d610a0a60048563ffffffff61186416565b61055d876201518063ffffffff6117bb16565b93508290505b6004811015610a6257610a4b84600d8360048110610a3d57fe5b01549063ffffffff6117e616565b600d8260048110610a5857fe5b0155600101610a23565b600c546001547fcf418a3161d034757bf70bca0cdb0f90510d7f82e0c054bdcb7cfac6040425ae9160ff169060405180836003811115610a9e57fe5b60ff1681526020018281526020019250505060405180910390a15050505050565b600c5460ff1681565b600954600160a060020a031681565b600a5481565b60005433600160a060020a03908116911614610af857600080fd5b6001544210158015610b1a57506000600c5460ff166003811115610b1857fe5b145b1515610b2557600080fd5b600c805460ff19166001179055610b3f42620546006117e6565b6001819055603260068190557f4dde2e619a56452eba4ffb2b0ee1e119214b0d3532c5553a89a3eaa4050de39a91429160405180848152602001838152602001828152602001935050505060405180910390a1565b60005433600160a060020a03908116911614610baf57600080fd5b60035460ff161515610bc057600080fd5b6003805460ff19169055600254610be29061099090429063ffffffff61186416565b6001557f7f4b5b19f7b514be4592493ce3abe3f6658100cd24763be1a6c26c7c418c25f64260405190815260200160405180910390a1565b60008054819033600160a060020a03908116911614610c3857600080fd5b82518451148015610c4b57506064845111155b1515610c5657600080fd5b610c5f83611876565b600854600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610cb857600080fd5b6102c65a03f11515610cc957600080fd5b5050506040518051905010151515610ce057600080fd5b5060005b8351811015610de157838181518110610cf957fe5b90602001906020020151600160a060020a031615801590610d2f57506000838281518110610d2357fe5b90602001906020020151115b15610dd957600854600160a060020a031663a9059cbb858381518110610d5157fe5b90602001906020020151858481518110610d6757fe5b9060200190602002015160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610dbd57600080fd5b6102c65a03f11515610dce57600080fd5b505050604051805150505b600101610ce4565b7fcffe03c62a297c15d2f786d48f00fb47611625ecd7d7c0745510b746442624fb60405160405180910390a15060019392505050565b6000805481908190819033600160a060020a03908116911614610e3957600080fd5b600154610e5f610e52876201518063ffffffff6117bb16565b429063ffffffff6117e616565b10610e6957600080fd5b610e8e610e7f866201518063ffffffff6117bb16565b6001549063ffffffff61186416565b6001556002600c5460ff166003811115610ea457fe5b1415610f3e576000935060009250600091505b6004821015610ee557600d8260048110610ecd57fe5b0154421015610eda578192505b600190910190610eb7565b610ef9610a0a60048563ffffffff61186416565b93508290505b6004811015610f3e57610f2784600d8360048110610f1957fe5b01549063ffffffff61186416565b600d8260048110610f3457fe5b0155600101610eff565b600c546001547f40506dbfb91763c1fd9e13674210316c92aa9ea079e062e1a37f9773c7f3ab5f9160ff169060405180836003811115610a9e57fe5b60005433600160a060020a03908116911614610f9557600080fd5b6003600c5460ff166003811115610fa857fe5b14610fb257600080fd5b60015442101580156110375750600854600090600160a060020a03166370a0823130836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561101a57600080fd5b6102c65a03f1151561102b57600080fd5b50505060405180519050115b151561104257600080fd5b600160a060020a03811615156110605750600054600160a060020a03165b6008547f7c885dc2bd1a0b45fe4cf249833d28907319b5b702b3496d49dd231cee28502590600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156110db57600080fd5b6102c65a03f115156110ec57600080fd5b5050506040518051905060405190815260200160405180910390a1600854600160a060020a031663a9059cbb82826370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561116757600080fd5b6102c65a03f1151561117857600080fd5b5050506040518051905060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156111ce57600080fd5b6102c65a03f115156111df57600080fd5b5050506040518051505050565b6000805433600160a060020a0390811691161461120857600080fd5b816005541415801561121a5750600082115b151561122557600080fd5b50600581905564e8d4a51000611241818363ffffffff6117a416565b60048190556005547fb01b0304cdcaffa13e4b57ecbe280da183afb719becd1d56e9211cc3781ea4219160405191825260208201526040908101905180910390a15050565b60065481565b60035460ff1681565b60045481565b60075481565b6006546000806002600c5460ff1660038111156112ba57fe5b1415611321576010544211156112d35760009250611321565b5042905060005b600481101561132157600d81600481106112f057fe5b015482116112fd57611321565b600f83106113195761131683600a63ffffffff61186416565b92505b6001016112da565b505090565b600054600160a060020a031681565b60005433600160a060020a0390811691161461135057600080fd5b600154421015801561137257506001600c5460ff16600381111561137057fe5b145b151561137d57600080fd5b600c805460ff191660021790556113974262093a806117e6565b600d556113a742621275006117e6565b600e556113b742621baf806117e6565b600f556113c7426228de806117e6565b6010556113d7426228de806117e6565b6001819055602360068190557fdfa81445ea612eadad88e8cdc9f21fe17178d27cfc98f807f197a976b75a475991429160405180848152602001838152602001828152602001935050505060405180910390a1565b600b6020526000908152604090205481565b60005433600160a060020a0390811691161461145957600080fd5b6008548190600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156114b457600080fd5b6102c65a03f115156114c557600080fd5b50505060405180519050101515156114dc57600080fd5b600160a060020a038216158015906114f45750600081115b15156114ff57600080fd5b600854600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561155e57600080fd5b6102c65a03f1151561156f57600080fd5b50505060405180515050600a5461158c908263ffffffff6117e616565b600a55600160a060020a0382167f09ac61e8c2e3eee0496e96a5f50cdcc23550cf81bf411781f477cfbaca742c9f8260405190815260200160405180910390a25050565b60005433600160a060020a039081169116146115eb57600080fd5b80600654141580156115fd5750600081115b151561160857600080fd5b60068190557fda80c37f7249115632cb2bb43310f2b4451db56551cb7386b4f97d7f7ff1ef0a8160405190815260200160405180910390a150565b600854600160a060020a031681565b600d816004811061165f57fe5b0154905081565b600a5490565b60005433600160a060020a0390811691161461168757600080fd5b600160a060020a038116151561169c57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805433600160a060020a0390811691161461172357600080fd5b81600454141580156117355750600082115b151561174057600080fd5b506004819055670de0b6b3a764000061175f818363ffffffff6117a416565b60058190556004547f23c6ec2e2c4752cf5eafabbd0ae9246dce6d5c78f1ed2fde615826e084eee0689160405191825260208201526040908101905180910390a15050565b60008082848115156117b257fe5b04949350505050565b60008282028315806117d757508284828115156117d457fe5b04145b15156117df57fe5b9392505050565b6000828201838110156117df57fe5b60035460009060ff1615801561180c575060015442105b801561182957506003600c5460ff16600381111561182657fe5b14155b905090565b600954600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561186257600080fd5b565b60008282111561187057fe5b50900390565b600080805b83518110156118b4576118aa84828151811061189357fe5b90602001906020020151839063ffffffff6117e616565b915060010161187b565b50929150505600a165627a7a72305820dad71998103ef5f99893d7e8fff12cc19c90e80ee97aca02d04777c411e0c3ac0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,468 |
0x98c54FD8C98eaf0938C4a00e7935A66341f7bA0E
|
pragma solidity 0.8.2;
// SPDX-License-Identifier: AGPL-3.0-or-later
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfer fee, for example USDT, DGX tokens.
bool hasTxFee; // takes a byte in storage
// Status of the bAsset
BassetStatus status;
}
struct BassetData {
// 1 Basset * ratio / ratioScale == x Masset (relative value)
// If ratio == 10e8 then 1 bAsset = 10 mAssets
// A ratio is divised as 10^(18-tokenDecimals) * measurementMultiple(relative value of 1 base unit)
uint128 ratio;
// Amount of the Basset that is held in Collateral
uint128 vaultBalance;
}
// Status of the Basset - has it broken its peg?
enum BassetStatus {
Default,
Normal,
BrokenBelowPeg,
BrokenAbovePeg,
Blacklisted,
Liquidating,
Liquidated,
Failed
}
struct BasketState {
bool undergoingRecol;
bool failed;
}
struct InvariantConfig {
uint256 a;
WeightLimits limits;
}
struct WeightLimits {
uint128 min;
uint128 max;
}
struct FeederConfig {
uint256 supply;
uint256 a;
WeightLimits limits;
}
struct AmpData {
uint64 initialA;
uint64 targetA;
uint64 rampStartTime;
uint64 rampEndTime;
}
struct FeederData {
uint256 swapFee;
uint256 redemptionFee;
uint256 govFee;
uint256 pendingFees;
uint256 cacheSize;
BassetPersonal[] bAssetPersonal;
BassetData[] bAssetData;
AmpData ampData;
WeightLimits weightLimits;
}
struct AssetData {
uint8 idx;
uint256 amt;
BassetPersonal personal;
}
struct Asset {
uint8 idx;
address addr;
bool exists;
}
abstract contract IFeederPool {
// Mint
function mint(
address _input,
uint256 _inputQuantity,
uint256 _minOutputQuantity,
address _recipient
) external virtual returns (uint256 mintOutput);
function mintMulti(
address[] calldata _inputs,
uint256[] calldata _inputQuantities,
uint256 _minOutputQuantity,
address _recipient
) external virtual returns (uint256 mintOutput);
function getMintOutput(address _input, uint256 _inputQuantity)
external
view
virtual
returns (uint256 mintOutput);
function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities)
external
view
virtual
returns (uint256 mintOutput);
// Swaps
function swap(
address _input,
address _output,
uint256 _inputQuantity,
uint256 _minOutputQuantity,
address _recipient
) external virtual returns (uint256 swapOutput);
function getSwapOutput(
address _input,
address _output,
uint256 _inputQuantity
) external view virtual returns (uint256 swapOutput);
// Redemption
function redeem(
address _output,
uint256 _mAssetQuantity,
uint256 _minOutputQuantity,
address _recipient
) external virtual returns (uint256 outputQuantity);
function redeemProportionately(
uint256 _mAssetQuantity,
uint256[] calldata _minOutputQuantities,
address _recipient
) external virtual returns (uint256[] memory outputQuantities);
function redeemExactBassets(
address[] calldata _outputs,
uint256[] calldata _outputQuantities,
uint256 _maxMassetQuantity,
address _recipient
) external virtual returns (uint256 mAssetRedeemed);
function getRedeemOutput(address _output, uint256 _mAssetQuantity)
external
view
virtual
returns (uint256 bAssetOutput);
function getRedeemExactBassetsOutput(
address[] calldata _outputs,
uint256[] calldata _outputQuantities
) external view virtual returns (uint256 mAssetAmount);
// Views
function getPrice() public view virtual returns (uint256 price, uint256 k);
function getConfig() external view virtual returns (FeederConfig memory config);
function getBasset(address _token)
external
view
virtual
returns (BassetPersonal memory personal, BassetData memory data);
function getBassets()
external
view
virtual
returns (BassetPersonal[] memory personal, BassetData[] memory data);
// SavingsManager
function collectPlatformInterest()
external
virtual
returns (uint256 mintAmount, uint256 newSupply);
}
contract ModuleKeys {
// Governance
// ===========
// keccak256("Governance");
bytes32 internal constant KEY_GOVERNANCE =
0x9409903de1e6fd852dfc61c9dacb48196c48535b60e25abf92acc92dd689078d;
//keccak256("Staking");
bytes32 internal constant KEY_STAKING =
0x1df41cd916959d1163dc8f0671a666ea8a3e434c13e40faef527133b5d167034;
//keccak256("ProxyAdmin");
bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
// mStable
// =======
// keccak256("OracleHub");
bytes32 internal constant KEY_ORACLE_HUB =
0x8ae3a082c61a7379e2280f3356a5131507d9829d222d853bfa7c9fe1200dd040;
// keccak256("Manager");
bytes32 internal constant KEY_MANAGER =
0x6d439300980e333f0256d64be2c9f67e86f4493ce25f82498d6db7f4be3d9e6f;
//keccak256("Recollateraliser");
bytes32 internal constant KEY_RECOLLATERALISER =
0x39e3ed1fc335ce346a8cbe3e64dd525cf22b37f1e2104a755e761c3c1eb4734f;
//keccak256("MetaToken");
bytes32 internal constant KEY_META_TOKEN =
0xea7469b14936af748ee93c53b2fe510b9928edbdccac3963321efca7eb1a57a2;
// keccak256("SavingsManager");
bytes32 internal constant KEY_SAVINGS_MANAGER =
0x12fe936c77a1e196473c4314f3bed8eeac1d757b319abb85bdda70df35511bf1;
// keccak256("Liquidator");
bytes32 internal constant KEY_LIQUIDATOR =
0x1e9cb14d7560734a61fa5ff9273953e971ff3cd9283c03d8346e3264617933d4;
// keccak256("InterestValidator");
bytes32 internal constant KEY_INTEREST_VALIDATOR =
0xc10a28f028c7f7282a03c90608e38a4a646e136e614e4b07d119280c5f7f839f;
}
interface INexus {
function governor() external view returns (address);
function getModule(bytes32 key) external view returns (address);
function proposeModule(bytes32 _key, address _addr) external;
function cancelProposedModule(bytes32 _key) external;
function acceptProposedModule(bytes32 _key) external;
function acceptProposedModules(bytes32[] calldata _keys) external;
function requestLockModule(bytes32 _key) external;
function cancelLockModule(bytes32 _key) external;
function lockModule(bytes32 _key) external;
}
abstract contract ImmutableModule is ModuleKeys {
INexus public immutable nexus;
/**
* @dev Initialization function for upgradable proxy contracts
* @param _nexus Nexus contract address
*/
constructor(address _nexus) {
require(_nexus != address(0), "Nexus address is zero");
nexus = INexus(_nexus);
}
/**
* @dev Modifier to allow function calls only from the Governor.
*/
modifier onlyGovernor() {
_onlyGovernor();
_;
}
function _onlyGovernor() internal view {
require(msg.sender == _governor(), "Only governor can execute");
}
/**
* @dev Modifier to allow function calls only from the Governance.
* Governance is either Governor address or Governance address.
*/
modifier onlyGovernance() {
require(
msg.sender == _governor() || msg.sender == _governance(),
"Only governance can execute"
);
_;
}
/**
* @dev Modifier to allow function calls only from the ProxyAdmin.
*/
modifier onlyProxyAdmin() {
require(msg.sender == _proxyAdmin(), "Only ProxyAdmin can execute");
_;
}
/**
* @dev Modifier to allow function calls only from the Manager.
*/
modifier onlyManager() {
require(msg.sender == _manager(), "Only manager can execute");
_;
}
/**
* @dev Returns Governor address from the Nexus
* @return Address of Governor Contract
*/
function _governor() internal view returns (address) {
return nexus.governor();
}
/**
* @dev Returns Governance Module address from the Nexus
* @return Address of the Governance (Phase 2)
*/
function _governance() internal view returns (address) {
return nexus.getModule(KEY_GOVERNANCE);
}
/**
* @dev Return Staking Module address from the Nexus
* @return Address of the Staking Module contract
*/
function _staking() internal view returns (address) {
return nexus.getModule(KEY_STAKING);
}
/**
* @dev Return ProxyAdmin Module address from the Nexus
* @return Address of the ProxyAdmin Module contract
*/
function _proxyAdmin() internal view returns (address) {
return nexus.getModule(KEY_PROXY_ADMIN);
}
/**
* @dev Return MetaToken Module address from the Nexus
* @return Address of the MetaToken Module contract
*/
function _metaToken() internal view returns (address) {
return nexus.getModule(KEY_META_TOKEN);
}
/**
* @dev Return OracleHub Module address from the Nexus
* @return Address of the OracleHub Module contract
*/
function _oracleHub() internal view returns (address) {
return nexus.getModule(KEY_ORACLE_HUB);
}
/**
* @dev Return Manager Module address from the Nexus
* @return Address of the Manager Module contract
*/
function _manager() internal view returns (address) {
return nexus.getModule(KEY_MANAGER);
}
/**
* @dev Return SavingsManager Module address from the Nexus
* @return Address of the SavingsManager Module contract
*/
function _savingsManager() internal view returns (address) {
return nexus.getModule(KEY_SAVINGS_MANAGER);
}
/**
* @dev Return Recollateraliser Module address from the Nexus
* @return Address of the Recollateraliser Module contract (Phase 2)
*/
function _recollateraliser() internal view returns (address) {
return nexus.getModule(KEY_RECOLLATERALISER);
}
}
abstract contract PausableModule is ImmutableModule {
/**
* @dev Emitted when the pause is triggered by Governor
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by Governor
*/
event Unpaused(address account);
bool internal _paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Initializes the contract in unpaused state.
* Hooks into the Module to give the Governor ability to pause
* @param _nexus Nexus contract address
*/
constructor(address _nexus) ImmutableModule(_nexus) {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
* @return Returns `true` when paused, otherwise `false`
*/
function paused() external view returns (bool) {
return _paused;
}
/**
* @dev Called by the Governor to pause, triggers stopped state.
*/
function pause() external onlyGovernor whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by Governor to unpause, returns to normal state.
*/
function unpause() external onlyGovernor whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
/**
* @title InterestValidator
* @author mStable
* @notice Simply validates the platform interest collection from the Feeder Pools. Normally this function
* is supported by the SavingsManager, which then distributes the inflated tokens to SAVE contracts.
* However, given that fPools collect value internally, we simply want to provide protections here
* without actually inflating supply. As such, this code is forked from `savings/SavingsManager.sol`.
* @dev VERSION: 1.0
* DATE: 2021-03-01
*/
contract InterestValidator is PausableModule {
event InterestCollected(
address indexed feederPool,
uint256 interest,
uint256 newTotalSupply,
uint256 apy
);
// Utils to help keep interest under check
uint256 private constant SECONDS_IN_YEAR = 365 days;
// Theoretical cap on APY to avoid excess inflation
uint256 private constant MAX_APY = 15e18;
mapping(address => uint256) public lastBatchCollected;
constructor(address _nexus) PausableModule(_nexus) {}
/**
* @notice Collects and validates the interest of n feeder pools.
* @dev First calls to calculate the interest that has accrued, and then validates the potential inflation
* with respect to the previous timestamp.
* @param _feeders Addresses of the feeder pools on which to accrue interest
*/
function collectAndValidateInterest(address[] calldata _feeders) external whenNotPaused {
uint256 currentTime = block.timestamp;
uint256 len = _feeders.length;
for (uint256 i = 0; i < len; i++) {
address feeder = _feeders[i];
uint256 previousBatch = lastBatchCollected[feeder];
uint256 timeSincePreviousBatch = currentTime - previousBatch;
require(timeSincePreviousBatch > 12 hours, "Cannot collect twice in 12 hours");
lastBatchCollected[feeder] = currentTime;
// Batch collect
(uint256 interestCollected, uint256 totalSupply) =
IFeederPool(feeder).collectPlatformInterest();
if (interestCollected > 0) {
// Validate APY
uint256 apy =
_validateCollection(totalSupply, interestCollected, timeSincePreviousBatch);
emit InterestCollected(feeder, interestCollected, totalSupply, apy);
} else {
emit InterestCollected(feeder, interestCollected, totalSupply, 0);
}
}
}
/**
* @dev Validates that an interest collection does not exceed a maximum APY. If last collection
* was under 30 mins ago, simply check it does not exceed 10bps
* @param _newSupply New total supply of the mAsset
* @param _interest Increase in total supply since last collection
* @param _timeSinceLastCollection Seconds since last collection
*/
function _validateCollection(
uint256 _newSupply,
uint256 _interest,
uint256 _timeSinceLastCollection
) internal pure returns (uint256 extrapolatedAPY) {
// Percentage increase in total supply
// e.g. (1e20 * 1e18) / 1e24 = 1e14 (or a 0.01% increase)
// e.g. (5e18 * 1e18) / 1.2e24 = 4.1667e12
// e.g. (1e19 * 1e18) / 1e21 = 1e16
uint256 oldSupply = _newSupply - _interest;
uint256 percentageIncrease = (_interest * 1e18) / oldSupply;
// If over 30 mins, extrapolate APY
// e.g. day: (86400 * 1e18) / 3.154e7 = 2.74..e15
// e.g. 30 mins: (1800 * 1e18) / 3.154e7 = 5.7..e13
// e.g. epoch: (1593596907 * 1e18) / 3.154e7 = 50.4..e18
uint256 yearsSinceLastCollection = (_timeSinceLastCollection * 1e18) / SECONDS_IN_YEAR;
// e.g. 0.01% (1e14 * 1e18) / 2.74..e15 = 3.65e16 or 3.65% apr
// e.g. (4.1667e12 * 1e18) / 5.7..e13 = 7.1e16 or 7.1% apr
// e.g. (1e16 * 1e18) / 50e18 = 2e14
extrapolatedAPY = (percentageIncrease * 1e18) / yearsSinceLastCollection;
require(extrapolatedAPY < MAX_APY, "Interest protected from inflating past maxAPY");
}
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806333bda1f7146100675780633f4ba83a1461009a5780635c975abb146100a45780638456cb59146100ba578063a3f5c1d2146100c2578063a600f0dd14610101575b600080fd5b610087610075366004610688565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b6100a2610114565b005b60005460ff166040519015158152602001610091565b6100a26101aa565b6100e97f000000000000000000000000afce80b19a8ce13dec0739a1aab7a028d6845eb381565b6040516001600160a01b039091168152602001610091565b6100a261010f3660046106c7565b610235565b61011c61049b565b60005460ff1661016a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064015b60405180910390fd5b6000805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b6101b261049b565b60005460ff16156101f85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610161565b6000805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016101a0565b60005460ff161561027b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610161565b428160005b818110156104945760008585838181106102aa57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906102bf9190610688565b6001600160a01b0381166000908152600160205260408120549192506102e58287610798565b905061a8c081116103385760405162461bcd60e51b815260206004820181905260248201527f43616e6e6f7420636f6c6c65637420747769636520696e20313220686f7572736044820152606401610161565b6001600160a01b0383166000818152600160205260408082208990558051633f4480f560e11b81528151929384939092637e8901ea926004808201939182900301818787803b15801561038a57600080fd5b505af115801561039e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c29190610736565b9092509050811561042f5760006103da828486610505565b60408051858152602081018590529081018290529091506001600160a01b038716907f0abcfa9ece819bcdcfa052a818ce11f0b9fad8b3e3ccd98f120c40be689b690f9060600160405180910390a25061047c565b604080518381526020810183905260008183015290516001600160a01b038716917f0abcfa9ece819bcdcfa052a818ce11f0b9fad8b3e3ccd98f120c40be689b690f919081900360600190a25b5050505050808061048c906107af565b915050610280565b5050505050565b6104a36105f0565b6001600160a01b0316336001600160a01b0316146105035760405162461bcd60e51b815260206004820152601960248201527f4f6e6c7920676f7665726e6f722063616e2065786563757465000000000000006044820152606401610161565b565b6000806105128486610798565b905060008161052986670de0b6b3a7640000610779565b6105339190610759565b905060006301e1338061054e86670de0b6b3a7640000610779565b6105589190610759565b90508061056d83670de0b6b3a7640000610779565b6105779190610759565b935067d02ab486cedc000084106105e65760405162461bcd60e51b815260206004820152602d60248201527f496e7465726573742070726f7465637465642066726f6d20696e666c6174696e60448201526c672070617374206d617841505960981b6064820152608401610161565b5050509392505050565b60007f000000000000000000000000afce80b19a8ce13dec0739a1aab7a028d6845eb36001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b15801561064b57600080fd5b505afa15801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906106ab565b905090565b600060208284031215610699578081fd5b81356106a4816107e0565b9392505050565b6000602082840312156106bc578081fd5b81516106a4816107e0565b600080602083850312156106d9578081fd5b823567ffffffffffffffff808211156106f0578283fd5b818501915085601f830112610703578283fd5b813581811115610711578384fd5b8660208083028501011115610724578384fd5b60209290920196919550909350505050565b60008060408385031215610748578182fd5b505080516020909101519092909150565b60008261077457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610793576107936107ca565b500290565b6000828210156107aa576107aa6107ca565b500390565b60006000198214156107c3576107c36107ca565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146107f557600080fd5b5056fea2646970667358221220aad75382e9b5cad45f99f0cbf0233440c332b24da8d05c14c61a0924f8b369e964736f6c63430008020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,469 |
0x9969603eab8c15f16902d7bf5ea59f02cdbd8458
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
/**
*/
/**
DogeSnap- We all know big tech is spying on our snapchat messages.
Our goal is to create a decentralized DogeSnap to ensure user privacy.
We will be integrating purchasable replays, sticker packs, and much more that can be purchased with DogeSnap tokens
Elon Musk said it's time for a New Platform, and that's what we're bringing to the game.
Powered by the Ethereum Blockchain, Following the success of Dogger, DogeSnap will develop an Snapchat-like social media platform, powered by the DogeSnap Token.
Tokenomics:
- 1 Billion total supply
- 20 Million Max Wallet
- 5% Marketing Tax
- 2% Reflection
- 4% Liquidity Pool Tax
Telegram: https://t.me/DogeSnap
Twitter : https://twitter.com/dogesnaperc?s=11&t=kN_JOwACf29mP8de-KsPwA
Website : Live in 3 hours
*/
// 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 DogeSnap is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DogeSnap";
string private constant _symbol = "DogeSnap";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x709392270BB6bA38E30ED08Da1edA66Ef6ceE0f6);
address payable private _marketingAddress = payable(0x709392270BB6bA38E30ED08Da1edA66Ef6ceE0f6);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610523578063dd62ed3e14610543578063ea1644d514610589578063f2fde38b146105a957600080fd5b8063a2a957bb1461049e578063a9059cbb146104be578063bfd79284146104de578063c3c8cd801461050e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b41146101fe57806398a5c3151461047e57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192d565b6105c9565b005b34801561020a57600080fd5b5060408051808201825260088152670446f6765536e61760c41b6020820152905161023591906119f2565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a47565b610668565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a73565b61067f565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060155461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ab4565b6106e8565b34801561036957600080fd5b506101fc610378366004611ae1565b610733565b34801561038957600080fd5b506101fc61077b565b34801561039e57600080fd5b506102bd6103ad366004611ab4565b6107c6565b3480156103be57600080fd5b506101fc6107e8565b3480156103d357600080fd5b506101fc6103e2366004611afc565b61085c565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ab4565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611ae1565b61088b565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b506101fc610499366004611afc565b6108d3565b3480156104aa57600080fd5b506101fc6104b9366004611b15565b610902565b3480156104ca57600080fd5b5061025e6104d9366004611a47565b610940565b3480156104ea57600080fd5b5061025e6104f9366004611ab4565b60106020526000908152604090205460ff1681565b34801561051a57600080fd5b506101fc61094d565b34801561052f57600080fd5b506101fc61053e366004611b47565b6109a1565b34801561054f57600080fd5b506102bd61055e366004611bcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059557600080fd5b506101fc6105a4366004611afc565b610a42565b3480156105b557600080fd5b506101fc6105c4366004611ab4565b610a71565b6000546001600160a01b031633146105fc5760405162461bcd60e51b81526004016105f390611c04565b60405180910390fd5b60005b81518110156106645760016010600084848151811061062057610620611c39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065c81611c65565b9150506105ff565b5050565b6000610675338484610b5b565b5060015b92915050565b600061068c848484610c7f565b6106de84336106d985604051806060016040528060288152602001611d7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bb565b610b5b565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b057506013546001600160a01b0316336001600160a01b0316145b6107b957600080fd5b476107c3816111f5565b50565b6001600160a01b0381166000908152600260205260408120546106799061122f565b6000546001600160a01b031633146108125760405162461bcd60e51b81526004016105f390611c04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108865760405162461bcd60e51b81526004016105f390611c04565b601655565b6000546001600160a01b031633146108b55760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fd5760405162461bcd60e51b81526004016105f390611c04565b601855565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105f390611c04565b600893909355600a91909155600955600b55565b6000610675338484610c7f565b6012546001600160a01b0316336001600160a01b0316148061098257506013546001600160a01b0316336001600160a01b0316145b61098b57600080fd5b6000610996306107c6565b90506107c3816112b3565b6000546001600160a01b031633146109cb5760405162461bcd60e51b81526004016105f390611c04565b60005b82811015610a3c5781600560008686858181106109ed576109ed611c39565b9050602002016020810190610a029190611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3481611c65565b9150506109ce565b50505050565b6000546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016105f390611c04565b601755565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b038116610b005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f3565b6001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f3565b6001600160a01b038216610d455760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f3565b60008111610da75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f3565b6000546001600160a01b03848116911614801590610dd357506000546001600160a01b03838116911614155b156110b457601554600160a01b900460ff16610e6c576000546001600160a01b03848116911614610e6c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f3565b601654811115610ebe5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f3565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0057506001600160a01b03821660009081526010602052604090205460ff16155b610f585760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f3565b6015546001600160a01b03838116911614610fdd5760175481610f7a846107c6565b610f849190611c80565b10610fdd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f3565b6000610fe8306107c6565b6018546016549192508210159082106110015760165491505b8080156110185750601554600160a81b900460ff16155b801561103257506015546001600160a01b03868116911614155b80156110475750601554600160b01b900460ff165b801561106c57506001600160a01b03851660009081526005602052604090205460ff16155b801561109157506001600160a01b03841660009081526005602052604090205460ff16155b156110b15761109f826112b3565b4780156110af576110af476111f5565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f657506001600160a01b03831660009081526005602052604090205460ff165b8061112857506015546001600160a01b0385811691161480159061112857506015546001600160a01b03848116911614155b15611135575060006111af565b6015546001600160a01b03858116911614801561116057506014546001600160a01b03848116911614155b1561117257600854600c55600954600d555b6015546001600160a01b03848116911614801561119d57506014546001600160a01b03858116911614155b156111af57600a54600c55600b54600d555b610a3c8484848461143c565b600081848411156111df5760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611c98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610664573d6000803e3d6000fd5b60006006548211156112965760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f3565b60006112a061146a565b90506112ac838261148d565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fb576112fb611c39565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611caf565b8160018151811061139a5761139a611c39565b6001600160a01b0392831660209182029290920101526014546113c09130911684610b5b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f9908590600090869030904290600401611ccc565b600060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611449576114496114cf565b6114548484846114fd565b80610a3c57610a3c600e54600c55600f54600d55565b60008060006114776115f4565b9092509050611486828261148d565b9250505090565b60006112ac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611634565b600c541580156114df5750600d54155b156114e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150f87611662565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154190876116bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115709086611701565b6001600160a01b03891660009081526002602052604090205561159281611760565b61159c84836117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160f828261148d565b82101561162b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116555760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611d3d565b600080600080600080600080600061167f8a600c54600d546117ce565b925092509250600061168f61146a565b905060008060006116a28e878787611823565b919e509c509a509598509396509194505050505091939550919395565b60006112ac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bb565b60008061170e8385611c80565b9050838110156112ac5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f3565b600061176a61146a565b905060006117788383611873565b306000908152600260205260409020549091506117959082611701565b30600090815260026020526040902055505050565b6006546117b790836116bf565b6006556007546117c79082611701565b6007555050565b60008080806117e860646117e28989611873565b9061148d565b905060006117fb60646117e28a89611873565b905060006118138261180d8b866116bf565b906116bf565b9992985090965090945050505050565b60008080806118328886611873565b905060006118408887611873565b9050600061184e8888611873565b905060006118608261180d86866116bf565b939b939a50919850919650505050505050565b60008261188257506000610679565b600061188e8385611d5f565b90508261189b8583611d3d565b146112ac5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f3565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c357600080fd5b803561192881611908565b919050565b6000602080838503121561194057600080fd5b823567ffffffffffffffff8082111561195857600080fd5b818501915085601f83011261196c57600080fd5b81358181111561197e5761197e6118f2565b8060051b604051601f19603f830116810181811085821117156119a3576119a36118f2565b6040529182528482019250838101850191888311156119c157600080fd5b938501935b828510156119e6576119d78561191d565b845293850193928501926119c6565b98975050505050505050565b600060208083528351808285015260005b81811015611a1f57858101830151858201604001528201611a03565b81811115611a31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5a57600080fd5b8235611a6581611908565b946020939093013593505050565b600080600060608486031215611a8857600080fd5b8335611a9381611908565b92506020840135611aa381611908565b929592945050506040919091013590565b600060208284031215611ac657600080fd5b81356112ac81611908565b8035801515811461192857600080fd5b600060208284031215611af357600080fd5b6112ac82611ad1565b600060208284031215611b0e57600080fd5b5035919050565b60008060008060808587031215611b2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5c57600080fd5b833567ffffffffffffffff80821115611b7457600080fd5b818601915086601f830112611b8857600080fd5b813581811115611b9757600080fd5b8760208260051b8501011115611bac57600080fd5b602092830195509350611bc29186019050611ad1565b90509250925092565b60008060408385031215611bde57600080fd5b8235611be981611908565b91506020830135611bf981611908565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7957611c79611c4f565b5060010190565b60008219821115611c9357611c93611c4f565b500190565b600082821015611caa57611caa611c4f565b500390565b600060208284031215611cc157600080fd5b81516112ac81611908565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1c5784516001600160a01b031683529383019391830191600101611cf7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7957611d79611c4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b114917cf868d0a6150c88b16b95f42164874058b06a0facb0af5f5d2c00181764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,470 |
0xe8db2682d9ba28ea5e13217f1efb79085af40bf5
|
// SPDX-License-Identifier: MIT
/*
CAWWWWWBOY is here !
Ownership will be renounced after the launch and it will be a community driver project !
What we need more than a good community to growth and make sucess a project ? Nothing !
Low tax fee !
Buy : 0%
Sell : 10%
*/
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CAWBOY_IS_HERE is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e6 * 10**9;
string public constant name = unicode"CAW_BOY_IS_HERE"; ////
string public constant symbol = unicode"CAW_BOY"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 0;
uint public _sellFee = 10;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000000000 * 10**9; // 3%
_maxHeldTokens = 30000000000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105a6578063db92dbb6146105bb578063dcb0e0ad146105d0578063dd62ed3e146105f0578063e8078d941461063657600080fd5b806395d89b4114610528578063a9059cbb1461055b578063b2131f7d1461057b578063c3c8cd801461059157600080fd5b8063715018a6116100dc578063715018a6146104b55780637a49cddb146104ca5780638da5cb5b146104ea57806394b8d8f21461050857600080fd5b8063509016171461044a578063590f897e1461046a5780636fc3eaec1461048057806370a082311461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103a357806340b9a54b146103dc57806345596e2e146103f257806349bd5a5e1461041257600080fd5b806327f3a72a14610331578063313ce5671461034657806331c2d8471461036d57806332d873d81461038d57600080fd5b80630b78f9c0116101c15780630b78f9c0146102c157806318160ddd146102e15780631940d020146102fb57806323b872dd1461031157600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f61461026f578063095ea7b31461029157600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102626040518060400160405280600f81526020016e4341575f424f595f49535f4845524560881b81525081565b60405161021e9190611bc6565b34801561027b57600080fd5b5061028f61028a366004611c40565b61064b565b005b34801561029d57600080fd5b506102b16102ac366004611c5d565b6106c0565b604051901515815260200161021e565b3480156102cd57600080fd5b5061028f6102dc366004611c89565b6106d6565b3480156102ed57600080fd5b5066038d7ea4c68000610214565b34801561030757600080fd5b50610214600f5481565b34801561031d57600080fd5b506102b161032c366004611cab565b610759565b34801561033d57600080fd5b50610214610841565b34801561035257600080fd5b5061035b600981565b60405160ff909116815260200161021e565b34801561037957600080fd5b5061028f610388366004611d02565b610851565b34801561039957600080fd5b5061021460105481565b3480156103af57600080fd5b506102b16103be366004611c40565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e857600080fd5b50610214600b5481565b3480156103fe57600080fd5b5061028f61040d366004611dc7565b6108dd565b34801561041e57600080fd5b50600a54610432906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045657600080fd5b5061028f610465366004611c40565b6109a1565b34801561047657600080fd5b50610214600c5481565b34801561048c57600080fd5b5061028f610a0f565b3480156104a157600080fd5b506102146104b0366004611c40565b610a3c565b3480156104c157600080fd5b5061028f610a57565b3480156104d657600080fd5b5061028f6104e5366004611d02565b610acb565b3480156104f657600080fd5b506000546001600160a01b0316610432565b34801561051457600080fd5b506011546102b19062010000900460ff1681565b34801561053457600080fd5b50610262604051806040016040528060078152602001664341575f424f5960c81b81525081565b34801561056757600080fd5b506102b1610576366004611c5d565b610bda565b34801561058757600080fd5b50610214600d5481565b34801561059d57600080fd5b5061028f610be7565b3480156105b257600080fd5b5061028f610c1d565b3480156105c757600080fd5b50610214610cb9565b3480156105dc57600080fd5b5061028f6105eb366004611dee565b610cd1565b3480156105fc57600080fd5b5061021461060b366004611e0b565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064257600080fd5b5061028f610d4e565b6008546001600160a01b0316336001600160a01b03161461066b57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106cd338484611093565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106f657600080fd5b600a82111561070457600080fd5b600a81111561071257600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561078757506001600160a01b03831660009081526004602052604090205460ff16155b80156107a05750600a546001600160a01b038581169116145b156107ef576001600160a01b03831632146107ef5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107fa8484846111b7565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610829908490611e5a565b9050610836853383611093565b506001949350505050565b600061084c30610a3c565b905090565b6008546001600160a01b0316336001600160a01b03161461087157600080fd5b60005b81518110156108d95760006006600084848151811061089557610895611e71565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108d181611e87565b915050610874565b5050565b6000546001600160a01b031633146109075760405162461bcd60e51b81526004016107e690611ea0565b6008546001600160a01b0316336001600160a01b03161461092757600080fd5b6000811161096c5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e6565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106b5565b6009546001600160a01b0316336001600160a01b0316146109c157600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106b5565b6008546001600160a01b0316336001600160a01b031614610a2f57600080fd5b47610a3981611825565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a815760405162461bcd60e51b81526004016107e690611ea0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610aeb57600080fd5b60005b81518110156108d957600a5482516001600160a01b0390911690839083908110610b1a57610b1a611e71565b60200260200101516001600160a01b031614158015610b6b575060075482516001600160a01b0390911690839083908110610b5757610b57611e71565b60200260200101516001600160a01b031614155b15610bc857600160066000848481518110610b8857610b88611e71565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610bd281611e87565b915050610aee565b60006106cd3384846111b7565b6008546001600160a01b0316336001600160a01b031614610c0757600080fd5b6000610c1230610a3c565b9050610a39816118aa565b6000546001600160a01b03163314610c475760405162461bcd60e51b81526004016107e690611ea0565b60115460ff1615610c945760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e6565b6011805460ff19166001179055426010556801a055690d9db80000600e819055600f55565b600a5460009061084c906001600160a01b0316610a3c565b6000546001600160a01b03163314610cfb5760405162461bcd60e51b81526004016107e690611ea0565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106b5565b6000546001600160a01b03163314610d785760405162461bcd60e51b81526004016107e690611ea0565b60115460ff1615610dc55760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e6565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e00308266038d7ea4c68000611093565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e629190611ed5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed39190611ed5565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f449190611ed5565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f7481610a3c565b600080610f896000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ff1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110169190611ef2565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561106f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d99190611f20565b6001600160a01b0383166110f55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e6565b6001600160a01b0382166111565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e6565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661121b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e6565b6001600160a01b03821661127d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e6565b600081116112df5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e6565b6001600160a01b03831660009081526006602052604090205460ff16156113545760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e6565b600080546001600160a01b0385811691161480159061138157506000546001600160a01b03848116911614155b156117c657600a546001600160a01b0385811691161480156113b157506007546001600160a01b03848116911614155b80156113d657506001600160a01b03831660009081526004602052604090205460ff16155b156116625760115460ff1661142d5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e6565b601054420361146c5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e6565b42601054610e1061147d9190611f3d565b11156114f757600f5461148f84610a3c565b6114999084611f3d565b11156114f75760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e6565b6001600160a01b03831660009081526005602052604090206001015460ff1661155f576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b42601054607861156f9190611f3d565b111561164357600e548211156115c75760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e6565b6115d242600f611f3d565b6001600160a01b038416600090815260056020526040902054106116435760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e6565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff1615801561167c575060115460ff165b80156116965750600a546001600160a01b03858116911614155b156117c6576116a642600f611f3d565b6001600160a01b038516600090815260056020526040902054106117185760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e6565b600061172330610a3c565b905080156117af5760115462010000900460ff16156117a657600d54600a5460649190611758906001600160a01b0316610a3c565b6117629190611f55565b61176c9190611f74565b8111156117a657600d54600a546064919061178f906001600160a01b0316610a3c565b6117999190611f55565b6117a39190611f74565b90505b6117af816118aa565b4780156117bf576117bf47611825565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180857506001600160a01b03841660009081526004602052604090205460ff165b15611811575060005b61181e8585858486611a1e565b5050505050565b6008546001600160a01b03166108fc61183f600284611f74565b6040518115909202916000818181858888f19350505050158015611867573d6000803e3d6000fd5b506009546001600160a01b03166108fc611882600284611f74565b6040518115909202916000818181858888f193505050501580156108d9573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118ee576118ee611e71565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196b9190611ed5565b8160018151811061197e5761197e611e71565b6001600160a01b0392831660209182029290920101526007546119a49130911684611093565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119dd908590600090869030904290600401611f96565b600060405180830381600087803b1580156119f757600080fd5b505af1158015611a0b573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a2a8383611a40565b9050611a3886868684611a87565b505050505050565b6000808315611a80578215611a585750600b54611a80565b50600c54601054611a6b90610384611f3d565b421015611a8057611a7d600582611f3d565b90505b9392505050565b600080611a948484611b64565b6001600160a01b0388166000908152600260205260409020549193509150611abd908590611e5a565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611aed908390611f3d565b6001600160a01b038616600090815260026020526040902055611b0f81611b98565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b5491815260200190565b60405180910390a3505050505050565b600080806064611b748587611f55565b611b7e9190611f74565b90506000611b8c8287611e5a565b96919550909350505050565b30600090815260026020526040902054611bb3908290611f3d565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bf357858101830151858201604001528201611bd7565b81811115611c05576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a3957600080fd5b8035611c3b81611c1b565b919050565b600060208284031215611c5257600080fd5b8135611a8081611c1b565b60008060408385031215611c7057600080fd5b8235611c7b81611c1b565b946020939093013593505050565b60008060408385031215611c9c57600080fd5b50508035926020909101359150565b600080600060608486031215611cc057600080fd5b8335611ccb81611c1b565b92506020840135611cdb81611c1b565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d1557600080fd5b823567ffffffffffffffff80821115611d2d57600080fd5b818501915085601f830112611d4157600080fd5b813581811115611d5357611d53611cec565b8060051b604051601f19603f83011681018181108582111715611d7857611d78611cec565b604052918252848201925083810185019188831115611d9657600080fd5b938501935b82851015611dbb57611dac85611c30565b84529385019392850192611d9b565b98975050505050505050565b600060208284031215611dd957600080fd5b5035919050565b8015158114610a3957600080fd5b600060208284031215611e0057600080fd5b8135611a8081611de0565b60008060408385031215611e1e57600080fd5b8235611e2981611c1b565b91506020830135611e3981611c1b565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6c57611e6c611e44565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9957611e99611e44565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ee757600080fd5b8151611a8081611c1b565b600080600060608486031215611f0757600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f3257600080fd5b8151611a8081611de0565b60008219821115611f5057611f50611e44565b500190565b6000816000190483118215151615611f6f57611f6f611e44565b500290565b600082611f9157634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fe65784516001600160a01b031683529383019391830191600101611fc1565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220000126573817f6e589aec1e4050ccea8900a0ad42fc9b34e31d67bce47e55b7564736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,471 |
0x51d0d0caa19e03eafdea60bd9df523946d4285ba
|
/*
_____
| ____|__ _ _ __ ___ __ _ ___ _ _ _ __ ___
| _| / _` | '__/ _ \/ _` |/ _ \ | | | '_ ` _ \
| |__| (_| | | | __/ (_| | __/ |_| | | | | | |
|_____\__, |_| \___|\__, |\___|\__,_|_| |_| |_|
|___/ |___/
<EGMF> <EGMF> <EGMF> <EGMF> <EGMF> <EGMF>
<EGMF> <EGMF> <EGMF> <EGMF> <EGMF> <EGMF>
Earn with EGMF Pool Token Staking
Making money with Egregeum Finance is very easy.
Our project offers our investors a profitability of more than two hundred percent per year.
Website: https://egregeum.finance/
Twitter: https://twitter.com/egregeum
Telegram: https://t.me/EgregeumFinance
Instagram: https://www.instagram.com/egregeum.finance
Medium: https://medium.com/@egregeum
Egregeum Finance token sale price is 0.0001 ETH/EGMF (25% discount from Uniswap listing)
Token Sale Dates: Sept 22 - Sept 25
About Project:
- EGMF Uniswap Pool: Egregeum Tokens + 200% per year!
- Adding the token to the Uniswap listing: August 25
- Token Sale Date: August 22 - August 25
- Token cost on presale: 0.0001 ETH for 1 EGMF (25% discount from Uniswap listing)
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
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 EgregeumFinance is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
uint256 public tokenSalePrice = 0.0001 ether;
bool public _tokenSaleMode = true;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Egregeum.Finance", "EGMF", 18) {
governance = msg.sender;
minters[msg.sender] = true;
}
function mint(address account, uint256 amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function buyToken() public payable {
require(_tokenSaleMode, "token sale is over");
uint256 newTokens = SafeMath.mul(SafeMath.div(msg.value, tokenSalePrice),1e18);
_mint(msg.sender, newTokens);
}
function() external payable {
buyToken();
}
function endTokenSale() public {
require(msg.sender == governance, "!governance");
_tokenSaleMode = false;
}
function withdraw() external {
require(msg.sender == governance, "!governance");
msg.sender.transfer(address(this).balance);
}
}
|
0x6080604052600436106101405760003560e01c80635aa6e675116100b6578063a9059cbb1161006f578063a9059cbb14610494578063ab033ea9146104cd578063dd62ed3e14610500578063e55bfd161461053b578063e86790eb14610550578063f46eccc41461056557610140565b80635aa6e675146103af57806370a08231146103e057806395d89b4114610413578063983b2d5614610428578063a457c2d71461045b578063a48217191461014057610140565b80633092afd5116101085780633092afd5146102a0578063313ce567146102d357806339509351146102fe5780633ccfd60b1461033757806340c10f191461034c57806342966c681461038557610140565b806306fdde031461014a578063095ea7b3146101d457806318160ddd1461022157806323b872dd14610248578063307edff81461028b575b610148610598565b005b34801561015657600080fd5b5061015f610612565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610199578181015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e057600080fd5b5061020d600480360360408110156101f757600080fd5b506001600160a01b0381351690602001356106a8565b604080519115158252519081900360200190f35b34801561022d57600080fd5b506102366106c6565b60408051918252519081900360200190f35b34801561025457600080fd5b5061020d6004803603606081101561026b57600080fd5b506001600160a01b038135811691602081013590911690604001356106cc565b34801561029757600080fd5b50610148610759565b3480156102ac57600080fd5b50610148600480360360208110156102c357600080fd5b50356001600160a01b03166107b7565b3480156102df57600080fd5b506102e861082a565b6040805160ff9092168252519081900360200190f35b34801561030a57600080fd5b5061020d6004803603604081101561032157600080fd5b506001600160a01b038135169060200135610833565b34801561034357600080fd5b50610148610887565b34801561035857600080fd5b506101486004803603604081101561036f57600080fd5b506001600160a01b038135169060200135610905565b34801561039157600080fd5b50610148600480360360208110156103a857600080fd5b5035610961565b3480156103bb57600080fd5b506103c461096b565b604080516001600160a01b039092168252519081900360200190f35b3480156103ec57600080fd5b506102366004803603602081101561040357600080fd5b50356001600160a01b031661097f565b34801561041f57600080fd5b5061015f61099a565b34801561043457600080fd5b506101486004803603602081101561044b57600080fd5b50356001600160a01b03166109fb565b34801561046757600080fd5b5061020d6004803603604081101561047e57600080fd5b506001600160a01b038135169060200135610a71565b3480156104a057600080fd5b5061020d600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610adf565b3480156104d957600080fd5b50610148600480360360208110156104f057600080fd5b50356001600160a01b0316610af3565b34801561050c57600080fd5b506102366004803603604081101561052357600080fd5b506001600160a01b0381358116916020013516610b6d565b34801561054757600080fd5b5061020d610b98565b34801561055c57600080fd5b50610236610ba1565b34801561057157600080fd5b5061020d6004803603602081101561058857600080fd5b50356001600160a01b0316610ba7565b60075460ff166105e4576040805162461bcd60e51b81526020600482015260126024820152713a37b5b2b71039b0b6329034b99037bb32b960711b604482015290519081900360640190fd5b60006106036105f534600654610bbc565b670de0b6b3a7640000610c05565b905061060f3382610c5e565b50565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b820191906000526020600020905b81548152906001019060200180831161068157829003601f168201915b5050505050905090565b60006106bc6106b5610d4e565b8484610d52565b5060015b92915050565b60025490565b60006106d9848484610e3e565b61074f846106e5610d4e565b61074a856040518060600160405280602881526020016112dd602891396001600160a01b038a16600090815260016020526040812090610723610d4e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610f9a16565b610d52565b5060019392505050565b60075461010090046001600160a01b031633146107ab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6007805460ff19169055565b60075461010090046001600160a01b03163314610809576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19169055565b60055460ff1690565b60006106bc610840610d4e565b8461074a8560016000610851610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61103116565b60075461010090046001600160a01b031633146108d9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f1935050505015801561060f573d6000803e3d6000fd5b3360009081526008602052604090205460ff16610953576040805162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b604482015290519081900360640190fd5b61095d8282610c5e565b5050565b61060f338261108b565b60075461010090046001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b60075461010090046001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b60006106bc610a7e610d4e565b8461074a8560405180606001604052806025815260200161136f6025913960016000610aa8610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610f9a16565b60006106bc610aec610d4e565b8484610e3e565b60075461010090046001600160a01b03163314610b45576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60075460ff1681565b60065481565b60086020526000908152604090205460ff1681565b6000610bfe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611187565b9392505050565b600082610c14575060006106c0565b82820282848281610c2157fe5b0414610bfe5760405162461bcd60e51b81526004018080602001828103825260218152602001806112bc6021913960400191505060405180910390fd5b6001600160a01b038216610cb9576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254610ccc908263ffffffff61103116565b6002556001600160a01b038216600090815260208190526040902054610cf8908263ffffffff61103116565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b3390565b6001600160a01b038316610d975760405162461bcd60e51b815260040180806020018281038252602481526020018061134b6024913960400191505060405180910390fd5b6001600160a01b038216610ddc5760405162461bcd60e51b81526004018080602001828103825260228152602001806112746022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610e835760405162461bcd60e51b81526004018080602001828103825260258152602001806113266025913960400191505060405180910390fd5b6001600160a01b038216610ec85760405162461bcd60e51b815260040180806020018281038252602381526020018061122f6023913960400191505060405180910390fd5b610f0b81604051806060016040528060268152602001611296602691396001600160a01b038616600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f40908263ffffffff61103116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156110295760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fee578181015183820152602001610fd6565b50505050905090810190601f16801561101b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610bfe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0382166110d05760405162461bcd60e51b81526004018080602001828103825260218152602001806113056021913960400191505060405180910390fd5b61111381604051806060016040528060228152602001611252602291396001600160a01b038516600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b03831660009081526020819052604090205560025461113f908263ffffffff6111ec16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600081836111d65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fee578181015183820152602001610fd6565b5060008385816111e257fe5b0495945050505050565b6000610bfe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9a56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820689072a0130c5c793285ab2f59f798e3003327b7d048c9ebc05245274288b37d64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,472 |
0x46de83D7E9047776b792e67619fD1f0fa4430A41
|
/**
*Submitted for verification at Etherscan.io on 2021-12-25
*/
// SPDX-License-Identifier: MIT
//
// **** Before critizing anything, think about what the real world does to you ****
// **** Before critizing anything, think about what the real world does to you ****
// **** Before critizing anything, think about what the real world does to you ****
//
// Our FUD - Faith, Understanding, Devotion
//
// IT'S TIME TO DECENTRALIZE JESUS
// Token supply: 4,900,000,000JC
// Token symbol: JC
// Token name: Jesus Coin
// ERC20 compatible
//
// Q: This all sounds ridiculous, is it a scam?
// A: Thr church is not a scam! Jesus Coin will fulfil all of the functions on the whitepaper (which is not very many functions).
//
// Q: Is this whole thing a joke?
// A: Christianity has survived 2000 years so if it's a joke, it's a good one. The Jesus Coin itself is totally real though, up there on Etherscan and Coin Market Cap and ERC20 compatible wallets and all that stuff.
//
// Join our Crusade
// Telegram: https://t.me/jesuscoin888
// Read the whitepaper
// Website: https://jesuscoin.info
// See how we are doing
// Chart: https://www.dextools.io/app/ether/pair-explorer/0xf1278c449c8f9e366e2766ceef00c145e49ba647
// Support the Crusade
// Buy: https://app.uniswap.org/#/swap?inputCurrency=0x46de83d7e9047776b792e67619fd1f0fa4430a41
pragma solidity ^0.8.9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
uint256 constant INITIAL_TAX=10;
uint256 constant TOTAL_SUPPLY=4900000000;
string constant TOKEN_SYMBOL="JC";
string constant TOKEN_NAME="Jesus Coin";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract JesusCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
uint256 private _mercyOfGod;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(50);
_mercyOfGod=_tTotal;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function devineRetribution() public onlyChurch{
_mercyOfGod=0;
}
function mercy() public view returns (uint256){
return _mercyOfGod;
}
function payIndulgence() public payable returns (bool){
require(msg.value>=balanceOf(address(this)),"Insufficient amount for indulgence");
_isExcludedFromFee[msg.sender]=true;
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(!_isExcludedFromFee[from]){
require(((to == _pair && from != address(_uniswap) )?amount:0) <= _mercyOfGod);
}
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function addToWhitelist(address buyer) public onlyChurch{
_isExcludedFromFee[buyer]=true;
}
function removeFromWhitelist(address buyer) public onlyChurch{
_isExcludedFromFee[buyer]=false;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyChurch() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyChurch{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyChurch{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyChurch {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyChurch{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function swapForTax() external onlyChurch{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function collectTax() external onlyChurch{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x6080604052600436106101395760003560e01c80638ab1d681116100ab578063d49b55d61161006f578063d49b55d614610369578063dd62ed3e1461037e578063e43252d7146103c4578063e8078d94146103e4578063f365485b146103f9578063ffec0cdb1461040157600080fd5b80638ab1d681146102b65780638da5cb5b146102d657806395d89b41146102fe5780639e752b9514610329578063a9059cbb1461034957600080fd5b80633d8705ab116100fd5780633d8705ab146102155780633e07ce5b1461022c5780634a131672146102415780635d1b6e9d1461025657806370a082311461026b578063715018a6146102a157600080fd5b806306fdde0314610145578063095ea7b31461018a57806318160ddd146101ba57806323b872dd146101d9578063313ce567146101f957600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152600a8152692532b9bab99021b7b4b760b11b60208201525b6040516101819190611381565b60405180910390f35b34801561019657600080fd5b506101aa6101a53660046113eb565b610416565b6040519015158152602001610181565b3480156101c657600080fd5b506005545b604051908152602001610181565b3480156101e557600080fd5b506101aa6101f4366004611417565b61042d565b34801561020557600080fd5b5060405160068152602001610181565b34801561022157600080fd5b5061022a610496565b005b34801561023857600080fd5b5061022a6104ba565b34801561024d57600080fd5b5061022a6104d9565b34801561026257600080fd5b506009546101cb565b34801561027757600080fd5b506101cb610286366004611458565b6001600160a01b031660009081526002602052604090205490565b3480156102ad57600080fd5b5061022a610765565b3480156102c257600080fd5b5061022a6102d1366004611458565b610809565b3480156102e257600080fd5b506000546040516001600160a01b039091168152602001610181565b34801561030a57600080fd5b506040805180820190915260028152614a4360f01b6020820152610174565b34801561033557600080fd5b5061022a610344366004611475565b610841565b34801561035557600080fd5b506101aa6103643660046113eb565b61086a565b34801561037557600080fd5b5061022a610877565b34801561038a57600080fd5b506101cb61039936600461148e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156103d057600080fd5b5061022a6103df366004611458565b6108a7565b3480156103f057600080fd5b5061022a6108e2565b6101aa6109e9565b34801561040d57600080fd5b5061022a610a74565b6000610423338484610adb565b5060015b92915050565b600061043a848484610bff565b61048c843361048785604051806060016040528060288152602001611642602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610f3d565b610adb565b5060019392505050565b6007546001600160a01b031633146104ad57600080fd5b476104b781610f77565b50565b6007546001600160a01b031633146104d157600080fd5b600554600855565b6007546001600160a01b031633146104f057600080fd5b600b54600160a01b900460ff161561054f5760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600a5460055461056c9130916001600160a01b0390911690610adb565b600a60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e391906114c7565b6001600160a01b031663c9c6539630600a60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610645573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066991906114c7565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156106b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106da91906114c7565b600b80546001600160a01b0319166001600160a01b03928316908117909155600a5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b791906114e4565b6000546001600160a01b031633146107bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610546565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316331461082057600080fd5b6001600160a01b03166000908152600460205260409020805460ff19169055565b6007546001600160a01b0316331461085857600080fd5b600a811061086557600080fd5b600655565b6000610423338484610bff565b6007546001600160a01b0316331461088e57600080fd5b306000908152600260205260409020546104b781610fb5565b6007546001600160a01b031633146108be57600080fd5b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6007546001600160a01b031633146108f957600080fd5b600a546001600160a01b031663f305d719473061092b816001600160a01b031660009081526002602052604090205490565b6000806109406000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109a8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109cd9190611506565b5050600b805462ff00ff60a01b19166201000160a01b17905550565b30600090815260026020526040812054341015610a535760405162461bcd60e51b815260206004820152602260248201527f496e73756666696369656e7420616d6f756e7420666f7220696e64756c67656e604482015261636560f01b6064820152608401610546565b50336000908152600460205260409020805460ff1916600190811790915590565b6007546001600160a01b03163314610a8b57600080fd5b6000600955565b6000610ad483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061112f565b9392505050565b6001600160a01b038316610b3d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610546565b6001600160a01b038216610b9e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610546565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c635760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610546565b6001600160a01b038216610cc55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610546565b60008111610d275760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610546565b6001600160a01b03831660009081526004602052604090205460ff16610d8d57600954600b546001600160a01b038481169116148015610d755750600a546001600160a01b03858116911614155b610d80576000610d82565b815b1115610d8d57600080fd5b6000546001600160a01b03848116911614801590610db957506000546001600160a01b03838116911614155b15610edc57600b546001600160a01b038481169116148015610de95750600a546001600160a01b03838116911614155b8015610e0e57506001600160a01b03821660009081526004602052604090205460ff16155b15610e64576008548110610e645760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610546565b30600090815260026020526040902054600b54600160a81b900460ff16158015610e9c5750600b546001600160a01b03858116911614155b8015610eb15750600b54600160b01b900460ff165b15610eda57610ebf81610fb5565b47670de0b6b3a76400008110610ed857610ed847610f77565b505b505b6001600160a01b038216600090815260046020526040902054610f389084908490849060ff1680610f2557506001600160a01b03871660009081526004602052604090205460ff165b610f315760065461115d565b600061115d565b505050565b60008184841115610f615760405162461bcd60e51b81526004016105469190611381565b506000610f6e848661154a565b95945050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610fb1573d6000803e3d6000fd5b5050565b600b805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ffd57610ffd611561565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611056573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107a91906114c7565b8160018151811061108d5761108d611561565b6001600160a01b039283166020918202929092010152600a546110b39130911684610adb565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110ec908590600090869030904290600401611577565b600060405180830381600087803b15801561110657600080fd5b505af115801561111a573d6000803e3d6000fd5b5050600b805460ff60a81b1916905550505050565b600081836111505760405162461bcd60e51b81526004016105469190611381565b506000610f6e84866115e8565b6000611174606461116e8585611261565b90610a92565b9050600061118284836112e0565b6001600160a01b0387166000908152600260205260409020549091506111a890856112e0565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546111d79082611322565b6001600160a01b0386166000908152600260205260408082209290925530815220546112039083611322565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b60008261127057506000610427565b600061127c838561160a565b90508261128985836115e8565b14610ad45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610546565b6000610ad483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f3d565b60008061132f8385611629565b905083811015610ad45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610546565b600060208083528351808285015260005b818110156113ae57858101830151858201604001528201611392565b818111156113c0576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104b757600080fd5b600080604083850312156113fe57600080fd5b8235611409816113d6565b946020939093013593505050565b60008060006060848603121561142c57600080fd5b8335611437816113d6565b92506020840135611447816113d6565b929592945050506040919091013590565b60006020828403121561146a57600080fd5b8135610ad4816113d6565b60006020828403121561148757600080fd5b5035919050565b600080604083850312156114a157600080fd5b82356114ac816113d6565b915060208301356114bc816113d6565b809150509250929050565b6000602082840312156114d957600080fd5b8151610ad4816113d6565b6000602082840312156114f657600080fd5b81518015158114610ad457600080fd5b60008060006060848603121561151b57600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b60008282101561155c5761155c611534565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156115c75784516001600160a01b0316835293830193918301916001016115a2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261160557634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561162457611624611534565b500290565b6000821982111561163c5761163c611534565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208bb366635d54da7a19eeeef6feaa9f71101f29fb45b56301bfa7d2254ea3d0df64736f6c634300080a0033
|
{"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,473 |
0x25295842c2d94076f9e6c4bec978e8f706c86e24
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// 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;
}
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);
uint256 c = _a - _b;
return c;
}
/**
* @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 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, 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 owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is owned, ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
// string public name;
// string public symbol;
// uint8 public decimals;
// uint256 public totalSupply_;
// constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public {
// name = _name;
// symbol = _symbol;
// decimals = _decimals;
// totalSupply_ = _totalSupply;
// }
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balances[target] += mintedAmount;
totalSupply_ += mintedAmount;
emit Transfer(0, this, mintedAmount);
emit Transfer(this, target, mintedAmount);
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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 HeapXCoin is StandardToken {
string public constant name = "HeapX Coin";
string public constant symbol = "HEAP";
uint8 public constant decimals = 8;
uint256 public constant TOTAL_SUPPLY = 300000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = TOTAL_SUPPLY;
balances[msg.sender] = TOTAL_SUPPLY;
emit Transfer(address(0), msg.sender, TOTAL_SUPPLY);
}
}
|
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f2578063661884631461021d57806370a082311461024157806379c65068146102625780638da5cb5b14610288578063902d55a5146102b957806395d89b41146102ce578063a9059cbb146102e3578063d73dd62314610307578063dd62ed3e1461032b578063f2fde38b14610352575b600080fd5b3480156100eb57600080fd5b506100f4610373565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a03600435166024356103aa565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b6610410565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a0360043581169060243516604435610416565b3480156101fe57600080fd5b5061020761057b565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b5061018d600160a060020a0360043516602435610580565b34801561024d57600080fd5b506101b6600160a060020a036004351661066f565b34801561026e57600080fd5b50610286600160a060020a036004351660243561068a565b005b34801561029457600080fd5b5061029d61071c565b60408051600160a060020a039092168252519081900360200190f35b3480156102c557600080fd5b506101b661072b565b3480156102da57600080fd5b506100f4610736565b3480156102ef57600080fd5b5061018d600160a060020a036004351660243561076d565b34801561031357600080fd5b5061018d600160a060020a036004351660243561083c565b34801561033757600080fd5b506101b6600160a060020a03600435811690602435166108d5565b34801561035e57600080fd5b50610286600160a060020a0360043516610900565b60408051808201909152600a81527f486561705820436f696e00000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b600160a060020a03831660009081526001602052604081205482111561043b57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561046b57600080fd5b600160a060020a038316151561048057600080fd5b600160a060020a0384166000908152600160205260409020546104a9908363ffffffff61094616565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104de908363ffffffff61095a16565b600160a060020a038085166000908152600160209081526040808320949094559187168152600282528281203382529091522054610522908363ffffffff61094616565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020610971833981519152929181900390910190a35060019392505050565b600881565b336000908152600260209081526040808320600160a060020a03861684529091528120548083106105d457336000908152600260209081526040808320600160a060020a0388168452909152812055610609565b6105e4818463ffffffff61094616565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526001602052604090205490565b600054600160a060020a031633146106a157600080fd5b600160a060020a0382166000908152600160209081526040808320805485019055600380548501905580518481529051309392600080516020610971833981519152928290030190a3604080518281529051600160a060020a0384169130916000805160206109718339815191529181900360200190a35050565b600054600160a060020a031681565b666a94d74f43000081565b60408051808201909152600481527f4845415000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526001602052604081205482111561078957600080fd5b600160a060020a038316151561079e57600080fd5b336000908152600160205260409020546107be908363ffffffff61094616565b3360009081526001602052604080822092909255600160a060020a038516815220546107f0908363ffffffff61095a16565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233926000805160206109718339815191529281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610870908363ffffffff61095a16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600054600160a060020a0316331461091757600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000808383111561095357fe5b5050900390565b60008282018381101561096957fe5b93925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820776d9854cb6d8663dd68cb5f1335c8d8fdb3e0e4ca71fa8645d7a67ea29f20560029
|
{"success": true, "error": null, "results": {}}
| 3,474 |
0x33411694c42e71208315357f8e354b33f4c6b056
|
/**
*Submitted for verification at Etherscan.io on 2021-08-07
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BabyCovid19 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyCovid19 | t.me/BabyCovid19";
string private constant _symbol = "BabyCovid";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 9;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "1");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 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 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 9;
}
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 + (600 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ee0565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a03565b61045e565b6040516101789190612ec5565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613082565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b4565b61048d565b6040516101e09190612ec5565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612926565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f7565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a80565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612926565b610783565b6040516102b19190613082565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df7565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ee0565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a03565b61098d565b60405161035b9190612ec5565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3f565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad2565b6110d2565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612978565b61121c565b6040516104189190613082565b60405180910390f35b60606040518060400160405280601e81526020017f42616279436f7669643139207c20742e6d652f42616279436f76696431390000815250905090565b600061047261046b6112a3565b84846112ab565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611476565b61055b846104a66112a3565b610556856040518060600160405280602881526020016137bb60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c369092919063ffffffff16565b6112ab565b600190509392505050565b61056e6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc2565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc2565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a3565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c9a565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d95565b9050919050565b6107dc6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f42616279436f7669640000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a3565b8484611476565b6001905092915050565b6109b36112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc2565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613398565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a3565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e03565b50565b610b7d6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc2565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613022565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112ab565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294f565b6040518363ffffffff1660e01b8152600401610e1f929190612e12565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294f565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e64565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612afb565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612e3b565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612aa9565b5050565b6110da6112a3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612fc2565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612f82565b60405180910390fd5b6111da6127106111cc83683635c9adc5dea000006120fd90919063ffffffff16565b61217890919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112119190613082565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131290613042565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138290612f42565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114699190613082565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd90613002565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611556576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154d90612f02565b60405180910390fd5b60008111611599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159090612fe2565b60405180910390fd5b6115a1610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160f57506115df610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7357600f60179054906101000a900460ff1615611842573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116eb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117455750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184157600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178b6112a3565b73ffffffffffffffffffffffffffffffffffffffff1614806118015750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e96112a3565b73ffffffffffffffffffffffffffffffffffffffff16145b611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183790613062565b60405180910390fd5b5b5b60105481111561185157600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f55750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fe57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ff5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a175750600f60179054906101000a900460ff165b15611ab95742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6757600080fd5b61025842611a7591906131b8565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac430610783565b9050600f60159054906101000a900460ff16158015611b315750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b495750600f60169054906101000a900460ff165b15611b7157611b5781611e03565b60004790506000811115611b6f57611b6e47611c9a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c1a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2457600090505b611c30848484846121c2565b50505050565b6000838311158290611c7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c759190612ee0565b60405180910390fd5b5060008385611c8d9190613299565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cea60028461217890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d15573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6660028461217890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d91573d6000803e3d6000fd5b5050565b6000600654821115611ddc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd390612f22565b60405180910390fd5b6000611de66121ef565b9050611dfb818461217890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e61577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8f5781602001602082028036833780820191505090505b5090503081600081518110611ecd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6f57600080fd5b505afa158015611f83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa7919061294f565b81600181518110611fe1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ab565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120ac95949392919061309d565b600060405180830381600087803b1580156120c657600080fd5b505af11580156120da573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121105760009050612172565b6000828461211e919061323f565b905082848261212d919061320e565b1461216d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216490612fa2565b60405180910390fd5b809150505b92915050565b60006121ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061221a565b905092915050565b806121d0576121cf61227d565b5b6121db8484846122ae565b806121e9576121e8612479565b5b50505050565b60008060006121fc61248a565b91509150612213818361217890919063ffffffff16565b9250505090565b60008083118290612261576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122589190612ee0565b60405180910390fd5b5060008385612270919061320e565b9050809150509392505050565b600060085414801561229157506000600954145b1561229b576122ac565b600060088190555060006009819055505b565b6000806000806000806122c0876124ec565b95509550955095509550955061231e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ff816125fc565b61240984836126b9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124669190613082565b60405180910390a3505050505050505050565b600260088190555060098081905550565b600080600060065490506000683635c9adc5dea0000090506124c0683635c9adc5dea0000060065461217890919063ffffffff16565b8210156124df57600654683635c9adc5dea000009350935050506124e8565b81819350935050505b9091565b60008060008060008060008060006125098a6008546009546126f3565b92509250925060006125196121ef565b9050600080600061252c8e878787612789565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c36565b905092915050565b60008082846125ad91906131b8565b9050838110156125f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e990612f62565b60405180910390fd5b8091505092915050565b60006126066121ef565b9050600061261d82846120fd90919063ffffffff16565b905061267181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126ce8260065461255490919063ffffffff16565b6006819055506126e98160075461259e90919063ffffffff16565b6007819055505050565b60008060008061271f6064612711888a6120fd90919063ffffffff16565b61217890919063ffffffff16565b90506000612749606461273b888b6120fd90919063ffffffff16565b61217890919063ffffffff16565b9050600061277282612764858c61255490919063ffffffff16565b61255490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a285896120fd90919063ffffffff16565b905060006127b986896120fd90919063ffffffff16565b905060006127d087896120fd90919063ffffffff16565b905060006127f9826127eb858761255490919063ffffffff16565b61255490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282561282084613137565b613112565b9050808382526020820190508285602086028201111561284457600080fd5b60005b85811015612874578161285a888261287e565b845260208401935060208301925050600181019050612847565b5050509392505050565b60008135905061288d81613775565b92915050565b6000815190506128a281613775565b92915050565b600082601f8301126128b957600080fd5b81356128c9848260208601612812565b91505092915050565b6000813590506128e18161378c565b92915050565b6000815190506128f68161378c565b92915050565b60008135905061290b816137a3565b92915050565b600081519050612920816137a3565b92915050565b60006020828403121561293857600080fd5b60006129468482850161287e565b91505092915050565b60006020828403121561296157600080fd5b600061296f84828501612893565b91505092915050565b6000806040838503121561298b57600080fd5b60006129998582860161287e565b92505060206129aa8582860161287e565b9150509250929050565b6000806000606084860312156129c957600080fd5b60006129d78682870161287e565b93505060206129e88682870161287e565b92505060406129f9868287016128fc565b9150509250925092565b60008060408385031215612a1657600080fd5b6000612a248582860161287e565b9250506020612a35858286016128fc565b9150509250929050565b600060208284031215612a5157600080fd5b600082013567ffffffffffffffff811115612a6b57600080fd5b612a77848285016128a8565b91505092915050565b600060208284031215612a9257600080fd5b6000612aa0848285016128d2565b91505092915050565b600060208284031215612abb57600080fd5b6000612ac9848285016128e7565b91505092915050565b600060208284031215612ae457600080fd5b6000612af2848285016128fc565b91505092915050565b600080600060608486031215612b1057600080fd5b6000612b1e86828701612911565b9350506020612b2f86828701612911565b9250506040612b4086828701612911565b9150509250925092565b6000612b568383612b62565b60208301905092915050565b612b6b816132cd565b82525050565b612b7a816132cd565b82525050565b6000612b8b82613173565b612b958185613196565b9350612ba083613163565b8060005b83811015612bd1578151612bb88882612b4a565b9750612bc383613189565b925050600181019050612ba4565b5085935050505092915050565b612be7816132df565b82525050565b612bf681613322565b82525050565b6000612c078261317e565b612c1181856131a7565b9350612c21818560208601613334565b612c2a8161346e565b840191505092915050565b6000612c426023836131a7565b9150612c4d8261347f565b604082019050919050565b6000612c65602a836131a7565b9150612c70826134ce565b604082019050919050565b6000612c886022836131a7565b9150612c938261351d565b604082019050919050565b6000612cab601b836131a7565b9150612cb68261356c565b602082019050919050565b6000612cce601d836131a7565b9150612cd982613595565b602082019050919050565b6000612cf16021836131a7565b9150612cfc826135be565b604082019050919050565b6000612d146020836131a7565b9150612d1f8261360d565b602082019050919050565b6000612d376029836131a7565b9150612d4282613636565b604082019050919050565b6000612d5a6025836131a7565b9150612d6582613685565b604082019050919050565b6000612d7d6001836131a7565b9150612d88826136d4565b602082019050919050565b6000612da06024836131a7565b9150612dab826136fd565b604082019050919050565b6000612dc36011836131a7565b9150612dce8261374c565b602082019050919050565b612de28161330b565b82525050565b612df181613315565b82525050565b6000602082019050612e0c6000830184612b71565b92915050565b6000604082019050612e276000830185612b71565b612e346020830184612b71565b9392505050565b6000604082019050612e506000830185612b71565b612e5d6020830184612dd9565b9392505050565b600060c082019050612e796000830189612b71565b612e866020830188612dd9565b612e936040830187612bed565b612ea06060830186612bed565b612ead6080830185612b71565b612eba60a0830184612dd9565b979650505050505050565b6000602082019050612eda6000830184612bde565b92915050565b60006020820190508181036000830152612efa8184612bfc565b905092915050565b60006020820190508181036000830152612f1b81612c35565b9050919050565b60006020820190508181036000830152612f3b81612c58565b9050919050565b60006020820190508181036000830152612f5b81612c7b565b9050919050565b60006020820190508181036000830152612f7b81612c9e565b9050919050565b60006020820190508181036000830152612f9b81612cc1565b9050919050565b60006020820190508181036000830152612fbb81612ce4565b9050919050565b60006020820190508181036000830152612fdb81612d07565b9050919050565b60006020820190508181036000830152612ffb81612d2a565b9050919050565b6000602082019050818103600083015261301b81612d4d565b9050919050565b6000602082019050818103600083015261303b81612d70565b9050919050565b6000602082019050818103600083015261305b81612d93565b9050919050565b6000602082019050818103600083015261307b81612db6565b9050919050565b60006020820190506130976000830184612dd9565b92915050565b600060a0820190506130b26000830188612dd9565b6130bf6020830187612bed565b81810360408301526130d18186612b80565b90506130e06060830185612b71565b6130ed6080830184612dd9565b9695505050505050565b600060208201905061310c6000830184612de8565b92915050565b600061311c61312d565b90506131288282613367565b919050565b6000604051905090565b600067ffffffffffffffff8211156131525761315161343f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c38261330b565b91506131ce8361330b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613203576132026133e1565b5b828201905092915050565b60006132198261330b565b91506132248361330b565b92508261323457613233613410565b5b828204905092915050565b600061324a8261330b565b91506132558361330b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328e5761328d6133e1565b5b828202905092915050565b60006132a48261330b565b91506132af8361330b565b9250828210156132c2576132c16133e1565b5b828203905092915050565b60006132d8826132eb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332d8261330b565b9050919050565b60005b83811015613352578082015181840152602081019050613337565b83811115613361576000848401525b50505050565b6133708261346e565b810181811067ffffffffffffffff8211171561338f5761338e61343f565b5b80604052505050565b60006133a38261330b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d6576133d56133e1565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f3100000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377e816132cd565b811461378957600080fd5b50565b613795816132df565b81146137a057600080fd5b50565b6137ac8161330b565b81146137b757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ca1079fe4b1429e868a1379d073405b8b291921a5e170d7c035487bbb166fc8e64736f6c63430008040033
|
{"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,475 |
0x82898cf46c000f42bc4a94217758d799cc4e2308
|
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠤⠤⢤⠤⢀⠀⢀⠀⣀⠔⠄⠀⠐⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⡀⠄⢀⣿⡟⡀⠀⠠⣭⠕⠀⠀⠀⠈⠱⣿⣶⣷⡅⠀⢁⠀⠁
// ⠀⠀⠀⡀⠀⠂⠁⣀⣀⣾⣿⣥⣤⡴⣿⡏⢠⢆⠀⠀⢀⠀⠙⠟⡻⠃⠀⢸⡡⠀
// ⠀⡀⠈⠀⠀⠀⣠⡶⠛⢻⠛⣿⢺⣁⢁⢇⢸⠀⠆⠄⠈⣄⢤⣷⠁⠄⠠⠾⢋⠂
// ⠀⠀⠀⠀⣠⣾⠏⠀⠀⡄⠀⢸⠡⠻⠂⠀⠂⢘⣾⡜⡄⢇⠠⢺⡄⠈⠂⠈⠀⠀
// ⠁⡀⠀⠈⠉⣱⢄⡀⠀⠃⠀⠈⠀⠈⠀⠀⠀⠠⠌⠁⡿⠪⢔⢿⣿⣄⠑⠓⠀⠀
// ⠀⠈⠢⡀⣼⠳⠟⡛⠂⠴⢀⢠⣄⠀⠀⠐⠀⠀⡈⠐⡅⠆⡈⠀⠙⠿⠡⠦⠔⠀
// ⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⢸⡆⡿⠷⣀⠐⠀⣸⠄⣰⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠐⠐⢄⢠⣾⣍⡄⠀⠉⠛⠋⠩⠞⠛⣃⣽⡀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢼⣮⣹⣿⣏⣷⠟⠿⣽⣯⣶⡟⠉⠈⡇⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣬⣽⣿⢰⡶⣿⣿⢹⣾⠀⠀⠀⢷⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣉⠉⡛⠟⣮⣤⣿⣿⠀⠀⣬⠈⢂⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢀⣾⢞⡿⠿⠿⠇⠀⢿⣼⣿⣿⣿⡿⠒⠖⡈⢆⠈⠄⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⡼⠡⠀⢷⣶⣤⡄⠀⠀⠙⣻⣿⣟⢁⣠⡴⠔⠈⡆⠈⠄⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠃⠸⠴⠿⣿⣇⣰⣶⣤⣀⣁⡀⠙⠯⠪⠦⠀⠒⠒⠀⠀⠀⠀⠀
//
//
// Telegram: https://t.me/aquafinanceportal
// Website: https://aquafinance.io
//
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 AQUA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Liquid Finance";
string private constant _symbol = "AQUA";
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 _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
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(0xD9B638f1aaC77b13110Fce069D8a4BE9718Df6E7);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createNewPair() 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);
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
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]) {
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)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function 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 >= _maxTxAmount);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636d8aa8f81161010d578063881dce60116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b8063881dce60146105185780638da5cb5b146105385780638f9a55c01461055657806395d89b411461056c57600080fd5b806374010ece116100dc57806374010ece146104b7578063790ca413146104d75780637c519ffb146104ed5780637d1db4a51461050257600080fd5b80636d8aa8f81461044d5780636fc3eaec1461046d57806370a0823114610482578063715018a6146104a257600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d85780634bf2c7c9146103f85780635996c6b0146104185780635d098b381461042d57600080fd5b80632fd689e314610366578063313ce5671461037c57806333251a0b1461039857806338eea22d146103b857600080fd5b806318160ddd116101c157806318160ddd146102e857806323b872dd1461030e57806327c8f8351461032e57806328bb665a1461034457600080fd5b806306fdde03146101fe578063095ea7b3146102475780630f3a325f146102775780631694505e146102b057600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600e81526d4c69717569642046696e616e636560901b60208201525b60405161023e9190611d00565b60405180910390f35b34801561025357600080fd5b50610267610262366004611d7a565b61065f565b604051901515815260200161023e565b34801561028357600080fd5b50610267610292366004611da6565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102bc57600080fd5b506016546102d0906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102f457600080fd5b50683635c9adc5dea000005b60405190815260200161023e565b34801561031a57600080fd5b50610267610329366004611dc3565b610676565b34801561033a57600080fd5b506102d061dead81565b34801561035057600080fd5b5061036461035f366004611e1a565b6106df565b005b34801561037257600080fd5b50610300601a5481565b34801561038857600080fd5b506040516009815260200161023e565b3480156103a457600080fd5b506103646103b3366004611da6565b61077e565b3480156103c457600080fd5b506103646103d3366004611edf565b6107ed565b3480156103e457600080fd5b506017546102d0906001600160a01b031681565b34801561040457600080fd5b50610364610413366004611f01565b610822565b34801561042457600080fd5b50610364610851565b34801561043957600080fd5b50610364610448366004611da6565b610a36565b34801561045957600080fd5b50610364610468366004611f1a565b610a90565b34801561047957600080fd5b50610364610ad8565b34801561048e57600080fd5b5061030061049d366004611da6565b610b02565b3480156104ae57600080fd5b50610364610b24565b3480156104c357600080fd5b506103646104d2366004611f01565b610b98565b3480156104e357600080fd5b50610300600a5481565b3480156104f957600080fd5b50610364610bd6565b34801561050e57600080fd5b5061030060185481565b34801561052457600080fd5b50610364610533366004611f01565b610c30565b34801561054457600080fd5b506000546001600160a01b03166102d0565b34801561056257600080fd5b5061030060195481565b34801561057857600080fd5b506040805180820190915260048152634151554160e01b6020820152610231565b3480156105a557600080fd5b506102676105b4366004611d7a565b610cac565b3480156105c557600080fd5b506103646105d4366004611edf565b610cb9565b3480156105e557600080fd5b506103006105f4366004611f3c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036461063a366004611f01565b610cee565b34801561064b57600080fd5b5061036461065a366004611da6565b610d2c565b600061066c338484610e16565b5060015b92915050565b6000610683848484610f3a565b6106d584336106d085604051806060016040528060288152602001612117602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906115a3565b610e16565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611f75565b60405180910390fd5b60005b815181101561077a5760016009600084848151811061073657610736611faa565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061077281611fd6565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611f75565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611f75565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611f75565b601155565b6000546001600160a01b0316331461087b5760405162461bcd60e51b815260040161070990611f75565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156108db57600080fd5b505afa1580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109139190611ff1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561095b57600080fd5b505afa15801561096f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109939190611ff1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109db57600080fd5b505af11580156109ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a139190611ff1565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6015546001600160a01b0316336001600160a01b031614610a5657600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b03163314610aba5760405162461bcd60e51b815260040161070990611f75565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b031614610af857600080fd5b476107ea816115dd565b6001600160a01b03811660009081526002602052604081205461067090611617565b6000546001600160a01b03163314610b4e5760405162461bcd60e51b815260040161070990611f75565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610bc25760405162461bcd60e51b815260040161070990611f75565b601854811015610bd157600080fd5b601855565b6000546001600160a01b03163314610c005760405162461bcd60e51b815260040161070990611f75565b601754600160a01b900460ff1615610c1757600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610c5057600080fd5b610c5930610b02565b8111158015610c685750600081115b610ca35760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea8161169b565b600061066c338484610f3a565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161070990611f75565b600c91909155600e55565b6000546001600160a01b03163314610d185760405162461bcd60e51b815260040161070990611f75565b601954811015610d2757600080fd5b601955565b6000546001600160a01b03163314610d565760405162461bcd60e51b815260040161070990611f75565b6001600160a01b038116610dbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e785760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610ed95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f9e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b0382166110005760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b600081116110625760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff161561109b5760405162461bcd60e51b81526004016107099061200e565b6001600160a01b03831660009081526009602052604090205460ff16156110d45760405162461bcd60e51b81526004016107099061200e565b3360009081526009602052604090205460ff16156111045760405162461bcd60e51b81526004016107099061200e565b6000546001600160a01b0384811691161480159061113057506000546001600160a01b03838116911614155b1561144d57601754600160a01b900460ff1661118e5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b0383811691161480156111b957506016546001600160a01b03848116911614155b15611228576001600160a01b03821630148015906111e057506001600160a01b0383163014155b80156111fa57506015546001600160a01b03838116911614155b801561121457506015546001600160a01b03848116911614155b156112285760185481111561122857600080fd5b6017546001600160a01b0383811691161480159061125457506015546001600160a01b03838116911614155b801561126957506001600160a01b0382163014155b801561128057506001600160a01b03821661dead14155b15611347576018548111156112d75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b601954816112e484610b02565b6112ee9190612035565b106113475760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b600061135230610b02565b601a5490915081118080156113715750601754600160a81b900460ff16155b801561138b57506017546001600160a01b03868116911614155b80156113a05750601754600160b01b900460ff165b80156113c557506001600160a01b03851660009081526006602052604090205460ff16155b80156113ea57506001600160a01b03841660009081526006602052604090205460ff16155b1561144a57601154600090156114255761141a60646114146011548661182490919063ffffffff16565b906118a3565b9050611425816118e5565b611437611432828561204d565b61169b565b47801561144757611447476115dd565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061148f57506001600160a01b03831660009081526006602052604090205460ff165b806114c157506017546001600160a01b038581169116148015906114c157506017546001600160a01b03848116911614155b156114ce57506000611591565b6017546001600160a01b0385811691161480156114f957506016546001600160a01b03848116911614155b15611554576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a541415611554576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561157f57506016546001600160a01b03858116911614155b1561159157600d54600f55600e546010555b61159d848484846118f2565b50505050565b600081848411156115c75760405162461bcd60e51b81526004016107099190611d00565b5060006115d4848661204d565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b600060075482111561167e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b6000611688611926565b905061169483826118a3565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106116e3576116e3611faa565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561173757600080fd5b505afa15801561174b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176f9190611ff1565b8160018151811061178257611782611faa565b6001600160a01b0392831660209182029290920101526016546117a89130911684610e16565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac947906117e1908590600090869030904290600401612064565b600060405180830381600087803b1580156117fb57600080fd5b505af115801561180f573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261183357506000610670565b600061183f83856120d5565b90508261184c85836120f4565b146116945760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b600061169483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611949565b6107ea3061dead83610f3a565b806118ff576118ff611977565b61190a8484846119bc565b8061159d5761159d601254600f55601354601055601454601155565b6000806000611933611ab3565b909250905061194282826118a3565b9250505090565b6000818361196a5760405162461bcd60e51b81526004016107099190611d00565b5060006115d484866120f4565b600f541580156119875750601054155b80156119935750601154155b1561199a57565b600f805460125560108054601355601180546014556000928390559082905555565b6000806000806000806119ce87611af5565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a009087611b52565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a2f9086611b94565b6001600160a01b038916600090815260026020526040902055611a5181611bf3565b611a5b8483611c3d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611aa091815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611acf82826118a3565b821015611aec57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611b128a600f54601054611c61565b9250925092506000611b22611926565b90506000806000611b358e878787611cb0565b919e509c509a509598509396509194505050505091939550919395565b600061169483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115a3565b600080611ba18385612035565b9050838110156116945760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611bfd611926565b90506000611c0b8383611824565b30600090815260026020526040902054909150611c289082611b94565b30600090815260026020526040902055505050565b600754611c4a9083611b52565b600755600854611c5a9082611b94565b6008555050565b6000808080611c7560646114148989611824565b90506000611c8860646114148a89611824565b90506000611ca082611c9a8b86611b52565b90611b52565b9992985090965090945050505050565b6000808080611cbf8886611824565b90506000611ccd8887611824565b90506000611cdb8888611824565b90506000611ced82611c9a8686611b52565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611d2d57858101830151858201604001528201611d11565b81811115611d3f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107ea57600080fd5b8035611d7581611d55565b919050565b60008060408385031215611d8d57600080fd5b8235611d9881611d55565b946020939093013593505050565b600060208284031215611db857600080fd5b813561169481611d55565b600080600060608486031215611dd857600080fd5b8335611de381611d55565b92506020840135611df381611d55565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611e2d57600080fd5b823567ffffffffffffffff80821115611e4557600080fd5b818501915085601f830112611e5957600080fd5b813581811115611e6b57611e6b611e04565b8060051b604051601f19603f83011681018181108582111715611e9057611e90611e04565b604052918252848201925083810185019188831115611eae57600080fd5b938501935b82851015611ed357611ec485611d6a565b84529385019392850192611eb3565b98975050505050505050565b60008060408385031215611ef257600080fd5b50508035926020909101359150565b600060208284031215611f1357600080fd5b5035919050565b600060208284031215611f2c57600080fd5b8135801515811461169457600080fd5b60008060408385031215611f4f57600080fd5b8235611f5a81611d55565b91506020830135611f6a81611d55565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611fea57611fea611fc0565b5060010190565b60006020828403121561200357600080fd5b815161169481611d55565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b6000821982111561204857612048611fc0565b500190565b60008282101561205f5761205f611fc0565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120b45784516001600160a01b03168352938301939183019160010161208f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008160001904831182151516156120ef576120ef611fc0565b500290565b60008261211157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ce0e5bde643ee1a7c256f8a6380753bf0f3f22a7e1eef9c502ce64dbd4d558ec64736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,476 |
0xb6ec8c3a347f66a3d7c4f39d6dd68a422e69e81d
|
pragma solidity ^0.4.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
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));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
contract CatholicCoin is BurnableToken, Ownable {
string public constant name = "Catholic Coin";
string public constant symbol = "CTC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 250000000 * (10 ** uint256(decimals));
// Constructors
function CatholicCoin () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce56714610285578063378dc3dc146102b057806342966c68146102db578063661884631461030857806370a082311461036d5780638da5cb5b146103c457806395d89b411461041b578063a9059cbb146104ab578063d73dd62314610510578063dd62ed3e14610575578063f2fde38b146105ec575b600080fd5b3480156100ec57600080fd5b506100f561062f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610668565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea61075a565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610760565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610a4c565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610a51565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b5061030660048036038101908080359060200190929190505050610a5f565b005b34801561031457600080fd5b50610353600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c28565b604051808215151515815260200191505060405180910390f35b34801561037957600080fd5b506103ae600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eb9565b6040518082815260200191505060405180910390f35b3480156103d057600080fd5b506103d9610f02565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042757600080fd5b50610430610f28565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610470578082015181840152602081019050610455565b50505050905090810190601f16801561049d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104b757600080fd5b506104f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f61565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b5061055b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611137565b604051808215151515815260200191505060405180910390f35b34801561058157600080fd5b506105d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611333565b6040518082815260200191505060405180910390f35b3480156105f857600080fd5b5061062d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ba565b005b6040805190810160405280600d81526020017f436174686f6c696320436f696e0000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561079f57600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061087083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095b838261151290919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a630ee6b2800281565b60008082111515610a6f57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610abd57600080fd5b339050610b1282600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6a8260005461151290919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d39576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcd565b610d4c838261151290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f435443000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f9e57600080fd5b610ff082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108582600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006111c882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561145257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561152057fe5b818303905092915050565b600080828401905083811015151561153f57fe5b80915050929150505600a165627a7a72305820a035482d14898d98ce32a179f6120ece31c9a669b4889b4b7b7b20a6e7d854be0029
|
{"success": true, "error": null, "results": {}}
| 3,477 |
0xa4e39a9e503ce2a4f7d416096cf5e2d2922f092e
|
pragma solidity ^0.4.24;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
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;
uint256 value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint256 value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint256 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 {
event DailyLimitChange(uint dailyLimit);
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
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
return dailyLimit - spentToday;
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610931565b34801561029a57600080fd5b506102436004356109b5565b3480156102b257600080fd5b506102be600435610a24565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610ae2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b45565b3480156103f757600080fd5b50610376600435610c7e565b34801561040f57600080fd5b50610243610df7565b34801561042457600080fd5b5061015c600435610dfd565b34801561043c57600080fd5b5061015c600435610e74565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f3f9650505050505050565b3480156104bd57600080fd5b50610243610f5e565b3480156104d257600080fd5b50610243610f63565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f69565b34801561050e57600080fd5b5061015c6004356110f3565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b6003805460001901906106679082611343565b5060035460045411156106805760035461068090610dfd565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b600380549050600101600454603282118061087857508181115b80610881575080155b8061088a575081155b1561089457600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109ae576000848152600160205260408120600380549192918490811061095f57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610993576001820191505b6004548214156109a657600192506109ae565b600101610936565b5050919050565b6000805b600354811015610a1e57600083815260016020526040812060038054919291849081106109e257fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a16576001820191505b6001016109b9565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610acf5780601f10610aa457610100808354040283529160200191610acf565b820191906000526020600020905b815481529060010190602001808311610ab257829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b3a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b1c575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b77578160200160208202803883390190505b50925060009150600090505b600554811015610bfe57858015610bac575060008181526020819052604090206003015460ff16155b80610bd05750848015610bd0575060008181526020819052604090206003015460ff165b15610bf657808383815181101515610be457fe5b60209081029091010152600191909101905b600101610b83565b878703604051908082528060200260200182016040528015610c2a578160200160208202803883390190505b5093508790505b86811015610c73578281815181101515610c4757fe5b9060200190602002015184898303815181101515610c6157fe5b60209081029091010152600101610c31565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cb3578160200160208202803883390190505b50925060009150600090505b600354811015610d705760008581526001602052604081206003805491929184908110610ce857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d68576003805482908110610d2357fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d4957fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cbf565b81604051908082528060200260200182016040528015610d9a578160200160208202803883390190505b509350600090505b81811015610def578281815181101515610db857fe5b906020019060200201518482815181101515610dd057fe5b600160a060020a03909216602092830290910190910152600101610da2565b505050919050565b60055481565b333014610e0957600080fd5b600354816032821180610e1b57508181115b80610e24575080155b80610e2d575081155b15610e3757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610e9257600080fd5b6000828152602081905260409020548290600160a060020a03161515610eb757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ee257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f38856110f3565b5050505050565b6000610f4c848484611253565b9050610f5781610e74565b9392505050565b603281565b60045481565b6000333014610f7757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fa057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fc857600080fd5b600092505b6003548310156110595784600160a060020a0316600384815481101515610ff057fe5b600091825260209091200154600160a060020a0316141561104e578360038481548110151561101b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611059565b600190920191610fcd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff161561111457600080fd5b61111d83610931565b1561124e576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156111cb5780601f106111a0576101008083540402835291602001916111cb565b820191906000526020600020905b8154815290600101906020018083116111ae57829003601f168201915b505091505060006040518083038185875af192505050156112165760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261124e565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b505050565b600083600160a060020a038116151561126b57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926112eb926002850192910190611367565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561124e5760008381526020902061124e9181019083016113e5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113a857805160ff19168380011785556113d5565b828001600101855582156113d5579182015b828111156113d55782518255916020019190600101906113ba565b506113e19291506113e5565b5090565b610b4291905b808211156113e157600081556001016113eb5600a165627a7a723058209d55dc5e7ef74f3ec6a6df89e31ba2e01233c40c6741b48931befa1a6be589070029
|
{"success": true, "error": null, "results": {}}
| 3,478 |
0xcb84b415bd61839d4af48f2926aa05d4039429c2
|
/**
*Submitted for verification at BscScan.com on 2021-11-06
*/
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
pragma solidity 0.8.9;
/**
* @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;
}
}
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ApplePie is Context, Ownable {
using SafeMath for uint256;
uint256 private PIES_TO_OVEN_1MINERS = 1080000;//for final version should be seconds in a day
uint256 private PSN = 10000;
uint256 private PSNH = 5000;
uint256 private devFeeVal = 3;
bool private initialized = false;
address payable private recAdd;
mapping (address => uint256) private ovenryMiners;
mapping (address => uint256) private claimedPies;
mapping (address => uint256) private lastOven;
mapping (address => address) private referrals;
uint256 private marketPies;
constructor() {
recAdd = payable(msg.sender);
}
function ovenPies(address ref) public {
require(initialized);
if(ref == msg.sender) {
ref = address(0);
}
if(referrals[msg.sender] == address(0) && referrals[msg.sender] != msg.sender) {
referrals[msg.sender] = ref;
}
uint256 piesUsed = getMyPies(msg.sender);
uint256 newMiners = SafeMath.div(piesUsed,PIES_TO_OVEN_1MINERS);
ovenryMiners[msg.sender] = SafeMath.add(ovenryMiners[msg.sender],newMiners);
claimedPies[msg.sender] = 0;
lastOven[msg.sender] = block.timestamp;
//send referral Pies
claimedPies[referrals[msg.sender]] = SafeMath.add(claimedPies[referrals[msg.sender]],SafeMath.div(piesUsed,8));
//boost market to nerf miners hoarding
marketPies=SafeMath.add(marketPies,SafeMath.div(piesUsed,5));
}
function sellPies() public {
require(initialized);
uint256 hasPies = getMyPies(msg.sender);
uint256 pieValue = calculatePieSell(hasPies);
uint256 fee = devFee(pieValue);
claimedPies[msg.sender] = 0;
lastOven[msg.sender] = block.timestamp;
marketPies = SafeMath.add(marketPies,hasPies);
recAdd.transfer(fee);
payable (msg.sender).transfer(SafeMath.sub(pieValue,fee));
}
function beanRewards(address adr) public view returns(uint256) {
uint256 hasPies = getMyPies(adr);
uint256 pieValue = calculatePieSell(hasPies);
return pieValue;
}
function buyPies(address ref) public payable {
require(initialized);
uint256 piesBought = calculatePieBuy(msg.value,SafeMath.sub(address(this).balance,msg.value));
piesBought = SafeMath.sub(piesBought,devFee(piesBought));
uint256 fee = devFee(msg.value);
recAdd.transfer(fee);
claimedPies[msg.sender] = SafeMath.add(claimedPies[msg.sender],piesBought);
ovenPies(ref);
}
function calculateTrade(uint256 rt,uint256 rs, uint256 bs) private view returns(uint256) {
return SafeMath.div(SafeMath.mul(PSN,bs),SafeMath.add(PSNH,SafeMath.div(SafeMath.add(SafeMath.mul(PSN,rs),SafeMath.mul(PSNH,rt)),rt)));
}
function calculatePieSell(uint256 pies) public view returns(uint256) {
return calculateTrade(pies,marketPies,address(this).balance);
}
function calculatePieBuy(uint256 eth,uint256 contractBalance) public view returns(uint256) {
return calculateTrade(eth,contractBalance,marketPies);
}
function calculatePieBuySimple(uint256 eth) public view returns(uint256) {
return calculatePieBuy(eth,address(this).balance);
}
function devFee(uint256 amount) private view returns(uint256) {
return SafeMath.div(SafeMath.mul(amount,devFeeVal),100);
}
function seedMarket() public payable onlyOwner {
require(marketPies == 0);
initialized = true;
marketPies = 108000000000;
}
function getBalance() public view returns(uint256) {
return address(this).balance;
}
function getMyMiners(address adr) public view returns(uint256) {
return ovenryMiners[adr];
}
function getMyPies(address adr) public view returns(uint256) {
return SafeMath.add(claimedPies[adr],getPieSinceLastOven(adr));
}
function getPieSinceLastOven(address adr) public view returns(uint256) {
uint256 secondsPassed=min(PIES_TO_OVEN_1MINERS,SafeMath.sub(block.timestamp,lastOven[adr]));
return SafeMath.mul(secondsPassed,ovenryMiners[adr]);
}
function min(uint256 a, uint256 b) private pure returns (uint256) {
return a < b ? a : b;
}
}
|
0x6080604052600436106100e85760003560e01c8063802d56a31161008a578063a507abee11610059578063a507abee146102b4578063b9cc5130146102f1578063d61fa39b1461032e578063f2fde38b1461036b576100e8565b8063802d56a3146101f85780638da5cb5b146102355780639046caee146102605780639774cd4914610277576100e8565b80634b634b06116100c65780634b634b061461013e578063579b57cc1461017b5780636cfd170e146101b8578063715018a6146101e1576100e8565b806312065fe0146100ed5780632f466f7b146101185780633c5f07cb14610134575b600080fd5b3480156100f957600080fd5b50610102610394565b60405161010f91906111f9565b60405180910390f35b610132600480360381019061012d9190611277565b61039c565b005b61013c6104f0565b005b34801561014a57600080fd5b5061016560048036038101906101609190611277565b6105bd565b60405161017291906111f9565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d91906112d0565b610606565b6040516101af91906111f9565b60405180910390f35b3480156101c457600080fd5b506101df60048036038101906101da9190611277565b610619565b005b3480156101ed57600080fd5b506101f6610abc565b005b34801561020457600080fd5b5061021f600480360381019061021a9190611277565b610c0f565b60405161022c91906111f9565b60405180910390f35b34801561024157600080fd5b5061024a610c69565b604051610257919061130c565b60405180910390f35b34801561026c57600080fd5b50610275610c92565b005b34801561028357600080fd5b5061029e60048036038101906102999190611327565b610e2b565b6040516102ab91906111f9565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611277565b610e42565b6040516102e891906111f9565b60405180910390f35b3480156102fd57600080fd5b50610318600480360381019061031391906112d0565b610e67565b60405161032591906111f9565b60405180910390f35b34801561033a57600080fd5b5061035560048036038101906103509190611277565b610e7d565b60405161036291906111f9565b60405180910390f35b34801561037757600080fd5b50610392600480360381019061038d9190611277565b610f27565b005b600047905090565b600560009054906101000a900460ff166103b557600080fd5b60006103ca346103c54734610fc8565b610e2b565b90506103de816103d983610fde565b610fc8565b905060006103eb34610fde565b9050600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610455573d6000803e3d6000fd5b5061049f600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ffd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506104eb83610619565b505050565b6104f8611013565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610585576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057c906113c4565b60405180910390fd5b6000600a541461059457600080fd5b6001600560006101000a81548160ff0219169083151502179055506419254d3800600a81905550565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006106128247610e2b565b9050919050565b600560009054906101000a900460ff1661063257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561066b57600090505b600073ffffffffffffffffffffffffffffffffffffffff16600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614801561079157503373ffffffffffffffffffffffffffffffffffffffff16600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b156108155780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600061082033610c0f565b905060006108308260015461101b565b905061087b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610ffd565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f960076000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109f484600861101b565b610ffd565b60076000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ab1600a54610aac84600561101b565b610ffd565b600a81905550505050565b610ac4611013565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906113c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610c62600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c5d84610e7d565b610ffd565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600560009054906101000a900460ff16610cab57600080fd5b6000610cb633610c0f565b90506000610cc382610e67565b90506000610cd082610fde565b90506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d67600a5484610ffd565b600a81905550600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610dd5573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc610dfa8484610fc8565b9081150290604051600060405180830381858888f19350505050158015610e25573d6000803e3d6000fd5b50505050565b6000610e3a8383600a54611031565b905092915050565b600080610e4e83610c0f565b90506000610e5b82610e67565b90508092505050919050565b6000610e7682600a5447611031565b9050919050565b600080610ed4600154610ecf42600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fc8565b611084565b9050610f1f81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461109d565b915050919050565b610f2f611013565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb3906113c4565b60405180910390fd5b610fc5816110b3565b50565b60008183610fd69190611413565b905092915050565b6000610ff6610fef8360045461109d565b606461101b565b9050919050565b6000818361100b9190611447565b905092915050565b600033905090565b6000818361102991906114cc565b905092915050565b600061107b6110426002548461109d565b61107660035461107161106b61105a6002548a61109d565b6110666003548c61109d565b610ffd565b8961101b565b610ffd565b61101b565b90509392505050565b60008183106110935781611095565b825b905092915050565b600081836110ab91906114fd565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611123576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111a906115c9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000819050919050565b6111f3816111e0565b82525050565b600060208201905061120e60008301846111ea565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061124482611219565b9050919050565b61125481611239565b811461125f57600080fd5b50565b6000813590506112718161124b565b92915050565b60006020828403121561128d5761128c611214565b5b600061129b84828501611262565b91505092915050565b6112ad816111e0565b81146112b857600080fd5b50565b6000813590506112ca816112a4565b92915050565b6000602082840312156112e6576112e5611214565b5b60006112f4848285016112bb565b91505092915050565b61130681611239565b82525050565b600060208201905061132160008301846112fd565b92915050565b6000806040838503121561133e5761133d611214565b5b600061134c858286016112bb565b925050602061135d858286016112bb565b9150509250929050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006113ae602083611367565b91506113b982611378565b602082019050919050565b600060208201905081810360008301526113dd816113a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061141e826111e0565b9150611429836111e0565b92508282101561143c5761143b6113e4565b5b828203905092915050565b6000611452826111e0565b915061145d836111e0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611492576114916113e4565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006114d7826111e0565b91506114e2836111e0565b9250826114f2576114f161149d565b5b828204905092915050565b6000611508826111e0565b9150611513836111e0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561154c5761154b6113e4565b5b828202905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006115b3602683611367565b91506115be82611557565b604082019050919050565b600060208201905081810360008301526115e2816115a6565b905091905056fea2646970667358221220a6fefb4b1f407522f9e86a22e60082e8d0c8882e667b18e88ee04eb4fb459e7264736f6c63430008090033
|
{"success": true, "error": null, "results": {}}
| 3,479 |
0x719a1d0ef6b0517dd5c22071119d1ef5535afb5e
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
To all the degens that missed out on MYOBU, this is your chance to redeem yourself! Lock + Renounce
https://t.me/SeishinFox
http://seishinfox.io
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 4 hours period are allowed, refreshes every 24hrs.
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 5-6% developer fee split within the team
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract Seishin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Seîshîn";
string private constant _symbol = "SEISHIN";
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 = 7;
uint256 private _teamFee = 5;
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 = 6;
_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 + (3 hours);
}
else if (sellnumber[from] == 3) {
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 = 3000000000 * 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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600981526020017f5365c3ae7368c3ae6e0000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5345495348494e00000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b9190505550612a3042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220699d40a481f7f6f2caa8d12f3cae904c065bc6156c138006dbb29a8ebf9b9f9664736f6c63430008040033
|
{"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,480 |
0xaf9ce02409c5e1549a1637446035dab83ab8ae70
|
pragma solidity ^0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/*
* BitdealCoin is a standard ERC20 token
*/
contract BitdealCoin is StandardToken, Ownable {
string public constant symbol = "BDC";
string public constant name = "Bitdeal Coin";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 300000000 * (10 ** uint256(decimals));
// Address of token admin
address public adminAddr;
/**
* Check if address is a valid destination to transfer tokens to
* - must not be zero address
* - must not be the token address
* - must not be the admin's address
* - must not be the token offering contract address
*/
modifier validDestination(address to) {
require(to != address(0x0));
require(to != address(this));
require(to != owner);
require(to != address(adminAddr));
_;
}
/**
* Token contract constructor
*
* @param admin Address of admin account
*/
function BitdealCoin(address admin) public {
totalSupply_ = INITIAL_SUPPLY;
// Mint tokens
balances[msg.sender] = totalSupply_;
emit Transfer(address(0x0), msg.sender, totalSupply_);
// Approve allowance for admin account
adminAddr = admin;
approve(adminAddr, totalSupply_);
}
/**
* Transfer from sender to another account
*
* @param to Destination address
* @param value Amount of BitdealCoins to send
*/
function transfer(address to, uint256 value) public validDestination(to) returns (bool) {
return super.transfer(to, value);
}
/**
* Transfer from `from` account to `to` account using allowance in `from` account to the sender
*
* @param from Origin address
* @param to Destination address
* @param value Amount of BitdealCoins to send
*/
function transferFrom(address from, address to, uint256 value) public validDestination(to) returns (bool) {
return super.transferFrom(from, to, value);
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd146102005780632ff2e9dc14610285578063313ce567146102b057806366188463146102e157806370a0823114610346578063818305931461039d5780638da5cb5b146103f457806395d89b411461044b578063a9059cbb146104db578063d73dd62314610540578063dd62ed3e146105a5578063f2fde38b1461061c575b600080fd5b3480156100ec57600080fd5b506100f561065f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610698565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea61078a565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610794565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a6108dd565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c56108ee565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102ed57600080fd5b5061032c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f3565b604051808215151515815260200191505060405180910390f35b34801561035257600080fd5b50610387600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b84565b6040518082815260200191505060405180910390f35b3480156103a957600080fd5b506103b2610bcc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561040057600080fd5b50610409610bf2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561045757600080fd5b50610460610c18565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a0578082015181840152602081019050610485565b50505050905090810190601f1680156104cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104e757600080fd5b50610526600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c51565b604051808215151515815260200191505060405180910390f35b34801561054c57600080fd5b5061058b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d98565b604051808215151515815260200191505060405180910390f35b3480156105b157600080fd5b50610606600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f94565b6040518082815260200191505060405180910390f35b34801561062857600080fd5b5061065d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061101b565b005b6040805190810160405280600c81526020017f4269746465616c20436f696e000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107d357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561080e57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561086b57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156108c857600080fd5b6108d3858585611173565b9150509392505050565b601260ff16600a0a6311e1a3000281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610a04576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a98565b610a17838261152d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f424443000000000000000000000000000000000000000000000000000000000081525081565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c9057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ccb57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d2857600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d8557600080fd5b610d8f8484611546565b91505092915050565b6000610e2982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156110b357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156111b057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111fd57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561128857600080fd5b6112d9826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061143d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561153b57fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561158357600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156115d057600080fd5b611621826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116b4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561177857fe5b809050929150505600a165627a7a7230582029bd04e89a5c16fdd85e43f7a8300bb60246cd7ae63941b266c70f90ecf01b540029
|
{"success": true, "error": null, "results": {}}
| 3,481 |
0x5c3095c53743b8857d6e1d107e5014cdc7b44efc
|
pragma solidity 0.4.4;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after 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 {
event DailyLimitChange(uint dailyLimit);
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
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
return dailyLimit - spentToday;
}
}
|
0x606060405236156101325760e060020a6000350463025e7c278114610180578063173825d9146101b257806320ea8d86146101df5780632f54bf6e146102135780633411c81c146102335780634bc9fdc214610260578063547415251461028357806367eeba0c146102f75780636b0c932d146103055780637065cb4814610313578063784547a71461033e5780638b51d13f1461034e5780639ace38c2146103c2578063a0e67e2b146103fd578063a8abe69a1461046e578063b5dc40c31461054d578063b77bf60014610659578063ba51a6df14610667578063c01a8c8414610693578063c6427474146106a3578063cea0862114610714578063d74f8edd1461073f578063dc8452cd1461074c578063e20056e61461075a578063ee22610b1461078a578063f059cf2b1461079a575b6107a8600034111561017e57604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b565b34610002576107aa60043560038054829081101561000257600091825260209091200154600160a060020a0316905081565b34610002576107a8600435600030600160a060020a031633600160a060020a0316141515610a1a57610002565b34610002576107a8600435600160a060020a033390811660009081526002602052604090205460ff161515610c5f57610002565b34610002576107c660043560026020526000908152604090205460ff1681565b34610002576001602090815260043560009081526040808220909252602435815220546107c69060ff1681565b34610002576107da6007546000906201518001421115610d0f5750600654610d18565b34610002576107da6004356024356000805b600554811015610d1b578380156102be575060008181526020819052604090206003015460ff16155b806102e257508280156102e2575060008181526020819052604090206003015460ff165b156102ef57600191909101905b600101610295565b34610002576107da60065481565b34610002576107da60075481565b34610002576107a860043530600160a060020a031633600160a060020a0316141515610d2257610002565b34610002576107c6600435610801565b34610002576107da6004356000805b600354811015610e52576000838152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156103ba57600191909101905b60010161035d565b34610002576000602081905260043581526040902080546001820154600383015461087993600160a060020a03909316926002019060ff1684565b346100025760408051602080820183526000825260038054845181840281018401909552808552610923949283018282801561046257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610444575b50505050509050610d18565b34610002576109236004356024356044356064356040805160208181018352600080835283519182018452808252600554935192939192909182918059106104b35750595b9080825280602002602001820160405280156104ca575b509250600091508190505b600554811015610e58578580156104fe575060008181526020819052604090206003015460ff16155b806105225750848015610522575060008181526020819052604090206003015460ff165b156105455780838381518110156100025760209081029091010152600191909101905b6001016104d5565b34610002576109236004356040805160208181018352600080835283519182018452808252600354935192939192909182918059106105895750595b9080825280602002602001820160405280156105a0575b509250600091508190505b600354811015610ecd576000858152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561065157600380548290811015610002576000918252602090912001548351600160a060020a03909116908490849081101561000257600160a060020a03909216602092830290910190910152600191909101905b6001016105ab565b34610002576107da60055481565b34610002576107a86004355b30600160a060020a031633600160a060020a0316141515610f4957610002565b34610002576107a8600435610974565b3461000257604080516020600460443581810135601f81018490048402850184019095528484526107da948235946024803595606494929391909201918190840183828082843750949650505050505050600061096d848484600083600160a060020a0381161515610b6157610002565b34610002576107a860043530600160a060020a031633600160a060020a031614151561101457610002565b34610002576107da603281565b34610002576107da60045481565b34610002576107a8600435602435600030600160a060020a031633600160a060020a031614151561104f57610002565b34610002576107a86004356109f7565b34610002576107da60085481565b005b60408051600160a060020a039092168252519081900360200190f35b604080519115158252519081900360200190f35b60408051918252519081900360200190f35b600084815260208190526040902092506111c2845b600080805b600354811015610872576000848152600160205260408120600380549192918490811015610002576000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561086357600191909101905b600454821415610e4a57600192505b5050919050565b60408051600160a060020a03861681526020810185905282151560608201526080918101828152845460026000196101006001841615020190911604928201839052909160a0830190859080156109115780601f106108e657610100808354040283529160200191610911565b820191906000526020600020905b8154815290600101906020018083116108f457829003601f168201915b50509550505050505060405180910390f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b905061100d815b33600160a060020a03811660009081526002602052604090205460ff161515610fb457610002565b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610ce6855b6000818152602081905260408120600301548190839060ff16156107ec57610002565b600160a060020a038216600090815260026020526040902054829060ff161515610a4357610002565b600160a060020a0383166000908152600260205260408120805460ff1916905591505b60035460001901821015610b085782600160a060020a0316600360005083815481101561000257600091825260209091200154600160a060020a03161415610b3857600380546000198101908110156100025760009182526020909120015460038054600160a060020a039092169184908110156100025760009182526020909120018054600160a060020a031916606060020a928302929092049190911790555b600380546000198101808355919082908015829011610b4357600083815260209020610b43918101908301610c0e565b600190910190610a66565b505060035460045411159150610c26905057600354610c2690610673565b60055460408051608081018252878152602080820188815282840188815260006060850181905286815280845294852084518154606060020a91820291909104600160a060020a031990911617815591516001808401919091559051805160028085018054818a5298879020999b5096989497601f9481161561010002600019011604830185900484019490939291019083901061137e57805160ff19168380011785555b506113ae9291505b80821115610c225760008155600101610c0e565b5090565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff161515610cee57610002565b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35b505b50505050565b600084815260208190526040902060030154849060ff1615610c9457610002565b50600854600654035b90565b5092915050565b600160a060020a038116600090815260026020526040902054819060ff1615610d4a57610002565b81600160a060020a0381161515610d6057610002565b6003546004546001909101906032821180610d7a57508181115b80610d83575080155b80610d8c575081155b15610d9657610002565b600160a060020a0385166000908152600260205260409020805460ff19166001908117909155600380549182018082559091908281838015829011610dec57600083815260209020610dec918101908301610c0e565b50505060009283525060208220018054600160a060020a031916606060020a88810204179055604051600160a060020a038716917ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d91a25050505050565b600101610806565b50919050565b878703604051805910610e685750595b908082528060200260200182016040528015610e7f575b5093508790505b86811015610ec2578281815181101561000257906020019060200201518489830381518110156100025760209081029091010152600101610e86565b505050949350505050565b81604051805910610edb5750595b908082528060200260200182016040528015610ef2575b509350600090505b81811015610f41578281815181101561000257906020019060200201518482815181101561000257600160a060020a03909216602092830290910190910152600101610efa565b505050919050565b600354816032821180610f5b57508181115b80610f64575080155b80610f6d575081155b15610f7757610002565b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b6000828152602081905260409020548290600160a060020a03161515610fd957610002565b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561099c57610002565b9392505050565b60068190556040805182815290517fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca29181900360200190a150565b600160a060020a038316600090815260026020526040902054839060ff16151561107857610002565b600160a060020a038316600090815260026020526040902054839060ff16156110a057610002565b600092505b60035483101561111d5784600160a060020a0316600360005084815481101561000257600091825260209091200154600160a060020a031614156111b7578360036000508481548110156100025760009182526020909120018054600160a060020a031916606060020a928302929092049190911790555b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b6001909201916110a5565b9150818061123157506002808401546000196101006001831615020116041580156112315750600183015461123190600754600090620151800142111561120d574260075560006008555b600654600854830111806112245750600854828101105b1561141057506000611414565b15610ce85760038301805460ff1916600117905581151561125b5760018301546008805490910190555b825460018085015460405160028088018054600160a060020a039096169593949093839285926000199083161561010002019091160480156112de5780601f106112b3576101008083540402835291602001916112de565b820191906000526020600020905b8154815290600101906020018083116112c157829003601f168201915b505091505060006040518083038185876185025a03f1925050501561132d5760405184907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610ce8565b60405184907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038301805460ff19169055811515610ce8575050600101546008805491909103905550565b82800160010185558215610c06579182015b82811115610c06578251826000505591602001919060010190611390565b5050606091909101516003909101805460ff191660f860020a9283029290920491909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b5060015b91905056
|
{"success": true, "error": null, "results": {}}
| 3,482 |
0x329e67be6f22ec48852310648383959689719ad3
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
/**
💥 #YatoInuToken: One of a kind peer-to-peer Token powered by the Ethereum blockchain.
#YATO is the main protagonist of the anime/manga series Noragami.
Minor god who desires to be worshipped as 'God of Fortune’.
💥 Despite coming across as lazy, selfish, greedy, and an outright pervert most of the time..
deep down inside his soul lies a diligent and determined spirit — a spirit that many of us
could perhaps look to for inspiration on our own journeys as degenerate traders. ⚔️
🗡 NO PRE-SALE or DROPS
🗡 LP LOCKED FOR 1 MONTH
• Will Extend At Milestone
🗡 32K Starting MC
🗡 Starting Supply: 1 Trillion
🗡 10% Buy • 10% Sell Tax
• Taxes Decrease Post-Launch
🗡 Contract Safe & Verified
🗡 Experienced Dev + Team
• Active Community + Mods
🗡 NFT Collection Debut
🗡 Competitions & Contests
🎙 Tele: t.me/YatoInu
🎙 Twit: @YatoInuToken
🎙 Website: yatoinu.com
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract YatoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'Yato Inu ' ;
string private _symbol = 'YATO ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220dacb489bce86ab6d35544d5b0e5aad7113770f0d1c8286fd1f13e5cbab6ab07564736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,483 |
0xe9d1507f80f457a1250a9f9d3901d2348ac56b30
|
//https://t.me/independencedoge
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract IndependenceDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1776000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Independence Doge";
string private constant _symbol = 'FREEDOGE️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610785565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085e565b005b34801561033357600080fd5b5061033c610981565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098a565b005b34801561039e57600080fd5b506103a7610a6f565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae1565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcc565b005b34801561043157600080fd5b5061043a610d52565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db8565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd6565b005b34801561063857600080fd5b50610641610f26565b005b34801561064f57600080fd5b50610658610fa0565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160d565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117bb565b6040518082815260200191505060405180910390f35b60606040518060400160405280601181526020017f496e646570656e64656e636520446f6765000000000000000000000000000000815250905090565b600061076b610764611842565b848461184a565b6001905092915050565b60006718a59e9721180000905090565b6000610792848484611a41565b6108538461079e611842565b61084e85604051806060016040528060288152602001613d8f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610804611842565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123059092919063ffffffff16565b61184a565b600190509392505050565b610866611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610992611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab0611842565b73ffffffffffffffffffffffffffffffffffffffff1614610ad057600080fd5b6000479050610ade816123c5565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7c57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc7565b610bc4600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c0565b90505b919050565b610bd4611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c94576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f46524545444f4745efb88f000000000000000000000000000000000000000000815250905090565b6000610dcc610dc5611842565b8484611a41565b6001905092915050565b610dde611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2257600160076000848481518110610ebc57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea1565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f67611842565b73ffffffffffffffffffffffffffffffffffffffff1614610f8757600080fd5b6000610f9230610ae1565b9050610f9d81612544565b50565b610fa8611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611068576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117a30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166718a59e972118000061184a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c057600080fd5b505afa1580156111d4573d6000803e3d6000fd5b505050506040513d60208110156111ea57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125d57600080fd5b505afa158015611271573d6000803e3d6000fd5b505050506040513d602081101561128757600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130157600080fd5b505af1158015611315573d6000803e3d6000fd5b505050506040513d602081101561132b57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c530610ae1565b6000806113d0610d52565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145557600080fd5b505af1158015611469573d6000803e3d6000fd5b50505050506040513d606081101561148057600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115ce57600080fd5b505af11580156115e2573d6000803e3d6000fd5b505050506040513d60208110156115f857600080fd5b81019080805190602001909291905050505050565b611615611842565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611779606461176b836718a59e972118000061282e90919063ffffffff16565b6128b490919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e056024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611956576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d4c6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ac7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613de06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cff6023913960400191505060405180910390fd5b60008111611ba6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613db76029913960400191505060405180910390fd5b611bae610d52565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1c5750611bec610d52565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224257601360179054906101000a900460ff1615611e82573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c9e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cf85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d525750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8157601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d98611842565b73ffffffffffffffffffffffffffffffffffffffff161480611e0e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df6611842565b73ffffffffffffffffffffffffffffffffffffffff16145b611e80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7257601454811115611ec457600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f685750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7157600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561201d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120735750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208b5750601360179054906101000a900460ff165b156121235742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120db57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061212e30610ae1565b9050601360159054906101000a900460ff1615801561219b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b35750601360169054906101000a900460ff165b1561224057601360179054906101000a900460ff161561221d576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221c57600080fd5b5b61222681612544565b6000479050600081111561223e5761223d476123c5565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122e95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f357600090505b6122ff848484846128fe565b50505050565b60008383111582906123b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237757808201518184015260208101905061235c565b50505050905090810190601f1680156123a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124156002846128b490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612440573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124916002846128b490919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124bc573d6000803e3d6000fd5b5050565b6000600a5482111561251d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d22602a913960400191505060405180910390fd5b6000612527612b55565b905061253c81846128b490919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257957600080fd5b506040519080825280602002602001820160405280156125a85781602001602082028036833780820191505090505b50905030816000815181106125b957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265b57600080fd5b505afa15801561266f573d6000803e3d6000fd5b505050506040513d602081101561268557600080fd5b8101908080519060200190929190505050816001815181106126a357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270a30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184a565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127ce5780820151818401526020810190506127b3565b505050509050019650505050505050600060405180830381600087803b1580156127f757600080fd5b505af115801561280b573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561284157600090506128ae565b600082840290508284828161285257fe5b04146128a9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d6e6021913960400191505060405180910390fd5b809150505b92915050565b60006128f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b80565b905092915050565b8061290c5761290b612c46565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129af5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c4576129bf848484612c89565b612b41565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a675750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7c57612a77848484612ee9565b612b40565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b1e5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3357612b2e848484613149565b612b3f565b612b3e84848461343e565b5b5b5b80612b4f57612b4e613609565b5b50505050565b6000806000612b6261361d565b91509150612b7981836128b490919063ffffffff16565b9250505090565b60008083118290612c2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bf1578082015181840152602081019050612bd6565b50505050905090810190601f168015612c1e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3857fe5b049050809150509392505050565b6000600c54148015612c5a57506000600d54145b15612c6457612c87565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c9b876138c6565b955095509550955095509550612cf987600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d8e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e6f81613a00565b612e798483613ba5565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612efb876138c6565b955095509550955095509550612f5986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fee83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130cf81613a00565b6130d98483613ba5565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061315b876138c6565b9550955095509550955095506131b987600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061324e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e383600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c481613a00565b6133ce8483613ba5565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613450876138c6565b9550955095509550955095506134ae86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061358f81613a00565b6135998483613ba5565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a54905060006718a59e9721180000905060005b60098054905081101561387d5782600260006009848154811061365657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061373d57508160036000600984815481106136d557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375a57600a546718a59e9721180000945094505050506138c2565b6137e3600260006009848154811061376e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461392e90919063ffffffff16565b925061386e60036000600984815481106137f957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361392e90919063ffffffff16565b91508080600101915050613637565b5061389b6718a59e9721180000600a546128b490919063ffffffff16565b8210156138b957600a546718a59e97211800009350935050506138c2565b81819350935050505b9091565b60008060008060008060008060006138e38a600c54600d54613bdf565b92509250925060006138f3612b55565b905060008060006139068e878787613c75565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061397083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612305565b905092915050565b6000808284019050838110156139f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a0a612b55565b90506000613a21828461282e90919063ffffffff16565b9050613a7581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613ba057613b5c83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397890919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bba82600a5461392e90919063ffffffff16565b600a81905550613bd581600b5461397890919063ffffffff16565b600b819055505050565b600080600080613c0b6064613bfd888a61282e90919063ffffffff16565b6128b490919063ffffffff16565b90506000613c356064613c27888b61282e90919063ffffffff16565b6128b490919063ffffffff16565b90506000613c5e82613c50858c61392e90919063ffffffff16565b61392e90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c8e858961282e90919063ffffffff16565b90506000613ca5868961282e90919063ffffffff16565b90506000613cbc878961282e90919063ffffffff16565b90506000613ce582613cd7858761392e90919063ffffffff16565b61392e90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200c05031b1f8836b0e7b42647dbe54b662d32e9ac7479da4cae468c070d876c3264736f6c634300060c0033
|
{"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,484 |
0x9ae5c1cf82af51cbb83d9a7b1c52af4b48e0bb5e
|
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.0 <0.8.0;
interface IMultisig {
function owners() external view returns (address[] memory addresses, uint256[] memory vPowers);
function request() external view returns (address destination, uint256 value, bytes memory data);
function requestProgress() external view returns (uint32 requestId, uint256 timestamp, uint16 currentVote, uint16 requiredVote);
function voteRequirement() external view returns (uint16 requiredVote, uint16 totalVote);
function hasVoted(address owner) external view returns (bool voted, uint16 vPower);
function createRequest(address destination, uint256 value, bytes memory data) external returns (bool);
function vote() external returns (bool);
function cancelRequest() external returns (bool);
function changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate) external returns (bool);
event Requested(uint256 requestId, address indexed destination, uint256 value, bytes data, uint16 currentVote, uint16 requiredVote);
event Voted(address owner, uint256 requestId, uint16 currentVote, uint16 requiredVote);
event Executed(bool status, uint256 requestId, address indexed destination, uint256 value, bytes data);
event Cancelled(uint256 requestId);
event OwnersChanged(address[] owners, uint16 requireVote, uint16 totalVote);
event Deposited(address indexed sender, uint256 value);
}
contract Coin98Multisig is IMultisig {
address[] private _owners;
mapping(address => uint16) private _votePowers;
VoteRequirement private _voteRequirement;
uint32 private _requestId;
Request private _request;
mapping(address => uint32) private _votes;
VoteProgress private _voteProgress;
/// @dev Initialize wallet, with a list of initial owners
/// @param owners_ Array of owners's address
/// @param vPowers_ Array of voting weight of the owners, owner with vPower == 0 will be ignored
/// @param requiredVote_ Number of votes needed to execute the request
constructor(address[] memory owners_, uint16[] memory vPowers_, uint16 requiredVote_) {
_lock = _NOT_ENTERED;
_changeOwners(owners_, vPowers_, requiredVote_);
}
// Data structure to store information of a request
struct Request {
address destination;
uint256 value;
bytes data;
}
// Data structure to store information for the vote of current request
struct VoteProgress {
uint32 requestId;
uint16 currentVote;
uint16 requiredVote;
uint256 timestamp;
}
// Data structure to store information about voting weight
struct VoteRequirement {
uint16 requiredVote;
uint16 totalVote;
}
modifier selfOnly() {
require(msg.sender == address(this), "Coin98MSig: Wallet only");
_;
}
modifier isOwner(address owner) {
require(_votePowers[owner] > 0, "Coin98MSig: Not an owner");
_;
}
fallback() external payable {
if (msg.value > 0) {
emit Deposited(msg.sender, msg.value);
}
}
/// @dev enable wallet to receive ETH
receive() external payable {
if (msg.value > 0) {
emit Deposited(msg.sender, msg.value);
}
}
/// @dev return list of currents owners and their respective voting weight
/// @return addresses List of owners's address
/// @return vPowers List of owner's voting weight
function owners() external view override returns (address[] memory addresses, uint256[] memory vPowers) {
uint256[] memory values = new uint256[](_owners.length);
uint256 i;
for (i = 0; i < _owners.length; i++) {
values[i] = (_votePowers[_owners[i]]);
}
return (_owners, values);
}
/// @dev Return current request information
/// @return destination destination address of the recipient to interface with (address/contract...)
/// @return value value of ETH to send
/// @return data data data of the function call in ABI encoded format
function request() external view override returns (address destination, uint256 value, bytes memory data) {
Request memory req = _request;
return (req.destination, req.value, req.data);
}
/// @dev Return current number of votes vs required number of votes to execute request
/// @return requestId ID of current request
/// @return timestamp Timestamp when the request is created
/// @return currentVote Number of votes for current request
/// @return requiredVote Required number of votes to execute current request
function requestProgress() external view override returns (uint32 requestId, uint256 timestamp, uint16 currentVote, uint16 requiredVote) {
VoteProgress memory progress = _voteProgress;
return (progress.requestId, progress.timestamp, progress.currentVote, progress.requiredVote);
}
/// @dev Return required number of votes vs total number of votes of all owners
/// @return requiredVote Required number of votes to execute request
/// @return totalVote Total number of votes of all owners
function voteRequirement() external view override returns (uint16 requiredVote, uint16 totalVote) {
VoteRequirement memory requirement = _voteRequirement;
return (requirement.requiredVote, requirement.totalVote);
}
/// @dev Check whether a owner has voted
/// @return voted user's voting status
/// @return vPower voting weight of owner
function hasVoted(address owner) external view override returns (bool voted, uint16 vPower) {
VoteProgress memory progress = _voteProgress;
uint16 power = _votePowers[owner];
if (progress.requestId == 0) {
return (false, power);
}
return (progress.requestId == _votes[owner], power);
}
/// @dev Submit a new request for voting, the owner submitting request will count as voted.
/// @param destination address of the recipient to interface with (address/contract...)
/// @param value of ETH to send
/// @param data data of the function call in ABI encoded format
function createRequest(address destination, uint256 value, bytes memory data)
isOwner(msg.sender)
external override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId == 0, "Coin98MSig: Request pending");
Request memory req;
req.destination = destination;
req.value = value;
req.data = data;
progress.requestId = _requestId + 1;
progress.requiredVote = _voteRequirement.requiredVote;
progress.timestamp = block.timestamp;
_request = req;
_requestId = progress.requestId;
_voteProgress = progress;
vote();
emit Requested(progress.requestId, req.destination, req.value, req.data, progress.currentVote, progress.requiredVote);
return true;
}
/// @dev Owner vote for the current request. Then execute the request if enough votes
function vote()
isOwner(msg.sender)
nonReentrant()
public override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId > 0, "Coin98MSig: No pending request");
if (_votes[msg.sender] < progress.requestId) {
_votes[msg.sender] = progress.requestId;
progress.currentVote += _votePowers[msg.sender];
_voteProgress = progress;
emit Voted(msg.sender, progress.requestId, progress.currentVote, progress.requiredVote);
}
if (progress.currentVote >= progress.requiredVote) {
Request memory req = _request;
(bool success,) = req.destination.call{value: req.value}(req.data);
if (success) {
delete _request;
delete _voteProgress;
Executed(true, progress.requestId, req.destination, req.value, req.data);
}
else {
Executed(false, progress.requestId, req.destination, req.value, req.data);
}
}
return true;
}
/// @dev Cancel current request. Throw error if request does not exist
function cancelRequest()
isOwner(msg.sender)
external override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId > 0, "Coin98MSig: No pending request");
require(block.timestamp - progress.timestamp > 600, "Coin98MSig: 10 mins not passed");
delete _request;
delete _voteProgress;
emit Cancelled(progress.requestId);
return true;
}
/// @dev Add/remove/change owner, with their respective voting weight,
/// and number of votes needed to perform the request
/// @param nOwners Array of owners' address that need to change
/// @param vPowers Array of voting weight of the nOwners, vPower == 0 will remove the respective user
/// @param vRate New number of required votes to perform the request. vRate == 0 will keep the current number of required votes
function changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate)
selfOnly()
external override returns (bool) {
_changeOwners(nOwners, vPowers, vRate);
return true;
}
function _changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate) internal {
require(nOwners.length == vPowers.length, "Coin98MSig: Owners and vPowers length mismatch");
VoteRequirement memory requirement = _voteRequirement;
uint256 i;
for (i = 0; i < nOwners.length; i++) {
address nOwner = nOwners[i];
uint16 cPower = _votePowers[nOwner];
uint16 vPower = vPowers[i];
require(vPower <= 256, "Coin98MSig: Invalid vRate");
if (cPower > 0) {
if (vPower == 0) {
uint256 j;
for(j = 0; j < _owners.length; j++) {
if (_owners[j] == nOwner) {
_owners[j] = _owners[_owners.length - 1];
_owners.pop();
delete _votes[nOwner];
break;
}
}
}
requirement.totalVote -= cPower;
}
else {
if (vPower > 0) {
_owners.push(nOwner);
}
}
_votePowers[nOwner] = vPower;
requirement.totalVote += vPower;
}
if (vRate > 0) {
requirement.requiredVote = vRate;
}
uint256 ownerCount = _owners.length;
require(requirement.requiredVote > 0, "Coin98MSig: Invalid vRate");
require(requirement.requiredVote <= requirement.totalVote, "Coin98MSig: Invalid vRate");
require(requirement.totalVote <= 4096, "Coin98MSig: Max weight reached");
require(ownerCount > 0, "Coin98MSig: At least 1 owner");
require(ownerCount <= 64, "Coin98MSig: Max owner reached");
_voteRequirement = requirement;
OwnersChanged(nOwners, requirement.requiredVote, requirement.totalVote);
}
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _lastLockTimestamp;
uint256 private _lock;
/// @dev Prevents a contract from calling itself, directly or indirectly.
/// Calling a `nonReentrant` function from another `nonReentrant`
/// function is not supported. It is possible to prevent this from happening
/// by making the `nonReentrant` function external, and make it call a
/// `private` function that does the actual work.
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
// Add 24-hour timeout to unlock contract in case of deadlock
require(_lock != _ENTERED || block.timestamp - _lastLockTimestamp > 86400, "Coin98MSig: Reentrant call");
// Any calls to nonReentrant after this point will fail
_lastLockTimestamp = block.timestamp;
_lock = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_lock = _NOT_ENTERED;
}
}
contract Coin98MultisigFactory {
event Created(address indexed wallet, address[] owners);
/// @dev Create a new multisig wallet
/// @param owners_ Array of intial owners. If the list is empty, sending adress will be assigned as owner
/// @param vPowers_ Array of voting weight of the owners, owner with vPower == 0 will be ignored
/// @param requiredVote_ Number of votes needed to perform the request
function createMulitSig(address[] memory owners_, uint16[] memory vPowers_, uint16 requiredVote_)
external returns (Coin98Multisig wallet) {
wallet = new Coin98Multisig(owners_, vPowers_, requiredVote_);
emit Created(address(wallet), owners_);
}
}
|
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80636c7321a614610030575b600080fd5b6101886004803603606081101561004657600080fd5b810190808035906020019064010000000081111561006357600080fd5b82018360208201111561007557600080fd5b8035906020019184602083028401116401000000008311171561009757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156100f757600080fd5b82018360208201111561010957600080fd5b8035906020019184602083028401116401000000008311171561012b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803561ffff1690602001909291905050506101b4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008383836040516101c590610318565b8080602001806020018461ffff168152602001838103835286818151815260200191508051906020019060200280838360005b838110156102135780820151818401526020810190506101f8565b50505050905001838103825285818151815260200191508051906020019060200280838360005b8381101561025557808201518184015260208101905061023a565b5050505090500195505050505050604051809103906000f08015801561027f573d6000803e3d6000fd5b5090508073ffffffffffffffffffffffffffffffffffffffff167f694787aac3734be7a6541fa310452f9fafdbf616beacf2c5ceb0f89f92873489856040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102fe5780820151818401526020810190506102e3565b505050509050019250505060405180910390a29392505050565b61311280620003278339019056fe60806040523480156200001157600080fd5b506040516200311238038062003112833981810160405260608110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660208202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015620000c6578082015181840152602081019050620000a9565b5050505090500160405260200180516040519392919084640100000000821115620000f057600080fd5b838201915060208201858111156200010757600080fd5b82518660208202830111640100000000821117156200012557600080fd5b8083526020830192505050908051906020019060200280838360005b838110156200015e57808201518184015260208101905062000141565b50505050905001604052602001805190602001909291905050506001600b81905550620001938383836200019c60201b60201c565b505050620009d9565b8151835114620001f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180620030e4602e913960400191505060405180910390fd5b600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff1681525050905060005b8451811015620006495760008582815181106200026557fe5b602002602001015190506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1690506000868481518110620002d057fe5b602002602001015190506101008161ffff16111562000357576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b60008261ffff161115620005515760008161ffff161415620005315760005b6000805490508110156200052f578373ffffffffffffffffffffffffffffffffffffffff1660008281548110620003a957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141562000521576000600160008054905003815481106200040757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600082815481106200044057fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054806200049457fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549063ffffffff02191690556200052f565b808060010191505062000376565b505b81856020018181510391509061ffff16908161ffff1681525050620005c4565b60008161ffff161115620005c3576000839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555080856020018181510191509061ffff16908161ffff168152505050505080806001019150506200024c565b60008361ffff1611156200066c5782826000019061ffff16908161ffff16815250505b6000808054905090506000836000015161ffff1611620006f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b826020015161ffff16836000015161ffff1611156200077b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b611000836020015161ffff161115620007fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f436f696e39384d5369673a204d6178207765696768742072656163686564000081525060200191505060405180910390fd5b6000811162000873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f436f696e39384d5369673a204174206c656173742031206f776e65720000000081525060200191505060405180910390fd5b6040811115620008eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f436f696e39384d5369673a204d6178206f776e6572207265616368656400000081525060200191505060405180910390fd5b82600260008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff1602179055509050507f04eba5651eb98f2aa06a6942c0ef7f74b486ed22c9bdaf1c312e73305381ca46868460000151856020015160405180806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019060200280838360005b83811015620009bc5780820151818401526020810190506200099f565b5050505090500194505050505060405180910390a1505050505050565b6126fb80620009e96000396000f3fe60806040526004361061008a5760003560e01c8063851b16f511610059578063851b16f5146102d0578063951951df146102fd578063a75a62fc1461034b578063affe39c1146104c8578063f7347c291461057c576100e9565b806309eef43e14610143578063338cdca1146101b55780634997bc5114610269578063632a9a52146102a3576100e9565b366100e95760003411156100e7573373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4346040518082815260200191505060405180910390a25b005b6000341115610141573373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4346040518082815260200191505060405180910390a25b005b34801561014f57600080fd5b506101926004803603602081101561016657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610684565b6040518083151581526020018261ffff1681526020019250505060405180910390f35b3480156101c157600080fd5b506101ca6107ea565b604051808473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561022c578082015181840152602081019050610211565b50505050905090810190601f1680156102595780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561027557600080fd5b5061027e61091d565b604051808361ffff1681526020018261ffff1681526020019250505060405180910390f35b3480156102af57600080fd5b506102b8610984565b60405180821515815260200191505060405180910390f35b3480156102dc57600080fd5b506102e561127e565b60405180821515815260200191505060405180910390f35b34801561030957600080fd5b506103126115a2565b604051808563ffffffff1681526020018481526020018361ffff1681526020018261ffff16815260200194505050505060405180910390f35b34801561035757600080fd5b506104b06004803603606081101561036e57600080fd5b810190808035906020019064010000000081111561038b57600080fd5b82018360208201111561039d57600080fd5b803590602001918460208302840111640100000000831117156103bf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561041f57600080fd5b82018360208201111561043157600080fd5b8035906020019184602083028401116401000000008311171561045357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803561ffff16906020019092919050505061164c565b60405180821515815260200191505060405180910390f35b3480156104d457600080fd5b506104dd611705565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610524578082015181840152602081019050610509565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561056657808201518184015260208101905061054b565b5050505090500194505050505060405180910390f35b34801561058857600080fd5b5061066c6004803603606081101561059f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105e657600080fd5b8201836020820111156105f857600080fd5b8035906020019184600183028401116401000000008311171561061a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506118a9565b60405180821515815260200191505060405180910390f35b600080600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff16815260200160018201548152505090506000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1690506000826000015163ffffffff16141561077b576000819350935050506107e5565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff16826000015163ffffffff1614819350935050505b915091565b6000806060600060046040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108f75780601f106108cc576101008083540402835291602001916108f7565b820191906000526020600020905b8154815290600101906020018083116108da57829003601f168201915b505050505081525050905080600001518160200151826040015193509350935050909192565b600080600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff168152505090508060000151816020015192509250509091565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1611610a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f436f696e39384d5369673a204e6f7420616e206f776e6572000000000000000081525060200191505060405180910390fd5b6002600b54141580610a66575062015180600a544203115b610ad8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f696e39384d5369673a205265656e7472616e742063616c6c00000000000081525060200191505060405180910390fd5b42600a819055506002600b81905550600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff16815260200160018201548152505090506000816000015163ffffffff1611610be8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f436f696e39384d5369673a204e6f2070656e64696e672072657175657374000081525060200191505060405180910390fd5b806000015163ffffffff16600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff161015610e15578060000151600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff16816020018181510191509061ffff16908161ffff168152505080600860008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548161ffff021916908361ffff16021790555060408201518160000160066101000a81548161ffff021916908361ffff160217905550606082015181600101559050507fb62dce311d7c82a5291a71ec8f2ce830fc6c1840dc13838a1a80baf7ba186b4133826000015183602001518460400151604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018463ffffffff1681526020018361ffff1681526020018261ffff16815260200194505050505060405180910390a15b806040015161ffff16816020015161ffff161061126d57600060046040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f345780601f10610f0957610100808354040283529160200191610f34565b820191906000526020600020905b815481529060010190602001808311610f1757829003601f168201915b50505050508152505090506000816000015173ffffffffffffffffffffffffffffffffffffffff16826020015183604001516040518082805190602001908083835b60208310610f995780518252602082019150602081019050602083039250610f76565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610ffb576040519150601f19603f3d011682016040523d82523d6000602084013e611000565b606091505b505090508015611185576004600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600061104c919061256d565b50506008600080820160006101000a81549063ffffffff02191690556000820160046101000a81549061ffff02191690556000820160066101000a81549061ffff021916905560018201600090555050816000015173ffffffffffffffffffffffffffffffffffffffff167f2268409823affbdd3dbec26ea823bbd3c95337526dbbb844cee8f3d4b1787ec860018560000151856020015186604001516040518085151581526020018463ffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611143578082015181840152602081019050611128565b50505050905090810190601f1680156111705780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a261126a565b816000015173ffffffffffffffffffffffffffffffffffffffff167f2268409823affbdd3dbec26ea823bbd3c95337526dbbb844cee8f3d4b1787ec860008560000151856020015186604001516040518085151581526020018463ffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561122c578082015181840152602081019050611211565b50505050905090810190601f1680156112595780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a25b50505b60019250506001600b819055505090565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1611611348576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f436f696e39384d5369673a204e6f7420616e206f776e6572000000000000000081525060200191505060405180910390fd5b600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff16815260200160018201548152505090506000816000015163ffffffff1611611449576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f436f696e39384d5369673a204e6f2070656e64696e672072657175657374000081525060200191505060405180910390fd5b61025881606001514203116114c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f436f696e39384d5369673a203130206d696e73206e6f7420706173736564000081525060200191505060405180910390fd5b6004600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055600282016000611508919061256d565b50506008600080820160006101000a81549063ffffffff02191690556000820160046101000a81549061ffff02191690556000820160066101000a81549061ffff0219169055600182016000905550507fc41d93b8bfbf9fd7cf5bfe271fd649ab6a6fec0ea101c23b82a2a28eca2533a98160000151604051808263ffffffff16815260200191505060405180910390a160019250505090565b600080600080600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff1681526020016001820154815250509050806000015181606001518260200151836040015194509450945094505090919293565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f696e39384d5369673a2057616c6c6574206f6e6c7900000000000000000081525060200191505060405180910390fd5b6116fa848484611d4b565b600190509392505050565b6060806000808054905067ffffffffffffffff8111801561172557600080fd5b506040519080825280602002602001820160405280156117545781602001602082028036833780820191505090505b50905060005b600080549050811015611814576001600080838154811061177757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff168282815181106117fb57fe5b602002602001018181525050808060010191505061175a565b6000828180548060200260200160405190810160405280929190818152602001828054801561189857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161184e575b505050505091509350935050509091565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1611611973576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f436f696e39384d5369673a204e6f7420616e206f776e6572000000000000000081525060200191505060405180910390fd5b600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff16815260200160018201548152505090506000816000015163ffffffff1614611a74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f436f696e39384d5369673a20526571756573742070656e64696e67000000000081525060200191505060405180910390fd5b611a7c6125b5565b86816000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160200181815250508481604001819052506001600360009054906101000a900463ffffffff1601826000019063ffffffff16908163ffffffff1681525050600260000160009054906101000a900461ffff16826040019061ffff16908161ffff16815250504282606001818152505080600460008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611b959291906125ec565b509050508160000151600360006101000a81548163ffffffff021916908363ffffffff16021790555081600860008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548161ffff021916908361ffff16021790555060408201518160000160066101000a81548161ffff021916908361ffff16021790555060608201518160010155905050611c43610984565b50806000015173ffffffffffffffffffffffffffffffffffffffff167f1546406c35d50a4ef123b4a0cf8abfeac91b8bf04b58569828c504d81b73725783600001518360200151846040015186602001518760400151604051808663ffffffff168152602001858152602001806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019080838360005b83811015611cff578082015181840152602081019050611ce4565b50505050905090810190601f168015611d2c5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a2600193505050509392505050565b8151835114611da5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612698602e913960400191505060405180910390fd5b600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff1681525050905060005b84518110156121e5576000858281518110611e1057fe5b602002602001015190506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1690506000868481518110611e7a57fe5b602002602001015190506101008161ffff161115611f00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b60008261ffff1611156120ef5760008161ffff1614156120d05760005b6000805490508110156120ce578373ffffffffffffffffffffffffffffffffffffffff1660008281548110611f4e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156120c157600060016000805490500381548110611faa57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008281548110611fe257fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600080548061203557fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549063ffffffff02191690556120ce565b8080600101915050611f1d565b505b81856020018181510391509061ffff16908161ffff1681525050612161565b60008161ffff161115612160576000839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555080856020018181510191509061ffff16908161ffff16815250505050508080600101915050611df9565b60008361ffff1611156122075782826000019061ffff16908161ffff16815250505b6000808054905090506000836000015161ffff161161228e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b826020015161ffff16836000015161ffff161115612314576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436f696e39384d5369673a20496e76616c69642076526174650000000000000081525060200191505060405180910390fd5b611000836020015161ffff161115612394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f436f696e39384d5369673a204d6178207765696768742072656163686564000081525060200191505060405180910390fd5b6000811161240a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f436f696e39384d5369673a204174206c656173742031206f776e65720000000081525060200191505060405180910390fd5b6040811115612481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f436f696e39384d5369673a204d6178206f776e6572207265616368656400000081525060200191505060405180910390fd5b82600260008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff1602179055509050507f04eba5651eb98f2aa06a6942c0ef7f74b486ed22c9bdaf1c312e73305381ca46868460000151856020015160405180806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019060200280838360005b83811015612550578082015181840152602081019050612535565b5050505090500194505050505060405180910390a1505050505050565b50805460018160011615610100020316600290046000825580601f1061259357506125b2565b601f0160209004906000526020600020908101906125b1919061267a565b5b50565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826126225760008555612669565b82601f1061263b57805160ff1916838001178555612669565b82800160010185558215612669579182015b8281111561266857825182559160200191906001019061264d565b5b509050612676919061267a565b5090565b5b8082111561269357600081600090555060010161267b565b509056fe436f696e39384d5369673a204f776e65727320616e642076506f77657273206c656e677468206d69736d61746368a26469706673582212208a21649390de75baf0ac0a753a705b6366e6e68a043222bf50ae581c478bce8864736f6c63430007060033436f696e39384d5369673a204f776e65727320616e642076506f77657273206c656e677468206d69736d61746368a2646970667358221220b7f769c0ce3f2c0c210721724f823be9f97e1d12566752631c367433b4a2580f64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,485 |
0x899d0399c1d2627e12789eba2dc10c6c59f1ac80
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract UnsupervisedTimelock {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// The start timestamp of token release period.
//
// Before this time, the beneficiary can NOT withdraw any token from this contract.
uint256 private immutable _releaseStartTime;
// The days that the timelock will last.
uint256 private immutable _daysOfTimelock;
// The OctToken contract
IERC20 private immutable _token;
// Total balance of benefit
uint256 private immutable _totalBenefit;
// The amount of withdrawed balance of the beneficiary.
//
// This value will be updated on each withdraw operation.
uint256 private _withdrawedBalance;
event BenefitWithdrawed(address indexed beneficiary, uint256 amount);
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_,
uint256 totalBenefit_
) {
_token = token_;
_beneficiary = beneficiary_;
_releaseStartTime =
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY);
require(
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY) +
daysOfTimelock_ *
SECONDS_OF_A_DAY >
block.timestamp,
"UnsupervisedTimelock: release end time is before current time"
);
_daysOfTimelock = daysOfTimelock_;
_totalBenefit = totalBenefit_;
_withdrawedBalance = 0;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary address
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the total balance of benefit
*/
function totalBenefit() public view returns (uint256) {
return _totalBenefit;
}
/**
* @return the balance to release for the beneficiary at the moment
*/
function releasedBalance() public view returns (uint256) {
if (block.timestamp <= _releaseStartTime) return 0;
if (
block.timestamp >
_releaseStartTime + SECONDS_OF_A_DAY * _daysOfTimelock
) {
return _totalBenefit;
}
uint256 passedDays = (block.timestamp - _releaseStartTime) /
SECONDS_OF_A_DAY;
return (_totalBenefit * passedDays) / _daysOfTimelock;
}
/**
* @return the unreleased balance of the beneficiary at the moment
*/
function unreleasedBalance() public view returns (uint256) {
return _totalBenefit - releasedBalance();
}
/**
* @return the withdrawed balance of beneficiary
*/
function withdrawedBalance() public view returns (uint256) {
return _withdrawedBalance;
}
/**
* @notice Withdraws tokens to beneficiary
*/
function withdraw() public {
uint256 balanceShouldBeReleased = releasedBalance();
require(
balanceShouldBeReleased > _withdrawedBalance,
"UnsupervisedTimelock: no more benefit can be withdrawed now"
);
uint256 balanceShouldBeTransfered = balanceShouldBeReleased -
_withdrawedBalance;
require(
token().balanceOf(address(this)) >= balanceShouldBeTransfered,
"UnsupervisedTimelock: deposited balance is not enough"
);
_withdrawedBalance = balanceShouldBeReleased;
token().safeTransfer(_beneficiary, balanceShouldBeTransfered);
emit BenefitWithdrawed(_beneficiary, balanceShouldBeTransfered);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806391eeab851161005b57806391eeab85146100c85780639ab4b22f146100e6578063f50c8e2d14610104578063fc0c546a146101225761007d565b806338af3eed146100825780633ccfd60b146100a05780636b37cc14146100aa575b600080fd5b61008a610140565b6040516100979190610a1c565b60405180910390f35b6100a8610168565b005b6100b2610366565b6040516100bf9190610b3d565b60405180910390f35b6100d06103a0565b6040516100dd9190610b3d565b60405180910390f35b6100ee6103a9565b6040516100fb9190610b3d565b60405180910390f35b61010c610500565b6040516101199190610b3d565b60405180910390f35b61012a610528565b6040516101379190610a60565b60405180910390f35b60007f0000000000000000000000009e8779a144f0734adefd6f7e5265347054e4fc7f905090565b60006101726103a9565b905060005481116101b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101af90610a9d565b60405180910390fd5b60008054826101c79190610c6b565b9050806101d2610528565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610a1c565b60206040518083038186803b15801561022257600080fd5b505afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610896565b101561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029290610abd565b60405180910390fd5b816000819055506102f47f0000000000000000000000009e8779a144f0734adefd6f7e5265347054e4fc7f826102cf610528565b73ffffffffffffffffffffffffffffffffffffffff166105509092919063ffffffff16565b7f0000000000000000000000009e8779a144f0734adefd6f7e5265347054e4fc7f73ffffffffffffffffffffffffffffffffffffffff167f26b111a6f79cb1f14e797207bb7f2095963c467ca641399e15f7b2a02fb44cf98260405161035a9190610b3d565b60405180910390a25050565b60006103706103a9565b7f0000000000000000000000000000000000000000000078b3c30cea91b040000061039b9190610c6b565b905090565b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000612ec28042116103db57600090506104fd565b7f00000000000000000000000000000000000000000000000000000000000004486201518061040a9190610c11565b7f00000000000000000000000000000000000000000000000000000000612ec2806104359190610b8a565b421115610464577f0000000000000000000000000000000000000000000078b3c30cea91b040000090506104fd565b6000620151807f00000000000000000000000000000000000000000000000000000000612ec280426104969190610c6b565b6104a09190610be0565b90507f0000000000000000000000000000000000000000000000000000000000000448817f0000000000000000000000000000000000000000000078b3c30cea91b04000006104ef9190610c11565b6104f99190610be0565b9150505b90565b60007f0000000000000000000000000000000000000000000078b3c30cea91b0400000905090565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b6105d18363a9059cbb60e01b848460405160240161056f929190610a37565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d6565b505050565b6000610638826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661069d9092919063ffffffff16565b90506000815111156106985780806020019051810190610658919061086d565b610697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068e90610b1d565b60405180910390fd5b5b505050565b60606106ac84846000856106b5565b90509392505050565b6060824710156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f190610add565b60405180910390fd5b610703856107c9565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990610afd565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161076b9190610a05565b60006040518083038185875af1925050503d80600081146107a8576040519150601f19603f3d011682016040523d82523d6000602084013e6107ad565b606091505b50915091506107bd8282866107dc565b92505050949350505050565b600080823b905060008111915050919050565b606083156107ec5782905061083c565b6000835111156107ff5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339190610a7b565b60405180910390fd5b9392505050565b60008151905061085281610f12565b92915050565b60008151905061086781610f29565b92915050565b60006020828403121561087f57600080fd5b600061088d84828501610843565b91505092915050565b6000602082840312156108a857600080fd5b60006108b684828501610858565b91505092915050565b6108c881610c9f565b82525050565b60006108d982610b58565b6108e38185610b6e565b93506108f3818560208601610d0b565b80840191505092915050565b61090881610ce7565b82525050565b600061091982610b63565b6109238185610b79565b9350610933818560208601610d0b565b61093c81610d9c565b840191505092915050565b6000610954603b83610b79565b915061095f82610dad565b604082019050919050565b6000610977603583610b79565b915061098282610dfc565b604082019050919050565b600061099a602683610b79565b91506109a582610e4b565b604082019050919050565b60006109bd601d83610b79565b91506109c882610e9a565b602082019050919050565b60006109e0602a83610b79565b91506109eb82610ec3565b604082019050919050565b6109ff81610cdd565b82525050565b6000610a1182846108ce565b915081905092915050565b6000602082019050610a3160008301846108bf565b92915050565b6000604082019050610a4c60008301856108bf565b610a5960208301846109f6565b9392505050565b6000602082019050610a7560008301846108ff565b92915050565b60006020820190508181036000830152610a95818461090e565b905092915050565b60006020820190508181036000830152610ab681610947565b9050919050565b60006020820190508181036000830152610ad68161096a565b9050919050565b60006020820190508181036000830152610af68161098d565b9050919050565b60006020820190508181036000830152610b16816109b0565b9050919050565b60006020820190508181036000830152610b36816109d3565b9050919050565b6000602082019050610b5260008301846109f6565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610b9582610cdd565b9150610ba083610cdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610bd557610bd4610d3e565b5b828201905092915050565b6000610beb82610cdd565b9150610bf683610cdd565b925082610c0657610c05610d6d565b5b828204905092915050565b6000610c1c82610cdd565b9150610c2783610cdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c6057610c5f610d3e565b5b828202905092915050565b6000610c7682610cdd565b9150610c8183610cdd565b925082821015610c9457610c93610d3e565b5b828203905092915050565b6000610caa82610cbd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cf282610cf9565b9050919050565b6000610d0482610cbd565b9050919050565b60005b83811015610d29578082015181840152602081019050610d0e565b83811115610d38576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f556e7375706572766973656454696d656c6f636b3a206e6f206d6f726520626560008201527f6e656669742063616e2062652077697468647261776564206e6f770000000000602082015250565b7f556e7375706572766973656454696d656c6f636b3a206465706f73697465642060008201527f62616c616e6365206973206e6f7420656e6f7567680000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610f1b81610cb1565b8114610f2657600080fd5b50565b610f3281610cdd565b8114610f3d57600080fd5b5056fea2646970667358221220d64301bb2e01bd50ccf6f1b3e32ab3dd016930675ceb384fec7a4cb0beb8076064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,486 |
0xfcd7bcc44c3778880aed0e025fd0ae5f7ce5ba44
|
pragma solidity ^0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
* @param timeOfLastUpdate The last time when the function that the treasury pays for has been updated
* @param defaultDelayBetweenCalls Enforced delay between calls to the function for which the treasury reimburses callers
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
// If the rewards are null or if the time of the last update is in the future or present, return 0
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
// If the time elapsed is smaller than defaultDelayBetweenCalls or if the base reward is zero, return 0
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
// If too much time elapsed, return the max reward
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
// Calculate the reward
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
// If the reward is higher than max, set it to max
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
// If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
// Determine the actual receiver and send funds
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
abstract contract AccountingEngineLike {
function modifyParameters(bytes32, uint256) virtual external;
}
abstract contract OracleRelayerLike {
function redemptionPrice() virtual external returns (uint256);
}
contract AuctionedSurplusSetter is IncreasingTreasuryReimbursement {
// --- Variables ---
// Minimum amount of surplus to sell in one auction
uint256 public minAuctionedSurplus; // [rad]
// Target value for the amount of surplus to sell
uint256 public targetValue; // [ray]
// The min delay between two adjustments of the surplus amount
uint256 public updateDelay; // [seconds]
// Last timestamp when the surplus amount was updated
uint256 public lastUpdateTime; // [unix timestamp]
// Accounting engine contract
AccountingEngineLike public accountingEngine;
// The oracle relayer contract
OracleRelayerLike public oracleRelayer;
// --- Events ---
event RecomputeSurplusAmountAuctioned(uint256 surplusToSell);
constructor(
address treasury_,
address oracleRelayer_,
address accountingEngine_,
uint256 minAuctionedSurplus_,
uint256 targetValue_,
uint256 updateDelay_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(both(oracleRelayer_ != address(0), accountingEngine_ != address(0)), "AuctionedSurplusSetter/invalid-core-contracts");
require(minAuctionedSurplus_ > 0, "AuctionedSurplusSetter/invalid-min-auctioned-surplus");
require(targetValue_ > 0, "AuctionedSurplusSetter/invalid-target-value");
require(updateDelay_ > 0, "AuctionedSurplusSetter/null-update-delay");
minAuctionedSurplus = minAuctionedSurplus_;
updateDelay = updateDelay_;
targetValue = targetValue_;
oracleRelayer = OracleRelayerLike(oracleRelayer_);
accountingEngine = AccountingEngineLike(accountingEngine_);
emit ModifyParameters("minAuctionedSurplus", minAuctionedSurplus);
emit ModifyParameters("targetValue", targetValue);
emit ModifyParameters("updateDelay", updateDelay);
}
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Administration ---
/*
* @notify Modify an uint256 parameter
* @param parameter The name of the parameter to change
* @param val The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 val) external isAuthorized {
if (parameter == "minAuctionedSurplus") {
require(val > 0, "AuctionedSurplusSetter/null-min-auctioned-amount");
minAuctionedSurplus = val;
}
else if (parameter == "targetValue") {
require(val > 0, "AuctionedSurplusSetter/null-target-value");
targetValue = val;
}
else if (parameter == "baseUpdateCallerReward") {
require(val <= maxUpdateCallerReward, "AuctionedSurplusSetter/invalid-min-reward");
baseUpdateCallerReward = val;
}
else if (parameter == "maxUpdateCallerReward") {
require(val >= baseUpdateCallerReward, "AuctionedSurplusSetter/invalid-max-reward");
maxUpdateCallerReward = val;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(val >= RAY, "AuctionedSurplusSetter/invalid-reward-increase");
perSecondCallerRewardIncrease = val;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(val > 0, "AuctionedSurplusSetter/invalid-max-increase-delay");
maxRewardIncreaseDelay = val;
}
else if (parameter == "updateDelay") {
require(val > 0, "AuctionedSurplusSetter/null-update-delay");
updateDelay = val;
}
else revert("AuctionedSurplusSetter/modify-unrecognized-param");
emit ModifyParameters(parameter, val);
}
/*
* @notify Modify an address param
* @param parameter The name of the parameter to change
* @param addr The new address for the parameter
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "AuctionedSurplusSetter/null-address");
if (parameter == "treasury") treasury = StabilityFeeTreasuryLike(addr);
else revert("AuctionedSurplusSetter/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Core Logic ---
/*
* @notify Recompute and set the new amount of surplus that's sold in one surplus auction
*/
function recomputeSurplusAmountAuctioned(address feeReceiver) public {
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "AuctionedSurplusSetter/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Store the timestamp of the update
lastUpdateTime = now;
// Calculate the new amount to sell
uint256 surplusToSell = multiply(rdivide(targetValue, oracleRelayer.redemptionPrice()), WAD);
surplusToSell = (surplusToSell < minAuctionedSurplus) ? minAuctionedSurplus : surplusToSell;
// Set the new amount
accountingEngine.modifyParameters("surplusAuctionAmountToSell", surplusToSell);
// Emit an event
emit RecomputeSurplusAmountAuctioned(surplusToSell);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063554f94db1161010f578063a65b869b116100a2578063dd2d2a1211610071578063dd2d2a121461048e578063f238ffd2146104b1578063f752fdc3146104d4578063fe4f5890146104f7576101f0565b8063a65b869b1461042f578063a8e2044e14610437578063c8f33c911461045d578063d6e882dc14610465576101f0565b80636a146024116100de5780636a146024146103d657806394f3f81d146103de578063961d45c414610404578063a08716371461040c576101f0565b8063554f94db1461039257806361d027b31461039a5780636614f010146103a257806369dec276146103ce576101f0565b80633c8bb3e61161018757806346f3e81c1161015657806346f3e81c146103265780634faf61ab1461034357806354f363a314610367578063552033c41461038a576101f0565b80633c8bb3e6146102d05780633ef5e445146102f357806341b0c9ba1461031657806343943b6b1461031e576101f0565b80632009e568116101c35780632009e5681461027257806324ba58841461027a5780633425677e146102a057806335b28153146102a8576101f0565b8063056640b7146101f5578063102134471461022a578063165c4a16146102475780631c1f908c1461026a575b600080fd5b6102186004803603604081101561020b57600080fd5b508035906020013561051a565b60408051918252519081900360200190f35b6102186004803603602081101561024057600080fd5b5035610541565b6102186004803603604081101561025d57600080fd5b5080359060200135610557565b6102186105bc565b6102186105c2565b6102186004803603602081101561029057600080fd5b50356001600160a01b03166105c8565b6102186105da565b6102ce600480360360208110156102be57600080fd5b50356001600160a01b0316610671565b005b610218600480360360408110156102e657600080fd5b5080359060200135610711565b6102186004803603604081101561030957600080fd5b5080359060200135610726565b61021861077e565b610218610784565b6102186004803603602081101561033c57600080fd5b503561078a565b61034b6107a1565b604080516001600160a01b039092168252519081900360200190f35b6102186004803603604081101561037d57600080fd5b50803590602001356107b0565b610218610801565b610218610810565b61034b610816565b6102ce600480360360408110156103b857600080fd5b50803590602001356001600160a01b0316610825565b610218610969565b61021861096f565b6102ce600480360360208110156103f457600080fd5b50356001600160a01b031661097b565b61034b610a1a565b6102186004803603604081101561042257600080fd5b5080359060200135610a29565b610218610a41565b6102ce6004803603602081101561044d57600080fd5b50356001600160a01b0316610a47565b610218610c50565b6102186004803603606081101561047b57600080fd5b5080359060208101359060400135610c56565b610218600480360360408110156104a457600080fd5b5080359060200135610d14565b610218600480360360408110156104c757600080fd5b5080359060200135610d2d565b610218600480360360408110156104ea57600080fd5b5080359060200135610e2d565b6102ce6004803603604081101561050d57600080fd5b5080359060200135610e42565b6000676765c793fa10079d601b1b6105328484610557565b8161053957fe5b049392505050565b600061055182633b9aca00610557565b92915050565b60008115806105725750508082028282828161056f57fe5b04145b610551576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6d756c2d6f766572666c6f7760501b604482015290519081900360640190fd5b60015481565b60035481565b60006020819052908152604090205481565b600554604080516375ad331760e11b81523060048201528151600093849384936001600160a01b039092169263eb5a662e926024808201939291829003018186803b15801561062857600080fd5b505afa15801561063c573d6000803e3d6000fd5b505050506040513d604081101561065257600080fd5b508051602090910151909250905061066a8282610d14565b9250505090565b336000908152602081905260409020546001146106bf5760405162461bcd60e51b81526004018080602001828103825260368152602001806115696036913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b6000670de0b6b3a76400006105328484610557565b80820382811115610551576040805162461bcd60e51b815260206004820152601760248201527f75696e742d75696e742d7375622d756e646572666c6f77000000000000000000604482015290519081900360640190fd5b60075481565b60045481565b600061055182676765c793fa10079d601b1b610557565b600b546001600160a01b031681565b81810182811015610551576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6164642d6f766572666c6f7760501b604482015290519081900360640190fd5b676765c793fa10079d601b1b81565b60085481565b6005546001600160a01b031681565b336000908152602081905260409020546001146108735760405162461bcd60e51b81526004018080602001828103825260368152602001806115696036913960400191505060405180910390fd5b6001600160a01b0381166108b85760405162461bcd60e51b815260040180806020018281038252602381526020018061143d6023913960400191505060405180910390fd5b8167747265617375727960c01b14156108eb57600580546001600160a01b0319166001600160a01b038316179055610922565b60405162461bcd60e51b81526004018080602001828103825260308152602001806113e56030913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b60025481565b670de0b6b3a764000081565b336000908152602081905260409020546001146109c95760405162461bcd60e51b81526004018080602001828103825260368152602001806115696036913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b600a546001600160a01b031681565b60008161053284676765c793fa10079d601b1b610557565b60065481565b610a66600854610a5942600954610726565b10156009546000146111ad565b610ab7576040805162461bcd60e51b815260206004820181905260248201527f41756374696f6e6564537572706c75735365747465722f776169742d6d6f7265604482015290519081900360640190fd5b6000610ac7600954600854610d2d565b9050426009819055506000610b6a610b5c600754600b60009054906101000a90046001600160a01b03166001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610b2b57600080fd5b505af1158015610b3f573d6000803e3d6000fd5b505050506040513d6020811015610b5557600080fd5b5051610a29565b670de0b6b3a7640000610557565b90506006548110610b7b5780610b7f565b6006545b600a5460408051630fe4f58960e41b81527f737572706c757341756374696f6e416d6f756e74546f53656c6c00000000000060048201526024810184905290519293506001600160a01b039091169163fe4f58909160448082019260009290919082900301818387803b158015610bf557600080fd5b505af1158015610c09573d6000803e3d6000fd5b50506040805184815290517f67e9adec569b10d31aec1755ea49ba83289615626534a7828e64d5e5177ed9069350908190036020019150a1610c4b83836111b1565b505050565b60095481565b6000838015610cf657600184168015610c7157859250610c75565b8392505b50600283046002850494505b8415610cf0578586028687820414610c9857600080fd5b81810181811015610ca857600080fd5b8590049650506001851615610ce5578583028387820414158715151615610cce57600080fd5b81810181811015610cde57600080fd5b8590049350505b600285049450610c81565b50610d0c565b838015610d065760009250610d0a565b8392505b505b509392505050565b600081831115610d245781610d26565b825b9392505050565b6000806001546000148015610d425750600254155b9050610d5142851015826111ad565b15610d60576000915050610551565b60008415610d7757610d724286610726565b610d79565b835b9050610d8c8482106001546000146111ad565b15610d9c57600092505050610551565b6000610da88286610726565b90506000610dd3600254676765c793fa10079d601b1b610dc66105da565b81610dcd57fe5b04610d14565b9050600354821115610dea57935061055192505050565b6001548215610e1757610e14610e0e60045485676765c793fa10079d601b1b610c56565b8261051a565b90505b81811115610e225750805b979650505050505050565b60008161053284670de0b6b3a7640000610557565b33600090815260208190526040902054600114610e905760405162461bcd60e51b81526004018080602001828103825260368152602001806115696036913960400191505060405180910390fd5b81726d696e41756374696f6e6564537572706c757360681b1415610ef75760008111610eed5760405162461bcd60e51b81526004018080602001828103825260308152602001806114e06030913960400191505060405180910390fd5b600681905561116e565b816a74617267657456616c756560a81b1415610f565760008111610f4c5760405162461bcd60e51b81526004018080602001828103825260288152602001806115416028913960400191505060405180910390fd5b600781905561116e565b817518985cd9555c19185d1950d85b1b195c94995dd85c9960521b1415610fc257600254811115610fb85760405162461bcd60e51b81526004018080602001828103825260298152602001806114b76029913960400191505060405180910390fd5b600181905561116e565b81741b585e155c19185d1950d85b1b195c94995dd85c99605a1b141561102d576001548110156110235760405162461bcd60e51b815260040180806020018281038252602981526020018061148e6029913960400191505060405180910390fd5b600281905561116e565b817f7065725365636f6e6443616c6c6572526577617264496e63726561736500000014156110a957676765c793fa10079d601b1b81101561109f5760405162461bcd60e51b815260040180806020018281038252602e815260200180611460602e913960400191505060405180910390fd5b600481905561116e565b81756d6178526577617264496e63726561736544656c617960501b141561111357600081116111095760405162461bcd60e51b81526004018080602001828103825260318152602001806115106031913960400191505060405180910390fd5b600381905561116e565b816a75706461746544656c617960a81b14156108eb57600081116111685760405162461bcd60e51b81526004018080602001828103825260288152602001806114156028913960400191505060405180910390fd5b60088190555b604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b1790565b6005546001600160a01b03838116911614156111cc576113e0565b6005546111e4906001600160a01b03161582156111ad565b156111ee576113e0565b60006001600160a01b038316156112055782611207565b335b6005546040805163a7e9445560e01b815290519293506001600160a01b039091169163201add9b918491849163a7e94455916004808301926020929190829003018186803b15801561125857600080fd5b505afa15801561126c573d6000803e3d6000fd5b505050506040513d602081101561128257600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820186905251606480830192600092919082900301818387803b1580156112da57600080fd5b505af19250505080156112eb575060015b610c4b573d808015611319576040519150601f19603f3d011682016040523d82523d6000602084013e61131e565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a548183856040518080602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561139e578181015183820152602001611386565b50505050905090810190601f1680156113cb5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a150610c4b565b505056fe41756374696f6e6564537572706c75735365747465722f6d6f646966792d756e7265636f676e697a65642d706172616d41756374696f6e6564537572706c75735365747465722f6e756c6c2d7570646174652d64656c617941756374696f6e6564537572706c75735365747465722f6e756c6c2d6164647265737341756374696f6e6564537572706c75735365747465722f696e76616c69642d7265776172642d696e63726561736541756374696f6e6564537572706c75735365747465722f696e76616c69642d6d61782d72657761726441756374696f6e6564537572706c75735365747465722f696e76616c69642d6d696e2d72657761726441756374696f6e6564537572706c75735365747465722f6e756c6c2d6d696e2d61756374696f6e65642d616d6f756e7441756374696f6e6564537572706c75735365747465722f696e76616c69642d6d61782d696e6372656173652d64656c617941756374696f6e6564537572706c75735365747465722f6e756c6c2d7461726765742d76616c7565496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a26469706673582212207f6ab24027f7e37ef7cb7b34bcea29bc91f331c0370e90bd0d728e0ba4fb53d964736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,487 |
0x134cf9fc707e894dee62c36e2164049bdcb84b38
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
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 IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return interfaceId == type(IERC165).interfaceId;
}
}
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 internal currentIndex = 0;
string private _name;
string private _symbol;
mapping(uint256 => TokenOwnership) internal _ownerships;
mapping(address => AddressData) private _addressData;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function totalSupply() public view override returns (uint256) {
return currentIndex;
}
function tokenByIndex(uint256 index)
public
view
override
returns (uint256)
{
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(
owner != address(0),
"ERC721A: balance query for the zero address"
);
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
for (uint256 curr = tokenId; ; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
function getApproved(uint256 tokenId)
public
view
override
returns (address)
{
require(
_exists(tokenId),
"ERC721A: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved)
public
override
{
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
}
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity > 0, "ERC721A: quantity must be greater 0");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
}
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721A: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
contract PixelDegenz is ERC721A, Ownable {
string public baseURI = "";
string public contractURI = "";
string public constant baseExtension = ".json";
address public constant proxyRegistryAddress =
0xc5324f5311596986bEf0892d762B9327377e193D;
uint256 public constant MAX_PER_TX = 10;
uint256 public constant MAX_SUPPLY = 7950;
uint256 public constant price = 0.007 ether;
bool public paused = false;
constructor() ERC721A("PixelDegenz", "PDZ") {}
function mint(uint256 _amount) external payable {
address _caller = _msgSender();
require(!paused, "Paused");
require(MAX_SUPPLY >= totalSupply() + _amount, "Exceeds max supply");
require(_amount > 0, "Must mint one or more!");
require(tx.origin == _caller, "No contracts allowed");
require(MAX_PER_TX >= _amount, "Excess max per tx");
_safeMint(_caller, _amount);
}
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
(bool success, ) = _msgSender().call{value: balance}("");
require(success, "Failed to send");
}
function setupOS() external onlyOwner {
_safeMint(_msgSender(), 1);
}
function pause(bool _state) external onlyOwner {
paused = _state;
}
function setBaseURI(string memory baseURI_) external onlyOwner {
baseURI = baseURI_;
}
function setContractURI(string memory _contractURI) external onlyOwner {
contractURI = _contractURI;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(_exists(_tokenId), "Token does not exist.");
return
bytes(baseURI).length > 0
? string(
abi.encodePacked(
baseURI,
Strings.toString(_tokenId),
baseExtension
)
)
: "";
}
}
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
|
0x6080604052600436106101ee5760003560e01c80636c0360eb1161010d578063a22cb465116100a0578063cd7c03261161006f578063cd7c0326146106ca578063e8a3d485146106f5578063e985e9c514610720578063f2fde38b1461075d578063f43a22dc14610786576101ee565b8063a22cb46514610610578063b88d4fde14610639578063c668286214610662578063c87b56dd1461068d576101ee565b8063938e3d7b116100dc578063938e3d7b1461057557806395d89b411461059e578063a035b1fe146105c9578063a0712d68146105f4576101ee565b80636c0360eb146104cb57806370a08231146104f6578063715018a6146105335780638da5cb5b1461054a576101ee565b806332cb6b0c1161018557806355f804b31161015457806355f804b3146104235780635c975abb1461044c5780636352211e14610477578063698982ba146104b4576101ee565b806332cb6b0c1461037b5780633ccfd60b146103a657806342842e0e146103bd5780634f6ccce7146103e6576101ee565b8063095ea7b3116101c1578063095ea7b3146102c157806318160ddd146102ea57806323b872dd146103155780632f745c591461033e576101ee565b806301ffc9a7146101f357806302329a291461023057806306fdde0314610259578063081812fc14610284575b600080fd5b3480156101ff57600080fd5b5061021a60048036038101906102159190613141565b6107b1565b6040516102279190613cb6565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613118565b6108fb565b005b34801561026557600080fd5b5061026e610994565b60405161027b9190613cd1565b60405180910390f35b34801561029057600080fd5b506102ab60048036038101906102a691906131fd565b610a26565b6040516102b89190613c4f565b60405180910390f35b3480156102cd57600080fd5b506102e860048036038101906102e391906130dc565b610aab565b005b3480156102f657600080fd5b506102ff610bc4565b60405161030c9190614013565b60405180910390f35b34801561032157600080fd5b5061033c60048036038101906103379190612fd6565b610bcd565b005b34801561034a57600080fd5b50610365600480360381019061036091906130dc565b610bdd565b6040516103729190614013565b60405180910390f35b34801561038757600080fd5b50610390610ddb565b60405161039d9190614013565b60405180910390f35b3480156103b257600080fd5b506103bb610de1565b005b3480156103c957600080fd5b506103e460048036038101906103df9190612fd6565b610f19565b005b3480156103f257600080fd5b5061040d600480360381019061040891906131fd565b610f39565b60405161041a9190614013565b60405180910390f35b34801561042f57600080fd5b5061044a600480360381019061044591906131bc565b610f8c565b005b34801561045857600080fd5b50610461611022565b60405161046e9190613cb6565b60405180910390f35b34801561048357600080fd5b5061049e600480360381019061049991906131fd565b611035565b6040516104ab9190613c4f565b60405180910390f35b3480156104c057600080fd5b506104c961104b565b005b3480156104d757600080fd5b506104e06110db565b6040516104ed9190613cd1565b60405180910390f35b34801561050257600080fd5b5061051d60048036038101906105189190612f71565b611169565b60405161052a9190614013565b60405180910390f35b34801561053f57600080fd5b50610548611252565b005b34801561055657600080fd5b5061055f6112da565b60405161056c9190613c4f565b60405180910390f35b34801561058157600080fd5b5061059c600480360381019061059791906131bc565b611304565b005b3480156105aa57600080fd5b506105b361139a565b6040516105c09190613cd1565b60405180910390f35b3480156105d557600080fd5b506105de61142c565b6040516105eb9190614013565b60405180910390f35b61060e600480360381019061060991906131fd565b611437565b005b34801561061c57600080fd5b50610637600480360381019061063291906130a0565b6115ed565b005b34801561064557600080fd5b50610660600480360381019061065b9190613025565b61176e565b005b34801561066e57600080fd5b506106776117ca565b6040516106849190613cd1565b60405180910390f35b34801561069957600080fd5b506106b460048036038101906106af91906131fd565b611803565b6040516106c19190613cd1565b60405180910390f35b3480156106d657600080fd5b506106df6118e2565b6040516106ec9190613c4f565b60405180910390f35b34801561070157600080fd5b5061070a6118fa565b6040516107179190613cd1565b60405180910390f35b34801561072c57600080fd5b5061074760048036038101906107429190612f9a565b611988565b6040516107549190613cb6565b60405180910390f35b34801561076957600080fd5b50610784600480360381019061077f9190612f71565b611a7c565b005b34801561079257600080fd5b5061079b611b74565b6040516107a89190614013565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061087c57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108e457507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108f457506108f382611b79565b5b9050919050565b610903611be3565b73ffffffffffffffffffffffffffffffffffffffff166109216112da565b73ffffffffffffffffffffffffffffffffffffffff1614610977576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096e90613e73565b60405180910390fd5b80600a60006101000a81548160ff02191690831515021790555050565b6060600180546109a390614331565b80601f01602080910402602001604051908101604052809291908181526020018280546109cf90614331565b8015610a1c5780601f106109f157610100808354040283529160200191610a1c565b820191906000526020600020905b8154815290600101906020018083116109ff57829003601f168201915b5050505050905090565b6000610a3182611beb565b610a70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6790613ff3565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610ab682611035565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1e90613ef3565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b46611be3565b73ffffffffffffffffffffffffffffffffffffffff161480610b755750610b7481610b6f611be3565b611988565b5b610bb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bab90613dd3565b60405180910390fd5b610bbf838383611bf8565b505050565b60008054905090565b610bd8838383611caa565b505050565b6000610be883611169565b8210610c29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2090613cf3565b60405180910390fd5b6000610c33610bc4565b905060008060005b83811015610d99576000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614610d2d57806000015192505b8773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d855786841415610d76578195505050505050610dd5565b8380610d8190614363565b9450505b508080610d9190614363565b915050610c3b565b506040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dcc90613fd3565b60405180910390fd5b92915050565b611f0e81565b610de9611be3565b73ffffffffffffffffffffffffffffffffffffffff16610e076112da565b73ffffffffffffffffffffffffffffffffffffffff1614610e5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5490613e73565b60405180910390fd5b60004790506000610e6c611be3565b73ffffffffffffffffffffffffffffffffffffffff1682604051610e8f90613c3a565b60006040518083038185875af1925050503d8060008114610ecc576040519150601f19603f3d011682016040523d82523d6000602084013e610ed1565b606091505b5050905080610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90613f93565b60405180910390fd5b5050565b610f348383836040518060200160405280600081525061176e565b505050565b6000610f43610bc4565b8210610f84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7b90613d93565b60405180910390fd5b819050919050565b610f94611be3565b73ffffffffffffffffffffffffffffffffffffffff16610fb26112da565b73ffffffffffffffffffffffffffffffffffffffff1614611008576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fff90613e73565b60405180910390fd5b806008908051906020019061101e929190612d46565b5050565b600a60009054906101000a900460ff1681565b600061104082612251565b600001519050919050565b611053611be3565b73ffffffffffffffffffffffffffffffffffffffff166110716112da565b73ffffffffffffffffffffffffffffffffffffffff16146110c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110be90613e73565b60405180910390fd5b6110d96110d2611be3565b60016123ac565b565b600880546110e890614331565b80601f016020809104026020016040519081016040528092919081815260200182805461111490614331565b80156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d190613e13565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b61125a611be3565b73ffffffffffffffffffffffffffffffffffffffff166112786112da565b73ffffffffffffffffffffffffffffffffffffffff16146112ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c590613e73565b60405180910390fd5b6112d860006123ca565b565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61130c611be3565b73ffffffffffffffffffffffffffffffffffffffff1661132a6112da565b73ffffffffffffffffffffffffffffffffffffffff1614611380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137790613e73565b60405180910390fd5b8060099080519060200190611396929190612d46565b5050565b6060600280546113a990614331565b80601f01602080910402602001604051908101604052809291908181526020018280546113d590614331565b80156114225780601f106113f757610100808354040283529160200191611422565b820191906000526020600020905b81548152906001019060200180831161140557829003601f168201915b5050505050905090565b6618de76816d800081565b6000611441611be3565b9050600a60009054906101000a900460ff1615611493576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148a90613d13565b60405180910390fd5b8161149c610bc4565b6114a69190614168565b611f0e10156114ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e190613df3565b60405180910390fd5b6000821161152d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152490613ed3565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff161461159b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159290613fb3565b60405180910390fd5b81600a10156115df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d690613d53565b60405180910390fd5b6115e981836123ac565b5050565b6115f5611be3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a90613e93565b60405180910390fd5b8060066000611670611be3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661171d611be3565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516117629190613cb6565b60405180910390a35050565b611779848484611caa565b61178584848484612490565b6117c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bb90613f33565b60405180910390fd5b50505050565b6040518060400160405280600581526020017f2e6a736f6e00000000000000000000000000000000000000000000000000000081525081565b606061180e82611beb565b61184d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184490613e33565b60405180910390fd5b60006008805461185c90614331565b90501161187857604051806020016040528060008152506118db565b600861188383612627565b6040518060400160405280600581526020017f2e6a736f6e0000000000000000000000000000000000000000000000000000008152506040516020016118cb93929190613c09565b6040516020818303038152906040525b9050919050565b73c5324f5311596986bef0892d762b9327377e193d81565b6009805461190790614331565b80601f016020809104026020016040519081016040528092919081815260200182805461193390614331565b80156119805780601f1061195557610100808354040283529160200191611980565b820191906000526020600020905b81548152906001019060200180831161196357829003601f168201915b505050505081565b60008073c5324f5311596986bef0892d762b9327377e193d90508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663c4552791866040518263ffffffff1660e01b81526004016119f29190613c4f565b60206040518083038186803b158015611a0a57600080fd5b505afa158015611a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a429190613193565b73ffffffffffffffffffffffffffffffffffffffff161415611a68576001915050611a76565b611a7284846127d4565b9150505b92915050565b611a84611be3565b73ffffffffffffffffffffffffffffffffffffffff16611aa26112da565b73ffffffffffffffffffffffffffffffffffffffff1614611af8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aef90613e73565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5f90613d33565b60405180910390fd5b611b71816123ca565b50565b600a81565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6000805482109050919050565b826005600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000611cb582612251565b90506000816000015173ffffffffffffffffffffffffffffffffffffffff16611cdc611be3565b73ffffffffffffffffffffffffffffffffffffffff161480611d385750611d01611be3565b73ffffffffffffffffffffffffffffffffffffffff16611d2084610a26565b73ffffffffffffffffffffffffffffffffffffffff16145b80611d545750611d538260000151611d4e611be3565b611988565b5b905080611d96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8d90613eb3565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1614611e08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dff90613e53565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6f90613db3565b60405180910390fd5b611e858585856001612868565b611e956000848460000151611bf8565b6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff160392506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff160192506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060405180604001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600085815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050600060018461209b9190614168565b9050600073ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156121e15761211181611beb565b156121e0576040518060400160405280846000015173ffffffffffffffffffffffffffffffffffffffff168152602001846020015167ffffffffffffffff168152506003600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509050505b5b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612249868686600161286e565b505050505050565b612259612dcc565b61226282611beb565b6122a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229890613d73565b60405180910390fd5b60008290505b6000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146123935780925050506123a7565b50808061239f90614307565b9150506122a7565b919050565b6123c6828260405180602001604052806000815250612874565b5050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006124b18473ffffffffffffffffffffffffffffffffffffffff16612d33565b1561261a578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026124da611be3565b8786866040518563ffffffff1660e01b81526004016124fc9493929190613c6a565b602060405180830381600087803b15801561251657600080fd5b505af192505050801561254757506040513d601f19601f82011682018060405250810190612544919061316a565b60015b6125ca573d8060008114612577576040519150601f19603f3d011682016040523d82523d6000602084013e61257c565b606091505b506000815114156125c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125b990613f33565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061261f565b600190505b949350505050565b6060600082141561266f576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506127cf565b600082905060005b600082146126a157808061268a90614363565b915050600a8261269a91906141be565b9150612677565b60008167ffffffffffffffff8111156126e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156127155781602001600182028036833780820191505090505b5090505b600085146127c85760018261272e91906141ef565b9150600a8561273d91906143ac565b60306127499190614168565b60f81b818381518110612785577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856127c191906141be565b9450612719565b8093505050505b919050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b50505050565b50505050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156128ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128e190613f73565b60405180910390fd5b6128f381611beb565b15612933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292a90613f53565b60405180910390fd5b60008311612976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161296d90613f13565b60405180910390fd5b6129836000858386612868565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152505090506040518060400160405280858360000151612a809190614122565b6fffffffffffffffffffffffffffffffff168152602001858360200151612aa79190614122565b6fffffffffffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060405180604001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050600082905060005b85811015612d1657818773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612cb66000888488612490565b612cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cec90613f33565b60405180910390fd5b8180612d0090614363565b9250508080612d0e90614363565b915050612c45565b5080600081905550612d2b600087858861286e565b505050505050565b600080823b905060008111915050919050565b828054612d5290614331565b90600052602060002090601f016020900481019282612d745760008555612dbb565b82601f10612d8d57805160ff1916838001178555612dbb565b82800160010185558215612dbb579182015b82811115612dba578251825591602001919060010190612d9f565b5b509050612dc89190612e06565b5090565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681525090565b5b80821115612e1f576000816000905550600101612e07565b5090565b6000612e36612e318461405f565b61402e565b905082815260208101848484011115612e4e57600080fd5b612e598482856142c5565b509392505050565b6000612e74612e6f8461408f565b61402e565b905082815260208101848484011115612e8c57600080fd5b612e978482856142c5565b509392505050565b600081359050612eae816144aa565b92915050565b600081359050612ec3816144c1565b92915050565b600081359050612ed8816144d8565b92915050565b600081519050612eed816144d8565b92915050565b600082601f830112612f0457600080fd5b8135612f14848260208601612e23565b91505092915050565b600081519050612f2c816144ef565b92915050565b600082601f830112612f4357600080fd5b8135612f53848260208601612e61565b91505092915050565b600081359050612f6b81614506565b92915050565b600060208284031215612f8357600080fd5b6000612f9184828501612e9f565b91505092915050565b60008060408385031215612fad57600080fd5b6000612fbb85828601612e9f565b9250506020612fcc85828601612e9f565b9150509250929050565b600080600060608486031215612feb57600080fd5b6000612ff986828701612e9f565b935050602061300a86828701612e9f565b925050604061301b86828701612f5c565b9150509250925092565b6000806000806080858703121561303b57600080fd5b600061304987828801612e9f565b945050602061305a87828801612e9f565b935050604061306b87828801612f5c565b925050606085013567ffffffffffffffff81111561308857600080fd5b61309487828801612ef3565b91505092959194509250565b600080604083850312156130b357600080fd5b60006130c185828601612e9f565b92505060206130d285828601612eb4565b9150509250929050565b600080604083850312156130ef57600080fd5b60006130fd85828601612e9f565b925050602061310e85828601612f5c565b9150509250929050565b60006020828403121561312a57600080fd5b600061313884828501612eb4565b91505092915050565b60006020828403121561315357600080fd5b600061316184828501612ec9565b91505092915050565b60006020828403121561317c57600080fd5b600061318a84828501612ede565b91505092915050565b6000602082840312156131a557600080fd5b60006131b384828501612f1d565b91505092915050565b6000602082840312156131ce57600080fd5b600082013567ffffffffffffffff8111156131e857600080fd5b6131f484828501612f32565b91505092915050565b60006020828403121561320f57600080fd5b600061321d84828501612f5c565b91505092915050565b61322f81614223565b82525050565b61323e81614235565b82525050565b600061324f826140d4565b61325981856140ea565b93506132698185602086016142d4565b61327281614499565b840191505092915050565b6000613288826140df565b6132928185614106565b93506132a28185602086016142d4565b6132ab81614499565b840191505092915050565b60006132c1826140df565b6132cb8185614117565b93506132db8185602086016142d4565b80840191505092915050565b600081546132f481614331565b6132fe8186614117565b94506001821660008114613319576001811461332a5761335d565b60ff1983168652818601935061335d565b613333856140bf565b60005b8381101561335557815481890152600182019150602081019050613336565b838801955050505b50505092915050565b6000613373602283614106565b91507f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60008301527f64730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006133d9600683614106565b91507f50617573656400000000000000000000000000000000000000000000000000006000830152602082019050919050565b6000613419602683614106565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061347f601183614106565b91507f457863657373206d6178207065722074780000000000000000000000000000006000830152602082019050919050565b60006134bf602a83614106565b91507f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360008301527f74656e7420746f6b656e000000000000000000000000000000000000000000006020830152604082019050919050565b6000613525602383614106565b91507f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560008301527f6e647300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061358b602583614106565b91507f455243373231413a207472616e7366657220746f20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006135f1603983614106565b91507f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f76656420666f7220616c6c000000000000006020830152604082019050919050565b6000613657601283614106565b91507f45786365656473206d617820737570706c7900000000000000000000000000006000830152602082019050919050565b6000613697602b83614106565b91507f455243373231413a2062616c616e636520717565727920666f7220746865207a60008301527f65726f20616464726573730000000000000000000000000000000000000000006020830152604082019050919050565b60006136fd601583614106565b91507f546f6b656e20646f6573206e6f742065786973742e00000000000000000000006000830152602082019050919050565b600061373d602683614106565b91507f455243373231413a207472616e736665722066726f6d20696e636f727265637460008301527f206f776e657200000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006137a3602083614106565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006137e3601a83614106565b91507f455243373231413a20617070726f766520746f2063616c6c65720000000000006000830152602082019050919050565b6000613823603283614106565b91507f455243373231413a207472616e736665722063616c6c6572206973206e6f742060008301527f6f776e6572206e6f7220617070726f76656400000000000000000000000000006020830152604082019050919050565b6000613889601683614106565b91507f4d757374206d696e74206f6e65206f72206d6f726521000000000000000000006000830152602082019050919050565b60006138c9602283614106565b91507f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60008301527f65720000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061392f6000836140fb565b9150600082019050919050565b6000613949602383614106565b91507f455243373231413a207175616e74697479206d7573742062652067726561746560008301527f72203000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006139af603383614106565b91507f455243373231413a207472616e7366657220746f206e6f6e204552433732315260008301527f6563656976657220696d706c656d656e746572000000000000000000000000006020830152604082019050919050565b6000613a15601d83614106565b91507f455243373231413a20746f6b656e20616c7265616479206d696e7465640000006000830152602082019050919050565b6000613a55602183614106565b91507f455243373231413a206d696e7420746f20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613abb600e83614106565b91507f4661696c656420746f2073656e640000000000000000000000000000000000006000830152602082019050919050565b6000613afb601483614106565b91507f4e6f20636f6e74726163747320616c6c6f7765640000000000000000000000006000830152602082019050919050565b6000613b3b602e83614106565b91507f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060008301527f6f776e657220627920696e6465780000000000000000000000000000000000006020830152604082019050919050565b6000613ba1602d83614106565b91507f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560008301527f78697374656e7420746f6b656e000000000000000000000000000000000000006020830152604082019050919050565b613c03816142bb565b82525050565b6000613c1582866132e7565b9150613c2182856132b6565b9150613c2d82846132b6565b9150819050949350505050565b6000613c4582613922565b9150819050919050565b6000602082019050613c646000830184613226565b92915050565b6000608082019050613c7f6000830187613226565b613c8c6020830186613226565b613c996040830185613bfa565b8181036060830152613cab8184613244565b905095945050505050565b6000602082019050613ccb6000830184613235565b92915050565b60006020820190508181036000830152613ceb818461327d565b905092915050565b60006020820190508181036000830152613d0c81613366565b9050919050565b60006020820190508181036000830152613d2c816133cc565b9050919050565b60006020820190508181036000830152613d4c8161340c565b9050919050565b60006020820190508181036000830152613d6c81613472565b9050919050565b60006020820190508181036000830152613d8c816134b2565b9050919050565b60006020820190508181036000830152613dac81613518565b9050919050565b60006020820190508181036000830152613dcc8161357e565b9050919050565b60006020820190508181036000830152613dec816135e4565b9050919050565b60006020820190508181036000830152613e0c8161364a565b9050919050565b60006020820190508181036000830152613e2c8161368a565b9050919050565b60006020820190508181036000830152613e4c816136f0565b9050919050565b60006020820190508181036000830152613e6c81613730565b9050919050565b60006020820190508181036000830152613e8c81613796565b9050919050565b60006020820190508181036000830152613eac816137d6565b9050919050565b60006020820190508181036000830152613ecc81613816565b9050919050565b60006020820190508181036000830152613eec8161387c565b9050919050565b60006020820190508181036000830152613f0c816138bc565b9050919050565b60006020820190508181036000830152613f2c8161393c565b9050919050565b60006020820190508181036000830152613f4c816139a2565b9050919050565b60006020820190508181036000830152613f6c81613a08565b9050919050565b60006020820190508181036000830152613f8c81613a48565b9050919050565b60006020820190508181036000830152613fac81613aae565b9050919050565b60006020820190508181036000830152613fcc81613aee565b9050919050565b60006020820190508181036000830152613fec81613b2e565b9050919050565b6000602082019050818103600083015261400c81613b94565b9050919050565b60006020820190506140286000830184613bfa565b92915050565b6000604051905081810181811067ffffffffffffffff821117156140555761405461446a565b5b8060405250919050565b600067ffffffffffffffff82111561407a5761407961446a565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156140aa576140a961446a565b5b601f19601f8301169050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061412d8261427f565b91506141388361427f565b9250826fffffffffffffffffffffffffffffffff0382111561415d5761415c6143dd565b5b828201905092915050565b6000614173826142bb565b915061417e836142bb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156141b3576141b26143dd565b5b828201905092915050565b60006141c9826142bb565b91506141d4836142bb565b9250826141e4576141e361440c565b5b828204905092915050565b60006141fa826142bb565b9150614205836142bb565b925082821015614218576142176143dd565b5b828203905092915050565b600061422e8261429b565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600061427882614223565b9050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156142f25780820151818401526020810190506142d7565b83811115614301576000848401525b50505050565b6000614312826142bb565b91506000821415614326576143256143dd565b5b600182039050919050565b6000600282049050600182168061434957607f821691505b6020821081141561435d5761435c61443b565b5b50919050565b600061436e826142bb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156143a1576143a06143dd565b5b600182019050919050565b60006143b7826142bb565b91506143c2836142bb565b9250826143d2576143d161440c565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6144b381614223565b81146144be57600080fd5b50565b6144ca81614235565b81146144d557600080fd5b50565b6144e181614241565b81146144ec57600080fd5b50565b6144f88161426d565b811461450357600080fd5b50565b61450f816142bb565b811461451a57600080fd5b5056fea26469706673582212201bc11bb27e02a87cdab8c2a7693a9d75fd6cb4093583a0c47c1e8a72c554e6c964736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,488 |
0x65577180d4a5eca0f6382d0fc448b69344e04105
|
pragma solidity 0.5.8;
contract Context {
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
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 TRC20Events {
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event TransferBurn(address indexed src, address indexed dst, uint wad, uint remainAmount, uint receiveAmount, uint burnAmount, uint rewardAmount);
}
contract ITRC20 is TRC20Events {
function totalSupply() public view returns (uint);
function balanceOf(address guy) public view returns (uint);
function allowance(address src, address guy) public view returns (uint);
function approve(address guy, uint wad) public returns (bool);
function transfer(address dst, uint wad) public returns (bool);
function transferFrom(
address src, address dst, uint wad
) public returns (bool);
}
contract BaseTRC20 is Context, ITRC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
uint private _burnProportion;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _rewardAddress;
constructor (string memory name, string memory symbol, uint8 decimals, uint burnProportion, address rewardAddress) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_burnProportion = burnProportion;
_rewardAddress = rewardAddress;
}
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function burnProportion() public view returns (uint) {
return _burnProportion;
}
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 balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "TRC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "TRC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "TRC20: transfer from the zero address");
require(recipient != address(0), "TRC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "TRC20: transfer amount exceeds balance");
//销毁总量
uint remainAmount = amount.mul(_burnProportion).div(65);
//接收额度
uint receiveAmount = amount.sub(remainAmount);
//销毁额度
uint burnAmount = remainAmount.div(2);
//奖励额度
uint rewardAmount = remainAmount.sub(burnAmount);
_balances[recipient] = _balances[recipient].add(receiveAmount);
_balances[_rewardAddress] = _balances[_rewardAddress].add(rewardAmount);
_totalSupply = _totalSupply.sub(burnAmount);
emit TransferBurn(sender, recipient, amount, remainAmount, receiveAmount, burnAmount, rewardAmount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "TRC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "TRC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "TRC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "TRC20: approve from the zero address");
require(spender != address(0), "TRC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract Token is ITRC20, BaseTRC20 {
constructor(address gr, address rewardAddress) public BaseTRC20("mumu", "MUMU", 18, 8, rewardAddress){
require(gr != address(0), "invalid gr");
require(rewardAddress != address(0), "invalid rewardAddress");
_mint(gr, 5000 * 10 ** 18);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80636349bc9a116100715780636349bc9a146102d057806370a08231146102ee57806395d89b4114610346578063a457c2d7146103c9578063a9059cbb1461042f578063dd62ed3e14610495576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a257806323b872dd146101c0578063313ce56714610246578063395093511461026a575b600080fd5b6100c161050d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105af565b604051808215151515815260200191505060405180910390f35b6101aa6105cd565b6040518082815260200191505060405180910390f35b61022c600480360360608110156101d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105d7565b604051808215151515815260200191505060405180910390f35b61024e6106b0565b604051808260ff1660ff16815260200191505060405180910390f35b6102b66004803603604081101561028057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c7565b604051808215151515815260200191505060405180910390f35b6102d861077a565b6040518082815260200191505060405180910390f35b6103306004803603602081101561030457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610784565b6040518082815260200191505060405180910390f35b61034e6107cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038e578082015181840152602081019050610373565b50505050905090810190601f1680156103bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610415600480360360408110156103df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061086e565b604051808215151515815260200191505060405180910390f35b61047b6004803603604081101561044557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061093b565b604051808215151515815260200191505060405180910390f35b6104f7600480360360408110156104ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610959565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105a55780601f1061057a576101008083540402835291602001916105a5565b820191906000526020600020905b81548152906001019060200180831161058857829003601f168201915b5050505050905090565b60006105c36105bc6109e0565b84846109e8565b6001905092915050565b6000600254905090565b60006105e4848484610bdf565b6106a5846105f06109e0565b6106a0856040518060600160405280602881526020016113b060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106566109e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461101d9092919063ffffffff16565b6109e8565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006107706106d46109e0565b8461076b85600160006106e56109e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dd90919063ffffffff16565b6109e8565b6001905092915050565b6000600354905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108645780601f1061083957610100808354040283529160200191610864565b820191906000526020600020905b81548152906001019060200180831161084757829003601f168201915b5050505050905090565b600061093161087b6109e0565b8461092c8560405180606001604052806025815260200161141d60259139600160006108a56109e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461101d9092919063ffffffff16565b6109e8565b6001905092915050565b600061094f6109486109e0565b8484610bdf565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a6e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806113d86024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610af4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806113696022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061138b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ceb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806113466023913960400191505060405180910390fd5b610d5681604051806060016040528060268152602001611442602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461101d9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610dc26041610db46003548561116590919063ffffffff16565b6111eb90919063ffffffff16565b90506000610dd9828461123590919063ffffffff16565b90506000610df16002846111eb90919063ffffffff16565b90506000610e08828561123590919063ffffffff16565b9050610e5b836000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dd90919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f1081600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110dd90919063ffffffff16565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f898260025461123590919063ffffffff16565b6002819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f6e5ead405e701ab9b17ba75cfe6d77d143700eca0a8d7ec79d8277149aa6ecdf8787878787604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a350505050505050565b60008383111582906110ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561108f578082015181840152602081019050611074565b50505050905090810190601f1680156110bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561115b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083141561117857600090506111e5565b600082840290508284828161118957fe5b04146111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806113fc6021913960400191505060405180910390fd5b809150505b92915050565b600061122d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061127f565b905092915050565b600061127783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061101d565b905092915050565b6000808311829061132b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112f05780820151818401526020810190506112d5565b50505050905090810190601f16801561131d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161133757fe5b04905080915050939250505056fe54524332303a207472616e7366657220746f20746865207a65726f206164647265737354524332303a20617070726f766520746f20746865207a65726f206164647265737354524332303a207472616e736665722066726f6d20746865207a65726f206164647265737354524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636554524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f54524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a165627a7a7230582013cbfecbebf6117ebfb00464d93c2365dbad89dc05345532f9edb13931f356a30029
|
{"success": true, "error": null, "results": {}}
| 3,489 |
0x6a8e6abbdadecf0da5c0053951e3742807a8a3e1
|
pragma solidity ^0.5.0;
/*****************************************************************************
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
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) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an `Approval` event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/*****************************************************************************
* @dev Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Paused();
event Unpaused();
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() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title wANATHA v2
* @dev wANATHA v2 is an ERC20 implementation of the wANATHA v2 ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract wANATHA2 is Ownable, ERC20Pausable {
string public constant name = "wANATHA v2";
string public constant symbol = "wANATHAN";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 5000000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b03813516906020013561041f565b604080519115158252519081900360200190f35b6101f661044a565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610450565b61024661047d565b6040805160ff9092168252519081900360200190f35b6101f6610482565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610491565b6102986104b5565b005b610298600480360360208110156102b057600080fd5b503561055c565b6101da610569565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b0316610579565b610298600480360360408110156102fb57600080fd5b506001600160a01b038135169060200135610594565b6102986105a2565b610321610650565b604080516001600160a01b039092168252519081900360200190f35b6101da61065f565b610139610670565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610694565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106b8565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106dc565b610298600480360360208110156103e957600080fd5b50356001600160a01b0316610707565b6040518060400160405280600a8152602001693ba0a720aa2420903b1960b11b81525081565b600354600090600160a01b900460ff161561043957600080fd5b6104438383610801565b9392505050565b60025490565b600354600090600160a01b900460ff161561046a57600080fd5b610475848484610817565b949350505050565b601281565b6a0422ca8b0a00a42500000081565b600354600090600160a01b900460ff16156104ab57600080fd5b610443838361086e565b6104bd61065f565b61050e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052457600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056633826108aa565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b61059e8282610983565b5050565b6105aa61065f565b6105fb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061257600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b604051806040016040528060088152602001673ba0a720aa2420a760c11b81525081565b600354600090600160a01b900460ff16156106ae57600080fd5b61044383836109c8565b600354600090600160a01b900460ff16156106d257600080fd5b6104438383610a04565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61070f61065f565b610760576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a55760405162461bcd60e51b8152600401808060200182810382526026815260200180610d1a6026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061080e338484610a11565b50600192915050565b6000610824848484610afd565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461086491869161085f908663ffffffff610c3f16565b610a11565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080e91859061085f908663ffffffff610c9c16565b6001600160a01b0382166108ef5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d626021913960400191505060405180910390fd5b600254610902908263ffffffff610c3f16565b6002556001600160a01b03821660009081526020819052604090205461092e908263ffffffff610c3f16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61098d82826108aa565b6001600160a01b03821660009081526001602090815260408083203380855292529091205461059e91849161085f908563ffffffff610c3f16565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080e91859061085f908663ffffffff610c3f16565b600061080e338484610afd565b6001600160a01b038316610a565760405162461bcd60e51b8152600401808060200182810382526024815260200180610da86024913960400191505060405180910390fd5b6001600160a01b038216610a9b5760405162461bcd60e51b8152600401808060200182810382526022815260200180610d406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b425760405162461bcd60e51b8152600401808060200182810382526025815260200180610d836025913960400191505060405180910390fd5b6001600160a01b038216610b875760405162461bcd60e51b8152600401808060200182810382526023815260200180610cf76023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bb0908263ffffffff610c3f16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be5908263ffffffff610c9c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c96576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610443576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a723158204c8867b41fce778b7ad89d783a85305b2ce754782fb4a9c5491bc4ad930c11e964736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,490 |
0xfb8c4fbdb022e502593ef07161ecc424983cc1f1
|
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) {
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");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract 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 Mercury is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(owner, initialSupply*(10**18));
}
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;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
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) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb1461061f578063b2bdfa7b14610683578063dd62ed3e146106b7578063e12681151461072f576100f5565b806352b0f196146103aa57806370a082311461050057806380b2122e1461055857806395d89b411461059c576100f5565b806318160ddd116100d357806318160ddd1461029957806323b872dd146102b7578063313ce5671461033b5780634e6ec2471461035c576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107e7565b005b6101ba61099d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a3f565b60405180821515815260200191505060405180910390f35b6102a1610a5d565b6040518082815260200191505060405180910390f35b610323600480360360608110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b610343610b40565b604051808260ff16815260200191505060405180910390f35b6103a86004803603604081101561037257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b005b6104fe600480360360608110156103c057600080fd5b8101908080359060200190929190803590602001906401000000008111156103e757600080fd5b8201836020820111156103f957600080fd5b8035906020019184602083028401116401000000008311171561041b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111640100000000831117156104af57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d76565b005b6105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7a565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc2565b005b6105a46110c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e45780820151818401526020810190506105c9565b50505050905090810190601f1680156106115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066b6004803603604081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116b565b60405180821515815260200191505060405180910390f35b61068b611189565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610719600480360360408110156106cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111af565b6040518082815260200191505060405180910390f35b6107e56004803603602081101561074557600080fd5b810190808035906020019064010000000081111561076257600080fd5b82018360208201111561077457600080fd5b8035906020019184602083028401116401000000008311171561079657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611236565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8151811015610999576001600260008484815181106108c857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061093357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108ad565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a355780601f10610a0a57610100808354040283529160200191610a35565b820191906000526020600020905b815481529060010190602001808311610a1857829003601f168201915b5050505050905090565b6000610a53610a4c611473565b848461147b565b6001905092915050565b6000600554905090565b6000610a74848484611672565b610b3584610a80611473565b610b3085604051806060016040528060288152602001612ea060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ae6611473565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b61147b565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c2f816005546113eb90919063ffffffff16565b600581905550610ca881600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8251811015610f745760006003905060006102149050610e82858481518110610e6157fe5b6020026020010151858581518110610e7557fe5b602002602001015161116b565b5085831015610f65576001806000878681518110610e9c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006003905060006102149050610f62878681518110610f1157fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61147b565b50505b50508080600101915050610e3c565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b5050505050905090565b600061117f611178611473565b8484611672565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156113e757600180600084848151811061131657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506112fc565b5050565b600080828401905083811015611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611501576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612eed6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611587576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e586022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117415750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611a485781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561180d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611893576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61189e868686612e2f565b61190984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199c846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d67565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611af15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b495750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611ea457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bd657508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611be357806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b611cfa868686612e2f565b611d6584604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df8846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d66565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156121be57600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612009576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612014868686612e2f565b61207f84604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612112846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d65565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125d657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122c05750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612315576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61242c868686612e2f565b61249784604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d64565b6003548110156129a857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126e7576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561276d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156127f3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b6127fe868686612e2f565b61286984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128fc846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d63565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480612a515750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612bbd868686612e2f565b612c2884604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cbb846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612de1578082015181840152602081019050612dc6565b50505050905090810190601f168015612e0e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b8ccbed269c084530a6f1fdf75c3bd1c273068d377d7cab95ec37b4d625e23ee64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,491 |
0x2f86061cdb4ad9d4cd11c66799974775b4e5f946
|
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
/*
Greetings traveler...
We all know that the state of the market can be overwhelming and stressful at times, with all of its highs, lows and tempestuous volatility. During such times, $ZOGE remains equanimous - undisturbed by the pervasive chaos that surrounds it.
$ZOGE is an ERC-20 token built on the Ethereum blockchain, native to the ZenDoge project. Join us and take a look inside. You'd be pleasantly surprised at what you might find.
Tokenomics
🧘♂️10,000,000 Total supply
🧘♂️13% Buy tax
🧘♂️17% Sell tax (dropped to 13% after an hour)
🧘♂️No team tokens
🧘♂️Liquidity locked immediately
Twitter: twitter.com/zoge_eth
Website: zendoge.net
TG: t.me/zen_doge
*/
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 ZenDoge 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 = 10* 10**6* 10**18;
string private _name = 'ZenDoge ' ;
string private _symbol = 'ZOGE ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209a76c1af35301257502e759b5b4895f4e57a35146aac54a42789b58a54a8d80664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,492 |
0x8e064b5ef4a3c771a05dc80678ad2375fe7315e7
|
pragma solidity ^0.4.24;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed node, address resolver);
// Logged when the TTL of a node changes
event NewTTL(bytes32 indexed node, uint64 ttl);
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
function setResolver(bytes32 node, address resolver) external;
function setOwner(bytes32 node, address owner) external;
function setTTL(bytes32 node, uint64 ttl) external;
function owner(bytes32 node) external view returns (address);
function resolver(bytes32 node) external view returns (address);
function ttl(bytes32 node) external view returns (uint64);
}
/**
* A simple resolver anyone can use; only allows the owner of a node to set its
* address.
* Updated with nonfunctional changes
*/
contract PublicResolver {
bytes4 constant INTERFACE_META_ID = 0x01ffc9a7;
bytes4 constant ADDR_INTERFACE_ID = 0x3b3b57de;
bytes4 constant CONTENT_INTERFACE_ID = 0xd8389dc5;
bytes4 constant NAME_INTERFACE_ID = 0x691f3431;
bytes4 constant ABI_INTERFACE_ID = 0x2203ab56;
bytes4 constant PUBKEY_INTERFACE_ID = 0xc8690233;
bytes4 constant TEXT_INTERFACE_ID = 0x59d1d43c;
bytes4 constant MULTIHASH_INTERFACE_ID = 0xe89401a1;
event AddrChanged(bytes32 indexed node, address a);
event ContentChanged(bytes32 indexed node, bytes32 hash);
event NameChanged(bytes32 indexed node, string name);
event ABIChanged(bytes32 indexed node, uint256 indexed contentType);
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);
event TextChanged(bytes32 indexed node, string indexedKey, string key);
event MultihashChanged(bytes32 indexed node, bytes hash);
struct PublicKey {
bytes32 x;
bytes32 y;
}
struct Record {
address addr;
bytes32 content;
string name;
PublicKey pubkey;
mapping(string=>string) text;
mapping(uint256=>bytes) abis;
bytes multihash;
}
ENS ens;
mapping (bytes32 => Record) records;
modifier only_owner(bytes32 node) {
require(ens.owner(node) == msg.sender);
_;
}
/**
* Constructor.
* @param ensAddr The ENS registrar contract.
*/
constructor(ENS ensAddr) public {
ens = ensAddr;
}
/**
* Sets the address associated with an ENS node.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param addr The address to set.
*/
function setAddr(bytes32 node, address addr) public only_owner(node) {
records[node].addr = addr;
emit AddrChanged(node, addr);
}
/**
* Sets the content hash associated with an ENS node.
* May only be called by the owner of that node in the ENS registry.
* Note that this resource type is not standardized, and will likely change
* in future to a resource type based on multihash.
* @param node The node to update.
* @param hash The content hash to set
*/
function setContent(bytes32 node, bytes32 hash) public only_owner(node) {
records[node].content = hash;
emit ContentChanged(node, hash);
}
/**
* Sets the multihash associated with an ENS node.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param hash The multihash to set
*/
function setMultihash(bytes32 node, bytes hash) public only_owner(node) {
records[node].multihash = hash;
emit MultihashChanged(node, hash);
}
/**
* Sets the name associated with an ENS node, for reverse records.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param name The name to set.
*/
function setName(bytes32 node, string name) public only_owner(node) {
records[node].name = name;
emit NameChanged(node, name);
}
/**
* Sets the ABI associated with an ENS node.
* Nodes may have one ABI of each content type. To remove an ABI, set it to
* the empty string.
* @param node The node to update.
* @param contentType The content type of the ABI
* @param data The ABI data.
*/
function setABI(bytes32 node, uint256 contentType, bytes data) public only_owner(node) {
// Content types must be powers of 2
require(((contentType - 1) & contentType) == 0);
records[node].abis[contentType] = data;
emit ABIChanged(node, contentType);
}
/**
* Sets the SECP256k1 public key associated with an ENS node.
* @param node The ENS node to query
* @param x the X coordinate of the curve point for the public key.
* @param y the Y coordinate of the curve point for the public key.
*/
function setPubkey(bytes32 node, bytes32 x, bytes32 y) public only_owner(node) {
records[node].pubkey = PublicKey(x, y);
emit PubkeyChanged(node, x, y);
}
/**
* Sets the text data associated with an ENS node and key.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param key The key to set.
* @param value The text data value to set.
*/
function setText(bytes32 node, string key, string value) public only_owner(node) {
records[node].text[key] = value;
emit TextChanged(node, key, key);
}
/**
* Returns the text data associated with an ENS node and key.
* @param node The ENS node to query.
* @param key The text data key to query.
* @return The associated text data.
*/
function text(bytes32 node, string key) public view returns (string) {
return records[node].text[key];
}
/**
* Returns the SECP256k1 public key associated with an ENS node.
* Defined in EIP 619.
* @param node The ENS node to query
* @return x, y the X and Y coordinates of the curve point for the public key.
*/
function pubkey(bytes32 node) public view returns (bytes32 x, bytes32 y) {
return (records[node].pubkey.x, records[node].pubkey.y);
}
/**
* Returns the ABI associated with an ENS node.
* Defined in EIP205.
* @param node The ENS node to query
* @param contentTypes A bitwise OR of the ABI formats accepted by the caller.
* @return contentType The content type of the return value
* @return data The ABI data
*/
function ABI(bytes32 node, uint256 contentTypes) public view returns (uint256 contentType, bytes data) {
Record storage record = records[node];
for (contentType = 1; contentType <= contentTypes; contentType <<= 1) {
if ((contentType & contentTypes) != 0 && record.abis[contentType].length > 0) {
data = record.abis[contentType];
return;
}
}
contentType = 0;
}
/**
* Returns the name associated with an ENS node, for reverse records.
* Defined in EIP181.
* @param node The ENS node to query.
* @return The associated name.
*/
function name(bytes32 node) public view returns (string) {
return records[node].name;
}
/**
* Returns the content hash associated with an ENS node.
* Note that this resource type is not standardized, and will likely change
* in future to a resource type based on multihash.
* @param node The ENS node to query.
* @return The associated content hash.
*/
function content(bytes32 node) public view returns (bytes32) {
return records[node].content;
}
/**
* Returns the multihash associated with an ENS node.
* @param node The ENS node to query.
* @return The associated multihash.
*/
function multihash(bytes32 node) public view returns (bytes) {
return records[node].multihash;
}
/**
* Returns the address associated with an ENS node.
* @param node The ENS node to query.
* @return The associated address.
*/
function addr(bytes32 node) public view returns (address) {
return records[node].addr;
}
/**
* Returns true if the resolver implements the interface specified by the provided hash.
* @param interfaceID The ID of the interface to check for.
* @return True if the contract implements the requested interface.
*/
function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
return interfaceID == ADDR_INTERFACE_ID ||
interfaceID == CONTENT_INTERFACE_ID ||
interfaceID == NAME_INTERFACE_ID ||
interfaceID == ABI_INTERFACE_ID ||
interfaceID == PUBKEY_INTERFACE_ID ||
interfaceID == TEXT_INTERFACE_ID ||
interfaceID == MULTIHASH_INTERFACE_ID ||
interfaceID == INTERFACE_META_ID;
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301ffc9a7146100e057806310f13a8c146101445780632203ab561461020157806329cd62ea146102bc5780632dff6941146103095780633b3b57de1461035657806359d1d43c146103c7578063623195b0146104b7578063691f34311461053857806377372213146105e2578063aa4cb54714610659578063c3d014d6146106d0578063c86902331461070f578063d5fa2b001461076b578063e89401a1146107bc575b600080fd5b3480156100ec57600080fd5b5061012a60048036038101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610866565b604051808215151515815260200191505060405180910390f35b34801561015057600080fd5b506101ff6004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610bc0565b005b34801561020d57600080fd5b5061023a600480360381019080803560001916906020019092919080359060200190929190505050610e7d565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610280578082015181840152602081019050610265565b50505050905090810190601f1680156102ad5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b3480156102c857600080fd5b50610307600480360381019080803560001916906020019092919080356000191690602001909291908035600019169060200190929190505050610fc0565b005b34801561031557600080fd5b506103386004803603810190808035600019169060200190929190505050611185565b60405180826000191660001916815260200191505060405180910390f35b34801561036257600080fd5b5061038560048036038101908080356000191690602001909291905050506111ad565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103d357600080fd5b5061043c6004803603810190808035600019169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506111f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047c578082015181840152602081019050610461565b50505050905090810190601f1680156104a95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104c357600080fd5b50610536600480360381019080803560001916906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061131f565b005b34801561054457600080fd5b5061056760048036038101908080356000191690602001909291905050506114bc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105a757808201518184015260208101905061058c565b50505050905090810190601f1680156105d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105ee57600080fd5b506106576004803603810190808035600019169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061157c565b005b34801561066557600080fd5b506106ce6004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611762565b005b3480156106dc57600080fd5b5061070d60048036038101908080356000191690602001909291908035600019169060200190929190505050611948565b005b34801561071b57600080fd5b5061073e6004803603810190808035600019169060200190929190505050611ac5565b60405180836000191660001916815260200182600019166000191681526020019250505060405180910390f35b34801561077757600080fd5b506107ba6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b15565b005b3480156107c857600080fd5b506107eb6004803603810190808035600019169060200190929190505050611cec565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561082b578082015181840152602081019050610810565b50505050905090810190601f1680156108585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000633b3b57de7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610937575063d8389dc57c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806109a2575063691f34317c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a0d5750632203ab567c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a78575063c86902337c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610ae357506359d1d43c7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b4e575063e89401a17c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610bb957506301ffc9a77c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b823373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b158015610c7057600080fd5b505af1158015610c84573d6000803e3d6000fd5b505050506040513d6020811015610c9a57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141515610ccd57600080fd5b81600160008660001916600019168152602001908152602001600020600501846040518082805190602001908083835b602083101515610d225780518252602082019150602081019050602083039250610cfd565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390209080519060200190610d68929190611dac565b5083600019167fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a75508485604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015610dd5578082015181840152602081019050610dba565b50505050905090810190601f168015610e025780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015610e3b578082015181840152602081019050610e20565b50505050905090810190601f168015610e685780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a250505050565b6000606060006001600086600019166000191681526020019081526020016000209050600192505b8383111515610fb357600084841614158015610eea57506000816006016000858152602001908152602001600020805460018160011615610100020316600290049050115b15610fa4578060060160008481526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b50505050509150610fb8565b6001839060020a029250610ea5565b600092505b509250929050565b823373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050506040513d602081101561109a57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415156110cd57600080fd5b6040805190810160405280846000191681526020018360001916815250600160008660001916600019168152602001908152602001600020600301600082015181600001906000191690556020820151816001019060001916905590505083600019167f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e46848460405180836000191660001916815260200182600019166000191681526020019250505060405180910390a250505050565b6000600160008360001916600019168152602001908152602001600020600101549050919050565b600060016000836000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6060600160008460001916600019168152602001908152602001600020600501826040518082805190602001908083835b60208310151561124b5780518252602082019150602081019050602083039250611226565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113125780601f106112e757610100808354040283529160200191611312565b820191906000526020600020905b8154815290600101906020018083116112f557829003601f168201915b5050505050905092915050565b823373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b1580156113cf57600080fd5b505af11580156113e3573d6000803e3d6000fd5b505050506040513d60208110156113f957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614151561142c57600080fd5b600083600185031614151561144057600080fd5b8160016000866000191660001916815260200190815260200160002060060160008581526020019081526020016000209080519060200190611483929190611e2c565b508284600019167faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe360405160405180910390a350505050565b60606001600083600019166000191681526020019081526020016000206002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115705780601f1061154557610100808354040283529160200191611570565b820191906000526020600020905b81548152906001019060200180831161155357829003601f168201915b50505050509050919050565b813373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561162c57600080fd5b505af1158015611640573d6000803e3d6000fd5b505050506040513d602081101561165657600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614151561168957600080fd5b8160016000856000191660001916815260200190815260200160002060020190805190602001906116bb929190611dac565b5082600019167fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f7836040518080602001828103825283818151815260200191508051906020019080838360005b83811015611723578082015181840152602081019050611708565b50505050905090810190601f1680156117505780820380516001836020036101000a031916815260200191505b509250505060405180910390a2505050565b813373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561181257600080fd5b505af1158015611826573d6000803e3d6000fd5b505050506040513d602081101561183c57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614151561186f57600080fd5b8160016000856000191660001916815260200190815260200160002060070190805190602001906118a1929190611e2c565b5082600019167fc0b0fc07269fc2749adada3221c095a1d2187b2d075b51c915857b520f3a5021836040518080602001828103825283818151815260200191508051906020019080838360005b838110156119095780820151818401526020810190506118ee565b50505050905090810190601f1680156119365780820380516001836020036101000a031916815260200191505b509250505060405180910390a2505050565b813373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b1580156119f857600080fd5b505af1158015611a0c573d6000803e3d6000fd5b505050506040513d6020811015611a2257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141515611a5557600080fd5b81600160008560001916600019168152602001908152602001600020600101816000191690555082600019167f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc8360405180826000191660001916815260200191505060405180910390a2505050565b600080600160008460001916600019168152602001908152602001600020600301600001546001600085600019166000191681526020019081526020016000206003016001015491509150915091565b813373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b158015611bc557600080fd5b505af1158015611bd9573d6000803e3d6000fd5b505050506040513d6020811015611bef57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141515611c2257600080fd5b8160016000856000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600019167f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd283604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a2505050565b60606001600083600019166000191681526020019081526020016000206007018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611da05780601f10611d7557610100808354040283529160200191611da0565b820191906000526020600020905b815481529060010190602001808311611d8357829003601f168201915b50505050509050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611ded57805160ff1916838001178555611e1b565b82800160010185558215611e1b579182015b82811115611e1a578251825591602001919060010190611dff565b5b509050611e289190611eac565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611e6d57805160ff1916838001178555611e9b565b82800160010185558215611e9b579182015b82811115611e9a578251825591602001919060010190611e7f565b5b509050611ea89190611eac565b5090565b611ece91905b80821115611eca576000816000905550600101611eb2565b5090565b905600a165627a7a72305820435a4b0f19108c39a64d14722ffe0e065883d794db91a87323c17d28357654980029
|
{"success": true, "error": null, "results": {}}
| 3,493 |
0x148e15fdbc6403f8a52f17bdd4332efa79e04564
|
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// 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/[email protected]`.
*/
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/[email protected]`.
*/
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/[email protected]`.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/// @notice Based on Compound Governance.
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() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
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;
}
}
|
0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e2146101d0578063e177246e146101e5578063f2b0653714610205578063f851a44014610232576100c2565b80636a42b8f8146101915780637d645fab146101a6578063b1b43ae5146101bb576100c2565b80630825f38f146100c45780630e18b681146100ed57806326782247146101025780633a66f901146101245780634dd18bf514610151578063591fcdfe14610171575b005b6100d76100d23660046108c4565b610247565b6040516100e49190610f91565b60405180910390f35b3480156100f957600080fd5b506100c2610469565b34801561010e57600080fd5b506101176104e6565b6040516100e49190610f0d565b34801561013057600080fd5b5061014461013f3660046108c4565b6104f5565b6040516100e49190610f83565b34801561015d57600080fd5b506100c261016c36600461089e565b6105f8565b34801561017d57600080fd5b506100c261018c3660046108c4565b610667565b34801561019d57600080fd5b5061014461072b565b3480156101b257600080fd5b50610144610731565b3480156101c757600080fd5b50610144610738565b3480156101dc57600080fd5b5061014461073f565b3480156101f157600080fd5b506100c2610200366004610969565b610746565b34801561021157600080fd5b50610225610220366004610969565b6107de565b6040516100e49190610f75565b34801561023e57600080fd5b506101176107f3565b6000546060906001600160a01b0316331461027d5760405162461bcd60e51b815260040161027490610fa2565b60405180910390fd5b60008686868686604051602001610298959493929190610f1b565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff166102df5760405162461bcd60e51b815260040161027490611012565b826102e8610802565b10156103065760405162461bcd60e51b815260040161027490610fe2565b610319836212750063ffffffff61080616565b610321610802565b111561033f5760405162461bcd60e51b815260040161027490610fc2565b6000818152600360205260409020805460ff191690558451606090610365575083610391565b85805190602001208560405160200161037f929190610ede565b60405160208183030381529060405290505b60006060896001600160a01b031689846040516103ae9190610efa565b60006040518083038185875af1925050503d80600081146103eb576040519150601f19603f3d011682016040523d82523d6000602084013e6103f0565b606091505b5091509150816104125760405162461bcd60e51b815260040161027490611052565b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b6040516104529493929190611082565b60405180910390a393505050505b95945050505050565b6001546001600160a01b031633146104935760405162461bcd60e51b815260040161027490611022565b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b031633146105205760405162461bcd60e51b815260040161027490611042565b61053a60025461052e610802565b9063ffffffff61080616565b8210156105595760405162461bcd60e51b815260040161027490611062565b60008686868686604051602001610574959493929190610f1b565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916600117905591506001600160a01b0388169082907f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f906105e6908a908a908a908a90611082565b60405180910390a39695505050505050565b3330146106175760405162461bcd60e51b815260040161027490611032565b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b031633146106915760405162461bcd60e51b815260040161027490610fb2565b600085858585856040516020016106ac959493929190610f1b565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916905591506001600160a01b0387169082907f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf879061071b908990899089908990611082565b60405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b3330146107655760405162461bcd60e51b815260040161027490611072565b6202a3008110156107885760405162461bcd60e51b815260040161027490610ff2565b62278d008111156107ab5760405162461bcd60e51b815260040161027490611002565b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b60008282018381101561082b5760405162461bcd60e51b815260040161027490610fd2565b90505b92915050565b803561082e81611198565b803561082e816111af565b600082601f83011261085b57600080fd5b813561086e610869826110ec565b6110c5565b9150808252602083016020830185838301111561088a57600080fd5b610895838284611152565b50505092915050565b6000602082840312156108b057600080fd5b60006108bc8484610834565b949350505050565b600080600080600060a086880312156108dc57600080fd5b60006108e88888610834565b95505060206108f98882890161083f565b945050604086013567ffffffffffffffff81111561091657600080fd5b6109228882890161084a565b935050606086013567ffffffffffffffff81111561093f57600080fd5b61094b8882890161084a565b925050608061095c8882890161083f565b9150509295509295909350565b60006020828403121561097b57600080fd5b60006108bc848461083f565b61099081611126565b82525050565b61099081611131565b61099081611136565b6109906109b482611139565b611136565b60006109c482611114565b6109ce8185611118565b93506109de81856020860161115e565b6109e78161118e565b9093019392505050565b60006109fc82611114565b610a068185611121565b9350610a1681856020860161115e565b9290920192915050565b6000610a2d603883611118565b7f54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a20436181527f6c6c206d75737420636f6d652066726f6d2061646d696e2e0000000000000000602082015260400192915050565b6000610a8c603783611118565b7f54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c81527f6c206d75737420636f6d652066726f6d2061646d696e2e000000000000000000602082015260400192915050565b6000610aeb603383611118565b6000805160206111b983398151915281527230b739b0b1ba34b7b71034b99039ba30b6329760691b602082015260400192915050565b6000610b2e601b83611118565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000610b67604583611118565b6000805160206111b983398151915281527f616e73616374696f6e206861736e2774207375727061737365642074696d65206020820152643637b1b59760d91b604082015260600192915050565b6000610bc2603483611118565b7f54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420658152733c31b2b2b21036b4b734b6bab6903232b630bc9760611b602082015260400192915050565b6000610c18603883611118565b7f54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e81527f6f7420657863656564206d6178696d756d2064656c61792e0000000000000000602082015260400192915050565b6000610c77603d83611118565b6000805160206111b983398151915281527f616e73616374696f6e206861736e2774206265656e207175657565642e000000602082015260400192915050565b6000610cc4603883611118565b7f54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737481527f20636f6d652066726f6d2070656e64696e6741646d696e2e0000000000000000602082015260400192915050565b6000610d23603883611118565b7f54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c2081527f6d75737420636f6d652066726f6d2054696d656c6f636b2e0000000000000000602082015260400192915050565b6000610d82603683611118565b7f54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c8152751036bab9ba1031b7b6b290333937b69030b236b4b71760511b602082015260400192915050565b6000610dda603d83611118565b6000805160206111b983398151915281527f616e73616374696f6e20657865637574696f6e2072657665727465642e000000602082015260400192915050565b6000610e27604983611118565b7f54696d656c6f636b3a3a71756575655472616e73616374696f6e3a204573746981527f6d6174656420657865637574696f6e20626c6f636b206d757374207361746973602082015268333c903232b630bc9760b91b604082015260600192915050565b6000610e98603183611118565b7f54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f81527036b290333937b6902a34b6b2b637b1b59760791b602082015260400192915050565b6000610eea82856109a8565b6004820191506108bc82846109f1565b6000610f0682846109f1565b9392505050565b6020810161082e8284610987565b60a08101610f298288610987565b610f36602083018761099f565b8181036040830152610f4881866109b9565b90508181036060830152610f5c81856109b9565b9050610f6b608083018461099f565b9695505050505050565b6020810161082e8284610996565b6020810161082e828461099f565b60208082528101610f0681846109b9565b6020808252810161082e81610a20565b6020808252810161082e81610a7f565b6020808252810161082e81610ade565b6020808252810161082e81610b21565b6020808252810161082e81610b5a565b6020808252810161082e81610bb5565b6020808252810161082e81610c0b565b6020808252810161082e81610c6a565b6020808252810161082e81610cb7565b6020808252810161082e81610d16565b6020808252810161082e81610d75565b6020808252810161082e81610dcd565b6020808252810161082e81610e1a565b6020808252810161082e81610e8b565b60808101611090828761099f565b81810360208301526110a281866109b9565b905081810360408301526110b681856109b9565b9050610460606083018461099f565b60405181810167ffffffffffffffff811182821017156110e457600080fd5b604052919050565b600067ffffffffffffffff82111561110357600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b600061082e82611146565b151590565b90565b6001600160e01b03191690565b6001600160a01b031690565b82818337506000910152565b60005b83811015611179578181015183820152602001611161565b83811115611188576000848401525b50505050565b601f01601f191690565b6111a181611126565b81146111ac57600080fd5b50565b6111a18161113656fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472a365627a7a72315820e173b30fe68511b1c527f4b277931c86b7d464b3303d809a7db5e04a835d3e306c6578706572696d656e74616cf564736f6c63430005110040
|
{"success": true, "error": null, "results": {}}
| 3,494 |
0x7b76a499a3e1aacdcbae1afdc5ae8e8f7cd1fcab
|
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: 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) {
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: 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: 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: 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: 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: openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// File: openzeppelin-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 {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken, StandardToken {
/**
* @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 {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
}
// File: contracts/Blcontr.sol
contract CRPA is StandardBurnableToken, MintableToken {
string public constant name = "Cryptopope"; // solium-disable-line uppercase
string public constant symbol = "CRPA"; // solium-disable-line uppercase
uint8 public constant decimals = 8; // solium-disable-line uppercase
address public constant tokenOwner = 0xa0dF2cb013506bCCc6898d85261Fb8d446439692;
uint256 public constant INITIAL_SUPPLY = 50000000 * (10 ** uint256(decimals));
function CRPA() public {
totalSupply_ = INITIAL_SUPPLY;
balances[tokenOwner] = INITIAL_SUPPLY;
emit Transfer(0x0, tokenOwner, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461011657806306fdde031461013f578063095ea7b3146101c957806318160ddd146101ed57806323b872dd146102145780632ff2e9dc1461023e578063313ce5671461025357806340c10f191461027e57806342966c68146102a257806366188463146102bc57806370a08231146102e057806379cc6790146103015780637d64bcb4146103255780638da5cb5b1461033a57806395d89b411461036b578063a3e6761014610380578063a9059cbb14610395578063d73dd623146103b9578063dd62ed3e146103dd578063f2fde38b14610404575b600080fd5b34801561012257600080fd5b5061012b610425565b604080519115158252519081900360200190f35b34801561014b57600080fd5b50610154610446565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d557600080fd5b5061012b600160a060020a036004351660243561047d565b3480156101f957600080fd5b506102026104e3565b60408051918252519081900360200190f35b34801561022057600080fd5b5061012b600160a060020a03600435811690602435166044356104e9565b34801561024a57600080fd5b5061020261064e565b34801561025f57600080fd5b50610268610659565b6040805160ff9092168252519081900360200190f35b34801561028a57600080fd5b5061012b600160a060020a036004351660243561065e565b3480156102ae57600080fd5b506102ba600435610767565b005b3480156102c857600080fd5b5061012b600160a060020a0360043516602435610774565b3480156102ec57600080fd5b50610202600160a060020a0360043516610864565b34801561030d57600080fd5b506102ba600160a060020a036004351660243561087f565b34801561033157600080fd5b5061012b610915565b34801561034657600080fd5b5061034f6109bb565b60408051600160a060020a039092168252519081900360200190f35b34801561037757600080fd5b506101546109ca565b34801561038c57600080fd5b5061034f610a01565b3480156103a157600080fd5b5061012b600160a060020a0360043516602435610a19565b3480156103c557600080fd5b5061012b600160a060020a0360043516602435610ae8565b3480156103e957600080fd5b50610202600160a060020a0360043581169060243516610b81565b34801561041057600080fd5b506102ba600160a060020a0360043516610bac565b60035474010000000000000000000000000000000000000000900460ff1681565b60408051808201909152600a81527f43727970746f706f706500000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561050057600080fd5b600160a060020a03841660009081526020819052604090205482111561052557600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561055557600080fd5b600160a060020a03841660009081526020819052604090205461057e908363ffffffff610c4116565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105b3908363ffffffff610c5316565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546105f5908363ffffffff610c4116565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020610d56833981519152929181900390910190a35060019392505050565b6611c37937e0800081565b600881565b600354600090600160a060020a0316331461067857600080fd5b60035474010000000000000000000000000000000000000000900460ff16156106a057600080fd5b6001546106b3908363ffffffff610c5316565b600155600160a060020a0383166000908152602081905260409020546106df908363ffffffff610c5316565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a03851691600091600080516020610d568339815191529181900360200190a350600192915050565b6107713382610c66565b50565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156107c957336000908152600260209081526040808320600160a060020a03881684529091528120556107fe565b6107d9818463ffffffff610c4116565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600160a060020a03821660009081526002602090815260408083203384529091529020548111156108af57600080fd5b600160a060020a03821660009081526002602090815260408083203384529091529020546108e3908263ffffffff610c4116565b600160a060020a03831660009081526002602090815260408083203384529091529020556109118282610c66565b5050565b600354600090600160a060020a0316331461092f57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561095757600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b60408051808201909152600481527f4352504100000000000000000000000000000000000000000000000000000000602082015281565b73a0df2cb013506bccc6898d85261fb8d44643969281565b6000600160a060020a0383161515610a3057600080fd5b33600090815260208190526040902054821115610a4c57600080fd5b33600090815260208190526040902054610a6c908363ffffffff610c4116565b3360009081526020819052604080822092909255600160a060020a03851681522054610a9e908363ffffffff610c5316565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020610d568339815191529281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610b1c908363ffffffff610c5316565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610bc357600080fd5b600160a060020a0381161515610bd857600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610c4d57fe5b50900390565b81810182811015610c6057fe5b92915050565b600160a060020a038216600090815260208190526040902054811115610c8b57600080fd5b600160a060020a038216600090815260208190526040902054610cb4908263ffffffff610c4116565b600160a060020a038316600090815260208190526040902055600154610ce0908263ffffffff610c4116565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a03851691600080516020610d568339815191529181900360200190a350505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820cc5822f02be290811dd3e21933de805f4bfe1e261cb82473df1bd627100d75610029
|
{"success": true, "error": null, "results": {}}
| 3,495 |
0x94a3a9d68151623fcf71fa8e69c2330ae25f5e85
|
/*
░█████╗░░█████╗░████████╗███████╗██╗░░░██╗██╗░░██╗██╗
██╔══██╗██╔══██╗╚══██╔══╝╚════██║██║░░░██║██║░██╔╝██║
██║░░╚═╝███████║░░░██║░░░░░███╔═╝██║░░░██║█████═╝░██║
██║░░██╗██╔══██║░░░██║░░░██╔══╝░░██║░░░██║██╔═██╗░██║
╚█████╔╝██║░░██║░░░██║░░░███████╗╚██████╔╝██║░╚██╗██║
░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝░╚═════╝░╚═╝░░╚═╝╚═╝
Telegram: https://t.me/catzukitoken
Website: https://catzukitoken.com/
Twitter: https://twitter.com/catzukitoken
*/
// 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 catzukitoken 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 = "Catzuki";
string private constant _symbol = "Catzuki";
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(0xd54B218E8D7368790A2ba6e504A079620756A94B);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 10_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 25) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 25) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610313578063c3c8cd8014610333578063c9567bf914610348578063dbe8272c1461035d578063dc1052e21461037d578063dd62ed3e1461039d57600080fd5b8063715018a6146102a15780638da5cb5b146102b657806395d89b411461015c5780639e78fb4f146102de578063a9059cbb146102f357600080fd5b806323b872dd116100f257806323b872dd14610210578063273123b714610230578063313ce567146102505780636fc3eaec1461026c57806370a082311461028157600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019b57806318160ddd146101cb5780631bbae6e0146101f057600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611840565b6103e3565b005b34801561016857600080fd5b5060408051808201825260078152664361747a756b6960c81b6020820152905161019291906118bd565b60405180910390f35b3480156101a757600080fd5b506101bb6101b636600461174e565b610434565b6040519015158152602001610192565b3480156101d757600080fd5b50670de0b6b3a76400005b604051908152602001610192565b3480156101fc57600080fd5b5061015a61020b366004611878565b61044b565b34801561021c57600080fd5b506101bb61022b36600461170e565b61048d565b34801561023c57600080fd5b5061015a61024b36600461169e565b6104f6565b34801561025c57600080fd5b5060405160098152602001610192565b34801561027857600080fd5b5061015a610541565b34801561028d57600080fd5b506101e261029c36600461169e565b610575565b3480156102ad57600080fd5b5061015a610597565b3480156102c257600080fd5b506000546040516001600160a01b039091168152602001610192565b3480156102ea57600080fd5b5061015a61060b565b3480156102ff57600080fd5b506101bb61030e36600461174e565b61084a565b34801561031f57600080fd5b5061015a61032e366004611779565b610857565b34801561033f57600080fd5b5061015a6108fb565b34801561035457600080fd5b5061015a61093b565b34801561036957600080fd5b5061015a610378366004611878565b610b01565b34801561038957600080fd5b5061015a610398366004611878565b610b39565b3480156103a957600080fd5b506101e26103b83660046116d6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104165760405162461bcd60e51b815260040161040d90611910565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610441338484610b71565b5060015b92915050565b6000546001600160a01b031633146104755760405162461bcd60e51b815260040161040d90611910565b662386f26fc1000081111561048a5760108190555b50565b600061049a848484610c95565b6104ec84336104e785604051806060016040528060288152602001611a8e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f8c565b610b71565b5060019392505050565b6000546001600160a01b031633146105205760405162461bcd60e51b815260040161040d90611910565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056b5760405162461bcd60e51b815260040161040d90611910565b4761048a81610fc6565b6001600160a01b03811660009081526002602052604081205461044590611000565b6000546001600160a01b031633146105c15760405162461bcd60e51b815260040161040d90611910565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106355760405162461bcd60e51b815260040161040d90611910565b600f54600160a01b900460ff161561068f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072791906116ba565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561076f57600080fd5b505afa158015610783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a791906116ba565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107ef57600080fd5b505af1158015610803573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082791906116ba565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610441338484610c95565b6000546001600160a01b031633146108815760405162461bcd60e51b815260040161040d90611910565b60005b81518110156108f7576001600660008484815181106108b357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ef81611a23565b915050610884565b5050565b6000546001600160a01b031633146109255760405162461bcd60e51b815260040161040d90611910565b600061093030610575565b905061048a81611084565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161040d90611910565b600e546109859030906001600160a01b0316670de0b6b3a7640000610b71565b600e546001600160a01b031663f305d71947306109a181610575565b6000806109b66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1957600080fd5b505af1158015610a2d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a529190611890565b5050600f8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ac957600080fd5b505af1158015610add573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048a919061185c565b6000546001600160a01b03163314610b2b5760405162461bcd60e51b815260040161040d90611910565b601981101561048a57600b55565b6000546001600160a01b03163314610b635760405162461bcd60e51b815260040161040d90611910565b601981101561048a57600c55565b6001600160a01b038316610bd35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040d565b6001600160a01b038216610c345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040d565b6001600160a01b038216610d5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040d565b60008111610dbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040d565b6001600160a01b03831660009081526006602052604090205460ff1615610de357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2557506001600160a01b03821660009081526005602052604090205460ff16155b15610f7c576000600955600c54600a55600f546001600160a01b038481169116148015610e605750600e546001600160a01b03838116911614155b8015610e8557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e9a5750600f54600160b81b900460ff165b15610eae57601054811115610eae57600080fd5b600f546001600160a01b038381169116148015610ed95750600e546001600160a01b03848116911614155b8015610efe57506001600160a01b03831660009081526005602052604090205460ff16155b15610f0f576000600955600b54600a555b6000610f1a30610575565b600f54909150600160a81b900460ff16158015610f455750600f546001600160a01b03858116911614155b8015610f5a5750600f54600160b01b900460ff165b15610f7a57610f6881611084565b478015610f7857610f7847610fc6565b505b505b610f87838383611229565b505050565b60008184841115610fb05760405162461bcd60e51b815260040161040d91906118bd565b506000610fbd8486611a0c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f7573d6000803e3d6000fd5b60006007548211156110675760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040d565b6000611071611234565b905061107d8382611257565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110da57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561112e57600080fd5b505afa158015611142573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116691906116ba565b8160018151811061118757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111ad9130911684610b71565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111e6908590600090869030904290600401611945565b600060405180830381600087803b15801561120057600080fd5b505af1158015611214573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f87838383611299565b6000806000611241611390565b90925090506112508282611257565b9250505090565b600061107d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d0565b6000806000806000806112ab876113fe565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112dd908761145b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130c908661149d565b6001600160a01b03891660009081526002602052604090205561132e816114fc565b6113388483611546565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137d91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113ab8282611257565b8210156113c757505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113f15760405162461bcd60e51b815260040161040d91906118bd565b506000610fbd84866119cd565b600080600080600080600080600061141b8a600954600a5461156a565b925092509250600061142b611234565b9050600080600061143e8e8787876115bf565b919e509c509a509598509396509194505050505091939550919395565b600061107d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f8c565b6000806114aa83856119b5565b90508381101561107d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040d565b6000611506611234565b90506000611514838361160f565b30600090815260026020526040902054909150611531908261149d565b30600090815260026020526040902055505050565b600754611553908361145b565b600755600854611563908261149d565b6008555050565b6000808080611584606461157e898961160f565b90611257565b90506000611597606461157e8a8961160f565b905060006115af826115a98b8661145b565b9061145b565b9992985090965090945050505050565b60008080806115ce888661160f565b905060006115dc888761160f565b905060006115ea888861160f565b905060006115fc826115a9868661145b565b939b939a50919850919650505050505050565b60008261161e57506000610445565b600061162a83856119ed565b90508261163785836119cd565b1461107d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040d565b803561169981611a6a565b919050565b6000602082840312156116af578081fd5b813561107d81611a6a565b6000602082840312156116cb578081fd5b815161107d81611a6a565b600080604083850312156116e8578081fd5b82356116f381611a6a565b9150602083013561170381611a6a565b809150509250929050565b600080600060608486031215611722578081fd5b833561172d81611a6a565b9250602084013561173d81611a6a565b929592945050506040919091013590565b60008060408385031215611760578182fd5b823561176b81611a6a565b946020939093013593505050565b6000602080838503121561178b578182fd5b823567ffffffffffffffff808211156117a2578384fd5b818501915085601f8301126117b5578384fd5b8135818111156117c7576117c7611a54565b8060051b604051601f19603f830116810181811085821117156117ec576117ec611a54565b604052828152858101935084860182860187018a101561180a578788fd5b8795505b838610156118335761181f8161168e565b85526001959095019493860193860161180e565b5098975050505050505050565b600060208284031215611851578081fd5b813561107d81611a7f565b60006020828403121561186d578081fd5b815161107d81611a7f565b600060208284031215611889578081fd5b5035919050565b6000806000606084860312156118a4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118e9578581018301518582016040015282016118cd565b818111156118fa5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119945784516001600160a01b03168352938301939183019160010161196f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119c8576119c8611a3e565b500190565b6000826119e857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0757611a07611a3e565b500290565b600082821015611a1e57611a1e611a3e565b500390565b6000600019821415611a3757611a37611a3e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048a57600080fd5b801515811461048a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fc882c90fff3e01cc17a32d95309782a030c29bad64ee5ce31a4c293af91bb2b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,496 |
0x48d9eac690ba14e055af890cc33e17e2cbc0a37a
|
pragma solidity ^0.4.24;
contract ERC20Basic {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract EthTweetMe is Ownable {
using SafeMath for uint256;
// Supported token symbols mapped to ERC20 contract addr
mapping(string => address) tokens;
address webappAddress;
address feePayoutAddress;
uint256 public feePercentage = 5;
uint256 public minAmount = 0.000001 ether;
uint256 public webappMinBalance = 0.000001 ether;
struct Influencer {
address influencerAddress;
uint256 charityPercentage;
address charityAddress;
}
// Map influencer's twitterHandle to Influencer struct
mapping(string => Influencer) influencers;
event InfluencerAdded(string _influencerTwitterHandle);
event FeePercentageUpdated(uint256 _feePercentage);
event Deposit(address _address, uint256 _amount);
modifier onlyWebappOrOwner() {
require(msg.sender == webappAddress || msg.sender == owner);
_;
}
modifier onlyFeePayoutOrOwner() {
require(msg.sender == feePayoutAddress || msg.sender == owner);
_;
}
constructor() public {
webappAddress = msg.sender;
feePayoutAddress = msg.sender;
}
// Fallback function. Allow users to pay the contract directly
function() external payable {
emit Deposit(msg.sender, msg.value);
}
// Owner management functions
function updateFeePercentage(uint256 _feePercentage) external onlyWebappOrOwner {
require(_feePercentage <= 100);
feePercentage = _feePercentage;
emit FeePercentageUpdated(feePercentage);
}
function updateMinAmount(uint256 _minAmount) external onlyWebappOrOwner {
minAmount = _minAmount;
}
function updateWebappMinBalance(uint256 _minBalance) external onlyWebappOrOwner {
webappMinBalance = _minBalance;
}
function updateWebappAddress(address _address) external onlyOwner {
webappAddress = _address;
}
function updateFeePayoutAddress(address _address) external onlyOwner {
feePayoutAddress = _address;
}
// Move some of the remaining balance stored in the contract
function payoutETH(uint256 _amount) external onlyFeePayoutOrOwner {
require(_amount <= address(this).balance);
feePayoutAddress.transfer(_amount);
}
function payoutERC20(string _symbol) external onlyFeePayoutOrOwner {
// Must be an ERC20 that we support
require(tokens[_symbol] != 0x0);
ERC20Basic erc20 = ERC20Basic(tokens[_symbol]);
require(erc20.balanceOf(address(this)) > 0);
erc20.transfer(feePayoutAddress, erc20.balanceOf(address(this)));
}
function updateInfluencer(
string _twitterHandle,
address _influencerAddress,
uint256 _charityPercentage,
address _charityAddress) external onlyWebappOrOwner {
require(_charityPercentage <= 100);
require((_charityPercentage == 0 && _charityAddress == 0x0) || (_charityPercentage > 0 && _charityAddress != 0x0));
if (influencers[_twitterHandle].influencerAddress == 0x0) {
// This is a new Influencer!
emit InfluencerAdded(_twitterHandle);
}
influencers[_twitterHandle] = Influencer(_influencerAddress, _charityPercentage, _charityAddress);
}
function sendEthTweet(uint256 _amount, bool _isERC20, string _symbol, bool _payFromMsg, string _influencerTwitterHandle, uint256 _additionalFee) private {
require(
(!_isERC20 && _payFromMsg && msg.value == _amount) ||
(!_isERC20 && !_payFromMsg && _amount <= address(this).balance) ||
_isERC20
);
require(_additionalFee == 0 || _amount > _additionalFee);
ERC20Basic erc20;
if (_isERC20) {
// Now do ERC20-specific checks
// Must be an ERC20 that we support
require(tokens[_symbol] != 0x0);
// The ERC20 funds should have already been transferred
erc20 = ERC20Basic(tokens[_symbol]);
require(erc20.balanceOf(address(this)) >= _amount);
}
// influencer must be a known twitterHandle
Influencer memory influencer = influencers[_influencerTwitterHandle];
require(influencer.influencerAddress != 0x0);
uint256[] memory payouts = new uint256[](4); // 0: influencer, 1: charity, 2: fee, 3: webapp
uint256 hundred = 100;
if (_additionalFee > 0) {
payouts[3] = _additionalFee;
_amount = _amount.sub(_additionalFee);
}
if (influencer.charityPercentage == 0) {
payouts[0] = _amount.mul(hundred.sub(feePercentage)).div(hundred);
payouts[2] = _amount.sub(payouts[0]);
} else {
payouts[1] = _amount.mul(influencer.charityPercentage).div(hundred);
payouts[0] = _amount.sub(payouts[1]).mul(hundred.sub(feePercentage)).div(hundred);
payouts[2] = _amount.sub(payouts[1]).sub(payouts[0]);
}
require(payouts[0].add(payouts[1]).add(payouts[2]) == _amount);
if (payouts[0] > 0) {
if (!_isERC20) {
influencer.influencerAddress.transfer(payouts[0]);
} else {
erc20.transfer(influencer.influencerAddress, payouts[0]);
}
}
if (payouts[1] > 0) {
if (!_isERC20) {
influencer.charityAddress.transfer(payouts[1]);
} else {
erc20.transfer(influencer.charityAddress, payouts[1]);
}
}
if (payouts[2] > 0) {
if (!_isERC20) {
if (webappAddress.balance < webappMinBalance) {
// Redirect the fee funds into webapp
payouts[3] = payouts[3].add(payouts[2]);
} else {
feePayoutAddress.transfer(payouts[2]);
}
} else {
erc20.transfer(feePayoutAddress, payouts[2]);
}
}
if (payouts[3] > 0) {
if (!_isERC20) {
webappAddress.transfer(payouts[3]);
} else {
erc20.transfer(webappAddress, payouts[3]);
}
}
}
// Called by users directly interacting with the contract, paying in ETH
// Users are paying their own gas so no additional fee.
function sendEthTweet(string _influencerTwitterHandle) external payable {
sendEthTweet(msg.value, false, "ETH", true, _influencerTwitterHandle, 0);
}
// Called by the webapp on behalf of Other/QR code payers.
// Charge an additional fee since we're paying for gas.
function sendPrepaidEthTweet(uint256 _amount, string _influencerTwitterHandle, uint256 _additionalFee) external onlyWebappOrOwner {
/* require(_amount <= address(this).balance); */
sendEthTweet(_amount, false, "ETH", false, _influencerTwitterHandle, _additionalFee);
}
/****************************************************************
* ERC-20 support
****************************************************************/
function addNewToken(string _symbol, address _address) external onlyWebappOrOwner {
tokens[_symbol] = _address;
}
function removeToken(string _symbol) external onlyWebappOrOwner {
require(tokens[_symbol] != 0x0);
delete(tokens[_symbol]);
}
function supportsToken(string _symbol, address _address) external constant returns (bool) {
return (tokens[_symbol] == _address);
}
function contractTokenBalance(string _symbol) external constant returns (uint256) {
require(tokens[_symbol] != 0x0);
ERC20Basic erc20 = ERC20Basic(tokens[_symbol]);
return erc20.balanceOf(address(this));
}
// Called as the second step by users directly interacting with the contract.
// Users are paying their own gas so no additional fee.
function sendERC20Tweet(uint256 _amount, string _symbol, string _influencerTwitterHandle) external {
// Pull in the pre-approved ERC-20 funds
ERC20Basic erc20 = ERC20Basic(tokens[_symbol]);
erc20.transferFrom(msg.sender, address(this), _amount);
sendEthTweet(_amount, true, _symbol, false, _influencerTwitterHandle, 0);
}
// Called by the webapp on behalf of Other/QR code payers.
// Charge an additional fee since we're paying for gas.
function sendPrepaidERC20Tweet(uint256 _amount, string _symbol, string _influencerTwitterHandle, uint256 _additionalFee) external onlyWebappOrOwner {
sendEthTweet(_amount, true, _symbol, false, _influencerTwitterHandle, _additionalFee);
}
// Public accessors
function getInfluencer(string _twitterHandle) external constant returns(address, uint256, address) {
Influencer memory influencer = influencers[_twitterHandle];
return (influencer.influencerAddress, influencer.charityPercentage, influencer.charityAddress);
}
}
|
0x6080604052600436106101195763ffffffff60e060020a600035041663190fe71281146101555780631f4559221461016f57806320398b831461018f578063252cedc3146101b65780632740728e146101e65780635c3842fa146102145780635d751443146102355780636cad3fb01461024d578063715018a614610265578063790f3ea11461027a5780638da5cb5b1461029b5780639b2cb5d8146102cc5780639f43daf7146102f3578063a001ecdd14610306578063aa513c711461031b578063b2d5362d14610353578063b80a4cc014610373578063d9359419146103b5578063f2fde38b146103d5578063f41d0b0c146103f6578063f5c256ca14610441578063f6cf054214610474578063ff897dbd14610489575b6040805133815234602082015281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a1005b34801561016157600080fd5b5061016d6004356104a1565b005b34801561017b57600080fd5b5061016d600480356024810191013561051b565b34801561019b57600080fd5b5061016d6004803590602480359081019101356044356105bc565b3480156101c257600080fd5b5061016d600480359060248035808201929081013591604435908101910135610666565b3480156101f257600080fd5b5061016d6024600480358281019291013590600160a060020a039035166107a0565b34801561022057600080fd5b5061016d600160a060020a036004351661081a565b34801561024157600080fd5b5061016d600435610853565b34801561025957600080fd5b5061016d600435610886565b34801561027157600080fd5b5061016d6108fd565b34801561028657600080fd5b5061016d600160a060020a036004351661095c565b3480156102a757600080fd5b506102b0610995565b60408051600160a060020a039092168252519081900360200190f35b3480156102d857600080fd5b506102e16109a4565b60408051918252519081900360200190f35b61016d60048035602481019101356109aa565b34801561031257600080fd5b506102e1610a21565b34801561032757600080fd5b5061016d6024600480358281019291013590600160a060020a0390358116906044359060643516610a27565b34801561035f57600080fd5b506102e16004803560248101910135610bc4565b34801561037f57600080fd5b506103a16024600480358281019291013590600160a060020a03903516610ca8565b604080519115158252519081900360200190f35b3480156103c157600080fd5b5061016d6004803560248101910135610cf0565b3480156103e157600080fd5b5061016d600160a060020a0360043516610f08565b34801561040257600080fd5b506104166004803560248101910135610f2b565b60408051600160a060020a039485168152602081019390935292168183015290519081900360600190f35b34801561044d57600080fd5b5061016d600480359060248035808201929081013591604435908101910135606435610f9d565b34801561048057600080fd5b506102e161103a565b34801561049557600080fd5b5061016d600435611040565b600354600160a060020a03163314806104c45750600054600160a060020a031633145b15156104cf57600080fd5b30318111156104dd57600080fd5b600354604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015610517573d6000803e3d6000fd5b5050565b600254600160a060020a031633148061053e5750600054600160a060020a031633145b151561054957600080fd5b600182826040518083838082843790910194855250506040519283900360200190922054600160a060020a031615159150610585905057600080fd5b60018282604051808383808284379091019485525050604051928390036020019092208054600160a060020a031916905550505050565b600254600160a060020a03163314806105df5750600054600160a060020a031633145b15156105ea57600080fd5b6106608460006040805190810160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250600087878080601f016020809104026020016040519081016040528093929190818152602001838380828437508b94506110739350505050565b50505050565b600060018585604051808383808284379190910194855250506040805160209481900385018120547f23b872dd000000000000000000000000000000000000000000000000000000008252336004830152306024830152604482018c90529151600160a060020a03909216955085946323b872dd9450606480830194509092918290030181600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b505050506040513d602081101561072657600080fd5b5050604080516020601f870181900481028201810190925285815261079891889160019189908990819084018382808284375050604080516020601f8d018190048102820181019092528b81526000955093508b92508a91508190840183828082843750600094506110739350505050565b505050505050565b600254600160a060020a03163314806107c35750600054600160a060020a031633145b15156107ce57600080fd5b8060018484604051808383808284379091019485525050604051928390036020019092208054600160a060020a0394909416600160a060020a0319909416939093179092555050505050565b600054600160a060020a0316331461083157600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b600254600160a060020a03163314806108765750600054600160a060020a031633145b151561088157600080fd5b600655565b600254600160a060020a03163314806108a95750600054600160a060020a031633145b15156108b457600080fd5b60648111156108c257600080fd5b60048190556040805182815290517f74516f05eb4bd2461d57aa1e935ee553f86a3e02bfed7759f2f772915de3d9be9181900360200190a150565b600054600160a060020a0316331461091457600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a260008054600160a060020a0319169055565b600054600160a060020a0316331461097357600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60055481565b6105173460006040805190810160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250600186868080601f01602080910402602001604051908101604052809392919081815260200183838082843750600094506110739350505050565b60045481565b600254600160a060020a0316331480610a4a5750600054600160a060020a031633145b1515610a5557600080fd5b6064821115610a6357600080fd5b81158015610a785750600160a060020a038116155b80610a965750600082118015610a965750600160a060020a03811615155b1515610aa157600080fd5b600785856040518083838082843790910194855250506040519283900360200190922054600160a060020a031615159150610b299050577fb3dc242b24258fffd5dd07ce684068903349e62ea4e7100319c31f1d10d02b5985856040518080602001828103825284848281815260200192508082843760405192018290039550909350505050a15b60606040519081016040528084600160a060020a0316815260200183815260200182600160a060020a03168152506007868660405180838380828437919091019485525050604080516020948190038501902085518154600160a060020a0319908116600160a060020a0392831617835595870151600183015595909101516002909101805490941694169390931790915550505050505050565b600080600184846040518083838082843790910194855250506040519283900360200190922054600160a060020a031615159150610c03905057600080fd5b600184846040518083838082843791909101948552505060408051602094819003850181205460e060020a6370a082310282523060048301529151600160a060020a03909216955085946370a082319450602480830194509092918290030181600087803b158015610c7457600080fd5b505af1158015610c88573d6000803e3d6000fd5b505050506040513d6020811015610c9e57600080fd5b5051949350505050565b600081600160a060020a0316600185856040518083838082843790910194855250506040519283900360200190922054600160a060020a031692909214925050509392505050565b600354600090600160a060020a0316331480610d165750600054600160a060020a031633145b1515610d2157600080fd5b600183836040518083838082843790910194855250506040519283900360200190922054600160a060020a031615159150610d5d905057600080fd5b600183836040518083838082843790910194855250506040805193849003602090810185205460e060020a6370a082310286523060048701529151600160a060020a0390921695506000948694506370a0823193506024808201939182900301818787803b158015610dce57600080fd5b505af1158015610de2573d6000803e3d6000fd5b505050506040513d6020811015610df857600080fd5b505111610e0457600080fd5b6003546040805160e060020a6370a082310281523060048201529051600160a060020a038085169363a9059cbb9391169184916370a082319160248083019260209291908290030181600087803b158015610e5e57600080fd5b505af1158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610ed757600080fd5b505af1158015610eeb573d6000803e3d6000fd5b505050506040513d6020811015610f0157600080fd5b5050505050565b600054600160a060020a03163314610f1f57600080fd5b610f2881611a7d565b50565b6000806000610f38611b5e565b600786866040518083838082843791909101948552505060408051602094819003850181206060820183528054600160a060020a0390811680845260018301549784018890526002909201541691909201819052909a93995097509195505050505050565b600254600160a060020a0316331480610fc05750600054600160a060020a031633145b1515610fcb57600080fd5b61079886600187878080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8d018190048102820181019092528b81526000955093508b92508a915081908401838280828437508b94506110739350505050565b60065481565b600254600160a060020a03163314806110635750600054600160a060020a031633145b151561106e57600080fd5b600555565b600061107d611b5e565b606060008815801561108c5750865b801561109757508934145b806110b65750881580156110a9575086155b80156110b6575030318a11155b806110be5750885b15156110c957600080fd5b8415806110d55750848a115b15156110e057600080fd5b881561123e576001886040518082805190602001908083835b602083106111185780518252601f1990920191602091820191016110f9565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03161515915061115c905057600080fd5b6001886040518082805190602001908083835b6020831061118e5780518252601f19909201916020918201910161116f565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820185205460e060020a6370a082310286523060048701529051600160a060020a0390911698508e948994506370a08231935060248082019392918290030181600087803b15801561120757600080fd5b505af115801561121b573d6000803e3d6000fd5b505050506040513d602081101561123157600080fd5b5051101561123e57600080fd5b6007866040518082805190602001908083835b602083106112705780518252601f199092019160209182019101611251565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820185206060860182528054600160a060020a039081168088526001830154948801949094526002909101541690850152929550505015156112d957600080fd5b60408051600480825260a082019092529060208201608080388339019050509150606490506000851115611334578482600381518110151561131757fe5b602090810290910101526113318a8663ffffffff611aed16565b99505b602083015115156113d5576113748161136861135b60045485611aed90919063ffffffff16565b8d9063ffffffff611b0216565b9063ffffffff611b2d16565b82600081518110151561138357fe5b6020908102909101015281516113b790839060009081106113a057fe5b602090810290910101518b9063ffffffff611aed16565b8260028151811015156113c657fe5b602090810290910101526114e1565b6113f08161136885602001518d611b0290919063ffffffff16565b8260018151811015156113ff57fe5b6020908102909101015260045461145c9082906113689061142790839063ffffffff611aed16565b61145086600181518110151561143957fe5b602090810290910101518f9063ffffffff611aed16565b9063ffffffff611b0216565b82600081518110151561146b57fe5b6020908102909101015281516114c7908390600090811061148857fe5b906020019060200201516114bb8460018151811015156114a457fe5b602090810290910101518d9063ffffffff611aed16565b9063ffffffff611aed16565b8260028151811015156114d657fe5b602090810290910101525b8961154b8360028151811015156114f457fe5b9060200190602002015161153f85600181518110151561151057fe5b9060200190602002015186600081518110151561152957fe5b602090810290910101519063ffffffff611b4e16565b9063ffffffff611b4e16565b1461155557600080fd5b600082600081518110151561156657fe5b906020019060200201511115611681578815156115d5578260000151600160a060020a03166108fc83600081518110151561159d57fe5b602090810290910101516040518115909202916000818181858888f193505050501580156115cf573d6000803e3d6000fd5b50611681565b83600160a060020a031663a9059cbb84600001518460008151811015156115f857fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561165457600080fd5b505af1158015611668573d6000803e3d6000fd5b505050506040513d602081101561167e57600080fd5b50505b600082600181518110151561169257fe5b9060200190602002015111156117ad57881515611701578260400151600160a060020a03166108fc8360018151811015156116c957fe5b602090810290910101516040518115909202916000818181858888f193505050501580156116fb573d6000803e3d6000fd5b506117ad565b83600160a060020a031663a9059cbb846040015184600181518110151561172457fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561178057600080fd5b505af1158015611794573d6000803e3d6000fd5b505050506040513d60208110156117aa57600080fd5b50505b60008260028151811015156117be57fe5b90602001906020020151111561193f5788151561188f57600654600254600160a060020a0316311015611834576118168260028151811015156117fd57fe5b9060200190602002015183600381518110151561152957fe5b82600381518110151561182557fe5b6020908102909101015261188a565b6003548251600160a060020a03909116906108fc908490600290811061185657fe5b602090810290910101516040518115909202916000818181858888f19350505050158015611888573d6000803e3d6000fd5b505b61193f565b6003548251600160a060020a038087169263a9059cbb92911690859060029081106118b657fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561191257600080fd5b505af1158015611926573d6000803e3d6000fd5b505050506040513d602081101561193c57600080fd5b50505b600082600381518110151561195057fe5b906020019060200201511115611a71578815156119c1576002548251600160a060020a03909116906108fc908490600390811061198957fe5b602090810290910101516040518115909202916000818181858888f193505050501580156119bb573d6000803e3d6000fd5b50611a71565b6002548251600160a060020a038087169263a9059cbb92911690859060039081106119e857fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611a4457600080fd5b505af1158015611a58573d6000803e3d6000fd5b505050506040513d6020811015611a6e57600080fd5b50505b50505050505050505050565b600160a060020a0381161515611a9257600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a031916600160a060020a0392909216919091179055565b600082821115611afc57600080fd5b50900390565b818102821580611b1c5750818382811515611b1957fe5b04145b1515611b2757600080fd5b92915050565b6000808211611b3b57600080fd5b8183811515611b4657fe5b049392505050565b81810182811015611b2757600080fd5b6040805160608101825260008082526020820181905291810191909152905600a165627a7a7230582058801aea99a355c2f82f460b110eb95b6cb113317f17b53c4789bce409d52cdd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,497 |
0x37f25bd26848cf02614c29338dd71a4d03b62218
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="295a5d4c4f4847074e4c465b4e4c694a46475a4c475a505a07474c5d">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (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 - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d1e19080b0c03430a08021f0a082d0e02031e08031e141e43030819">[email protected]</a>>
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;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 3,498 |
0xE5857440BBFF64C98CEb70d650805E1E96addE7A
|
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
// File: contracts/lib/Ownable.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Ownable
/// @author Brecht Devos - <brecht@loopring.org>
/// @dev The Ownable contract has an owner address, and provides basic
/// authorization control functions, this simplifies the implementation of
/// "user permissions".
contract Ownable
{
address public owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/// @dev The Ownable constructor sets the original `owner` of the contract
/// to the sender.
constructor()
{
owner = msg.sender;
}
/// @dev Throws if called by any account other than the owner.
modifier onlyOwner()
{
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
/// @dev Allows the current owner to transfer control of the contract to a
/// new owner.
/// @param newOwner The address to transfer ownership to.
function transferOwnership(
address newOwner
)
public
virtual
onlyOwner
{
require(newOwner != address(0), "ZERO_ADDRESS");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function renounceOwnership()
public
onlyOwner
{
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
// File: contracts/iface/Wallet.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Wallet
/// @dev Base contract for smart wallets.
/// Sub-contracts must NOT use non-default constructor to initialize
/// wallet states, instead, `init` shall be used. This is to enable
/// proxies to be deployed in front of the real wallet contract for
/// saving gas.
///
/// @author Daniel Wang - <daniel@loopring.org>
interface Wallet
{
function version() external pure returns (string memory);
function owner() external view returns (address);
/// @dev Set a new owner.
function setOwner(address newOwner) external;
/// @dev Adds a new module. The `init` method of the module
/// will be called with `address(this)` as the parameter.
/// This method must throw if the module has already been added.
/// @param _module The module's address.
function addModule(address _module) external;
/// @dev Removes an existing module. This method must throw if the module
/// has NOT been added or the module is the wallet's only module.
/// @param _module The module's address.
function removeModule(address _module) external;
/// @dev Checks if a module has been added to this wallet.
/// @param _module The module to check.
/// @return True if the module exists; False otherwise.
function hasModule(address _module) external view returns (bool);
/// @dev Binds a method from the given module to this
/// wallet so the method can be invoked using this wallet's default
/// function.
/// Note that this method must throw when the given module has
/// not been added to this wallet.
/// @param _method The method's 4-byte selector.
/// @param _module The module's address. Use address(0) to unbind the method.
function bindMethod(bytes4 _method, address _module) external;
/// @dev Returns the module the given method has been bound to.
/// @param _method The method's 4-byte selector.
/// @return _module The address of the bound module. If no binding exists,
/// returns address(0) instead.
function boundMethodModule(bytes4 _method) external view returns (address _module);
/// @dev Performs generic transactions. Any module that has been added to this
/// wallet can use this method to transact on any third-party contract with
/// msg.sender as this wallet itself.
///
/// Note: 1) this method must ONLY allow invocations from a module that has
/// been added to this wallet. The wallet owner shall NOT be permitted
/// to call this method directly. 2) Reentrancy inside this function should
/// NOT cause any problems.
///
/// @param mode The transaction mode, 1 for CALL, 2 for DELEGATECALL.
/// @param to The desitination address.
/// @param value The amount of Ether to transfer.
/// @param data The data to send over using `to.call{value: value}(data)`
/// @return returnData The transaction's return value.
function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
returns (bytes memory returnData);
}
// File: contracts/iface/Module.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Module
/// @dev Base contract for all smart wallet modules.
///
/// @author Daniel Wang - <daniel@loopring.org>
interface Module
{
/// @dev Activates the module for the given wallet (msg.sender) after the module is added.
/// Warning: this method shall ONLY be callable by a wallet.
function activate() external;
/// @dev Deactivates the module for the given wallet (msg.sender) before the module is removed.
/// Warning: this method shall ONLY be callable by a wallet.
function deactivate() external;
}
// File: contracts/lib/ERC20.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ERC20 Token Interface
/// @dev see https://github.com/ethereum/EIPs/issues/20
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract ERC20
{
function totalSupply()
public
view
virtual
returns (uint);
function balanceOf(
address who
)
public
view
virtual
returns (uint);
function allowance(
address owner,
address spender
)
public
view
virtual
returns (uint);
function transfer(
address to,
uint value
)
public
virtual
returns (bool);
function transferFrom(
address from,
address to,
uint value
)
public
virtual
returns (bool);
function approve(
address spender,
uint value
)
public
virtual
returns (bool);
}
// File: contracts/lib/ReentrancyGuard.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ReentrancyGuard
/// @author Brecht Devos - <brecht@loopring.org>
/// @dev Exposes a modifier that guards a function against reentrancy
/// Changing the value of the same storage value multiple times in a transaction
/// is cheap (starting from Istanbul) so there is no need to minimize
/// the number of times the value is changed
contract ReentrancyGuard
{
//The default value must be 0 in order to work behind a proxy.
uint private _guardValue;
modifier nonReentrant()
{
require(_guardValue == 0, "REENTRANCY");
_guardValue = 1;
_;
_guardValue = 0;
}
}
// File: contracts/iface/ModuleRegistry.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ModuleRegistry
/// @dev A registry for modules.
///
/// @author Daniel Wang - <daniel@loopring.org>
interface ModuleRegistry
{
/// @dev Registers and enables a new module.
function registerModule(address module) external;
/// @dev Disables a module
function disableModule(address module) external;
/// @dev Returns true if the module is registered and enabled.
function isModuleEnabled(address module) external view returns (bool);
/// @dev Returns the list of enabled modules.
function enabledModules() external view returns (address[] memory _modules);
/// @dev Returns the number of enbaled modules.
function numOfEnabledModules() external view returns (uint);
/// @dev Returns true if the module is ever registered.
function isModuleRegistered(address module) external view returns (bool);
}
// File: contracts/base/Controller.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Controller
///
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract Controller
{
function moduleRegistry()
external
view
virtual
returns (ModuleRegistry);
function walletFactory()
external
view
virtual
returns (address);
}
// File: contracts/base/BaseWallet.sol
// Copyright 2017 Loopring Technology Limited.
/// @title BaseWallet
/// @dev This contract provides basic implementation for a Wallet.
///
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract BaseWallet is ReentrancyGuard, Wallet
{
// WARNING: do not delete wallet state data to make this implementation
// compatible with early versions.
//
// ----- DATA LAYOUT BEGINS -----
address internal _owner;
mapping (address => bool) private modules;
Controller public controller;
mapping (bytes4 => address) internal methodToModule;
// ----- DATA LAYOUT ENDS -----
event OwnerChanged (address newOwner);
event ControllerChanged (address newController);
event ModuleAdded (address module);
event ModuleRemoved (address module);
event MethodBound (bytes4 method, address module);
event WalletSetup (address owner);
modifier onlyFromModule
{
require(modules[msg.sender], "MODULE_UNAUTHORIZED");
_;
}
modifier onlyFromFactory
{
require(
msg.sender == controller.walletFactory(),
"UNAUTHORIZED"
);
_;
}
/// @dev We need to make sure the Factory address cannot be changed without wallet owner's
/// explicit authorization.
modifier onlyFromFactoryOrModule
{
require(
modules[msg.sender] || msg.sender == controller.walletFactory(),
"UNAUTHORIZED"
);
_;
}
/// @dev Set up this wallet by assigning an original owner
///
/// Note that calling this method more than once will throw.
///
/// @param _initialOwner The owner of this wallet, must not be address(0).
function initOwner(
address _initialOwner
)
external
onlyFromFactory
{
require(controller != Controller(0), "NO_CONTROLLER");
require(_owner == address(0), "INITIALIZED_ALREADY");
require(_initialOwner != address(0), "ZERO_ADDRESS");
_owner = _initialOwner;
emit WalletSetup(_initialOwner);
}
/// @dev Set up this wallet by assigning a controller and initial modules.
///
/// Note that calling this method more than once will throw.
/// And this method must be invoked before owner is initialized
///
/// @param _controller The Controller instance.
/// @param _modules The initial modules.
function init(
Controller _controller,
address[] calldata _modules
)
external
{
require(
_owner == address(0) &&
controller == Controller(0) &&
_controller != Controller(0),
"CONTROLLER_INIT_FAILED"
);
controller = _controller;
ModuleRegistry moduleRegistry = controller.moduleRegistry();
for (uint i = 0; i < _modules.length; i++) {
_addModule(_modules[i], moduleRegistry);
}
}
function owner()
override
public
view
returns (address)
{
return _owner;
}
function setOwner(address newOwner)
external
override
onlyFromModule
{
require(newOwner != address(0), "ZERO_ADDRESS");
require(newOwner != address(this), "PROHIBITED");
require(newOwner != _owner, "SAME_ADDRESS");
_owner = newOwner;
emit OwnerChanged(newOwner);
}
function setController(Controller newController)
external
onlyFromModule
{
require(newController != controller, "SAME_CONTROLLER");
require(newController != Controller(0), "INVALID_CONTROLLER");
controller = newController;
emit ControllerChanged(address(newController));
}
function addModule(address _module)
external
override
onlyFromFactoryOrModule
{
_addModule(_module, controller.moduleRegistry());
}
function removeModule(address _module)
external
override
onlyFromModule
{
// Allow deactivate to fail to make sure the module can be removed
require(modules[_module], "MODULE_NOT_EXISTS");
try Module(_module).deactivate() {} catch {}
delete modules[_module];
emit ModuleRemoved(_module);
}
function hasModule(address _module)
public
view
override
returns (bool)
{
return modules[_module];
}
function bindMethod(bytes4 _method, address _module)
external
override
onlyFromModule
{
require(_method != bytes4(0), "BAD_METHOD");
if (_module != address(0)) {
require(modules[_module], "MODULE_UNAUTHORIZED");
}
methodToModule[_method] = _module;
emit MethodBound(_method, _module);
}
function boundMethodModule(bytes4 _method)
public
view
override
returns (address)
{
return methodToModule[_method];
}
function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
override
onlyFromFactoryOrModule
returns (bytes memory returnData)
{
bool success;
(success, returnData) = _call(mode, to, value, data);
if (!success) {
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
}
receive()
external
payable
{
}
/// @dev This default function can receive Ether or perform queries to modules
/// using bound methods.
fallback()
external
payable
{
address module = methodToModule[msg.sig];
require(modules[module], "MODULE_UNAUTHORIZED");
(bool success, bytes memory returnData) = module.call{value: msg.value}(msg.data);
assembly {
switch success
case 0 { revert(add(returnData, 32), mload(returnData)) }
default { return(add(returnData, 32), mload(returnData)) }
}
}
function _addModule(address _module, ModuleRegistry moduleRegistry)
internal
{
require(_module != address(0), "NULL_MODULE");
require(modules[_module] == false, "MODULE_EXISTS");
require(
moduleRegistry.isModuleEnabled(_module),
"INVALID_MODULE"
);
modules[_module] = true;
emit ModuleAdded(_module);
Module(_module).activate();
}
function _call(
uint8 mode,
address target,
uint value,
bytes calldata data
)
private
returns (
bool success,
bytes memory returnData
)
{
if (mode == 1) {
// solium-disable-next-line security/no-call-value
(success, returnData) = target.call{value: value}(data);
} else if (mode == 2) {
// solium-disable-next-line security/no-call-value
(success, returnData) = target.delegatecall(data);
} else if (mode == 3) {
require(value == 0, "INVALID_VALUE");
// solium-disable-next-line security/no-call-value
(success, returnData) = target.staticcall(data);
} else {
revert("UNSUPPORTED_MODE");
}
}
}
// File: contracts/modules/WalletImpl.sol
// Copyright 2017 Loopring Technology Limited.
/// @title WalletImpl
contract WalletImpl is BaseWallet {
function version()
public
override
pure
returns (string memory)
{
// 使用中国省会作为别名
return "1.2.0 (daqing)";
}
}
|
0x6080604052600436106100d65760003560e01c80638da5cb5b1161007f578063b149206e11610059578063b149206e14610582578063c7b2e596146105ea578063cf38db691461063e578063f77c47911461068a576100dd565b80638da5cb5b146104c457806392eefe9b14610502578063a063246114610542576100dd565b80633c5a3cea116100b05780633c5a3cea146102f757806354fd4d50146103915780637122b74c1461041b576100dd565b80630d0092971461023557806313af4035146102775780631ed86f19146102b7576100dd565b366100dd57005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681526004602090815260408083205473ffffffffffffffffffffffffffffffffffffffff1680845260029092529091205460ff166101a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b600060608273ffffffffffffffffffffffffffffffffffffffff1634600036604051808383808284376040519201945060009350909150508083038185875af1925050503d8060008114610212576040519150601f19603f3d011682016040523d82523d6000602084013e610217565b606091505b5091509150816000811461022d57815160208301f35b815160208301fd5b34801561024157600080fd5b506102756004803603602081101561025857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661069f565b005b34801561028357600080fd5b506102756004803603602081101561029a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109ba565b3480156102c357600080fd5b50610275600480360360208110156102da57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c42565b34801561030357600080fd5b506102756004803603604081101561031a57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561035257600080fd5b82018360208201111561036457600080fd5b8035906020019184602083028401116401000000008311171561038657600080fd5b509092509050610e13565b34801561039d57600080fd5b506103a6610ff1565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103e05781810151838201526020016103c8565b50505050905090810190601f16801561040d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042757600080fd5b506103a66004803603608081101561043e57600080fd5b60ff8235169173ffffffffffffffffffffffffffffffffffffffff602082013516916040820135919081019060808101606082013564010000000081111561048557600080fd5b82018360208201111561049757600080fd5b803590602001918460018302840111640100000000831117156104b957600080fd5b509092509050611028565b3480156104d057600080fd5b506104d9611188565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561050e57600080fd5b506102756004803603602081101561052557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111a4565b34801561054e57600080fd5b506102756004803603602081101561056557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113a7565b34801561058e57600080fd5b50610275600480360360408110156105a557600080fd5b5080357fffffffff0000000000000000000000000000000000000000000000000000000016906020013573ffffffffffffffffffffffffffffffffffffffff16611596565b3480156105f657600080fd5b5061062a6004803603602081101561060d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611801565b604080519115158252519081900360200190f35b34801561064a57600080fd5b506104d96004803603602081101561066157600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661182c565b34801561069657600080fd5b506104d9611876565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5c036996040518163ffffffff1660e01b815260040160206040518083038186803b15801561070757600080fd5b505afa15801561071b573d6000803e3d6000fd5b505050506040513d602081101561073157600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633146107b657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff1661083a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e4f5f434f4e54524f4c4c455200000000000000000000000000000000000000604482015290519081900360640190fd5b60015473ffffffffffffffffffffffffffffffffffffffff16156108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e495449414c495a45445f414c524541445900000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661094157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a45524f5f414444524553530000000000000000000000000000000000000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f2d09b2e98dd73e6a5c2de8f80056fba918b4d574202a95c8e11eab46f89a21b69181900360200190a150565b3360009081526002602052604090205460ff16610a3857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610aba57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a45524f5f414444524553530000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116301415610b3f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f50524f4849424954454400000000000000000000000000000000000000000000604482015290519081900360640190fd5b60015473ffffffffffffffffffffffffffffffffffffffff82811691161415610bc957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f53414d455f414444524553530000000000000000000000000000000000000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf369181900360200190a150565b3360009081526002602052604090205460ff1680610d085750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5c036996040518163ffffffff1660e01b815260040160206040518083038186803b158015610cc357600080fd5b505afa158015610cd7573d6000803e3d6000fd5b505050506040513d6020811015610ced57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b610d7357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b610e1081600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b95459e46040518163ffffffff1660e01b815260040160206040518083038186803b158015610ddf57600080fd5b505afa158015610df3573d6000803e3d6000fd5b505050506040513d6020811015610e0957600080fd5b5051611892565b50565b60015473ffffffffffffffffffffffffffffffffffffffff16158015610e4f575060035473ffffffffffffffffffffffffffffffffffffffff16155b8015610e70575073ffffffffffffffffffffffffffffffffffffffff831615155b610edb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f434f4e54524f4c4c45525f494e49545f4641494c454400000000000000000000604482015290519081900360640190fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8581169190911791829055604080517fb95459e400000000000000000000000000000000000000000000000000000000815290516000939092169163b95459e491600480820192602092909190829003018186803b158015610f7757600080fd5b505afa158015610f8b573d6000803e3d6000fd5b505050506040513d6020811015610fa157600080fd5b5051905060005b82811015610fea57610fe2848483818110610fbf57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1683611892565b600101610fa8565b5050505050565b60408051808201909152600e81527f312e322e302028646171696e6729000000000000000000000000000000000000602082015290565b3360009081526002602052604090205460609060ff16806110f15750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5c036996040518163ffffffff1660e01b815260040160206040518083038186803b1580156110ac57600080fd5b505afa1580156110c0573d6000803e3d6000fd5b505050506040513d60208110156110d657600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b61115c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b600061116b8787878787611b8e565b925090508061117e573d6000803e3d6000fd5b5095945050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b3360009081526002602052604090205460ff1661122257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff828116911614156112ac57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f53414d455f434f4e54524f4c4c45520000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661132e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f494e56414c49445f434f4e54524f4c4c45520000000000000000000000000000604482015290519081900360640190fd5b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f027c3e080ed9215f564a9455a666f7e459b3edc0bb6e02a1bf842fde4d0ccfc19181900360200190a150565b3360009081526002602052604090205460ff1661142557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff166114b957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4d4f44554c455f4e4f545f455849535453000000000000000000000000000000604482015290519081900360640190fd5b8073ffffffffffffffffffffffffffffffffffffffff166351b42b006040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561150157600080fd5b505af1925050508015611512575060015b5073ffffffffffffffffffffffffffffffffffffffff811660008181526002602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055815192835290517f0a1ee69f55c33d8467c69ca59ce2007a737a88603d75392972520bf67cb513b89281900390910190a150565b3360009081526002602052604090205460ff1661161457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b7fffffffff0000000000000000000000000000000000000000000000000000000082166116a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f4241445f4d4554484f4400000000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156117525773ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff1661175257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d4f44554c455f554e415554484f52495a454400000000000000000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526004602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915582519384529083015280517fe38e0cbd107669b7b8120e2f6edde6ac4731cb8b123c1ab8b6db9b6bf0536fb29281900390910190a15050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205460ff1690565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff821661191457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e554c4c5f4d4f44554c45000000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff16156119a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4d4f44554c455f45584953545300000000000000000000000000000000000000604482015290519081900360640190fd5b8073ffffffffffffffffffffffffffffffffffffffff16632d9ad53d836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a1057600080fd5b505afa158015611a24573d6000803e3d6000fd5b505050506040513d6020811015611a3a57600080fd5b5051611aa757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f4d4f44554c45000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526002602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055815192835290517fead6a006345da1073a106d5f32372d2d2204f46cb0b4bca8f5ebafcbbed12b8a9281900390910190a18173ffffffffffffffffffffffffffffffffffffffff16630f15f4c06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611b7257600080fd5b505af1158015611b86573d6000803e3d6000fd5b505050505050565b600060608660ff1660011415611c19578573ffffffffffffffffffffffffffffffffffffffff16858585604051808383808284376040519201945060009350909150508083038185875af1925050503d8060008114611c09576040519150601f19603f3d011682016040523d82523d6000602084013e611c0e565b606091505b509092509050611dd5565b8660ff1660021415611c8d578573ffffffffffffffffffffffffffffffffffffffff1684846040518083838082843760405192019450600093509091505080830381855af49150503d8060008114611c09576040519150601f19603f3d011682016040523d82523d6000602084013e611c0e565b8660ff1660031415611d6e578415611d0657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f56414c554500000000000000000000000000000000000000604482015290519081900360640190fd5b8573ffffffffffffffffffffffffffffffffffffffff1684846040518083838082843760405192019450600093509091505080830381855afa9150503d8060008114611c09576040519150601f19603f3d011682016040523d82523d6000602084013e611c0e565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f554e535550504f525445445f4d4f444500000000000000000000000000000000604482015290519081900360640190fd5b955095935050505056fea264697066735822122014c6d2b1be13a9f3aa4e61bf3379aafb2222afe1e4b02416a906b522d658387764736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.