Created
July 5, 2018 17:02
-
-
Save koras/fc018ffd8d5527942f5dcc6fd43d4165 to your computer and use it in GitHub Desktop.
getSireList
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 getSireList(uint page, uint indexBunny) | |
public view returns( | |
uint32[12] rabbitID, | |
uint[12]currentPriceBids, | |
uint elementEnd, | |
uint elementTotal | |
) { | |
uint32 bunnyID = 0; | |
uint pagecount = 12; | |
uint start = 0; | |
if (page < 1) { | |
page = 1; | |
} | |
if (sireGenom[indexBunny].length == 0) { | |
return; | |
} | |
elementEnd = page.mul(pagecount); | |
if (elementEnd > sireGenom[indexBunny].length) { | |
elementEnd = sireGenom[indexBunny].length; | |
} | |
elementTotal = sireGenom[indexBunny].length; | |
for (uint i = (((page-1)*pagecount)); i < (elementEnd); i++) { | |
bunnyID = uint32(sireGenom[indexBunny][i]); | |
rabbitID[start] = bunnyID; | |
currentPriceBids[start] = getSirePrice(bunnyID); | |
start++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment