Last active
October 31, 2022 20:38
-
-
Save ac12644/892d783c913ed81d5668ac6ddaeb449b 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
... | |
uint256 constant maxLimit = 20; | |
function fundraisersCount() public view returns (uint256) { | |
return _fundraisers.length; | |
} | |
function fundraisers(uint256 limit, uint256 offset) | |
public | |
view | |
returns (Fundraiser[] memory coll) | |
{ | |
require(offset <= fundraisersCount(), 'offset out of bounds'); | |
uint256 size = fundraisersCount() - offset; | |
size = size < limit ? size : limit; | |
size = size < maxLimit ? size : maxLimit; | |
coll = new Fundraiser[](size); | |
for (uint256 i = 0; i < size; i++) { | |
coll[i] = _fundraisers[offset + i]; | |
} | |
return coll; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment