Skip to content

Instantly share code, notes, and snippets.

@koras
Created July 5, 2018 17:02
Show Gist options
  • Save koras/fc018ffd8d5527942f5dcc6fd43d4165 to your computer and use it in GitHub Desktop.
Save koras/fc018ffd8d5527942f5dcc6fd43d4165 to your computer and use it in GitHub Desktop.
getSireList
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