> For the complete documentation index, see [llms.txt](https://docs.prl.one/buttonwood/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prl.one/buttonwood/developers/button-wrappers/unbuttontoken.md).

# UnbuttonToken

The UnbuttonToken wraps elastic balance (rebasing) tokens like AMPL, Chai and AAVE's aTokens, to create a fixed balance representation.

The ratio of a user's balance to the total supply represents their share of the total deposit pool.

## API Documentation

## `initialize(address underlying_, string name_, string symbol_, uint256 initialRate)` (public)

Initializes the token with the given parameters.

## `mint(uint256 amount) → uint256` (external)

Mints the given amount of Unbutton tokens for the user. Transfers an equivalent value of underlying tokens from the user to the contract.

## `mintFor(address to, uint256 amount) → uint256` (external)

Mints the given amount of Unbutton tokens for `to`. Transfers an equivalent value of underlying tokens from the caller to the contract.

## `burn(uint256 amount) → uint256` (external)

Burns the given amount of Unbutton tokens from the caller. Transfers an equivalent value of underlying tokens from the contract to the caller.

## `burnTo(address to, uint256 amount) → uint256` (external)

Burns the given amount of Unbutton tokens from the caller. Transfers an equivalent value of underlying tokens from the contract to `to`.

## `burnAll() → uint256` (external)

Burns all Unbutton tokens from the caller. Transfers an equivalent value of underlying tokens from the contract to the caller.

## `burnAllTo(address to) → uint256` (external)

Burns all Unbutton tokens from the caller. Transfers an equivalent value of underlying tokens from the contract to `to`.

## `deposit(uint256 uAmount) → uint256` (external)

Deposit the given number of underlying tokens from the caller to the contract. Mints an equivalent value of Unbutton tokens to the caller.

## `depositFor(address to, uint256 uAmount) → uint256` (external)

Deposit the given number of underlying tokens from the caller to the contract. Mints an equivalent value of Unbutton tokens to `to`.

## `withdraw(uint256 uAmount) → uint256` (external)

Withdraw the given number of underlying tokens from the contract. Transfers an equivalent value of Unbutton tokens from the caller to the contract.

## `withdrawTo(address to, uint256 uAmount) → uint256` (external)

Withdraw the given number of underlying tokens to `to` from the contract. Transfers an equivalent value of Unbutton tokens from the caller to the contract.

## `withdrawAll() → uint256` (external)

Withdraw caller's entire balance of underlying tokens. Transfers an equivalent value of Unbutton tokens from the caller to the contract.

## `withdrawAllTo(address to) → uint256` (external)

Withdraw caller's entire balance of underlying tokens for `to`. Transfers an equivalent value of Unbutton tokens from the caller to the contract.

## `totalUnderlying() → uint256` (external)

The total number of underlying tokens held by the contract.

## `balanceOfUnderlying(address owner) → uint256` (external)

Returns `owner`'s balance in terms of the underlying token.

## `underlyingToWrapper(uint256 uAmount) → uint256` (external)

Returns the equivalent value of Unbutton tokens for the given amount of underlying tokens.

## `wrapperToUnderlying(uint256 amount) → uint256` (external)

Returns the equivalent value of Unbutton tokens for the given amount of underlying tokens.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.prl.one/buttonwood/developers/button-wrappers/unbuttontoken.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
