Feature Tip: Add private address tag to any address under My Name Tag !
Overview
Max Total Supply
2,717 Unicorns
Holders
381 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 0 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MyToken
Compiler Version
v0.2.0-nightly.2016.1.13+commit.d2f18c7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2017-09-24 */ 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; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"target","type":"address"},{"name":"mintedAmount","type":"uint256"}],"name":"mintToken","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"frozenAccount","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"spentAllowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"target","type":"address"},{"name":"freeze","type":"bool"}],"name":"freezeAccount","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"type":"function"},{"inputs":[{"name":"initialSupply","type":"uint256"},{"name":"tokenName","type":"string"},{"name":"decimalUnits","type":"uint8"},{"name":"tokenSymbol","type":"string"},{"name":"centralMinter","type":"address"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"target","type":"address"},{"indexed":false,"name":"frozen","type":"bool"}],"name":"FrozenFunds","type":"event"}]
Contract Creation Code
60606040526040516108ee3803806108ee83398101604052805160805160a05160c05160e0519394928301939192019060008054600160a060020a03191633179055600160a060020a0381166000146100655760008054600160a060020a031916821790555b600160a060020a033316600090815260056020908152604082208790558551600180549381905292600281851615610100026000190190911604601f9081018390047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69081019390919089019083901061010257805160ff19168380011785555b506101329291505b8082111561018b57600081556001016100ee565b828001600101855582156100e6579182015b828111156100e6578251826000505591602001919060010190610114565b50508160026000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061018f57805160ff19168380011785555b506101bf9291506100ee565b5090565b8280016001018555821561017f579182015b8281111561017f5782518260005055916020019190600101906101a1565b50506003805460ff19169390931790925550505060045561070a806101e46000396000f3606060405236156100b95760e060020a600035046306fdde0381146100c1578063095ea7b31461011d57806318160ddd1461015857806323b872dd14610161578063313ce5671461019357806370a082311461019f57806379c65068146101b75780638da5cb5b146101db57806395d89b41146101ed578063a9059cbb14610246578063b414d4b614610275578063dc3080f214610290578063dd62ed3e146102b5578063e724529c146102da578063f2fde38b146102fe575b61031f610002565b610321600180546020600282841615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156103dc5780601f106103b1576101008083540402835291602001916103dc565b600160a060020a03338116600090815260076020908152604080832060043594909416835292905290812060243590555b6060908152602090f35b61014e60045481565b61014e600435602435604435600160a060020a0383166000908152600560205260408120548290101561058a57610002565b61014e60035460ff1681565b61014e60043560056020526000908152604090205481565b61031f60043560243560005433600160a060020a039081169116146104d957610002565b61014e600054600160a060020a031681565b610321600280546020601f600019600184161561010002019092168390049182018190040260809081016040526060828152929190828280156103dc5780601f106103b1576101008083540402835291602001916103dc565b61031f60043560243533600160a060020a0316600090815260056020526040902054819010156103e457610002565b61014e60043560066020526000908152604090205460ff1681565b60086020908152600435600090815260408082209092526024358152205461014e9081565b60076020908152600435600090815260408082209092526024358152205461014e9081565b61031f60043560243560005433600160a060020a0390811691161461053557610002565b61031f60043560005433600160a060020a0390811691161461038f57610002565b005b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156103815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b505050505081565b600160a060020a03821660009081526040902054808201101561040657610002565b33600160a060020a031660009081526006602052604090205460ff161561042c57610002565b806005600050600033600160a060020a03168152602001908152602001600020600082828250540392505081905550806005600050600084600160a060020a0316815260200190815260200160002060008282825054019250508190555081600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600160a060020a0380831660008181526005602090815260408220805486019055600480548601905590546060858152929316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a35050565b600160a060020a03821660008181526006602052604090819020805460ff191684179055606091825260808390527f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a591a15050565b600160a060020a0383168152604081205482810110156105a957610002565b600160a060020a03841681526006602052604081205460ff16156105cc57610002565b600760209081526040808320600160a060020a033381168086529184528285205490881685526008845282852091855292528220548301111561060e57610002565b816005600050600086600160a060020a03168152602001908152602001600020600082828250540392505081905550816005600050600085600160a060020a03168152602001908152602001600020600082828250540192505081905550816008600050600086600160a060020a03168152602001908152602001600020600050600033600160a060020a0316815260200190815260200160002060008282825054019250508190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3939250505056000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000008556e69636f726e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004f09fa68400000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x606060405236156100b95760e060020a600035046306fdde0381146100c1578063095ea7b31461011d57806318160ddd1461015857806323b872dd14610161578063313ce5671461019357806370a082311461019f57806379c65068146101b75780638da5cb5b146101db57806395d89b41146101ed578063a9059cbb14610246578063b414d4b614610275578063dc3080f214610290578063dd62ed3e146102b5578063e724529c146102da578063f2fde38b146102fe575b61031f610002565b610321600180546020600282841615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156103dc5780601f106103b1576101008083540402835291602001916103dc565b600160a060020a03338116600090815260076020908152604080832060043594909416835292905290812060243590555b6060908152602090f35b61014e60045481565b61014e600435602435604435600160a060020a0383166000908152600560205260408120548290101561058a57610002565b61014e60035460ff1681565b61014e60043560056020526000908152604090205481565b61031f60043560243560005433600160a060020a039081169116146104d957610002565b61014e600054600160a060020a031681565b610321600280546020601f600019600184161561010002019092168390049182018190040260809081016040526060828152929190828280156103dc5780601f106103b1576101008083540402835291602001916103dc565b61031f60043560243533600160a060020a0316600090815260056020526040902054819010156103e457610002565b61014e60043560066020526000908152604090205460ff1681565b60086020908152600435600090815260408082209092526024358152205461014e9081565b60076020908152600435600090815260408082209092526024358152205461014e9081565b61031f60043560243560005433600160a060020a0390811691161461053557610002565b61031f60043560005433600160a060020a0390811691161461038f57610002565b005b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156103815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b505050505081565b600160a060020a03821660009081526040902054808201101561040657610002565b33600160a060020a031660009081526006602052604090205460ff161561042c57610002565b806005600050600033600160a060020a03168152602001908152602001600020600082828250540392505081905550806005600050600084600160a060020a0316815260200190815260200160002060008282825054019250508190555081600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600160a060020a0380831660008181526005602090815260408220805486019055600480548601905590546060858152929316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a35050565b600160a060020a03821660008181526006602052604090819020805460ff191684179055606091825260808390527f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a591a15050565b600160a060020a0383168152604081205482810110156105a957610002565b600160a060020a03841681526006602052604081205460ff16156105cc57610002565b600760209081526040808320600160a060020a033381168086529184528285205490881685526008845282852091855292528220548301111561060e57610002565b816005600050600086600160a060020a03168152602001908152602001600020600082828250540392505081905550816005600050600085600160a060020a03168152602001908152602001600020600082828250540192505081905550816008600050600086600160a060020a03168152602001908152602001600020600050600033600160a060020a0316815260200190815260200160002060008282825054019250508190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3939250505056
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000008556e69636f726e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004f09fa68400000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : initialSupply (uint256): 0
Arg [1] : tokenName (string): Unicorns
Arg [2] : decimalUnits (uint8): 0
Arg [3] : tokenSymbol (string): 🦄
Arg [4] : centralMinter (address): 0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d359
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [6] : 556e69636f726e73000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [8] : f09fa68400000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.