contract Treasury is AccessControlEnumerable, Ownable {
    /**
    @notice OWNER ROLE - Only Owner can add admins.
    The role is only used to assign roles to other roles.
    Ownable is used for onlyOwner and single owner og the contract.
    */
    bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");

    /**
    @notice ADMIN ROLE
    Admin can call transfer to Owner.
    */
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

    /**
    @notice - onlyAdmin
    */
    modifier onlyAdmin() {
        require(hasRole(ADMIN_ROLE, _msgSender()), "Treasury: Not admin.");
        _;
    }

    event Transfer(
        address indexed sender,
        address indexed recipient,
        uint256 amount
    );

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 amount
    );

    IERC20 public token;

    constructor(address _owner, address tokenAddr) {
        transferOwnership(_owner);

        token = IERC20(tokenAddr);

        _setupRole(ADMIN_ROLE, _owner);
        _setupRole(OWNER_ROLE, _owner);
        
        _setRoleAdmin(OWNER_ROLE,OWNER_ROLE);
        _setRoleAdmin(ADMIN_ROLE,OWNER_ROLE);
    }

    /**
    @notice Deposit to Treasury. 
    @dev This is a function added specifically for Vanilla Token.
    The newBalance - oldBalance makes sure that 5% burn of VNLA token is kept into account.
    This ensures the Transfer emit is correct.
    */
    function deposit(uint256 amount) external {
        uint256 oldBalance = token.balanceOf(address(this));

        token.transferFrom(_msgSender(), address(this), amount);

        uint256 newBalance = token.balanceOf(address(this));
        emit Transfer(_msgSender(), address(this), newBalance - oldBalance);
    }

    function approve(address withdrawer, uint256 amount) external onlyAdmin {
        token.approve(withdrawer, amount);
        emit Approval(address(this), withdrawer, amount);
    }
}
/**
 This can be used for off-chain functionality on Ethereum.
 Conversion of 
 */
function deposit(uint256 amount) external {
    uint256 oldBalance = token.balanceOf(address(this));

    token.transferFrom(_msgSender(), address(this), amount);

    uint256 newBalance = token.balanceOf(address(this));
    emit Transfer(_msgSender(), address(this), newBalance - oldBalance);
}

/**
 @notice Deposit to Treasury. 
 @dev This is a function added specifically for Vanilla Token.
 The newBalance - oldBalance makes sure that 5% burn of VNLA token is kept into account.
 This ensures the Transfer emit is correct.
 */