# Participating Drinking Establishments (PDEs)

Participating Drinking Establishments (PDE): These are the F\&B merchants and businesses hosting drinkers. The local bar, the city’s premier club, the skyline lounge, the speakeasy, the hotel restaurant, and etc. All these F\&B merchants would be considered a PDE in the happyhourDAO ecosystem.

*Architectural structure of a PDE.*

```
struct PDE {
    string _name;
    string _location;
    address _address;
    uint _accessCode;
    uint _PDEid;
}

PDE[] public pdes;

mapping (uint => address) public PDEtoOwner;
```

*Public onboarding function for PDE. Name, Location, ETH address, and a temporary Access Code are required.*

```
function onboardPDE(string memory _name, string memory _location, address _address, uint _accessCode) public {
    uint PDEid = uint(keccak256(abi.encodePacked(_name, _location, _address)));
    pdes.push(PDE(_name, _location, _address, _accessCode, PDEid));
    uint PDEindexNum = pdes.length - 1;
    PDEtoOwner[PDEindexNum] = msg.sender;
    emit newPDEonboarded(_name, _location, _address, PDEid, PDEindexNum, _accessCode);
}
```

*Enables PDEs to change their Access Code anytime.*

```
function _changeAccessCode(uint _PDEindexNum, uint _newAccessCode) public {
    require(PDEtoOwner[_PDEindexNum] == msg.sender);
    pdes[_PDEindexNum]._accessCode = _newAccessCode;
}
```
