# BUK Treasury

## BUK Treasury Contract

The `Treasury` contract is a Solidity smart contract designed for managing the fund for Buk protocol and other marketplace contracts. This contract controls all kinds of money (cryptocurrency) transactions.

### Overview

The contract is designed with the following key components:

* **BUK Protocol**: Address of the BUK Protocol contract.
* **Roles**: Constants for roles like ADMIN and BUK\_PROTOCOL.
* **Stable**: Stable coin transactions

### Features

* **Withdraw stable**: Use to withdraw money to specified account
* **Refund stable and other** : Use to refund money related to bookings
* **Role-based Access**: Different functionalities accessible by admin, BUK Protocol, and NFT owners.
* **Stable Token Transactions**: Uses a stable token for transactions in the marketplace.

### Functions

#### Public and External Functions:

* **pause**: To pause contract, only admin.
* **unpause**: To pause contract, only admin.
* **setStableToken**: To set stable token.
* **setBukProtocol**: Set a new BUK Protocol address.
* **withdrawStableToken**: To withdraw stable tokens to specified account, Only admin.
* **withdrawOtherToken**: To withdraw other tokens to specified account, Only admin.
* **stableRefund**: To refund stable tokens to specified account, only Buk protocol can call this.
* **otherRefund**: To refund other tokens to specified account, only Buk protocol can call this.
* **getStableToken**: Get the address of the stable token.

#### Private Functions:

* **\\\_setStableToken**: Set a new stable token address.

### Events

* **SetStableToken**: Emitted when a new stable token address is set.
* **BukProtocolSet**: Emitted when a new BUK Protocol address is set.
* **WithdrawnToken**: Emitted when a withdrawn token.
* **Refund**: Emitted when a token refunded.

### Interface: ITreasury

The `ITreasury` interface provides a blueprint for the main `Treasury` contract. It defines the essential functions, events, and data structures that the main contract should implement.

#### Key Components:

* **Events**: Various events like `SetStableToken`, `BukProtocolSet`, `WithdrawnToken`, `Refund`etc.
* **Functions**: Functions like `stableRefund`, `otherRefund`, `getStableToken`, etc.

### License

This project is licensed under the MIT License.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bukprotocol.io/buk-protocol-v2/buk-protocol-smart-contracts/buk-treasury.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
