address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x50cd66a8008becd0b108cea3147f27eef78fd0a3 | /**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// 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 NINJABANK 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 = 1e12 * 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 = "NINJABANK";
string private constant _symbol = "NINJABANK";
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 _maxHeldAmount = _tTotal;
uint256 private _maxBuyAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxHeldAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x1e760BD6B73d5009597A2fa8bA234B537DD2209c);
_buyTax = 15;
_sellTax = 15;
_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) {
uint walletBalance = balanceOf(address(to));
require(amount <= _maxBuyAmount);
require(amount.add(walletBalance) <= _maxHeldAmount);
}
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;
_maxBuyAmount = 5000000000 * 10**9;
_maxHeldAmount = 20000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function 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 > 5000000000 * 10**9) {
_maxHeldAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610316578063c3c8cd8014610336578063c9567bf91461034b578063dbe8272c14610360578063dc1052e214610380578063dd62ed3e146103a057600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b411461013a5780639e78fb4f146102e1578063a9059cbb146102f657600080fd5b8063273123b7116100f2578063273123b714610213578063313ce5671461023357806346df33b71461024f5780636fc3eaec1461026f57806370a082311461028457600080fd5b806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab5780631bbae6e0146101d157806323b872dd146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201825260098152684e494e4a4142414e4b60b81b6020820152905161017291906118dd565b60405180910390f35b34801561018757600080fd5b5061019b610196366004611764565b6103e6565b6040519015158152602001610172565b3480156101b757600080fd5b50683635c9adc5dea000005b604051908152602001610172565b3480156101dd57600080fd5b506101f16101ec366004611896565b6103fd565b005b3480156101ff57600080fd5b5061019b61020e366004611723565b610449565b34801561021f57600080fd5b506101f161022e3660046116b0565b6104b2565b34801561023f57600080fd5b5060405160098152602001610172565b34801561025b57600080fd5b506101f161026a36600461185c565b6104fd565b34801561027b57600080fd5b506101f1610545565b34801561029057600080fd5b506101c361029f3660046116b0565b610579565b3480156102b057600080fd5b506101f161059b565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102ed57600080fd5b506101f161060f565b34801561030257600080fd5b5061019b610311366004611764565b61084e565b34801561032257600080fd5b506101f1610331366004611790565b61085b565b34801561034257600080fd5b506101f16108f1565b34801561035757600080fd5b506101f1610931565b34801561036c57600080fd5b506101f161037b366004611896565b610b06565b34801561038c57600080fd5b506101f161039b366004611896565b610b3e565b3480156103ac57600080fd5b506101c36103bb3660046116ea565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f3338484610b76565b5060015b92915050565b6000546001600160a01b031633146104305760405162461bcd60e51b815260040161042790611932565b60405180910390fd5b674563918244f400008111156104465760108190555b50565b6000610456848484610c9a565b6104a884336104a385604051806060016040528060288152602001611ac9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fb8565b610b76565b5060019392505050565b6000546001600160a01b031633146104dc5760405162461bcd60e51b815260040161042790611932565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105275760405162461bcd60e51b815260040161042790611932565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461056f5760405162461bcd60e51b815260040161042790611932565b4761044681610ff2565b6001600160a01b0381166000908152600260205260408120546103f79061102c565b6000546001600160a01b031633146105c55760405162461bcd60e51b815260040161042790611932565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106395760405162461bcd60e51b815260040161042790611932565b600f54600160a01b900460ff16156106935760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610427565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b91906116cd565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077357600080fd5b505afa158015610787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ab91906116cd565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f357600080fd5b505af1158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b91906116cd565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103f3338484610c9a565b6000546001600160a01b031633146108855760405162461bcd60e51b815260040161042790611932565b60005b81518110156108ed576001600660008484815181106108a9576108a9611a79565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108e581611a48565b915050610888565b5050565b6000546001600160a01b0316331461091b5760405162461bcd60e51b815260040161042790611932565b600061092630610579565b9050610446816110b0565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260040161042790611932565b600e5461097c9030906001600160a01b0316683635c9adc5dea00000610b76565b600e546001600160a01b031663f305d719473061099881610579565b6000806109ad6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1057600080fd5b505af1158015610a24573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a4991906118af565b5050600f8054674563918244f400006011556801158e460913d0000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ace57600080fd5b505af1158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104469190611879565b6000546001600160a01b03163314610b305760405162461bcd60e51b815260040161042790611932565b600f81101561044657600b55565b6000546001600160a01b03163314610b685760405162461bcd60e51b815260040161042790611932565b600f81101561044657600c55565b6001600160a01b038316610bd85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610427565b6001600160a01b038216610c395760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610427565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610427565b6001600160a01b038216610d605760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610427565b60008111610dc25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610427565b6001600160a01b03831660009081526006602052604090205460ff1615610de857600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2a57506001600160a01b03821660009081526005602052604090205460ff16155b15610fa8576000600955600c54600a55600f546001600160a01b038481169116148015610e655750600e546001600160a01b03838116911614155b8015610e8a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e9f5750600f54600160b81b900460ff165b15610eda576000610eaf83610579565b9050601154821115610ec057600080fd5b601054610ecd8383611239565b1115610ed857600080fd5b505b600f546001600160a01b038381169116148015610f055750600e546001600160a01b03848116911614155b8015610f2a57506001600160a01b03831660009081526005602052604090205460ff16155b15610f3b576000600955600b54600a555b6000610f4630610579565b600f54909150600160a81b900460ff16158015610f715750600f546001600160a01b03858116911614155b8015610f865750600f54600160b01b900460ff165b15610fa657610f94816110b0565b478015610fa457610fa447610ff2565b505b505b610fb3838383611298565b505050565b60008184841115610fdc5760405162461bcd60e51b815260040161042791906118dd565b506000610fe98486611a31565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108ed573d6000803e3d6000fd5b60006007548211156110935760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610427565b600061109d6112a3565b90506110a983826112c6565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110f8576110f8611a79565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561114c57600080fd5b505afa158015611160573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118491906116cd565b8160018151811061119757611197611a79565b6001600160a01b039283166020918202929092010152600e546111bd9130911684610b76565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111f6908590600090869030904290600401611967565b600060405180830381600087803b15801561121057600080fd5b505af1158015611224573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061124683856119d8565b9050838110156110a95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610427565b610fb3838383611308565b60008060006112b06113ff565b90925090506112bf82826112c6565b9250505090565b60006110a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611441565b60008060008060008061131a8761146f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061134c90876114cc565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461137b9086611239565b6001600160a01b03891660009081526002602052604090205561139d8161150e565b6113a78483611558565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ec91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061141b82826112c6565b82101561143857505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836114625760405162461bcd60e51b815260040161042791906118dd565b506000610fe984866119f0565b600080600080600080600080600061148c8a600954600a5461157c565b925092509250600061149c6112a3565b905060008060006114af8e8787876115d1565b919e509c509a509598509396509194505050505091939550919395565b60006110a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fb8565b60006115186112a3565b905060006115268383611621565b306000908152600260205260409020549091506115439082611239565b30600090815260026020526040902055505050565b60075461156590836114cc565b6007556008546115759082611239565b6008555050565b600080808061159660646115908989611621565b906112c6565b905060006115a960646115908a89611621565b905060006115c1826115bb8b866114cc565b906114cc565b9992985090965090945050505050565b60008080806115e08886611621565b905060006115ee8887611621565b905060006115fc8888611621565b9050600061160e826115bb86866114cc565b939b939a50919850919650505050505050565b600082611630575060006103f7565b600061163c8385611a12565b90508261164985836119f0565b146110a95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610427565b80356116ab81611aa5565b919050565b6000602082840312156116c257600080fd5b81356110a981611aa5565b6000602082840312156116df57600080fd5b81516110a981611aa5565b600080604083850312156116fd57600080fd5b823561170881611aa5565b9150602083013561171881611aa5565b809150509250929050565b60008060006060848603121561173857600080fd5b833561174381611aa5565b9250602084013561175381611aa5565b929592945050506040919091013590565b6000806040838503121561177757600080fd5b823561178281611aa5565b946020939093013593505050565b600060208083850312156117a357600080fd5b823567ffffffffffffffff808211156117bb57600080fd5b818501915085601f8301126117cf57600080fd5b8135818111156117e1576117e1611a8f565b8060051b604051601f19603f8301168101818110858211171561180657611806611a8f565b604052828152858101935084860182860187018a101561182557600080fd5b600095505b8386101561184f5761183b816116a0565b85526001959095019493860193860161182a565b5098975050505050505050565b60006020828403121561186e57600080fd5b81356110a981611aba565b60006020828403121561188b57600080fd5b81516110a981611aba565b6000602082840312156118a857600080fd5b5035919050565b6000806000606084860312156118c457600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561190a578581018301518582016040015282016118ee565b8181111561191c576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119b75784516001600160a01b031683529383019391830191600101611992565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119eb576119eb611a63565b500190565b600082611a0d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a2c57611a2c611a63565b500290565b600082821015611a4357611a43611a63565b500390565b6000600019821415611a5c57611a5c611a63565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461044657600080fd5b801515811461044657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209f33c414775411b503cff50c2543e790b629ceef62401024cc9ab8ceca18e78164736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 0 |
0xe5c4a238c7c80c1c312e8f36e21d5f0aba40c5b7 | /**
*Submitted for verification at Etherscan.io on 2020-10-30
*/
/**
*Submitted for verification at Etherscan.io on 2020-03-04
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
contract AMPT {
/// @notice EIP-20 token name for this token
string public constant name = "Amplify Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "AMPT";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 100000000e18; // 100 million AMPT
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new AMPT token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "AMPT::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "AMPT::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "AMPT::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "AMPT::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "AMPT::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "AMPT::delegateBySig: invalid nonce");
require(now <= expiry, "AMPT::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "AMPT::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "AMPT::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "AMPT::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "AMPT::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "AMPT::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "AMPT::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "AMPT::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "AMPT::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610358578063c3cda52014610388578063dd62ed3e146103a4578063e7a324dc146103d4578063f1127ed8146103f257610121565b806370a082311461027a578063782d6fe1146102aa5780637ecebe00146102da57806395d89b411461030a578063a9059cbb1461032857610121565b806323b872dd116100f457806323b872dd146101b0578063313ce567146101e0578063587cde1e146101fe5780635c19a95c1461022e5780636fcfff451461024a57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461017457806320606b7014610192575b600080fd5b61012e610423565b60405161013b9190612741565b60405180910390f35b61015e6004803603810190610159919061217d565b61045c565b60405161016b919061263c565b60405180910390f35b61017c6105ee565b6040516101899190612823565b60405180910390f35b61019a6105fd565b6040516101a79190612657565b60405180910390f35b6101ca60048036038101906101c5919061212e565b610621565b6040516101d7919061263c565b60405180910390f35b6101e86108b3565b6040516101f59190612882565b60405180910390f35b610218600480360381019061021391906120c9565b6108b8565b6040516102259190612621565b60405180910390f35b610248600480360381019061024391906120c9565b6108eb565b005b610264600480360381019061025f91906120c9565b6108f8565b604051610271919061283e565b60405180910390f35b610294600480360381019061028f91906120c9565b61091b565b6040516102a19190612823565b60405180910390f35b6102c460048036038101906102bf919061217d565b61098a565b6040516102d191906128b8565b60405180910390f35b6102f460048036038101906102ef91906120c9565b610d99565b6040516103019190612823565b60405180910390f35b610312610db1565b60405161031f9190612741565b60405180910390f35b610342600480360381019061033d919061217d565b610dea565b60405161034f919061263c565b60405180910390f35b610372600480360381019061036d91906120c9565b610e27565b60405161037f91906128b8565b60405180910390f35b6103a2600480360381019061039d91906121b9565b610f15565b005b6103be60048036038101906103b991906120f2565b6111d2565b6040516103cb9190612823565b60405180910390f35b6103dc61127e565b6040516103e99190612657565b60405180910390f35b61040c60048036038101906104079190612242565b6112a2565b60405161041a929190612859565b60405180910390f35b6040518060400160405280600d81526020017f416d706c69667920546f6b656e0000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156104af577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506104d4565b6104d183604051806060016040528060258152602001612b0c602591396112fb565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516105db919061289d565b60405180910390a3600191505092915050565b6a52b7d2dcc80cd2e400000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905060006106e385604051806060016040528060258152602001612b0c602591396112fb565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561075d57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b1561089a57600061078783836040518060600160405280603d8152602001612b31603d9139611359565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610890919061289d565b60405180910390a3505b6108a58787836113ca565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108f533826117ab565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b60004382106109ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c5906127e3565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610a3b576000915050610d93565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610b3d57600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff16915050610d93565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610bbe576000915050610d93565b6000806001830390505b8163ffffffff168163ffffffff161115610d15576000600283830363ffffffff1681610bf057fe5b0482039050610bfd612032565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415610ced57806020015195505050505050610d93565b86816000015163ffffffff161015610d0757819350610d0e565b6001820392505b5050610bc8565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600481526020017f414d50540000000000000000000000000000000000000000000000000000000081525081565b600080610e0f83604051806060016040528060268152602001612b6e602691396112fb565b9050610e1c3385836113ca565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1611610e91576000610f0d565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8666040518060400160405280600d81526020017f416d706c69667920546f6b656e0000000000000000000000000000000000000081525080519060200120610f7d61196b565b30604051602001610f9194939291906126b7565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610fe29493929190612672565b6040516020818303038152906040528051906020012090506000828260405160200161100f9291906125ea565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161104c94939291906126fc565b6020604051602081039080840390855afa15801561106e573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e1906127c3565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611179576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117090612763565b60405180910390fd5b874211156111bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b390612783565b60405180910390fd5b6111c6818b6117ab565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c010000000000000000000000008310829061134f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113469190612741565b60405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff16111582906113bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b49190612741565b60405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561143a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143190612803565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a1906127a3565b60405180910390fd5b611524600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060368152602001612ad660369139611359565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555061160b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060308152602001612a7e60309139611978565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516116d5919061289d565b60405180910390a36117a6600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836119ee565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46119658284836119ee565b50505050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff16101583906119e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d99190612741565b60405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a3857506000816bffffffffffffffffffffffff16115b15611ce457600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611b90576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611adb576000611b57565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611b7e8285604051806060016040528060288152602001612aae60289139611359565b9050611b8c86848484611ce9565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ce3576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611c2e576000611caa565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611cd18285604051806060016040528060278152602001612bc860279139611978565b9050611cdf85848484611ce9565b5050505b5b505050565b6000611d0d43604051806060016040528060348152602001612b9460349139611fdc565b905060008463ffffffff16118015611da257508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15611e3d5781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611f85565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611fcd9291906128d3565b60405180910390a25050505050565b600064010000000083108290612028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201f9190612741565b60405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff1681525090565b60008135905061206f81612a0a565b92915050565b60008135905061208481612a21565b92915050565b60008135905061209981612a38565b92915050565b6000813590506120ae81612a4f565b92915050565b6000813590506120c381612a66565b92915050565b6000602082840312156120db57600080fd5b60006120e984828501612060565b91505092915050565b6000806040838503121561210557600080fd5b600061211385828601612060565b925050602061212485828601612060565b9150509250929050565b60008060006060848603121561214357600080fd5b600061215186828701612060565b935050602061216286828701612060565b92505060406121738682870161208a565b9150509250925092565b6000806040838503121561219057600080fd5b600061219e85828601612060565b92505060206121af8582860161208a565b9150509250929050565b60008060008060008060c087890312156121d257600080fd5b60006121e089828a01612060565b96505060206121f189828a0161208a565b955050604061220289828a0161208a565b945050606061221389828a016120b4565b935050608061222489828a01612075565b92505060a061223589828a01612075565b9150509295509295509295565b6000806040838503121561225557600080fd5b600061226385828601612060565b92505060206122748582860161209f565b9150509250929050565b61228781612923565b82525050565b61229681612935565b82525050565b6122a581612941565b82525050565b6122bc6122b782612941565b6129ef565b82525050565b60006122cd826128fc565b6122d78185612907565b93506122e78185602086016129bc565b6122f0816129f9565b840191505092915050565b6000612308600283612918565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b6000612348602283612907565b91507f414d50543a3a64656c656761746542795369673a20696e76616c6964206e6f6e60008301527f63650000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006123ae602683612907565b91507f414d50543a3a64656c656761746542795369673a207369676e6174757265206560008301527f78706972656400000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612414603a83612907565b91507f414d50543a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008301527f616e7366657220746f20746865207a65726f20616464726573730000000000006020830152604082019050919050565b600061247a602683612907565b91507f414d50543a3a64656c656761746542795369673a20696e76616c69642073696760008301527f6e617475726500000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006124e0602783612907565b91507f414d50543a3a6765745072696f72566f7465733a206e6f74207965742064657460008301527f65726d696e6564000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612546603c83612907565b91507f414d50543a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008301527f616e736665722066726f6d20746865207a65726f2061646472657373000000006020830152604082019050919050565b6125a88161296b565b82525050565b6125b781612975565b82525050565b6125c681612985565b82525050565b6125d5816129aa565b82525050565b6125e481612992565b82525050565b60006125f5826122fb565b915061260182856122ab565b60208201915061261182846122ab565b6020820191508190509392505050565b6000602082019050612636600083018461227e565b92915050565b6000602082019050612651600083018461228d565b92915050565b600060208201905061266c600083018461229c565b92915050565b6000608082019050612687600083018761229c565b612694602083018661227e565b6126a1604083018561259f565b6126ae606083018461259f565b95945050505050565b60006080820190506126cc600083018761229c565b6126d9602083018661229c565b6126e6604083018561259f565b6126f3606083018461227e565b95945050505050565b6000608082019050612711600083018761229c565b61271e60208301866125bd565b61272b604083018561229c565b612738606083018461229c565b95945050505050565b6000602082019050818103600083015261275b81846122c2565b905092915050565b6000602082019050818103600083015261277c8161233b565b9050919050565b6000602082019050818103600083015261279c816123a1565b9050919050565b600060208201905081810360008301526127bc81612407565b9050919050565b600060208201905081810360008301526127dc8161246d565b9050919050565b600060208201905081810360008301526127fc816124d3565b9050919050565b6000602082019050818103600083015261281c81612539565b9050919050565b6000602082019050612838600083018461259f565b92915050565b600060208201905061285360008301846125ae565b92915050565b600060408201905061286e60008301856125ae565b61287b60208301846125db565b9392505050565b600060208201905061289760008301846125bd565b92915050565b60006020820190506128b260008301846125cc565b92915050565b60006020820190506128cd60008301846125db565b92915050565b60006040820190506128e860008301856125cc565b6128f560208301846125cc565b9392505050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600061292e8261294b565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b60006129b582612992565b9050919050565b60005b838110156129da5780820151818401526020810190506129bf565b838111156129e9576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b612a1381612923565b8114612a1e57600080fd5b50565b612a2a81612941565b8114612a3557600080fd5b50565b612a418161296b565b8114612a4c57600080fd5b50565b612a5881612975565b8114612a6357600080fd5b50565b612a6f81612985565b8114612a7a57600080fd5b5056fe414d50543a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773414d50543a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773414d50543a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365414d50543a3a617070726f76653a20616d6f756e7420657863656564732039362062697473414d50543a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365414d50543a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473414d50543a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473414d50543a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a264697066735822122089f2071976f9715ce4ef45d326b33c69234bd06bc840c26275c0855b56e9dba764736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 1 |
0x3ddd6a5dc87798285d43515832c17cbff141ad28 | 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 TokenERC20 {
// Public variables of the token
string public name = "KmongCoin";
string public symbol = "KMC";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply = 10000000000 * (10 ** 18);
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
) public {
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` 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;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* KMCToken TOKEN STARTS HERE */
/******************************************/
contract KMCToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
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 KMCToken(
) TokenERC20() public {}
/* 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 (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_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 {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, 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) 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
}
} | 0x6060604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305fefda7811461012c57806306fdde0314610147578063095ea7b3146101d157806318160ddd1461020757806323b872dd1461022c578063313ce5671461025457806342966c681461027d5780634b7503341461029357806370a08231146102a657806379c65068146102c557806379cc6790146102e75780638620410b146103095780638da5cb5b1461031c57806395d89b411461034b578063a6f2ae3a1461035e578063a9059cbb14610366578063b414d4b614610388578063cae9ca51146103a7578063dd62ed3e1461040c578063e4849b3214610431578063e724529c14610447578063f2fde38b1461046b575b600080fd5b341561013757600080fd5b61014560043560243561048a565b005b341561015257600080fd5b61015a6104b0565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019657808201518382015260200161017e565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b6101f3600160a060020a036004351660243561054e565b604051901515815260200160405180910390f35b341561021257600080fd5b61021a61057e565b60405190815260200160405180910390f35b341561023757600080fd5b6101f3600160a060020a0360043581169060243516604435610584565b341561025f57600080fd5b6102676105fb565b60405160ff909116815260200160405180910390f35b341561028857600080fd5b6101f3600435610604565b341561029e57600080fd5b61021a61068f565b34156102b157600080fd5b61021a600160a060020a0360043516610695565b34156102d057600080fd5b610145600160a060020a03600435166024356106a7565b34156102f257600080fd5b6101f3600160a060020a036004351660243561076d565b341561031457600080fd5b61021a610849565b341561032757600080fd5b61032f61084f565b604051600160a060020a03909116815260200160405180910390f35b341561035657600080fd5b61015a61085e565b6101456108c9565b341561037157600080fd5b610145600160a060020a03600435166024356108e9565b341561039357600080fd5b6101f3600160a060020a03600435166108f8565b34156103b257600080fd5b6101f360048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061090d95505050505050565b341561041757600080fd5b61021a600160a060020a0360043581169060243516610a3f565b341561043c57600080fd5b610145600435610a5c565b341561045257600080fd5b610145600160a060020a03600435166024351515610ab9565b341561047657600080fd5b610145600160a060020a0360043516610b45565b60005433600160a060020a039081169116146104a557600080fd5b600791909155600855565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105465780601f1061051b57610100808354040283529160200191610546565b820191906000526020600020905b81548152906001019060200180831161052957829003601f168201915b505050505081565b600160a060020a033381166000908152600660209081526040808320938616835292905220819055600192915050565b60045481565b600160a060020a038084166000908152600660209081526040808320339094168352929052908120548211156105b957600080fd5b600160a060020a03808516600090815260066020908152604080832033909416835292905220805483900390556105f1848484610b8f565b5060019392505050565b60035460ff1681565b600160a060020a0333166000908152600560205260408120548290101561062a57600080fd5b600160a060020a03331660008181526005602052604090819020805485900390556004805485900390557fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a2506001919050565b60075481565b60056020526000908152604090205481565b60005433600160a060020a039081169116146106c257600080fd5b600160a060020a03808316600090815260056020526040808220805485019055600480548501905530909216917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a381600160a060020a031630600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35050565b600160a060020a0382166000908152600560205260408120548290101561079357600080fd5b600160a060020a03808416600090815260066020908152604080832033909416835292905220548211156107c657600080fd5b600160a060020a038084166000818152600560209081526040808320805488900390556006825280832033909516835293905282902080548590039055600480548590039055907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a250600192915050565b60085481565b600054600160a060020a031681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105465780601f1061051b57610100808354040283529160200191610546565b6000600854348115156108d857fe5b0490506108e6303383610b8f565b50565b6108f4338383610b8f565b5050565b60096020526000908152604090205460ff1681565b60008361091a818561054e565b15610a375780600160a060020a0316638f4ffcb1338630876040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156109d05780820151838201526020016109b8565b50505050905090810190601f1680156109fd5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610a1e57600080fd5b6102c65a03f11515610a2f57600080fd5b505050600191505b509392505050565b600660209081526000928352604080842090915290825290205481565b6007548102600160a060020a033016311015610a7757600080fd5b610a82333083610b8f565b33600160a060020a03166108fc60075483029081150290604051600060405180830381858888f1935050505015156108e657600080fd5b60005433600160a060020a03908116911614610ad457600080fd5b600160a060020a03821660009081526009602052604090819020805460ff19168315151790557f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5908390839051600160a060020a039092168252151560208201526040908101905180910390a15050565b60005433600160a060020a03908116911614610b6057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382161515610ba457600080fd5b600160a060020a03831660009081526005602052604090205481901015610bca57600080fd5b600160a060020a03821660009081526005602052604090205481810111610bf057600080fd5b600160a060020a03831660009081526009602052604090205460ff1615610c1657600080fd5b600160a060020a03821660009081526009602052604090205460ff1615610c3c57600080fd5b600160a060020a038084166000818152600560205260408082208054869003905592851680825290839020805485019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a35050505600a165627a7a72305820283b2ce3e3c2c295898aee6311e65f2875e023e8358b695329701e39e7e63cea0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 2 |
0xef3288934A34AdCB5D31A9dA66aa44d56A2D4309 | pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* 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);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
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;
}
}
contract DioToken is BasicToken, MintableToken {
/**
* @dev Math operations with safety checks that throw on error
*/
using SafeMath for uint256;
string public constant name = "DIO Token";
string public constant symbol = "DIO";
uint8 public constant decimals = 8;
/**
* @dev E8 represents the number 100000000, allowing easy multiplications between the minimal
*/
uint constant E8 = 10**8;
function transfer(
address _to,
uint256 _value
)
public
onlyOwner
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
onlyOwner
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
onlyOwner
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
onlyOwner
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
onlyOwner
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | 0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610125578063095ea7b3146101b557806318160ddd1461021a57806323b872dd14610245578063313ce567146102ca57806340c10f19146102fb578063661884631461036057806370a08231146103c5578063715018a61461041c5780637d64bcb4146104335780638da5cb5b1461046257806395d89b41146104b9578063a9059cbb14610549578063d73dd623146105ae578063dd62ed3e14610613578063f2fde38b1461068a575b600080fd5b34801561010257600080fd5b5061010b6106cd565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a6106e0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c157600080fd5b50610200600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610719565b604051808215151515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610789565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610793565b604051808215151515815260200191505060405180910390f35b3480156102d657600080fd5b506102df610805565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030757600080fd5b50610346600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061080a565b604051808215151515815260200191505060405180910390f35b34801561036c57600080fd5b506103ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f0565b604051808215151515815260200191505060405180910390f35b3480156103d157600080fd5b50610406600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a60565b6040518082815260200191505060405180910390f35b34801561042857600080fd5b50610431610aa8565b005b34801561043f57600080fd5b50610448610bad565b604051808215151515815260200191505060405180910390f35b34801561046e57600080fd5b50610477610c75565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c557600080fd5b506104ce610c9b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050e5780820151818401526020810190506104f3565b50505050905090810190601f16801561053b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055557600080fd5b50610594600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cd4565b604051808215151515815260200191505060405180910390f35b3480156105ba57600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d44565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610db4565b6040518082815260200191505060405180910390f35b34801561069657600080fd5b506106cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e3b565b005b600360149054906101000a900460ff1681565b6040805190810160405280600981526020017f44494f20546f6b656e000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077757600080fd5b6107818383610ea3565b905092915050565b6000600154905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107f157600080fd5b6107fc848484610f95565b90509392505050565b600881565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561086857600080fd5b600360149054906101000a900460ff1615151561088457600080fd5b6108998260015461134f90919063ffffffff16565b6001819055506108f0826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4e57600080fd5b610a58838361136b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b0457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0b57600080fd5b600360149054906101000a900460ff16151515610c2757600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f44494f000000000000000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d3257600080fd5b610d3c83836115fc565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da257600080fd5b610dac838361181b565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e9757600080fd5b610ea081611a17565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610fd257600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561101f57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110aa57600080fd5b6110fb826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061125f82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000818301905082811015151561136257fe5b80905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561147c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611510565b61148f8382611b1390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561163957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561168657600080fd5b6116d7826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061176a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006118ac82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a5357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611b2157fe5b8183039050929150505600a165627a7a723058205de727189215c7e0ae16889db71bcd1df36ea2fef57c3ae97d9387145ebfa9050029 | {"success": true, "error": null, "results": {}} | 3 |
0x4ebbead673d51a82b4387e5f9dbdfb8efc1c9c7b | pragma solidity ^0.4.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title 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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will recieve the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(0X0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract ChangeCoin is MintableToken {
string public name = "Change COIN";
string public symbol = "CAG";
uint256 public decimals = 18;
bool public tradingStarted = false;
/**
* @dev modifier that throws if trading has not started yet
*/
modifier hasStartedTrading() {
require(tradingStarted);
_;
}
/**
* @dev Allows the owner to enable the trading. This can not be undone
*/
function startTrading() onlyOwner {
tradingStarted = true;
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _to the recipient address of the tokens.
* @param _value number of tokens to be transfered.
*/
function transfer(address _to, uint _value) hasStartedTrading returns (bool){
return super.transfer(_to, _value);
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint _value) hasStartedTrading returns (bool){
return super.transferFrom(_from, _to, _value);
}
}
contract ChangeCoinCrowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
ChangeCoin public token;
// start and end block where investments are allowed (both inclusive)
uint256 public startTimestamp;
uint256 public endTimestamp;
// address where funds are collected
address public hardwareWallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public minContribution;
uint256 public hardcap;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event MainSaleClosed();
uint256 public raisedInPresale = 36670.280302936701463815 ether;
function ChangeCoinCrowdsale() {
startTimestamp = 1508160600;
endTimestamp = 1508162400;
rate = 500;
hardwareWallet = 0x71B1Ee0848c4F68df05429490fc4237089692e1e;
token = ChangeCoin(0x7d4b8Cce0591C9044a22ee543533b72E976E36C3);
minContribution = 0.49 ether;
hardcap = 200000 ether;
require(startTimestamp >= now);
require(endTimestamp >= startTimestamp);
}
/**
* @dev Calculates the amount of bonus coins the buyer gets
* @param tokens uint the amount of tokens you get according to current rate
* @return uint the amount of bonus tokens the buyer gets
*/
function bonusAmmount(uint256 tokens) internal returns(uint256) {
uint256 bonus5 = tokens /20;
// add bonus 20% in first 24hours, 15% in first week, 10% in 2nd week
if (now < startTimestamp + 24 hours) { // 5080 is aprox 24h
return bonus5 * 4;
} else if (now < startTimestamp + 1 weeks) {
return bonus5 * 3;
} else if (now < startTimestamp + 2 weeks) {
return bonus5 * 2;
} else {
return 0;
}
}
// check if valid purchase
modifier validPurchase {
require(now >= startTimestamp);
require(now <= endTimestamp);
require(msg.value >= minContribution);
require(weiRaised.add(msg.value).add(raisedInPresale) <= hardcap);
_;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
bool timeLimitReached = now > endTimestamp;
bool capReached = weiRaised.add(raisedInPresale) >= hardcap;
return timeLimitReached || capReached;
}
// low level token purchase function
function buyTokens(address beneficiary) payable validPurchase {
require(beneficiary != 0x0);
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
tokens = tokens + bonusAmmount(tokens);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
hardwareWallet.transfer(msg.value);
}
// finish mining coins and transfer ownership of Change coin to owner
function finishMinting() public onlyOwner {
require(hasEnded());
uint issuedTokenSupply = token.totalSupply();
uint restrictedTokens = issuedTokenSupply.mul(60).div(40);
token.mint(hardwareWallet, restrictedTokens);
token.finishMinting();
token.transferOwnership(owner);
MainSaleClosed();
}
// fallback function can be used to buy tokens
function () payable {
buyTokens(msg.sender);
}
} | 0x606060405236156100b45763ffffffff60e060020a6000350416632c4e722e81146100c15780634042b66f146100e65780637366e3ff1461010b5780637d64bcb4146101305780638da5cb5b14610145578063a85adeab14610174578063aaffadf314610199578063b071cbe6146101be578063e6fd48bc146101e3578063e9edf4cd14610208578063ec8ac4d814610237578063ecb70fb71461024d578063f2fde38b14610274578063fc0c546a14610295575b5b6100be336102c4565b5b005b34156100cc57600080fd5b6100d461047f565b60405190815260200160405180910390f35b34156100f157600080fd5b6100d4610485565b60405190815260200160405180910390f35b341561011657600080fd5b6100d461048b565b60405190815260200160405180910390f35b341561013b57600080fd5b6100be610491565b005b341561015057600080fd5b6101586106cd565b604051600160a060020a03909116815260200160405180910390f35b341561017f57600080fd5b6100d46106dc565b60405190815260200160405180910390f35b34156101a457600080fd5b6100d46106e2565b60405190815260200160405180910390f35b34156101c957600080fd5b6100d46106e8565b60405190815260200160405180910390f35b34156101ee57600080fd5b6100d46106ee565b60405190815260200160405180910390f35b341561021357600080fd5b6101586106f4565b604051600160a060020a03909116815260200160405180910390f35b6100be600160a060020a03600435166102c4565b005b341561025857600080fd5b610260610703565b604051901515815260200160405180910390f35b341561027f57600080fd5b6100be600160a060020a036004351661073e565b005b34156102a057600080fd5b610158610796565b604051600160a060020a03909116815260200160405180910390f35b60008060025442101515156102d857600080fd5b6003544211156102e757600080fd5b6007543410156102f657600080fd5b600854610320600954610314346006546107a590919063ffffffff16565b9063ffffffff6107a516565b111561032b57600080fd5b600160a060020a038316151561034057600080fd5b60055434925061035790839063ffffffff6107bf16565b9050610362816107ee565b600654910190610378908363ffffffff6107a516565b600655600154600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156103da57600080fd5b6102c65a03f115156103eb57600080fd5b505050604051805190505082600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18848460405191825260208201526040908101905180910390a3600454600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561047857600080fd5b5b5b505050565b60055481565b60065481565b60095481565b60008054819033600160a060020a039081169116146104af57600080fd5b6104b7610703565b15156104c257600080fd5b600154600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561050a57600080fd5b6102c65a03f1151561051b57600080fd5b505050604051805192506105499050602861053d84603c63ffffffff6107bf16565b9063ffffffff61085416565b600154600454919250600160a060020a03908116916340c10f1991168360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156105b257600080fd5b6102c65a03f115156105c357600080fd5b50505060405180515050600154600160a060020a0316637d64bcb46000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561061557600080fd5b6102c65a03f1151561062657600080fd5b50505060405180515050600154600054600160a060020a039182169163f2fde38b911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561068757600080fd5b6102c65a03f1151561069857600080fd5b5050507f1a67d6e5b402fe0ff129cb2047b6e67ba18b8dde04bb285faed9e709d6b1eb2760405160405180910390a15b5b5050565b600054600160a060020a031681565b60035481565b60075481565b60085481565b60025481565b600454600160a060020a031681565b6000806000600354421191506008546107296009546006546107a590919063ffffffff16565b1015905081806107365750805b92505b505090565b60005433600160a060020a0390811691161461075957600080fd5b600160a060020a03811615610791576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600154600160a060020a031681565b6000828201838110156107b457fe5b8091505b5092915050565b60008282028315806107db57508284828115156107d857fe5b04145b15156107b457fe5b8091505b5092915050565b6000806014835b04905060025462015180014210156108125780600402915061084b565b60025462093a800142101561082c5780600302915061084b565b60025462127500014210156108465780600202915061084b565b600091505b5b5b5b50919050565b600080828481151561086257fe5b0490508091505b50929150505600a165627a7a72305820c7ac9f6c1dd921ea91a39ac9550d1358611940a1fc13ff0d346a88c91d2561680029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 4 |
0x198cf24375eccdf599c624d10f0c6fb9b75ec215 | pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/*
* Manager that stores permitted addresses
*/
contract PermissionManager is Ownable {
mapping (address => bool) permittedAddresses;
function addAddress(address newAddress) public onlyOwner {
permittedAddresses[newAddress] = true;
}
function removeAddress(address remAddress) public onlyOwner {
permittedAddresses[remAddress] = false;
}
function isPermitted(address pAddress) public view returns(bool) {
if (permittedAddresses[pAddress]) {
return true;
}
return false;
}
}
contract Registry is Ownable {
struct ContributorData {
bool isActive;
uint contributionETH;
uint contributionUSD;
uint tokensIssued;
uint quoteUSD;
uint contributionRNTB;
}
mapping(address => ContributorData) public contributorList;
mapping(uint => address) private contributorIndexes;
uint private nextContributorIndex;
/* Permission manager contract */
PermissionManager public permissionManager;
bool public completed;
modifier onlyPermitted() {
require(permissionManager.isPermitted(msg.sender));
_;
}
event ContributionAdded(address _contributor, uint overallEth, uint overallUSD, uint overallToken, uint quote);
event ContributionEdited(address _contributor, uint overallEth, uint overallUSD, uint overallToken, uint quote);
function Registry(address pManager) public {
permissionManager = PermissionManager(pManager);
completed = false;
}
function setPermissionManager(address _permadr) public onlyOwner {
require(_permadr != 0x0);
permissionManager = PermissionManager(_permadr);
}
function isActiveContributor(address contributor) public view returns(bool) {
return contributorList[contributor].isActive;
}
function removeContribution(address contributor) public onlyPermitted {
contributorList[contributor].isActive = false;
}
function setCompleted(bool compl) public onlyPermitted {
completed = compl;
}
function addContribution(address _contributor, uint _amount, uint _amusd, uint _tokens, uint _quote ) public onlyPermitted {
if (contributorList[_contributor].isActive == false) {
contributorList[_contributor].isActive = true;
contributorList[_contributor].contributionETH = _amount;
contributorList[_contributor].contributionUSD = _amusd;
contributorList[_contributor].tokensIssued = _tokens;
contributorList[_contributor].quoteUSD = _quote;
contributorIndexes[nextContributorIndex] = _contributor;
nextContributorIndex++;
} else {
contributorList[_contributor].contributionETH += _amount;
contributorList[_contributor].contributionUSD += _amusd;
contributorList[_contributor].tokensIssued += _tokens;
contributorList[_contributor].quoteUSD = _quote;
}
ContributionAdded(_contributor, contributorList[_contributor].contributionETH, contributorList[_contributor].contributionUSD, contributorList[_contributor].tokensIssued, contributorList[_contributor].quoteUSD);
}
function editContribution(address _contributor, uint _amount, uint _amusd, uint _tokens, uint _quote) public onlyPermitted {
if (contributorList[_contributor].isActive == true) {
contributorList[_contributor].contributionETH = _amount;
contributorList[_contributor].contributionUSD = _amusd;
contributorList[_contributor].tokensIssued = _tokens;
contributorList[_contributor].quoteUSD = _quote;
}
ContributionEdited(_contributor, contributorList[_contributor].contributionETH, contributorList[_contributor].contributionUSD, contributorList[_contributor].tokensIssued, contributorList[_contributor].quoteUSD);
}
function addContributor(address _contributor, uint _amount, uint _amusd, uint _tokens, uint _quote) public onlyPermitted {
contributorList[_contributor].isActive = true;
contributorList[_contributor].contributionETH = _amount;
contributorList[_contributor].contributionUSD = _amusd;
contributorList[_contributor].tokensIssued = _tokens;
contributorList[_contributor].quoteUSD = _quote;
contributorIndexes[nextContributorIndex] = _contributor;
nextContributorIndex++;
ContributionAdded(_contributor, contributorList[_contributor].contributionETH, contributorList[_contributor].contributionUSD, contributorList[_contributor].tokensIssued, contributorList[_contributor].quoteUSD);
}
function getContributionETH(address _contributor) public view returns (uint) {
return contributorList[_contributor].contributionETH;
}
function getContributionUSD(address _contributor) public view returns (uint) {
return contributorList[_contributor].contributionUSD;
}
function getContributionRNTB(address _contributor) public view returns (uint) {
return contributorList[_contributor].contributionRNTB;
}
function getContributionTokens(address _contributor) public view returns (uint) {
return contributorList[_contributor].tokensIssued;
}
function addRNTBContribution(address _contributor, uint _amount) public onlyPermitted {
if (contributorList[_contributor].isActive == false) {
contributorList[_contributor].isActive = true;
contributorList[_contributor].contributionRNTB = _amount;
contributorIndexes[nextContributorIndex] = _contributor;
nextContributorIndex++;
} else {
contributorList[_contributor].contributionETH += _amount;
}
}
function getContributorByIndex(uint index) public view returns (address) {
return contributorIndexes[index];
}
function getContributorAmount() public view returns(uint) {
return nextContributorIndex;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
if(_data.length > 0) {
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
}
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
contract ERC223Interface {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function allowedAddressesOf(address who) public view returns (bool);
function getTotalSupply() public view returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event TransferContract(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Unity Token is ERC223 token.
* @author Vladimir Kovalchuk
*/
contract UnityToken is ERC223Interface {
using SafeMath for uint;
string public constant name = "Unity Token";
string public constant symbol = "UNT";
uint8 public constant decimals = 18;
/* The supply is initially 100UNT to the precision of 18 decimals */
uint public constant INITIAL_SUPPLY = 100000 * (10 ** uint(decimals));
mapping(address => uint) balances; // List of user balances.
mapping(address => bool) allowedAddresses;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function addAllowed(address newAddress) public onlyOwner {
allowedAddresses[newAddress] = true;
}
function removeAllowed(address remAddress) public onlyOwner {
allowedAddresses[remAddress] = false;
}
address public owner;
/* Constructor initializes the owner's balance and the supply */
function UnityToken() public {
owner = msg.sender;
totalSupply = INITIAL_SUPPLY;
balances[owner] = INITIAL_SUPPLY;
}
function getTotalSupply() public view returns (uint) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
if (isContract(_to)) {
require(allowedAddresses[_to]);
if (balanceOf(msg.sender) < _value)
revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
TransferContract(msg.sender, _to, _value, _data);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value)
revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(allowedAddresses[_to]);
if (balanceOf(msg.sender) < _value)
revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
TransferContract(msg.sender, _to, _value, _data);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function allowedAddressesOf(address _owner) public view returns (bool allowed) {
return allowedAddresses[_owner];
}
}
/**
* @title Hold contract.
* @author Vladimir Kovalchuk
*/
contract Hold is Ownable {
uint8 stages = 5;
uint8 public percentage;
uint8 public currentStage;
uint public initialBalance;
uint public withdrawed;
address public multisig;
Registry registry;
PermissionManager public permissionManager;
uint nextContributorToTransferEth;
address public observer;
uint dateDeployed;
mapping(address => bool) private hasWithdrawedEth;
event InitialBalanceChanged(uint balance);
event EthReleased(uint ethreleased);
event EthRefunded(address contributor, uint ethrefunded);
event StageChanged(uint8 newStage);
event EthReturnedToOwner(address owner, uint balance);
modifier onlyPermitted() {
require(permissionManager.isPermitted(msg.sender) || msg.sender == owner);
_;
}
modifier onlyObserver() {
require(msg.sender == observer || msg.sender == owner);
_;
}
function Hold(address _multisig, uint cap, address pm, address registryAddress, address observerAddr) public {
percentage = 100 / stages;
currentStage = 0;
multisig = _multisig;
initialBalance = cap;
dateDeployed = now;
permissionManager = PermissionManager(pm);
registry = Registry(registryAddress);
observer = observerAddr;
}
function setPermissionManager(address _permadr) public onlyOwner {
require(_permadr != 0x0);
permissionManager = PermissionManager(_permadr);
}
function setObserver(address observerAddr) public onlyOwner {
require(observerAddr != 0x0);
observer = observerAddr;
}
function setInitialBalance(uint inBal) public {
initialBalance = inBal;
InitialBalanceChanged(inBal);
}
function releaseAllETH() onlyPermitted public {
uint balReleased = getBalanceReleased();
require(balReleased > 0);
require(this.balance >= balReleased);
multisig.transfer(balReleased);
withdrawed += balReleased;
EthReleased(balReleased);
}
function releaseETH(uint n) onlyPermitted public {
require(this.balance >= n);
require(getBalanceReleased() >= n);
multisig.transfer(n);
withdrawed += n;
EthReleased(n);
}
function getBalance() public view returns (uint) {
return this.balance;
}
function changeStageAndReleaseETH() public onlyObserver {
uint8 newStage = currentStage + 1;
require(newStage <= stages);
currentStage = newStage;
StageChanged(newStage);
releaseAllETH();
}
function changeStage() public onlyObserver {
uint8 newStage = currentStage + 1;
require(newStage <= stages);
currentStage = newStage;
StageChanged(newStage);
}
function getBalanceReleased() public view returns (uint) {
return initialBalance * percentage * currentStage / 100 - withdrawed ;
}
function returnETHByOwner() public onlyOwner {
require(now > dateDeployed + 183 days);
uint balance = getBalance();
owner.transfer(getBalance());
EthReturnedToOwner(owner, balance);
}
function refund(uint _numberOfReturns) public onlyOwner {
require(_numberOfReturns > 0);
address currentParticipantAddress;
for (uint cnt = 0; cnt < _numberOfReturns; cnt++) {
currentParticipantAddress = registry.getContributorByIndex(nextContributorToTransferEth);
if (currentParticipantAddress == 0x0)
return;
if (!hasWithdrawedEth[currentParticipantAddress]) {
uint EthAmount = registry.getContributionETH(currentParticipantAddress);
EthAmount -= EthAmount * (percentage / 100 * currentStage);
currentParticipantAddress.transfer(EthAmount);
EthRefunded(currentParticipantAddress, EthAmount);
hasWithdrawedEth[currentParticipantAddress] = true;
}
nextContributorToTransferEth += 1;
}
}
function() public payable {
}
function getWithdrawed(address contrib) public onlyPermitted view returns (bool) {
return hasWithdrawedEth[contrib];
}
} | 0x6060604052600436106101025763ffffffff60e060020a60003504166245626f811461010457806312065fe01461011757806314f796ca1461013c57806318369a2a1461014f578063244f489414610162578063278ecde114610195578063465105f0146101ab5780634783c35b146101be57806349e4b3e5146101ed5780635bf5d54c1461020c5780638da5cb5b1461023557806394d9c9c7146102485780639a79712814610267578063c06702dd1461027a578063c78ad77f1461028d578063c7f8fe65146102a0578063cc7a2049146102b3578063eb70e498146102c6578063f2fde38b146102d9578063f5710cc5146102f8578063f9a075dc1461030e575b005b341561010f57600080fd5b610102610324565b341561012257600080fd5b61012a6103ed565b60405190815260200160405180910390f35b341561014757600080fd5b6101026103fb565b341561015a57600080fd5b61012a6104dd565b341561016d57600080fd5b610181600160a060020a03600435166104e3565b604051901515815260200160405180910390f35b34156101a057600080fd5b61010260043561059c565b34156101b657600080fd5b6101026107e4565b34156101c957600080fd5b6101d161091e565b604051600160a060020a03909116815260200160405180910390f35b34156101f857600080fd5b610102600160a060020a036004351661092d565b341561021757600080fd5b61021f61098c565b60405160ff909116815260200160405180910390f35b341561024057600080fd5b6101d161099c565b341561025357600080fd5b610102600160a060020a03600435166109ab565b341561027257600080fd5b61012a610a0a565b341561028557600080fd5b610102610a10565b341561029857600080fd5b61021f610aea565b34156102ab57600080fd5b61012a610b0c565b34156102be57600080fd5b6101d1610b4a565b34156102d157600080fd5b6101d1610b59565b34156102e457600080fd5b610102600160a060020a0360043516610b68565b341561030357600080fd5b610102600435610c03565b341561031957600080fd5b610102600435610c3e565b6000805433600160a060020a0390811691161461034057600080fd5b60085462f1428001421161035357600080fd5b61035b6103ed565b600054909150600160a060020a03166108fc6103756103ed565b9081150290604051600060405180830381858888f19350505050151561039a57600080fd5b6000547fb0713fd859084b92ed26a9ae29b593554272da77e2b0019f9e8a714e5696ada290600160a060020a031682604051600160a060020a03909216825260208201526040908101905180910390a150565b600160a060020a0330163190565b60075460009033600160a060020a0390811691161480610429575060005433600160a060020a039081169116145b151561043457600080fd5b5060005460b060020a810460ff908116600101917401000000000000000000000000000000000000000090048116908216111561047057600080fd5b6000805476ff00000000000000000000000000000000000000000000191660b060020a60ff8416021790557f273467821f33675618854603ef917ebcec8a1a39f95c43d5564ed1aefab870b38160405160ff909116815260200160405180910390a16104da6107e4565b50565b60015481565b600554600090600160a060020a0316633fd8cc4e33836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561053e57600080fd5b6102c65a03f1151561054f57600080fd5b5050506040518051905080610572575060005433600160a060020a039081169116145b151561057d57600080fd5b50600160a060020a031660009081526009602052604090205460ff1690565b600080548190819033600160a060020a039081169116146105bc57600080fd5b600084116105c957600080fd5b600091505b838210156107de57600454600654600160a060020a039091169063085d19739060006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561062d57600080fd5b6102c65a03f1151561063e57600080fd5b5050506040518051935050600160a060020a038316151561065e576107de565b600160a060020a03831660009081526009602052604090205460ff1615156107c857600454600160a060020a0316632785fb988460006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156106d957600080fd5b6102c65a03f115156106ea57600080fd5b505050604051805160005490925060ff60b060020a8204811692506064917501000000000000000000000000000000000000000000900416040260ff1681028103905082600160a060020a03166108fc829081150290604051600060405180830381858888f19350505050151561076057600080fd5b7fffab3269bdaceca4d1bbc53e74b982ac2b306687e17e21f1e499e7fdf6751ac88382604051600160a060020a03909216825260208201526040908101905180910390a1600160a060020a0383166000908152600960205260409020805460ff191660011790555b60068054600190810190915591909101906105ce565b50505050565b600554600090600160a060020a0316633fd8cc4e33836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561083f57600080fd5b6102c65a03f1151561085057600080fd5b5050506040518051905080610873575060005433600160a060020a039081169116145b151561087e57600080fd5b610886610b0c565b90506000811161089557600080fd5b600160a060020a03301631819010156108ad57600080fd5b600354600160a060020a031681156108fc0282604051600060405180830381858888f1935050505015156108e057600080fd5b60028054820190557f6c5a44000b36584e7c69c5f29c728355fd8b870c7123f6b75a32511001af27368160405190815260200160405180910390a150565b600354600160a060020a031681565b60005433600160a060020a0390811691161461094857600080fd5b600160a060020a038116151561095d57600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005460b060020a900460ff1681565b600054600160a060020a031681565b60005433600160a060020a039081169116146109c657600080fd5b600160a060020a03811615156109db57600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60025481565b60075460009033600160a060020a0390811691161480610a3e575060005433600160a060020a039081169116145b1515610a4957600080fd5b5060005460b060020a810460ff9081166001019174010000000000000000000000000000000000000000900481169082161115610a8557600080fd5b6000805476ff00000000000000000000000000000000000000000000191660b060020a60ff8416021790557f273467821f33675618854603ef917ebcec8a1a39f95c43d5564ed1aefab870b38160405160ff909116815260200160405180910390a150565b6000547501000000000000000000000000000000000000000000900460ff1681565b600254600054600154606460b060020a830460ff90811675010000000000000000000000000000000000000000009094041690910291909102040390565b600554600160a060020a031681565b600754600160a060020a031681565b60005433600160a060020a03908116911614610b8357600080fd5b600160a060020a0381161515610b9857600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60018190557f8e43342fbe0fafce18a1b26c3f117f53a29d56dfabfedec55e0faa082612e8848160405190815260200160405180910390a150565b600554600160a060020a0316633fd8cc4e3360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610c9757600080fd5b6102c65a03f11515610ca857600080fd5b5050506040518051905080610ccb575060005433600160a060020a039081169116145b1515610cd657600080fd5b600160a060020a0330163181901015610cee57600080fd5b80610cf7610b0c565b10156108ad57600080fd00a165627a7a723058206ad16dc1d634a4d92589db00657b0b1511c4eaf919c0c64223f2dac658bffa8b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 5 |
0x507ae33c5a059cb22217bad9fb2a9d929908866e | pragma solidity 0.6.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library 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(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a, m);
uint256 d = sub(c, 1);
return mul(div(d,m),m);
}
}
interface IKEK {
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function burn(address account, uint256 amount) external;
}
interface IFARMINGPOOL {
function getTotalStakedAmount() external view returns (uint256);
function getStakedAmount(address account) external view returns (uint256);
function getStakers() external view returns (address[] memory);
}
contract StakingReward is Context {
using SafeMath for uint256;
// Events
event ClaimedReward(address account, uint256 amount);
// states
struct Gains {
uint256 RPEPEBLUPendingGains;
uint256 RPEPELPURPLEPendingGains;
uint256 RPEPEBLUTotalGained;
uint256 RPEPELPURPLETotalGained;
}
address private _RPEPEBLU;
address private _RPEPELPURPLE;
address private _KEK;
uint private _lastTimestamp;
uint private _timeInterval;
uint256 private _rewardBlockAmount;
uint256 private _totalRewardsPerDay;
mapping(address => Gains) private _gains;
constructor(address kek, address rpepeblu, address rpepelpurple, uint timeInterval) public {
_KEK = kek;
_RPEPEBLU = rpepeblu;
_RPEPELPURPLE = rpepelpurple;
// Set the initial last timestamp
_lastTimestamp = block.timestamp;
// Set the initial staking reward block size
_rewardBlockAmount = 260000E18;
// time interval for create reward block and claim reward
// This value will be 1 day
_timeInterval = timeInterval;
}
/**
* @dev API to get reward block size
*/
function getRewardBlockAmount() external view returns (uint256) {
return _rewardBlockAmount;
}
/**
* @dev API to get the staker's pending gains in RPEPEBLU pool
*/
function getPendingGainsInRPEPEBLU(address account) public view returns (uint256) {
return _gains[account].RPEPEBLUPendingGains;
}
/**
* @dev API to get the staker's pending gains in RPEPELPURPLE pool
*/
function getPendingGainsInRPEPELPURPLE(address account) public view returns (uint256) {
return _gains[account].RPEPELPURPLEPendingGains;
}
/**
* @dev API to get the staker's total gained in RPEPEBLU pool
*/
function getTotalGainedInRPEPEBLU(address account) public view returns (uint256) {
return _gains[account].RPEPEBLUTotalGained;
}
/**
* @dev API to get the staker's total gained in RPEPELPURPLE pool
*/
function getTotalGainedInRPEPELPURPLE(address account) public view returns (uint256) {
return _gains[account].RPEPELPURPLETotalGained;
}
/**
* @dev API to get total amount staked in RPEPEBLU and RPEPELPURPLE pools
*/
function getTotalStakedAmountInPools() public view returns (uint256) {
uint256 stakedAmountInPKPool = IFARMINGPOOL(_RPEPEBLU).getTotalStakedAmount();
uint256 stakedAmountInLPPool = IFARMINGPOOL(_RPEPELPURPLE).getTotalStakedAmount();
return stakedAmountInPKPool.add(stakedAmountInLPPool);
}
/**
* @dev API to get current daily staking rate of RPEPEBLU pool.
*
* Algorithm
* - rate = (block size / 2) / amount of rPEPE in RPEPEBLU and RPEPELPURPLE pools.
* - if block size = 260,000KEK (phase 1)
* then maximum rate=0.05KEK, minimum rate=0.005KEK
* - if block size = 130,000KEK (phase 2)
* then maximum rate=0.025KEK, minimum rate=0.0025KEK
* - if block size = 65,000KEK (phase 3)
* then maximum rate=0.0125KEK, minimum rate=0.00125KEK
* - if block size = 32,500KEK (phase 4)
* then maximum rate=0.00625KEK, minimum rate=0.000625KEK
*/
function getStakingRateInRPEPEBLU() public view returns (uint256) {
uint256 maxRate = _getMaximunRate();
uint256 minRate = _getMinimunRate();
uint256 totalStakedAmount = getTotalStakedAmountInPools();
uint256 rate = 0;
if (totalStakedAmount > 0) {
rate = _rewardBlockAmount.mul(1E18).div(totalStakedAmount);
if (rate < minRate) {
rate = minRate;
} else if (rate > maxRate) {
rate = maxRate;
}
}
return rate;
}
/**
* @dev API to get current daily staking rate of RPEPELPURPLE pool.
*
* Algorithm
* - rate = block size / amount of rPEPE in RPEPEBLU and RPEPELPURPLE pools
* - if block size = 260,000KEK (phase 1)
* then maximum rate=0.1KEK, minimum rate=0.01KEK
* - if block size = 130,000KEK (phase 2)
* then maximum rate=0.05KEK, minimum rate=0.005KEK
* - if block size = 65,000KEK (phase 3)
* then maximum rate=0.025KEK, minimum rate=0.0025KEK
* - if block size = 32,500KEK (phase 4)
* then maximum rate=0.0125KEK, minimum rate=0.00125KEK
*/
function getStakingRateInRPEPELPURPLE() public view returns (uint256) {
uint256 maxRate = _getMaximunRate().mul(2);
uint256 minRate = _getMinimunRate().mul(2);
uint256 totalStakedAmount = getTotalStakedAmountInPools();
uint256 rate = 0;
if (totalStakedAmount > 0) {
rate = _rewardBlockAmount.mul(1E18).div(totalStakedAmount);
if (rate < minRate) {
rate = minRate;
} else if (rate > maxRate) {
rate = maxRate;
}
}
return rate;
}
/**
* @dev API to harvest staker's reward from RPEPEBLU.
*/
function harvestFromRPEPEBLU() external {
uint256 pendingGains = getPendingGainsInRPEPEBLU(_msgSender());
// send tokens to the staker's account
require(IKEK(_KEK).transfer(_msgSender(), pendingGains));
_gains[_msgSender()].RPEPEBLUPendingGains = 0;
_gains[_msgSender()].RPEPEBLUTotalGained = _gains[_msgSender()].RPEPEBLUTotalGained.add(pendingGains);
emit ClaimedReward(_msgSender(), pendingGains);
}
/**
* @dev API to harvest staker's reward from RPEPELPURPLE.
*/
function harvestFromRPEPELPURPLE() external {
uint256 pendingGains = getPendingGainsInRPEPELPURPLE(_msgSender());
// send tokens to the staker's account
require(IKEK(_KEK).transfer(_msgSender(), pendingGains));
_gains[_msgSender()].RPEPELPURPLEPendingGains = 0;
_gains[_msgSender()].RPEPELPURPLETotalGained = _gains[_msgSender()].RPEPELPURPLETotalGained.add(pendingGains);
emit ClaimedReward(_msgSender(), pendingGains);
}
/**
* @dev API to create new staking reward block and claim reward per day.
*/
function createRewardBlockAndClaimRewards() external {
uint count = (block.timestamp - _lastTimestamp) / _timeInterval;
_createRewardBlockAndClaimRewards(count);
// update last timestamp
_lastTimestamp = count * _timeInterval + _lastTimestamp;
}
/**
* @dev Get maximum rate
*/
function _getMaximunRate() internal view returns (uint256) {
uint256 maxRate = 0;
if (_rewardBlockAmount == 260000E18) { // for phase 1
maxRate = 5E16;
} else if (_rewardBlockAmount == 130000E18) { // for phase 2
maxRate = 25E15;
} else if (_rewardBlockAmount == 65000E18) { // for phase 3
maxRate = 125E14;
} else if (_rewardBlockAmount == 32500E18) { // for phase 4
maxRate = 625E13;
}
require(maxRate > 0, "Block size has been undefined");
return maxRate;
}
/**
* @dev Get minimum rate
*/
function _getMinimunRate() internal view returns (uint256) {
uint256 minRate = 0;
if (_rewardBlockAmount == 260000E18) { // for phase 1
minRate = 5E15;
} else if (_rewardBlockAmount == 130000E18) { // for phase 2
minRate = 25E14;
} else if (_rewardBlockAmount == 65000E18) { // for phase 3
minRate = 125E13;
} else if (_rewardBlockAmount == 32500E18) { // for phase 4
minRate = 625E12;
}
require(minRate > 0, "Block size has been undefined");
return minRate;
}
/**
* @dev Create new staking reward block by calculation the remaining in staking reward.
*/
function _createRewardBlockAndClaimRewards(uint count) internal {
for (uint i = 0; i < count; i++) {
_createRewardBlockAndBurn(IKEK(_KEK).balanceOf(address(this)));
_claimRewardsInRPEPEBLU();
_claimRewardsInRPEPELPURPLE();
}
}
/**
* @dev Set the block amount for current staking reward and burn tokens for block amount
*
* Formula:
* - 260,000 KEK (75%-100% remaining in staking reward)
* - 130,000 KEK (50%-75% remaining in staking reward)
* - 65,000 KEK (25%-50% remaining in staking reward)
* - 32,500 KEK (0%-25% remaining in staking reward)
*/
function _createRewardBlockAndBurn(uint256 available) internal {
require(available > 0, "Available KEK amount must be more than zero.");
uint256 percent = available.div(49000000E10).mul(100);
// Initialize total rewards per day
_totalRewardsPerDay = 0;
if (percent > 0 && percent < 25) {
_rewardBlockAmount = 32500E18;
IKEK(_KEK).burn(address(this), 32500E18);
} else if (percent >= 25 && percent < 50) {
_rewardBlockAmount = 65000E18;
IKEK(_KEK).burn(address(this), 65000E18);
} else if (percent >= 50 && percent < 75) {
_rewardBlockAmount = 130000E18;
IKEK(_KEK).burn(address(this), 130000E18);
} else if (percent >= 75 && percent <= 100) {
_rewardBlockAmount = 260000E18;
IKEK(_KEK).burn(address(this), 260000E18);
}
}
/**
* @dev Claim rewards to all stakers in RPEPEBLU daily
*/
function _claimRewardsInRPEPEBLU() internal {
address[] memory stakers = IFARMINGPOOL(_RPEPEBLU).getStakers();
for (uint256 i = 0; i < stakers.length; i++) {
_calcPendingGainsInRPEPEBLU(stakers[i]);
}
}
/**
* @dev Claim rewards to all stakers in RPEPELPURPLE daily
*/
function _claimRewardsInRPEPELPURPLE() internal {
address[] memory stakers = IFARMINGPOOL(_RPEPELPURPLE).getStakers();
for (uint256 i = 0; i < stakers.length; i++) {
_calcPendingGainsInRPEPELPURPLE(stakers[i]);
}
}
/**
* @dev Calcuate staker's pending gains in RPEPEBLU.
*/
function _calcPendingGainsInRPEPEBLU(address account) internal {
require(account != address(0), "Invalid address");
uint256 rewards = (IFARMINGPOOL(_RPEPEBLU).getStakedAmount(account)).mul(getStakingRateInRPEPEBLU()).div(1E18);
if (_totalRewardsPerDay.add(rewards) > _rewardBlockAmount) {
rewards = _rewardBlockAmount.sub(_totalRewardsPerDay);
}
_gains[account].RPEPEBLUPendingGains = _gains[account].RPEPEBLUPendingGains.add(rewards);
_totalRewardsPerDay = _totalRewardsPerDay.add(rewards);
}
/**
* @dev Calcuate staker's pending gains in RPEPELPURPLE.
*/
function _calcPendingGainsInRPEPELPURPLE(address account) internal {
require(account != address(0), "Invalid address");
uint256 rewards = (IFARMINGPOOL(_RPEPELPURPLE).getStakedAmount(account)).mul(getStakingRateInRPEPELPURPLE()).div(1E18);
if (_totalRewardsPerDay.add(rewards) > _rewardBlockAmount) {
rewards = _rewardBlockAmount.sub(_totalRewardsPerDay);
}
_gains[account].RPEPELPURPLEPendingGains = _gains[account].RPEPELPURPLEPendingGains.add(rewards);
_totalRewardsPerDay = _totalRewardsPerDay.add(rewards);
}
}
| 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063b6301ba411610071578063b6301ba414610156578063c430074b146101ae578063da861c78146101cc578063e7b64fe314610224578063e7d5062f14610242578063fe8787dd1461024c576100a9565b8063072e6de4146100ae5780632cc54d6f146101065780633a4c15311461012457806368ac9d031461012e57806388d691d214610138575b600080fd5b6100f0600480360360208110156100c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102a4565b6040518082815260200191505060405180910390f35b61010e6102f0565b6040518082815260200191505060405180910390f35b61012c61037c565b005b6101366105f1565b005b610140610620565b6040518082815260200191505060405180910390f35b6101986004803603602081101561016c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610788565b6040518082815260200191505060405180910390f35b6101b66107d4565b6040518082815260200191505060405180910390f35b61020e600480360360208110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107de565b6040518082815260200191505060405180910390f35b61022c61082a565b6040518082815260200191505060405180910390f35b61024a6108dc565b005b61028e6004803603602081101561026257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b51565b6040518082815260200191505060405180910390f35b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6000806102fb610b9d565b90506000610307610cac565b90506000610313610620565b9050600080905060008211156103725761035282610344670de0b6b3a7640000600554610dbb90919063ffffffff16565b610e4190919063ffffffff16565b90508281101561036457829050610371565b83811115610370578390505b5b5b8094505050505090565b600061038e610389610e8b565b610b51565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6103d6610e8b565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561044057600080fd5b505af1158015610454573d6000803e3d6000fd5b505050506040513d602081101561046a57600080fd5b810190808051906020019092919050505061048457600080fd5b600060076000610492610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555061052f81600760006104e3610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154610e9390919063ffffffff16565b6007600061053b610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055507fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba36105a5610e8b565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b600060045460035442038161060257fe5b04905061060e81610f1b565b60035460045482020160038190555050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338adb6f06040518163ffffffff1660e01b815260040160206040518083038186803b15801561068a57600080fd5b505afa15801561069e573d6000803e3d6000fd5b505050506040513d60208110156106b457600080fd5b810190808051906020019092919050505090506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338adb6f06040518163ffffffff1660e01b815260040160206040518083038186803b15801561073157600080fd5b505afa158015610745573d6000803e3d6000fd5b505050506040513d602081101561075b57600080fd5b810190808051906020019092919050505090506107818183610e9390919063ffffffff16565b9250505090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b6000600554905090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b600080610848600261083a610b9d565b610dbb90919063ffffffff16565b905060006108676002610859610cac565b610dbb90919063ffffffff16565b90506000610873610620565b9050600080905060008211156108d2576108b2826108a4670de0b6b3a7640000600554610dbb90919063ffffffff16565b610e4190919063ffffffff16565b9050828110156108c4578290506108d1565b838111156108d0578390505b5b5b8094505050505090565b60006108ee6108e9610e8b565b6102a4565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb610936610e8b565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156109a057600080fd5b505af11580156109b4573d6000803e3d6000fd5b505050506040513d60208110156109ca57600080fd5b81019080805190602001909291905050506109e457600080fd5b6000600760006109f2610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550610a8f8160076000610a43610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610e9390919063ffffffff16565b60076000610a9b610e8b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055507fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba3610b05610e8b565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b6000806000905069370ea0d47cf61a8000006005541415610bc75766b1a2bc2ec500009050610c2f565b691b87506a3e7b0d4000006005541415610bea576658d15e176280009050610c2e565b690dc3a8351f3d86a000006005541415610c0d57662c68af0bb140009050610c2d565b6906e1d41a8f9ec35000006005541415610c2c576616345785d8a00090505b5b5b5b60008111610ca5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f426c6f636b2073697a6520686173206265656e20756e646566696e656400000081525060200191505060405180910390fd5b8091505090565b6000806000905069370ea0d47cf61a8000006005541415610cd6576611c37937e080009050610d3e565b691b87506a3e7b0d4000006005541415610cf9576608e1bc9bf040009050610d3d565b690dc3a8351f3d86a000006005541415610d1c57660470de4df820009050610d3c565b6906e1d41a8f9ec35000006005541415610d3b576602386f26fc100090505b5b5b5b60008111610db4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f426c6f636b2073697a6520686173206265656e20756e646566696e656400000081525060200191505060405180910390fd5b8091505090565b600080831415610dce5760009050610e3b565b6000828402905082848281610ddf57fe5b0414610e36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611eb36021913960400191505060405180910390fd5b809150505b92915050565b6000610e8383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061102c565b905092915050565b600033905090565b600080828401905083811015610f11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008090505b818110156110285761100b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610fcb57600080fd5b505afa158015610fdf573d6000803e3d6000fd5b505050506040513d6020811015610ff557600080fd5b81019080805190602001909291905050506110f2565b611013611564565b61101b6116e0565b8080600101915050610f21565b5050565b600080831182906110d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561109d578082015181840152602081019050611082565b50505050905090810190601f1680156110ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816110e457fe5b049050809150509392505050565b6000811161114b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180611ed4602c913960400191505060405180910390fd5b600061117b606461116d6706ccd46763f1000085610e4190919063ffffffff16565b610dbb90919063ffffffff16565b905060006006819055506000811180156111955750601981105b1561127b576906e1d41a8f9ec3500000600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac306906e1d41a8f9ec35000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561125e57600080fd5b505af1158015611272573d6000803e3d6000fd5b50505050611560565b6019811015801561128c5750603281105b1561137257690dc3a8351f3d86a00000600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac30690dc3a8351f3d86a000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561135557600080fd5b505af1158015611369573d6000803e3d6000fd5b5050505061155f565b603281101580156113835750604b81105b1561146957691b87506a3e7b0d400000600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac30691b87506a3e7b0d4000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561144c57600080fd5b505af1158015611460573d6000803e3d6000fd5b5050505061155e565b604b811015801561147b575060648111155b1561155d5769370ea0d47cf61a800000600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac3069370ea0d47cf61a8000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561154457600080fd5b505af1158015611558573d6000803e3d6000fd5b505050505b5b5b5b5050565b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166343352d616040518163ffffffff1660e01b815260040160006040518083038186803b1580156115cd57600080fd5b505afa1580156115e1573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561160b57600080fd5b810190808051604051939291908464010000000082111561162b57600080fd5b8382019150602082018581111561164157600080fd5b825186602082028301116401000000008211171561165e57600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561169557808201518184015260208101905061167a565b50505050905001604052505050905060008090505b81518110156116dc576116cf8282815181106116c257fe5b602002602001015161185d565b80806001019150506116aa565b5050565b6060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166343352d616040518163ffffffff1660e01b815260040160006040518083038186803b15801561174a57600080fd5b505afa15801561175e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561178857600080fd5b81019080805160405193929190846401000000008211156117a857600080fd5b838201915060208201858111156117be57600080fd5b82518660208202830111640100000000821117156117db57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156118125780820151818401526020810190506117f7565b50505050905001604052505050905060008090505b81518110156118595761184c82828151811061183f57fe5b6020026020010151611b02565b8080600101915050611827565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611900576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b6000611a0e670de0b6b3a7640000611a006119196102f0565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634da6a556876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156119b757600080fd5b505afa1580156119cb573d6000803e3d6000fd5b505050506040513d60208110156119e157600080fd5b8101908080519060200190929190505050610dbb90919063ffffffff16565b610e4190919063ffffffff16565b9050600554611a2882600654610e9390919063ffffffff16565b1115611a4857611a45600654600554611da890919063ffffffff16565b90505b611a9d81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610e9390919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611af881600654610e9390919063ffffffff16565b6006819055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611ba5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b6000611cb4670de0b6b3a7640000611ca6611bbe61082a565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634da6a556876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611c5d57600080fd5b505afa158015611c71573d6000803e3d6000fd5b505050506040513d6020811015611c8757600080fd5b8101908080519060200190929190505050610dbb90919063ffffffff16565b610e4190919063ffffffff16565b9050600554611cce82600654610e9390919063ffffffff16565b1115611cee57611ceb600654600554611da890919063ffffffff16565b90505b611d4381600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154610e9390919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550611d9e81600654610e9390919063ffffffff16565b6006819055505050565b6000611dea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611df2565b905092915050565b6000838311158290611e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e64578082015181840152602081019050611e49565b50505050905090810190601f168015611e915780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77417661696c61626c65204b454b20616d6f756e74206d757374206265206d6f7265207468616e207a65726f2ea2646970667358221220d0c8ed8ebc174094fe7fb10d3be2768f12166370a0374578c542e600f71c221264736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 6 |
0x03380c491c5051edc4e1a89352c28aa383dee7f0 | "/**\n *Submitted for verification at Etherscan.io on 2022-03-13\n*/\n\n// SPDX-License-Identifier: (...TRUNCATED) | "0x6080604052600436106102295760003560e01c806374010ece1161012357806398a5c315116100ab578063dd62ed3e116(...TRUNCATED) | "{\"success\": true, \"error\": null, \"results\": {\"detectors\": [{\"check\": \"reentrancy-eth\", (...TRUNCATED) | 7 |
0x2df514a060bbd105ea428182e8b140454f426d15 | "pragma solidity ^0.4.24;\n\ncontract IERC20Token {\n // these functions aren't abstract sinc(...TRUNCATED) | "0x60806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006(...TRUNCATED) | "{\"success\": true, \"error\": null, \"results\": {\"detectors\": [{\"check\": \"unchecked-transfer(...TRUNCATED) | 8 |
0x1e232f3074e6b9eadf18aad92844eee2b4b33744 | "/**\n *Submitted for verification at Etherscan.io on 2020-11-21\n*/\n\n// SPDX-License-Identifier: (...TRUNCATED) | "0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426b(...TRUNCATED) | "{\"success\": true, \"error\": null, \"results\": {\"detectors\": [{\"check\": \"divide-before-mult(...TRUNCATED) | 9 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 37