编译器
0.5.16+commit.9c3226ce
文件 1 的 6:Context.sol
pragma solidity 0.5.16;
contract Context {
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this;
return msg.data;
}
}
文件 2 的 6:EightPayTokenV2.sol
pragma solidity 0.5.16;
import { IERC20 } from "./IERC20.sol";
import { Context } from "./Context.sol";
import { SafeMath } from "./SafeMath.sol";
import { Ownable } from "./Ownable.sol";
import { LGEWhitelisted } from "./LGEWhitelisted.sol";
contract EightPayTokenV2 is Context, IERC20, Ownable, LGEWhitelisted {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
constructor() public {
_name = "8PAY Network v2";
_symbol = "8PAY v2";
_decimals = 18;
_totalSupply = 88888888 * 10 ** 18;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function getOwner() external view returns (address) {
return owner();
}
function decimals() external view returns (uint8) {
return _decimals;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function name() external view returns (string memory) {
return _name;
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_applyLGEWhitelist(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
文件 3 的 6:IERC20.sol
pragma solidity 0.5.16;
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);
}
文件 4 的 6:LGEWhitelisted.sol
pragma solidity 0.5.16;
import { Context } from "./Context.sol";
import { SafeMath } from "./SafeMath.sol";
contract LGEWhitelisted is Context {
using SafeMath for uint256;
struct WhitelistRound {
uint256 duration;
uint256 amountMax;
mapping(address => bool) addresses;
mapping(address => uint256) purchased;
}
WhitelistRound[] public _lgeWhitelistRounds;
uint256 public _lgeTimestamp;
address public _lgePairAddress;
address public _whitelister;
event WhitelisterTransferred(address indexed previousWhitelister, address indexed newWhitelister);
constructor () internal {
_whitelister = _msgSender();
}
modifier onlyWhitelister() {
require(_whitelister == _msgSender(), "Caller is not the whitelister");
_;
}
function renounceWhitelister() external onlyWhitelister {
emit WhitelisterTransferred(_whitelister, address(0));
_whitelister = address(0);
}
function transferWhitelister(address newWhitelister) external onlyWhitelister {
_transferWhitelister(newWhitelister);
}
function _transferWhitelister(address newWhitelister) internal {
require(newWhitelister != address(0), "New whitelister is the zero address");
emit WhitelisterTransferred(_whitelister, newWhitelister);
_whitelister = newWhitelister;
}
function createLGEWhitelist(address pairAddress, uint256[] calldata durations, uint256[] calldata amountsMax) external onlyWhitelister() {
require(durations.length == amountsMax.length, "Invalid whitelist(s)");
_lgePairAddress = pairAddress;
if(durations.length > 0) {
delete _lgeWhitelistRounds;
for (uint256 i = 0; i < durations.length; i++) {
_lgeWhitelistRounds.push(WhitelistRound(durations[i], amountsMax[i]));
}
}
}
function modifyLGEWhitelist(uint256 index, uint256 duration, uint256 amountMax, address[] calldata addresses, bool enabled) external onlyWhitelister() {
require(index < _lgeWhitelistRounds.length, "Invalid index");
require(amountMax > 0, "Invalid amountMax");
if(duration != _lgeWhitelistRounds[index].duration)
_lgeWhitelistRounds[index].duration = duration;
if(amountMax != _lgeWhitelistRounds[index].amountMax)
_lgeWhitelistRounds[index].amountMax = amountMax;
for (uint256 i = 0; i < addresses.length; i++) {
_lgeWhitelistRounds[index].addresses[addresses[i]] = enabled;
}
}
function getLGEWhitelistRound() public view returns (uint256, uint256, uint256, uint256, bool, uint256) {
if(_lgeTimestamp > 0) {
uint256 wlCloseTimestampLast = _lgeTimestamp;
for (uint256 i = 0; i < _lgeWhitelistRounds.length; i++) {
WhitelistRound storage wlRound = _lgeWhitelistRounds[i];
wlCloseTimestampLast = wlCloseTimestampLast.add(wlRound.duration);
if(now <= wlCloseTimestampLast)
return (i.add(1), wlRound.duration, wlCloseTimestampLast, wlRound.amountMax, wlRound.addresses[_msgSender()], wlRound.purchased[_msgSender()]);
}
}
return (0, 0, 0, 0, false, 0);
}
function _applyLGEWhitelist(address sender, address recipient, uint256 amount) internal {
if(_lgePairAddress == address(0) || _lgeWhitelistRounds.length == 0)
return;
if(_lgeTimestamp == 0 && sender != _lgePairAddress && recipient == _lgePairAddress && amount > 0)
_lgeTimestamp = now;
if(sender == _lgePairAddress && recipient != _lgePairAddress) {
(uint256 wlRoundNumber,,,,,) = getLGEWhitelistRound();
if(wlRoundNumber > 0) {
WhitelistRound storage wlRound = _lgeWhitelistRounds[wlRoundNumber.sub(1)];
require(wlRound.addresses[recipient], "LGE - Buyer is not whitelisted");
uint256 amountRemaining = 0;
if(wlRound.purchased[recipient] < wlRound.amountMax)
amountRemaining = wlRound.amountMax.sub(wlRound.purchased[recipient]);
require(amount <= amountRemaining, "LGE - Amount exceeds whitelist maximum");
wlRound.purchased[recipient] = wlRound.purchased[recipient].add(amount);
}
}
}
}
文件 5 的 6:Ownable.sol
pragma solidity 0.5.16;
import { Context } from "./Context.sol";
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() external onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) external onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
文件 6 的 6:SafeMath.sol
pragma solidity 0.5.16;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
{
"compilationTarget": {
"contracts/EightPayTokenV2.sol": "EightPayTokenV2"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 5000
},
"remappings": []
}
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousWhitelister","type":"address"},{"indexed":true,"internalType":"address","name":"newWhitelister","type":"address"}],"name":"WhitelisterTransferred","type":"event"},{"constant":true,"inputs":[],"name":"_lgePairAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_lgeTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_lgeWhitelistRounds","outputs":[{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"amountMax","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_whitelister","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"pairAddress","type":"address"},{"internalType":"uint256[]","name":"durations","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsMax","type":"uint256[]"}],"name":"createLGEWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getLGEWhitelistRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"amountMax","type":"uint256"},{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"modifyLGEWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceWhitelister","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newWhitelister","type":"address"}],"name":"transferWhitelister","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]