Created
October 24, 2016 21:20
-
-
Save seanavery/abe52f1efa9e11a890e54fb3f22ac912 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function submitBid(uint _price, uint _amount) bidInMarket(_price) external returns (bool) { | |
Bid memory b; | |
b.price = _price; | |
b.amount = _amount; | |
for(uint i = 0; i < Bids.length; i++) { | |
if(Bids[i].price > _price) { | |
Bid[] memory tempBids = new Bid[](Bids.length - i); | |
for(uint j = i; j < Bids.length; j++) { | |
tempBids[j-i] = Bids[j]; | |
} | |
Bids[i] = b; | |
Bids.length = Bids.length + 1; | |
for(uint k = 0; k < tempBids.length; k++) { | |
Bids[i+k+1] = tempBids[k]; | |
} | |
return true; | |
} | |
} | |
Bids.push(b); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment