{
address: "0x0c3b429fa6cd44a96fcea3cc3fc085d1ddee8158",
balance: {
type: "BigNumber",
hex: "0x00"
string: "0"
ether: "0.0"
},
"transactions": [],
code: "/*
Name: SaleService
Version: 0.0.3
*/
function IERC20(tokenAddress) {
return address(tokenAddress).getContract();
}
class SaleService {
name = 'Presale Service';
tokenAddress = '0x0000000000000000000000000000000000000000';
maxSupply = number('0');
presaleDateStart = number(0);
presaleDateStop = number(0);
presalePrice = number(0);
presaleMaxSupply = number(0);
presaleWhilteListMerkleRoot = number('0');
publicPrice = number('0');
Initialize(tokenAddress, maxSupply, presaleDateStart, presaleDateStop, presalePrice, presaleMaxSupply, presaleWhilteListMerkleRoot, publicPrice) {} // event
BuyPresale(sender, value, amountOut) {} // event
Buy(sender, value, amountOut) {} // event
WithdrawSales(sender, amount) {} // event
initialize(tokenAddress, maxSupply, presaleDateStart, presaleDateStop, presalePrice, presaleMaxSupply, presaleWhilteListMerkleRoot, publicPrice) {
require(! maxSupply.lt(presaleMaxSupply)," INVALID_SUPPLY");
this.tokenAddress = tokenAddress;
this.maxSupply = maxSupply;
this.presaleDateStart = presaleDateStart;
this.presaleDateStop = presaleDateStop;
this.presalePrice = presalePrice;
this.presaleMaxSupply = presaleMaxSupply;
this.presaleWhilteListMerkleRoot = presaleWhilteListMerkleRoot;
this.publicPrice = publicPrice;
emit('Initialize', [tokenAddress, maxSupply, presaleDateStart, presaleDateStop, presalePrice, presaleMaxSupply, presaleWhilteListMerkleRoot, publicPrice]);
}
buyPresale() {
require(this.tokenAddress != '', "NOT_INITIALIZED");
require(! block.timestamp.lt(this.presaleDateStart), "PRESALE_NOT_STARTED");
require(! block.timestamp.gt(this.presaleDateStop), "PRESALE_FINISHED");
const [amountOut,] = this._getAmountOut(msg.value, this.presalePrice);
require(amountOut.gt(0), "INVALID_AMOUNT_OUT");
const totalSupply = tokenOut.totalSupply;
require(! totalSupply.add(amountOut).gt(this.presaleMaxSupply), 'PRESALE_SUPPLY_EXCEEDED');
require(! totalSupply.add(amountOut).gt(this.maxSupply), 'TOTAL_SUPPLY_EXCEEDED');
this.presaleMaxSupply = this.presaleMaxSupply.add(amountOut);
IERC20(this.tokenAddress).mint(msg.sender, amountOut);
emit('BuyPresale', [msg.sender, msg.value, amountOut]);
}
buy() {
require(this.tokenAddress != '', "NOT_INITIALIZED");
require(block.timestamp.gt(this.presaleDateStop), "PRESALE_NOT_FINISHED");
const [amountOut,] = this._getAmountOut(msg.value, this.publicPrice);
require(amountOut.gt(0), "INVALID_AMOUNT_OUT");
const totalSupply = tokenOut.totalSupply;
require(! totalSupply.add(amountOut).gt(this.maxSupply), 'TOTAL_SUPPLY_EXCEEDED');
IERC20(this.tokenAddress).mint(msg.sender, amountOut);
emit('Buy', [msg.sender, msg.value, amountOut]);
}
_getAmountOut(amountIn, price) {
const tokenOut = IERC20(this.tokenAddress);
const decimalsOut = tokenOut.decimals;
const amountOut = amountIn.div(price).mul(10 ** decimalsOut);
return [amountOut];
}
withdrawSales(amount) {
require(msg.sender == this.owner, 'ONLY_OWNER');
require(! amount.gt(address(this).balance));
address(this).transfer(msg.sender, amount);
emit('WithdrawSales', [msg.sender, amount]);
}
}
// Events
SaleService.prototype.Initialize.event = true;
SaleService.prototype.Initialize.inputs = ['address indexed', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'uint256'];
SaleService.prototype.BuyPresale.event = true;
SaleService.prototype.BuyPresale.inputs = ['address indexed', 'uint256', 'uint256']
SaleService.prototype.Buy.event = true;
SaleService.prototype.Buy.inputs = ['address indexed', 'uint256', 'uint256']
SaleService.prototype.WithdrawSales.event = true;
SaleService.prototype.WithdrawSales.inputs = ['address indexed', 'uint256']
// Methods
SaleService.prototype.initialize.inputs = ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'uint256'];
SaleService.prototype.buyPresale.payable = true;
SaleService.prototype.withdrawSales.inputs = ['uint256'];
return SaleService;
",
codeHash: "0xcaecd86c68df5f226652551a59315ea58ec7dd73f41ff92877654483799c10b9",
codeAbi: {
0x06fdde03: {
constant: true,
"inputs": [],
name: "name",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x9d76ea58: {
constant: true,
"inputs": [],
name: "tokenAddress",
outputs: [
{
name: "",
type: "address"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xd5abeb01: {
constant: true,
"inputs": [],
name: "maxSupply",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x48e37220: {
constant: true,
"inputs": [],
name: "presaleDateStart",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x3c9ba63c: {
constant: true,
"inputs": [],
name: "presaleDateStop",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x000e7fa8: {
constant: true,
"inputs": [],
name: "presalePrice",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x08fc299b: {
constant: true,
"inputs": [],
name: "presaleMaxSupply",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xac716ec9: {
constant: true,
"inputs": [],
name: "presaleWhilteListMerkleRoot",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xa945bf80: {
constant: true,
"inputs": [],
name: "publicPrice",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0xa8ac9b50: {
constant: true,
"inputs": [],
name: "prototype",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
0x6b67af55: {
inputs: [
{
name: "tokenAddress",
type: "address",
indexed: true
},
{
name: "maxSupply",
type: "uint256",
indexed: false
},
{
name: "presaleDateStart",
type: "uint256",
indexed: false
},
{
name: "presaleDateStop",
type: "uint256",
indexed: false
},
{
name: "presalePrice",
type: "uint256",
indexed: false
},
{
name: "presaleMaxSupply",
type: "uint256",
indexed: false
},
{
name: "presaleWhilteListMerkleRoot",
type: "address",
indexed: false
},
{
name: "publicPrice",
type: "uint256",
indexed: false
}
],
name: "Initialize",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x6cbd15ae: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "value",
type: "uint256",
indexed: false
},
{
name: "amountOut",
type: "uint256",
indexed: false
}
],
name: "BuyPresale",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x1cbc5ab1: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "value",
type: "uint256",
indexed: false
},
{
name: "amountOut",
type: "uint256",
indexed: false
}
],
name: "Buy",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0x60e3475a: {
inputs: [
{
name: "sender",
type: "address",
indexed: true
},
{
name: "amount",
type: "uint256",
indexed: false
}
],
name: "WithdrawSales",
"outputs": [],
stateMutability: "nonpayable",
type: "event"
},
0xac9b697d: {
inputs: [
{
name: "tokenAddress",
type: "address"
},
{
name: "maxSupply",
type: "uint256"
},
{
name: "presaleDateStart",
type: "uint256"
},
{
name: "presaleDateStop",
type: "uint256"
},
{
name: "presalePrice",
type: "uint256"
},
{
name: "presaleMaxSupply",
type: "uint256"
},
{
name: "presaleWhilteListMerkleRoot",
type: "address"
},
{
name: "publicPrice",
type: "uint256"
}
],
name: "initialize",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0x9fcdec61: {
"inputs": [],
name: "buyPresale",
"outputs": [],
stateMutability: "payable",
type: "function"
},
0xa6f2ae3a: {
"inputs": [],
name: "buy",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
},
0x93744494: {
inputs: [
{
name: "amount",
type: "uint256"
}
],
name: "withdrawSales",
"outputs": [],
stateMutability: "nonpayable",
type: "function"
}
},
contractName: "SaleService",
storage: {
prototype: {
address: "0x0c3b429fa6cd44a96fcea3cc3fc085d1ddee8158"
},
name: "Presale Service",
tokenAddress: "0x76c2315B2E96876d0D3Db8f036F74fEe3b581785",
maxSupply: {
type: "BigNumber",
hex: "0x152d02c7e14af6800000"
string: "100000000000000000000000"
ether: "100000.0"
},
presaleDateStart: {
type: "BigNumber",
hex: "0x0180897a8ddc"
string: "1651573951964"
ether: "0.000001651573951964"
},
presaleDateStop: {
type: "BigNumber",
hex: "0x018089e8ee8a"
string: "1651581185674"
ether: "0.000001651581185674"
},
presalePrice: {
type: "BigNumber",
hex: "0x0429d069189e0000"
string: "300000000000000000"
ether: "0.3"
},
presaleMaxSupply: {
type: "BigNumber",
hex: "0x032d26d12e980b600000"
string: "15000000000000000000000"
ether: "15000.0"
},
presaleWhilteListMerkleRoot: "0x0000000000000000000000000000000000000000",
publicPrice: {
type: "BigNumber",
hex: "0x0de0b6b3a7640000"
string: "1000000000000000000"
ether: "1.0"
}
},
storageHash: "0xe285f48642c31762dbad92dd5ce76aed1d803ef044e171980e6016fd44966108",
savedOnBlockNumber: {
type: "BigNumber",
hex: "0x11"
string: "17"
ether: "0.000000000000000017"
}
}