improving contract

master
lza_menace 1 year ago
parent bb4ec5b0cd
commit 3fec003f98

@ -66,19 +66,48 @@ contract Main is Owned {
}
// =========================================================================
// Tokens
// Getters
// =========================================================================
/// Get balance of BOOMR tokens
/// Get BOOMR token balance of wallet
function boomerBalance(address _address) public view returns (uint256) {
return unaboomer.balanceOf(_address);
}
/// Get balance of BOMB tokens
/// Get BOOMR token total supply
function boomerSupply() public view returns (uint256) {
return unaboomer.totalSupply();
}
/// Get BOOMR kill count (unaboomers killed)
function boomerKillCount() public view returns (uint256) {
return unaboomer.killCount();
}
/// Get BOOMR token max supply
function boomerMaxSupply() public view returns (uint256) {
return unaboomer.MAX_SUPPLY();
}
/// Get BOOMR token survivor count
function boomerSurvivorCount() public view returns (uint256) {
return unaboomer.SURVIVOR_COUNT();
}
/// Get BOMB token balance of wallet
function bombBalance(address _address) public view returns (uint256) {
return mailbomb.balanceOf(_address, 1);
}
/// Get BOMB token supply
function bombSupply() public view returns (uint256) {
return mailbomb.bombsAssembled();
}
// =========================================================================
// Tokens
// =========================================================================
/// Radicalize a boomer to become a Unaboomer - start with 2 bombs
function radicalizeBoomers(uint256 _amount) external payable missionNotCompleted {
require(msg.value >= _amount * boomerPrice, "not enough ether");
@ -104,9 +133,9 @@ contract Main is Owned {
require(_amount <= unaboomer.totalSupply(), "not enough supply");
bool[] memory res = new bool[](_amount);
uint256[] memory killed = new uint256[](_amount);
uint256 boomerSupply = unaboomer.totalSupply();
uint256 supply = unaboomer.totalSupply();
for (uint256 i; i < _amount; i++) {
uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % boomerSupply;
uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % supply;
bool dud = unaboomer.tokenDead(randomBoomer);
unaboomer.die(randomBoomer);
res[i] = dud;

Loading…
Cancel
Save