Created
August 1, 2018 07:49
-
-
Save janfilips/b55100ac728c4b7fb9c42f573fab3ca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract DollarAuction { | |
address player; | |
uint public price; | |
uint public playersCount; | |
mapping(address => uint) playersBids; | |
mapping(uint => address) players; | |
function DollarAuction(uint _winning_price) payable { | |
price = _winning_price; | |
} | |
function placeBid() payable returns (bool) { | |
if( playersBids[msg.sender] == 0 ) | |
playersBids[msg.sender] = msg.value; | |
playersBids[msg.sender] += msg.value; | |
playersCount += 1; | |
// file an event here...... | |
return true; | |
} | |
function getBid(address player) public returns (uint) { | |
return playersBids[player]; | |
} | |
function listBids() public returns (uint[]) { | |
uint[] memory bids = new uint[](playersCount); | |
for(uint i=0;i<=playersCount;i++) { | |
player = players[i]; | |
bids[i] = playersBids[player]; | |
} | |
return bids; | |
} | |
//function listPlayers() public returns (address[]) { | |
// address[] memory playersAddresses = new address[](playersCount); | |
// for(uint i=0; i<=playersCount; i++) { | |
// playersAddresses.push( players[i] ); | |
// } | |
// return playersAddresses; | |
//} | |
function payout() public returns (bool) { | |
// skontroluje cas | |
// zosorti players | |
// vyplati players per pre-defined rules | |
// spusti payRoyalty funkci na remainder | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment