Contract Overview
Transactions:
177 txns
Latest 25 transactions from a total of 177 transactions
[ Download CSV Export ]
Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution
[ Download CSV Export ]
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.
Contract Source Code Verified (Exact Match)
Contract Source Code Verified (Exact Match)
Contract Name: | OneSingleCoin |
Compiler Version: | v0.4.24+commit.e67f0147 |
Optimization Enabled: | Yes |
Runs (Optimizer): | 200 |
Contract Source Code
pragma solidity ^0.4.24; contract OneSingleCoin { uint256 public currentHodlerId; address public currentHodler; address[] public previousHodlers; string[] public messages; uint256 public price; event Purchased( uint indexed _buyerId, address _buyer ); mapping (address => uint) public balance; constructor() public { currentHodler = msg.sender; currentHodlerId = 0; messages.push("One coin to rule them all"); price = 8 finney; emit Purchased(currentHodlerId, currentHodler); } function buy(string message) public payable returns (bool) { require (msg.value >= price); if (msg.value > price) { balance[msg.sender] += msg.value - price; } uint256 previousHodlersCount = previousHodlers.length; for (uint256 i = 0; i < previousHodlersCount; i++) { balance[previousHodlers[i]] += (price * 8 / 100) / previousHodlersCount; } balance[currentHodler] += price * 92 / 100; price = price * 120 / 100; previousHodlers.push(currentHodler); messages.push(message); currentHodler = msg.sender; currentHodlerId = previousHodlersCount + 1; emit Purchased(currentHodlerId, currentHodler); } function withdraw() public { uint amount = balance[msg.sender]; balance[msg.sender] = 0; msg.sender.transfer(amount); } }
Contract ABI
[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"messages","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"message","type":"string"}],"name":"buy","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"previousHodlers","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentHodlerId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentHodler","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_buyerId","type":"uint256"},{"indexed":false,"name":"_buyer","type":"address"}],"name":"Purchased","type":"event"}]
Contract Creation Code
608060405234801561001057600080fd5b5060018054600160a060020a0319163317815560008080556003805492830180825591526040805180820190915260198082527f4f6e6520636f696e20746f2072756c65207468656d20616c6c00000000000000602092909201918252919261009e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90910191906100f2565b5050661c6bf52634000060045560005460015460408051600160a060020a039092168252517fb47c52a971a941c629c2f7690d2a3bd407390d3c8eabc35473c70883a3d5da169181900360200190a261018d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061013357805160ff1916838001178555610160565b82800160010185558215610160579182015b82811115610160578251825591602001919060010190610145565b5061016c929150610170565b5090565b61018a91905b8082111561016c5760008155600101610176565b90565b61062b8061019c6000396000f30060806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630d80fefd81146100925780633ccfd60b1461011f578063492cc7691461013657806355872813146101965780635a75b8d5146101ca5780636776ddd0146101f1578063a035b1fe14610206578063e3d670d71461021b575b600080fd5b34801561009e57600080fd5b506100aa60043561023c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100e45781810151838201526020016100cc565b50505050905090810190601f1680156101115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012b57600080fd5b506101346102e3565b005b6040805160206004803580820135601f81018490048402850184019095528484526101829436949293602493928401919081908401838280828437509497506103289650505050505050565b604080519115158252519081900360200190f35b3480156101a257600080fd5b506101ae60043561050f565b60408051600160a060020a039092168252519081900360200190f35b3480156101d657600080fd5b506101df610537565b60408051918252519081900360200190f35b3480156101fd57600080fd5b506101ae61053d565b34801561021257600080fd5b506101df61054c565b34801561022757600080fd5b506101df600160a060020a0360043516610552565b600380548290811061024a57fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152935090918301828280156102db5780601f106102b0576101008083540402835291602001916102db565b820191906000526020600020905b8154815290600101906020018083116102be57829003601f168201915b505050505081565b33600081815260056020526040808220805490839055905190929183156108fc02918491818181858888f19350505050158015610324573d6000803e3d6000fd5b5050565b6000806000600454341015151561033e57600080fd5b600454341115610367576004543360009081526005602052604090208054349290920390910190555b505060025460005b818110156103d35760045482906064906008020481151561038c57fe5b04600560006002848154811015156103a057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190208054909101905560010161036f565b6004805460018054600160a060020a039081166000908152600560209081526040822080546064605c9097028790040190558554607802949094049094558154600280548085019091557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace01805473ffffffffffffffffffffffffffffffffffffffff191691909216179055600380549182018082559352865161049e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90920191880190610564565b50506001805473ffffffffffffffffffffffffffffffffffffffff19163317808255908301600081905560408051600160a060020a039390931683525190917fb47c52a971a941c629c2f7690d2a3bd407390d3c8eabc35473c70883a3d5da16919081900360200190a25050919050565b600280548290811061051d57fe5b600091825260209091200154600160a060020a0316905081565b60005481565b600154600160a060020a031681565b60045481565b60056020526000908152604090205481565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105a557805160ff19168380011785556105d2565b828001600101855582156105d2579182015b828111156105d25782518255916020019190600101906105b7565b506105de9291506105e2565b5090565b6105fc91905b808211156105de57600081556001016105e8565b905600a165627a7a7230582018b7c87ea7fbd4d7f3de405dc3d50aebc249e9eaa50db293bd0c829d7cb9cb6f0029
Swarm Source:
bzzr://18b7c87ea7fbd4d7f3de405dc3d50aebc249e9eaa50db293bd0c829d7cb9cb6f
Block | Age | transaction | Difficulty | GasUsed | Reward |
---|
Block | Age | Uncle Number | Difficulty | GasUsed | Reward |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.