|
|
|
@ -176,40 +176,6 @@ contract Main is Owned {
|
|
|
|
|
return mailbomb.bombsExploded();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get N addresses from the leaderboard
|
|
|
|
|
/// @param _amount Amount of addresses to return
|
|
|
|
|
/// @return addresses List of addresses from the top N entries of leaderboard
|
|
|
|
|
function getLeaderboard(uint256 _amount) public view returns (address[] memory addresses) {
|
|
|
|
|
address[] memory addressList;
|
|
|
|
|
uint256 idx;
|
|
|
|
|
while (addressList.length < _amount) {
|
|
|
|
|
bool exists;
|
|
|
|
|
address a = leaderboard[leaderboardPointer - idx];
|
|
|
|
|
for (uint256 n; n < addressList.length; n++) {
|
|
|
|
|
if (addressList[n] == a) {
|
|
|
|
|
exists = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!exists) {
|
|
|
|
|
addressList[idx] = a;
|
|
|
|
|
idx++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return addressList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get N kill amounts
|
|
|
|
|
/// @param addresses List of addresses to query kill counts for
|
|
|
|
|
/// @return amounts List of kill counts for each address in addresses
|
|
|
|
|
function getKillCounts(address[] memory addresses) public view returns (uint256[] memory amounts) {
|
|
|
|
|
uint256[] memory _amounts;
|
|
|
|
|
for (uint256 i; i < addresses.length; i++) {
|
|
|
|
|
address addr = addresses[i];
|
|
|
|
|
_amounts[i] = killCount[addr];
|
|
|
|
|
}
|
|
|
|
|
return _amounts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
|
// Tokens
|
|
|
|
|
// =========================================================================
|
|
|
|
@ -240,7 +206,7 @@ contract Main is Owned {
|
|
|
|
|
require(_amount <= unaboomer.totalSupply(), "not enough supply");
|
|
|
|
|
uint256 supply = unaboomer.totalSupply();
|
|
|
|
|
for (uint256 i; i < _amount; i++) {
|
|
|
|
|
uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % supply;
|
|
|
|
|
uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, _amount, block.timestamp, msg.sender))) % supply;
|
|
|
|
|
bool dud = unaboomer.tokenDead(randomBoomer);
|
|
|
|
|
unaboomer.die(randomBoomer);
|
|
|
|
|
bool senderOwned = msg.sender == unaboomer.ownerOf(randomBoomer);
|
|
|
|
|