Contract Diff Checker

Contract Name:
whiskeygame

Contract Source Code:

File 1 of 1 : whiskeygame

// SPDX-License-Identifier: MIT

// Whiskey Game
// https://t.me/bourbonchat

pragma solidity 0.8.24;

contract whiskeygame {
    uint256 private constant BEANS_TO_HATCH_1BEAN = 1080000;
    uint256 private constant SECONDS_IN_ONE_DAY = 86400;
    uint256 private constant PSN = 10000;
    uint256 private constant PSNH = 5000;
    uint256 private constant feeVal = 8;
    bool private initialized = false;
    address private devAdd;
    mapping (address => uint256) public userTreasury;
    mapping (address => uint256) public userTreasuryDays;
    mapping (address => uint256) private userClaims;
    mapping (address => uint256) private userDeposits;
    mapping (address => uint256) private hatcheryMiners;
    mapping (address => uint256) public lastHatch;
    mapping (address => address) public referrals;
    mapping (address => uint256) private claimedEggs;
    uint256 public marketEggs;
    uint256 public totalDeposits;
    
    constructor() {
        devAdd = msg.sender;
    }

    receive() external payable {}

    function hatchEggs(address ref) public {
        require(initialized);

        if(ref == msg.sender) {
            ref = address(0);
        }
        
        if(referrals[msg.sender] == address(0) && referrals[msg.sender] != msg.sender) {
            referrals[msg.sender] = ref;
        }
        
        uint256 eggsUsed = getMyEggs(msg.sender);
        uint256 newMiners = eggsUsed / BEANS_TO_HATCH_1BEAN;
        require(eggsUsed > BEANS_TO_HATCH_1BEAN);
        hatcheryMiners[msg.sender] += newMiners;
        lastHatch[msg.sender] = block.timestamp;
        claimedEggs[msg.sender] = 0;
        hatcheryMiners[referrals[msg.sender]] += ((eggsUsed / 15) / BEANS_TO_HATCH_1BEAN);
        marketEggs = marketEggs + (eggsUsed / 5);
    }
    
    function sellEggs() public {
        require(initialized);
        uint256 hasEggs = getMyEggs(msg.sender);
        uint256 eggValue = calculateEggSell(hasEggs);
        uint256 fee = devFee(eggValue);
        userClaims[msg.sender] += eggValue - ((eggValue * feeVal) / 100);
        claimedEggs[msg.sender] = 0;
        lastHatch[msg.sender] = block.timestamp;
        marketEggs += hasEggs;
        hatcheryMiners[msg.sender] -= (hatcheryMiners[msg.sender] * 10) / 100;
        payable (devAdd).transfer(((eggValue * feeVal) / 100));
        payable (msg.sender).transfer(eggValue - fee); 
    }
    
    function beanRewards(address adr) public view returns(uint256) {
        uint256 hasEggs = getMyEggs(adr);
        if (hasEggs == 0) {
        return 0;
        }
        uint256 eggValue = calculateEggSell(hasEggs);
        return eggValue;
    }
    
    function buyEggs(address ref) public payable {
        require(initialized);
        totalDeposits += msg.value - ((msg.value * feeVal) / 100);
        userDeposits[msg.sender] += msg.value - ((msg.value * feeVal) / 100);
        uint256 eggsBought = calculateEggBuy(msg.value,(address(this).balance - msg.value));
        eggsBought = eggsBought - devFee(eggsBought);
        require(eggsBought > BEANS_TO_HATCH_1BEAN);
        claimedEggs[msg.sender] += eggsBought;
        payable (devAdd).transfer(((msg.value * feeVal) / 100));
        hatchEggs(ref);
    }

    function upgradeTreasury() public {
        require(initialized);
        require(hatcheryMiners[msg.sender] > 0);
        userTreasuryDays[msg.sender] += 1;
        require(userDeposits[msg.sender] > (100000000000000000) * userTreasuryDays[msg.sender]);
        hatcheryMiners[msg.sender] -= (hatcheryMiners[msg.sender] * 5) / 100;
        userTreasury[msg.sender] += 86400;      
    }

    function getBNBDeposited(address adr) public view returns(uint256) {
        return userDeposits[adr];
    }
    
    function getBNBClaimed(address adr) public view returns(uint256) {
        return userClaims[adr];
    }
    
    function calculateTrade(uint256 rt,uint256 rs, uint256 bs) private pure returns(uint256) {
        return (PSN * bs) / (PSNH + ((PSN * rs + PSNH * rt) / rt));
    }
    
    function calculateEggSell(uint256 eggs) public view returns(uint256) {
        return calculateTrade(eggs,marketEggs,address(this).balance);
    }
    
    function calculateEggBuy(uint256 eth,uint256 contractBalance) public view returns(uint256) {
        return calculateTrade(eth,contractBalance,marketEggs);
    }
    
    function calculateEggBuySimple(uint256 eth) public view returns(uint256) {
        return calculateEggBuy(eth,address(this).balance);
    }
    
    function devFee(uint256 amount) private pure returns(uint256) {
        return ((amount * feeVal) / 100);
    }
    
    function seedMarket() public payable {
        require(marketEggs == 0);
        require(msg.sender == devAdd);
        totalDeposits += msg.value;
        initialized = true;
        marketEggs = 108000000000;
    }
    
    function getBalance() public view returns(uint256) {
        return address(this).balance;
    }
    
    function getMyMiners(address adr) public view returns(uint256) {
        return hatcheryMiners[adr];
    }
    
    function getMyEggs(address adr) public view returns(uint256) {
        return (claimedEggs[adr] + getEggsSinceLastHatch(adr));
    }
    
    function getEggsSinceLastHatch(address adr) public view returns(uint256) {
        uint256 secondsPassed = min((SECONDS_IN_ONE_DAY + userTreasury[adr]),(block.timestamp - lastHatch[adr]));
        return (secondsPassed * hatcheryMiners[adr]);
    }
    
    function min(uint256 a, uint256 b) private pure returns (uint256) {
        return a < b ? a : b;
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):