---
# System prepended metadata

title: Untitled

---

```solidity=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract NYUVendingMachine {
    uint public numSodas;
    address public owner; // 0xbAA390D7b0e7adAc5dF373c43187e412a2D2D200
    address public engineer;

    mapping(address => uint) public sodasPerAddress;

    constructor(uint _numSodas) {
        numSodas = _numSodas;
        owner = msg.sender; // assign the owner to be the deployer of the contract
    }

    function purchaseSoda() public payable {
        require(msg.value > 100 wei, "You need to pay minimum 100 wei!");
        require(numSodas > 0, "Num sodas in machine must be positive!");
        sodasPerAddress[msg.sender]++;
        numSodas--;
    }

    function withdrawProfits() public {
        require(msg.sender == owner, "You must be the owner to call this function!");
        payable(owner).transfer(address(this).balance);
    }

    function setEngineer(address _newEngineer) public {
        require(msg.sender == owner, "You must be the owner to call this function!");
        engineer = _newEngineer;
    }

    function refillSodas(uint _newSodas) public {
        require(msg.sender == engineer);
        numSodas += _newSodas;
    }

    function changeOwner(address _newOwner) public {
        require(msg.sender == owner, "You must be the owner to call this function!");
        owner = _newOwner;
    }

    function pow() public {
        require(msg.sender == owner || msg.sender == engineer, "You must be the owner to call this function!");
        selfdestruct(payable(owner));
    }
}
```