Transaction Hash:
Block:
5852032 at Jun-25-2018 01:38:15 PM +UTC
Transaction Fee:
0.00132705 ETH
$2.72
Gas Used:
44,235 Gas / 30 Gwei
Account State Difference:
| Address | Before | After | State Difference | ||
|---|---|---|---|---|---|
| 0x386882cE...3Bfe4C85A |
0.573029144353356325 Eth
Nonce: 30
|
0.321702094353356325 Eth
Nonce: 31
| 0.25132705 | ||
|
0x829BD824...93333A830
Miner
| (F2Pool Old) | 4,496.007995757416777636 Eth | 4,496.009322807416777636 Eth | 0.00132705 | |
| 0xB3353265...424d1F2CF | 4,843.39275542477 Eth | 4,843.64275542477 Eth | 0.25 | ||
| 0xcd85f4fD...7e5041A32 |
Execution Trace
File 1 of 2: ESSENTIA_PE
File 2 of 2: ESSENTIA
pragma solidity ^0.4.24;
/*
Copyright 2018, Angelo A. M. & Vicent Nos & Mireia Puig
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
////////////////////////////////////////////////////////
//: ://
//: ESSENTIA Public Engagement ://
//: https://essentia.one ://
//:..................................................://
////////////////////////////////////////////////////////
contract TokenCHK {
function balanceOf(address _owner) public pure returns (uint256 balance) {}
}
contract ESSENTIA_PE is Ownable {
using SafeMath for uint256;
string public name = "ESSENTIA Public Engagement"; // Extended name of this contract
uint256 public tokenPrice = 0; // Set the fixed ESS token price
uint256 public maxCap = 0; // Set the target maximum cap in ETH
address public FWDaddrETH; // Set the address to forward the received ETH to
address public ESSgenesis; // Set the ESSENTIA Genesis contract address
uint256 public totalSold; // Keep track of the contributions total
uint256 public decimals = 18; // The decimals to consider
mapping (address => uint256) public sold; // Map the ESS token allcations
uint256 public pubEnd = 0; // Set the unixtime END for the public engagement
address contractAddr=this; // Better way to point to this from this
// Constant to simplify the conversion of token amounts into integer form
uint256 public tokenUnit = uint256(10)**decimals;
//
// "toETHaddr" is the address to which the ETH contributions are forwarded to, aka FWDaddrETH
// "addrESSgenesis" is the address of the Essentia ERC20 token contract, aka ESSgenesis
//
// NOTE: this contract will sell only its token balance on the ERC20 specified in addrESSgenesis
// the maxCap in ETH and the tokenPrice will indirectly set the ESS token amount on sale
//
// NOTE: this contract should have sufficient ESS token balance to be > maxCap / tokenPrice
//
// NOTE: this contract will stop REGARDLESS of the above (maxCap) when its token balance is all sold
//
// The Owner of this contract can set: Price, End, MaxCap, ESS Genesis and ETH Forward address
//
// The received ETH are directly forwarded to the external FWDaddrETH address
// The ESS tokens are transferred to the contributing addresses once withdrawPUB is executed
//
constructor
(
address toETHaddr,
address addrESSgenesis
) public {
FWDaddrETH = toETHaddr;
ESSgenesis = addrESSgenesis;
}
function () public payable {
buy(); // Allow to buy tokens sending ETH directly to the contract, fallback
}
function setFWDaddrETH(address _value) public onlyOwner{
FWDaddrETH=_value; // Set the forward address default toETHaddr
}
function setGenesis(address _value) public onlyOwner{
ESSgenesis=_value; // Set the ESS erc20 genesis contract address default ESSgenesis
}
function setMaxCap(uint256 _value) public onlyOwner{
maxCap=_value; // Set the max cap in ETH default 0
}
function setPrice(uint256 _value) public onlyOwner{
tokenPrice=_value; // Set the token price default 0
}
function setPubEnd(uint256 _value) public onlyOwner{
pubEnd=_value; // Set the END of the public engagement unixtime default 0
}
function buy() public payable {
require(block.timestamp < pubEnd); // Require the current unixtime to be lower than the END unixtime
require(msg.value > 0); // Require the sender to send an ETH tx higher than 0
require(msg.value <= msg.sender.balance); // Require the sender to have sufficient ETH balance for the tx
// Requiring this to avoid going out of tokens, aka we are getting just true/false from the transfer call
require(msg.value + totalSold <= maxCap);
// Calculate the amount of tokens per contribution
uint256 tokenAmount = (msg.value * tokenUnit) / tokenPrice;
// Requiring sufficient token balance on this contract to accept the tx
require(tokenAmount<=TokenCHK(ESSgenesis).balanceOf(contractAddr));
transferBuy(msg.sender, tokenAmount); // Instruct the accounting function
totalSold = totalSold.add(msg.value); // Account for the total contributed/sold
FWDaddrETH.transfer(msg.value); // Forward the ETH received to the external address
}
function withdrawPUB() public returns(bool){
require(block.timestamp > pubEnd); // Require the PE to be over - actual time higher than end unixtime
require(sold[msg.sender] > 0); // Require the ESS token balance to be sent to be higher than 0
// Send ESS tokens to the contributors proportionally to their contribution/s
if(!ESSgenesis.call(bytes4(keccak256("transfer(address,uint256)")), msg.sender, sold[msg.sender])){revert();}
delete sold[msg.sender];
return true;
}
function transferBuy(address _to, uint256 _value) internal returns (bool) {
require(_to != address(0)); // Require the destination address being non-zero
sold[_to]=sold[_to].add(_value); // Account for multiple txs from the same address
return true;
}
//
// Probably the sky would fall down first but, in case skynet feels funny..
// ..we try to make sure anyway that no ETH would get stuck in this contract
//
function EMGwithdraw(uint256 weiValue) external onlyOwner {
require(block.timestamp > pubEnd); // Require the public engagement to be over
require(weiValue > 0); // Require a non-zero value
FWDaddrETH.transfer(weiValue); // Transfer to the external ETH forward address
}
}File 2 of 2: ESSENTIA
pragma solidity ^0.4.24;
/*
Copyright 2018, Angelo A. M. & Vicent Nos & Mireia Puig
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
//////////////////////////////////////////////////////////////
// //
// ESSENTIA erc20 & Genesis //
// https://essentia.one //
// //
//////////////////////////////////////////////////////////////
contract ESSENTIA_ERC20 is Ownable {
using SafeMath for uint256;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) internal allowed;
// Public variables for the ESSENTIA ERC20 ESS token contract
string public constant standard = "ESSENTIA erc20 and Genesis";
uint256 public constant decimals = 18; // hardcoded to be a constant
string public name = "ESSENTIA";
string public symbol = "ESS";
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
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);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/* Approve and then communicate the approved contract in a single tx */
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;
}
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external ;
}
//
// This creates and adds two genesis pools of ESS tokens to the balance of the A and B ETH addresses
// The A/B ESS Genesis pools are 35/65 of the A+B total ESS Token supply. Integer rounded
//
contract ESSENTIA is ESSENTIA_ERC20 {
address public A;
address public B;
constructor (
) public {
A = 0x564a1D21886ADF1F46FF9D867CE8827C5Ec1B388;
B = 0xB33532656433f4Eca3782F6B20298d1424d1F2CF;
balances[A]=balances[A].add(614359681*(uint256(10)**decimals));
balances[B]=balances[B].add(1140953692*(uint256(10)**decimals));
totalSupply=balances[A]+balances[B];
}
}