🍸
happyhourDAO
  • Introducing happyhourDAO
  • The happyhourDAO
    • Abstract
    • What is the happyhourDAO
    • happyhourDAO ecosystem
    • $HOUR tokenomics
    • Drinkers
    • Participating Drinking Establishments (PDEs)
    • $DRNK governance tokenomics
    • happyhourDAO VC venture
    • happyhourDAO roadmap
    • The Team
    • $HOUR/$DRNK mint and release schedule
    • Last Call
Powered by GitBook
On this page
  1. The happyhourDAO

Drinkers

The local dive bar goer, the fist pumping clubber, the high class fancy rooftop lounger, or the occasional casual drinker, this is the DAO for you.

Drinkers (holders of $HOUR): These are the users and community members interacting with the Happy Hour Protocol Engine. These are the happy hour goers, nightlife fist-pumpers, bartenders, and all other alcoholics who make it a priority to support the F&B industry.

Start earning $HOUR function. Requires a minimum happy hour fee stake, the PDE's PDEid and its Access Code.

function startHOUR(uint _PDEid, uint _accessCode) public payable {

    uint validPDE;

    for (uint i = 0; i < pdes.length; i++) {
        if (pdes[i]._PDEid == _PDEid && pdes[i]._accessCode == _accessCode) {
            validPDE = 1;
        } else {
            validPDE = 0;
        }
    }

    require(validPDE == 1);
    require(msg.value == happyHourFee, "Invalid Happy Hour Fee.");
    givePoolDrinkingId();
    drinkingIDtoPDEid[drinkingID[msg.sender]] = _PDEid;
    happyHourFeePool += 1;
    timeIN = block.timestamp;
}

Function to stop earning $HOUR

function endHOUR(address payable wiped) public {

    address PDEcommission;
    require(msg.sender == wiped);
    timeOUT = block.timestamp;

    for (uint i = 0; i < pdes.length; i++) {
        if (pdes[i]._PDEid == drinkingIDtoPDEid[drinkingID[msg.sender]]) {
            PDEcommission = pdes[i]._address;
        }
    }

    nullPoolDrinkingId();
    happyHourFeePool -= 1;
    wiped.transfer(1 ether);
    hoursSpentDrinking = (timeOUT - timeIN) / 60 / 60;
    uint HOURearned = hoursSpentDrinking * HOURperhour;
    uint PDEcommissionEarned = HOURearned / PDEcommissionRate;
    _mint(wiped, HOURearned);
    _mint(PDEcommission, PDEcommissionEarned);
    emit endHOURresults(hoursSpentDrinking, HOURearned, PDEcommissionEarned);
}

Each Drinker is designated an ID in order to keep track of current hours accumulated per Drinker during 1 session.

contract poolDrinkingID {

    mapping(address => uint256) public drinkingID;
    uint256 drinkingIDcounter;

    event createdDrinkingID(address user, uint256 id);

    function givePoolDrinkingId() internal returns (uint256)  { 
        require(drinkingID[msg.sender]==0, "You are already drinking.");
        drinkingIDcounter += 1;
        drinkingID[msg.sender] = uint(keccak256(abi.encodePacked(block.timestamp, msg.sender)));
        emit createdDrinkingID(msg.sender,drinkingID[msg.sender]);
        return drinkingID[msg.sender];
    }

    function nullPoolDrinkingId() internal {
        require(drinkingID[msg.sender] != 0, "You haven't started drinking yet.");
        drinkingIDcounter -= 1;
        drinkingID[msg.sender] = 0;
    }

    function getPoolDrinkingId() public view returns(uint256) {
        return drinkingID[msg.sender];
    }

    function getNumberOfCurrentDrinkers() public view returns(uint) {
        return drinkingIDcounter;
    }
}

Getter function to view ETH amount staked in current happy hour fee pool.

function gethappyHourFeePool() public view returns (uint) {
    return happyHourFeePool;
}
Previous$HOUR tokenomicsNextParticipating Drinking Establishments (PDEs)

Last updated 3 years ago