Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Funded By
N/A
Latest 10 from a total of 10 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Shutdown | 5573894 | 2858 days ago | IN | 0 ETH | 0.00004046 | ||||
| Lotto Count | 5564401 | 2859 days ago | IN | 0.000001 ETH | 0.00067057 | ||||
| Lotto Count | 5564392 | 2859 days ago | IN | 0.000001 ETH | 0.00144 | ||||
| Lotto Count | 5564385 | 2859 days ago | IN | 0.000001 ETH | 0.00072 | ||||
| Lotto Count | 5564364 | 2859 days ago | IN | 0.000001 ETH | 0.00036 | ||||
| Lotto Count | 5552652 | 2861 days ago | IN | 0 ETH | 0.00067057 | ||||
| Add Ticket | 5551393 | 2862 days ago | IN | 0.101 ETH | 0.00010709 | ||||
| Add Ticket | 5551323 | 2862 days ago | IN | 0.101 ETH | 0.00013818 | ||||
| Add Ticket | 5551298 | 2862 days ago | IN | 0.101 ETH | 0.00019818 | ||||
| Lotto Count | 5551274 | 2862 days ago | IN | 2 ETH | 0.00062824 |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Self Destruct called at Txn Hash 0xc12576ac12a5931e3201e63f2f33dc4f1b77083c1de89354d5e2567ba702a8a6
Contract Name:
NewLottery
Compiler Version
v0.4.23+commit.124ca40d
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2018-05-03
*/
pragma solidity ^0.4.20;
/* library/Owned.sol */
contract Owned {
address owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
assert(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
contract NewLottery is Owned {
//CONSTANT
uint256 private maxTickets;
uint256 public minimumBounty;
uint256 public ticketPrice;
//LOTO REGISTER
uint256 public lottoIndex;
uint256 lastTicketTime;
//LOTTO VARIABLES
uint8 _direction;
uint256 numtickets;
uint256 totalBounty;
address owner;
event NewTicket(address indexed fromAddress, bool success);
event LottoComplete(address indexed fromAddress, uint indexed lottoIndex, uint256 reward);
/// Create a new Lotto
function LottoCount() public payable
{
owner = msg.sender;
ticketPrice = 0.101 * 10**18;
minimumBounty = 1 * 10**18;
maxTickets = 10;
_direction = 0;
lottoIndex = 1;
lastTicketTime = 0;
numtickets = 0;
totalBounty = msg.value;
require(totalBounty >= minimumBounty);
}
function getBalance() public view returns (uint256 balance)
{
balance = 0;
if(owner == msg.sender) balance = this.balance;
return balance;
}
function withdraw() onlyOwner public
{
//reset values
lottoIndex += 1;
numtickets = 0;
totalBounty = 0;
owner.transfer(this.balance);
}
function shutdown() onlyOwner public
{
suicide(msg.sender);
}
function getLastTicketTime() public view returns (uint256 time)
{
time = lastTicketTime;
return time;
}
function AddTicket() public payable
{
require(msg.value == ticketPrice);
require(numtickets < maxTickets);
//update bif
lastTicketTime = now;
totalBounty += ticketPrice;
bool success = numtickets == maxTickets;
NewTicket(msg.sender, success);
//check if winner
if(success)
{
PayWinner(msg.sender);
}
}
function PayWinner( address winner ) private
{
require(numtickets == maxTickets);
//calc reward
uint ownerTax = 5 * totalBounty / 100;
uint winnerPrice = totalBounty - ownerTax;
LottoComplete(msg.sender, lottoIndex, winnerPrice);
//reset values
lottoIndex += 1;
numtickets = 0;
totalBounty = 0;
//change max tickets to give unpredictability
if(_direction == 0 && maxTickets < 20) maxTickets += 1;
if(_direction == 1 && maxTickets > 10) maxTickets -= 1;
if(_direction == 0 && maxTickets == 20) _direction = 1;
if(_direction == 1 && maxTickets == 10) _direction = 0;
//give real money
owner.transfer(ownerTax);
winner.transfer(winnerPrice);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"getBalance","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ticketPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastTicketTime","outputs":[{"name":"time","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"LottoCount","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"lottoIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"AddTicket","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"minimumBounty","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"shutdown","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"fromAddress","type":"address"},{"indexed":false,"name":"success","type":"bool"}],"name":"NewTicket","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"fromAddress","type":"address"},{"indexed":true,"name":"lottoIndex","type":"uint256"},{"indexed":false,"name":"reward","type":"uint256"}],"name":"LottoComplete","type":"event"}]Contract Creation Code
608060405260008054600160a060020a033316600160a060020a0319909116179055610560806100306000396000f3006080604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312065fe081146100a85780631209b1f6146100cf57806319c97154146100e45780633ccfd60b146100f95780637741fc52146101105780637a15eb8d14610118578063b204bb5d1461012d578063cdf016ca14610135578063f2fde38b1461014a578063fc0e74d11461016b575b600080fd5b3480156100b457600080fd5b506100bd610180565b60408051918252519081900360200190f35b3480156100db57600080fd5b506100bd6101aa565b3480156100f057600080fd5b506100bd6101b0565b34801561010557600080fd5b5061010e6101b6565b005b61010e610224565b34801561012457600080fd5b506100bd610297565b61010e61029d565b34801561014157600080fd5b506100bd610327565b34801561015657600080fd5b5061010e600160a060020a036004351661032d565b34801561017757600080fd5b5061010e610381565b60095460009033600160a060020a03908116911614156101a75750600160a060020a033016315b90565b60035481565b60055490565b60005433600160a060020a039081169116146101ce57fe5b600480546001019055600060078190556008819055600954604051600160a060020a0391821692309092163180156108fc0292909190818181858888f19350505050158015610221573d6000803e3d6000fd5b50565b6009805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a0316179055670166d2f702508000600355670de0b6b3a76400006002819055600a60019081556006805460ff1916905560045560006005819055600755346008819055101561029557600080fd5b565b60045481565b60035460009034146102ae57600080fd5b600154600754106102be57600080fd5b504260055560035460088054909101905560015460075460408051919092148082529151600160a060020a033316917f23de19158786940de5dda06fd0b7b6cb38f4a275de8e5aa97841291762e9892c919081900360200190a2801561022157610221336103a5565b60025481565b60005433600160a060020a0390811691161461034557fe5b600160a060020a038116156102215760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b60005433600160a060020a0390811691161461039957fe5b33600160a060020a0316ff5b6000806001546007541415156103ba57600080fd5b6008546064906005020491508160085403905060045433600160a060020a03167fdc5dff36369474a27c3e9316fd6e5682d3eed3a3c023aa2a2ebcb553c954d387836040518082815260200191505060405180910390a36004805460010190556000600781905560085560065460ff1615801561043957506014600154105b156104475760018054810190555b60065460ff16600114801561045e5750600a600154115b1561046e57600180546000190190555b60065460ff1615801561048357506001546014145b15610496576006805460ff191660011790555b60065460ff1660011480156104ad5750600154600a145b156104bd576006805460ff191690555b600954604051600160a060020a039091169083156108fc029084906000818181858888f193505050501580156104f7573d6000803e3d6000fd5b50604051600160a060020a0384169082156108fc029083906000818181858888f1935050505015801561052e573d6000803e3d6000fd5b505050505600a165627a7a72305820ed42512a312d0a44d7fd0d4a9154549bb0c9337bb4763bc3fd08242c04f508880029
Deployed Bytecode
0x6080604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312065fe081146100a85780631209b1f6146100cf57806319c97154146100e45780633ccfd60b146100f95780637741fc52146101105780637a15eb8d14610118578063b204bb5d1461012d578063cdf016ca14610135578063f2fde38b1461014a578063fc0e74d11461016b575b600080fd5b3480156100b457600080fd5b506100bd610180565b60408051918252519081900360200190f35b3480156100db57600080fd5b506100bd6101aa565b3480156100f057600080fd5b506100bd6101b0565b34801561010557600080fd5b5061010e6101b6565b005b61010e610224565b34801561012457600080fd5b506100bd610297565b61010e61029d565b34801561014157600080fd5b506100bd610327565b34801561015657600080fd5b5061010e600160a060020a036004351661032d565b34801561017757600080fd5b5061010e610381565b60095460009033600160a060020a03908116911614156101a75750600160a060020a033016315b90565b60035481565b60055490565b60005433600160a060020a039081169116146101ce57fe5b600480546001019055600060078190556008819055600954604051600160a060020a0391821692309092163180156108fc0292909190818181858888f19350505050158015610221573d6000803e3d6000fd5b50565b6009805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a0316179055670166d2f702508000600355670de0b6b3a76400006002819055600a60019081556006805460ff1916905560045560006005819055600755346008819055101561029557600080fd5b565b60045481565b60035460009034146102ae57600080fd5b600154600754106102be57600080fd5b504260055560035460088054909101905560015460075460408051919092148082529151600160a060020a033316917f23de19158786940de5dda06fd0b7b6cb38f4a275de8e5aa97841291762e9892c919081900360200190a2801561022157610221336103a5565b60025481565b60005433600160a060020a0390811691161461034557fe5b600160a060020a038116156102215760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b60005433600160a060020a0390811691161461039957fe5b33600160a060020a0316ff5b6000806001546007541415156103ba57600080fd5b6008546064906005020491508160085403905060045433600160a060020a03167fdc5dff36369474a27c3e9316fd6e5682d3eed3a3c023aa2a2ebcb553c954d387836040518082815260200191505060405180910390a36004805460010190556000600781905560085560065460ff1615801561043957506014600154105b156104475760018054810190555b60065460ff16600114801561045e5750600a600154115b1561046e57600180546000190190555b60065460ff1615801561048357506001546014145b15610496576006805460ff191660011790555b60065460ff1660011480156104ad5750600154600a145b156104bd576006805460ff191690555b600954604051600160a060020a039091169083156108fc029084906000818181858888f193505050501580156104f7573d6000803e3d6000fd5b50604051600160a060020a0384169082156108fc029083906000818181858888f1935050505015801561052e573d6000803e3d6000fd5b505050505600a165627a7a72305820ed42512a312d0a44d7fd0d4a9154549bb0c9337bb4763bc3fd08242c04f508880029
Swarm Source
bzzr://ed42512a312d0a44d7fd0d4a9154549bb0c9337bb4763bc3fd08242c04f50888
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.