becrypto/contracts/tokens/erc721/BEMysteryBox.sol
2022-08-10 16:35:50 +08:00

27 lines
884 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./BEBase.sol";
// this contract will transfer ownership to BETimelockController after deployed
// all onlyowner method would add timelock
contract BEMysteryBox is BEBase{
constructor() ERC721("CRYPTO ELITE'S MYSTERY BOXES", "BOX") {}
function userTokens(address user, uint256 start, uint256 page)
external view returns (uint256 [] memory){
uint256 size = balanceOf(user);
uint256[] memory results = new uint256[](page);
if (start < size) {
uint256 max = size;
if (start + page < size) {
max = start + page;
}
for (uint256 i = start; i < max; ++i) {
uint256 tokenId = tokenOfOwnerByIndex(user, i);
results[i-start] = tokenId;
}
}
return results;
}
}