Transaction Hash:
Block:
3684818 at May-10-2017 08:22:50 PM +UTC
Transaction Fee:
0.00104362 ETH
$5.02
Gas Used:
52,181 Gas / 20 Gwei
Emitted Events:
15 |
HumaniqToken.Transfer( from=[Sender] 0x4fdb16661f829636dd1b538cd732fc268ddb5eb7, to=MyToken, value=580000000000000 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x4fDB1666...68Ddb5eB7 |
0.99509342 Eth
Nonce: 5
|
0.9940498 Eth
Nonce: 6
| 0.00104362 | ||
0x52bc44d5...b7d7bE3b5
Miner
| (Nanopool) | 2,459.21008703378502248 Eth | 2,459.21113065378502248 Eth | 0.00104362 | |
0xcbCC0F03...A7487b908 |
Execution Trace
HumaniqToken.transfer( _to=0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7, _value=580000000000000 ) => ( success=True )
transfer[AbstractToken (ln:46)]
File 1 of 2: HumaniqToken
File 2 of 2: MyToken
pragma solidity ^0.4.6; /** * Math operations with safety checks */ contract SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { assert(b > 0); uint c = a / b; assert(a == b * c + a % b); return c; } function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a); return c; } function assert(bool assertion) internal { if (!assertion) { throw; } } } /// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 /// @title Abstract token contract - Functions to be implemented by token contracts. contract AbstractToken { // This is not an abstract function, because solc won't recognize generated getter functions for public variables as functions function totalSupply() constant returns (uint256 supply) {} function balanceOf(address owner) constant returns (uint256 balance); function transfer(address to, uint256 value) returns (bool success); function transferFrom(address from, address to, uint256 value) returns (bool success); function approve(address spender, uint256 value) returns (bool success); function allowance(address owner, address spender) constant returns (uint256 remaining); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); event Issuance(address indexed to, uint256 value); } contract StandardToken is AbstractToken { /* * Data structures */ mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; /* * Read and write storage functions */ /// @dev Transfers sender's tokens to a given address. Returns success. /// @param _to Address of token receiver. /// @param _value Number of tokens to transfer. function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success. /// @param _from Address from where tokens are withdrawn. /// @param _to Address to where tokens are sent. /// @param _value Number of tokens to transfer. function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } /// @dev Returns number of tokens owned by given address. /// @param _owner Address of token owner. function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /// @dev Sets approved amount of tokens for spender. Returns success. /// @param _spender Address of allowed account. /// @param _value Number of approved tokens. function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /* * Read storage functions */ /// @dev Returns number of allowed tokens for given address. /// @param _owner Address of token owner. /// @param _spender Address of token spender. function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } } /// @title Token contract - Implements Standard Token Interface with HumaniQ features. /// @author Evgeny Yurtaev - <[email protected]> /// @author Alexey Bashlykov - <[email protected]> contract HumaniqToken is StandardToken, SafeMath { /* * External contracts */ address public minter; /* * Token meta data */ string constant public name = "Humaniq"; string constant public symbol = "HMQ"; uint8 constant public decimals = 8; // Address of the founder of Humaniq. address public founder = 0xc890b1f532e674977dfdb791cafaee898dfa9671; // Multisig address of the founders address public multisig = 0xa2c9a7578e2172f32a36c5c0e49d64776f9e7883; // Address where all tokens created during ICO stage initially allocated address constant public allocationAddressICO = 0x1111111111111111111111111111111111111111; // Address where all tokens created during preICO stage initially allocated address constant public allocationAddressPreICO = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // 31 820 314 tokens were minted during preICO uint constant public preICOSupply = mul(31820314, 100000000); // 131 038 286 tokens were minted during ICO uint constant public ICOSupply = mul(131038286, 100000000); // Max number of tokens that can be minted uint public maxTotalSupply; /* * Modifiers */ modifier onlyFounder() { // Only founder is allowed to do this action. if (msg.sender != founder) { throw; } _; } modifier onlyMinter() { // Only minter is allowed to proceed. if (msg.sender != minter) { throw; } _; } /* * Contract functions */ /// @dev Crowdfunding contract issues new tokens for address. Returns success. /// @param _for Address of receiver. /// @param tokenCount Number of tokens to issue. function issueTokens(address _for, uint tokenCount) external payable onlyMinter returns (bool) { if (tokenCount == 0) { return false; } if (add(totalSupply, tokenCount) > maxTotalSupply) { throw; } totalSupply = add(totalSupply, tokenCount); balances[_for] = add(balances[_for], tokenCount); Issuance(_for, tokenCount); return true; } /// @dev Function to change address that is allowed to do emission. /// @param newAddress Address of new emission contract. function changeMinter(address newAddress) public onlyFounder returns (bool) { // Forbid previous emission contract to distribute tokens minted during ICO stage delete allowed[allocationAddressICO][minter]; minter = newAddress; // Allow emission contract to distribute tokens minted during ICO stage allowed[allocationAddressICO][minter] = balanceOf(allocationAddressICO); } /// @dev Function to change founder address. /// @param newAddress Address of new founder. function changeFounder(address newAddress) public onlyFounder returns (bool) { founder = newAddress; } /// @dev Function to change multisig address. /// @param newAddress Address of new multisig. function changeMultisig(address newAddress) public onlyFounder returns (bool) { multisig = newAddress; } /// @dev Contract constructor function sets initial token balances. function HumaniqToken(address founderAddress) { // Set founder address founder = founderAddress; // Allocate all created tokens during ICO stage to allocationAddressICO. balances[allocationAddressICO] = ICOSupply; // Allocate all created tokens during preICO stage to allocationAddressPreICO. balances[allocationAddressPreICO] = preICOSupply; // Allow founder to distribute tokens minted during preICO stage allowed[allocationAddressPreICO][founder] = preICOSupply; // Give 14 percent of all tokens to founders. balances[multisig] = div(mul(ICOSupply, 14), 86); // Set correct totalSupply and limit maximum total supply. totalSupply = add(ICOSupply, balances[multisig]); totalSupply = add(totalSupply, preICOSupply); maxTotalSupply = mul(totalSupply, 5); } }
File 2 of 2: MyToken
contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) throw; _ } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } } /* The token is used as a voting shares */ contract token { function mintToken(address target, uint256 mintedAmount); } contract Congress is owned { /* Contract Variables and events */ uint public minimumQuorum; uint public debatingPeriodInMinutes; int public majorityMargin; Proposal[] public proposals; uint public numProposals; mapping(address => uint) public memberId; Member[] public members; address public unicornAddress; uint public priceOfAUnicornInFinney; event ProposalAdded(uint proposalID, address recipient, uint amount, string description); event Voted(uint proposalID, bool position, address voter, string justification); event ProposalTallied(uint proposalID, int result, uint quorum, bool active); event MembershipChanged(address member); event ChangeOfRules(uint minimumQuorum, uint debatingPeriodInMinutes, int majorityMargin); struct Proposal { address recipient; uint amount; string description; uint votingDeadline; bool executed; bool proposalPassed; uint numberOfVotes; int currentResult; bytes32 proposalHash; Vote[] votes; mapping(address => bool) voted; } struct Member { address member; uint voteWeight; bool canAddProposals; string name; uint memberSince; } struct Vote { bool inSupport; address voter; string justification; } /* First time setup */ function Congress(uint minimumQuorumForProposals, uint minutesForDebate, int marginOfVotesForMajority, address congressLeader) { minimumQuorum = minimumQuorumForProposals; debatingPeriodInMinutes = minutesForDebate; majorityMargin = marginOfVotesForMajority; members.length++; members[0] = Member({ member: 0, voteWeight: 0, canAddProposals: false, memberSince: now, name: '' }); if (congressLeader != 0) owner = congressLeader; } /*make member*/ function changeMembership(address targetMember, uint voteWeight, bool canAddProposals, string memberName) onlyOwner { uint id; if (memberId[targetMember] == 0) { memberId[targetMember] = members.length; id = members.length++; members[id] = Member({ member: targetMember, voteWeight: voteWeight, canAddProposals: canAddProposals, memberSince: now, name: memberName }); } else { id = memberId[targetMember]; Member m = members[id]; m.voteWeight = voteWeight; m.canAddProposals = canAddProposals; m.name = memberName; } MembershipChanged(targetMember); } /*change rules*/ function changeVotingRules(uint minimumQuorumForProposals, uint minutesForDebate, int marginOfVotesForMajority) onlyOwner { minimumQuorum = minimumQuorumForProposals; debatingPeriodInMinutes = minutesForDebate; majorityMargin = marginOfVotesForMajority; ChangeOfRules(minimumQuorum, debatingPeriodInMinutes, majorityMargin); } // ribbonPriceInEther function changeUnicorn(uint newUnicornPriceInFinney, address newUnicornAddress) onlyOwner { unicornAddress = newUnicornAddress; priceOfAUnicornInFinney = newUnicornPriceInFinney; } /* Function to create a new proposal */ function newProposalInWei(address beneficiary, uint weiAmount, string JobDescription, bytes transactionBytecode) returns(uint proposalID) { if (memberId[msg.sender] == 0 || !members[memberId[msg.sender]].canAddProposals) throw; proposalID = proposals.length++; Proposal p = proposals[proposalID]; p.recipient = beneficiary; p.amount = weiAmount; p.description = JobDescription; p.proposalHash = sha3(beneficiary, weiAmount, transactionBytecode); p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes; p.executed = false; p.proposalPassed = false; p.numberOfVotes = 0; ProposalAdded(proposalID, beneficiary, weiAmount, JobDescription); numProposals = proposalID + 1; } /* Function to create a new proposal */ function newProposalInEther(address beneficiary, uint etherAmount, string JobDescription, bytes transactionBytecode) returns(uint proposalID) { if (memberId[msg.sender] == 0 || !members[memberId[msg.sender]].canAddProposals) throw; proposalID = proposals.length++; Proposal p = proposals[proposalID]; p.recipient = beneficiary; p.amount = etherAmount * 1 ether; p.description = JobDescription; p.proposalHash = sha3(beneficiary, etherAmount * 1 ether, transactionBytecode); p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes; p.executed = false; p.proposalPassed = false; p.numberOfVotes = 0; ProposalAdded(proposalID, beneficiary, etherAmount, JobDescription); numProposals = proposalID + 1; } /* function to check if a proposal code matches */ function checkProposalCode(uint proposalNumber, address beneficiary, uint amount, bytes transactionBytecode) constant returns(bool codeChecksOut) { Proposal p = proposals[proposalNumber]; return p.proposalHash == sha3(beneficiary, amount, transactionBytecode); } function vote(uint proposalNumber, bool supportsProposal, string justificationText) returns(uint voteID) { if (memberId[msg.sender] == 0) throw; uint voteWeight = members[memberId[msg.sender]].voteWeight; Proposal p = proposals[proposalNumber]; // Get the proposal if (p.voted[msg.sender] == true) throw; // If has already voted, cancel p.voted[msg.sender] = true; // Set this voter as having voted p.numberOfVotes += voteWeight; // Increase the number of votes if (supportsProposal) { // If they support the proposal p.currentResult += int(voteWeight); // Increase score } else { // If they don't p.currentResult -= int(voteWeight); // Decrease the score } // Create a log of this event Voted(proposalNumber, supportsProposal, msg.sender, justificationText); } function executeProposal(uint proposalNumber, bytes transactionBytecode) returns(int result) { Proposal p = proposals[proposalNumber]; /* Check if the proposal can be executed */ if (now < p.votingDeadline // has the voting deadline arrived? || p.executed // has it been already executed? || p.proposalHash != sha3(p.recipient, p.amount, transactionBytecode) // Does the transaction code match the proposal? || p.numberOfVotes < minimumQuorum) // has minimum quorum? throw; /* execute result */ if (p.currentResult > majorityMargin) { /* If difference between support and opposition is larger than margin */ p.recipient.call.value(p.amount)(transactionBytecode); p.executed = true; p.proposalPassed = true; } else { p.executed = true; p.proposalPassed = false; } // Fire Events ProposalTallied(proposalNumber, p.currentResult, p.numberOfVotes, p.proposalPassed); } function() { if (msg.value > priceOfAUnicornInFinney) { token unicorn = token(unicornAddress); unicorn.mintToken(msg.sender, msg.value / (priceOfAUnicornInFinney * 1 finney)); } } } contract MyToken is owned { /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping(address => uint256) public balanceOf; mapping(address => bool) public frozenAccount; mapping(address => mapping(address => uint)) public allowance; mapping(address => mapping(address => uint)) public spentAllowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); event FrozenFunds(address target, bool frozen); /* Initializes contract with initial supply tokens to the creator of the contract */ function MyToken(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol, address centralMinter) { if (centralMinter != 0) owner = centralMinter; // Sets the minter balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes totalSupply = initialSupply; } /* Send coins */ function transfer(address _to, uint256 _value) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (frozenAccount[msg.sender]) throw; // Check if frozen balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } function mintToken(address target, uint256 mintedAmount) onlyOwner { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(owner, target, mintedAmount); } function freezeAccount(address target, bool freeze) onlyOwner { frozenAccount[target] = freeze; FrozenFunds(target, freeze); } function transferFrom(address _from, address _to, uint256 _value) returns(bool success) { if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (frozenAccount[_from]) throw; // Check if frozen if (spentAllowance[_from][msg.sender] + _value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient spentAllowance[_from][msg.sender] += _value; Transfer(msg.sender, _to, _value); } function approve(address _spender, uint256 _value) returns(bool success) { allowance[msg.sender][_spender] = _value; } function() { //owner.send(msg.value); throw; } }