> For the complete documentation index, see [llms.txt](https://docs.augmentlabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augmentlabs.io/smart-contracts/token-controller.md).

# Token Controller

Token Controller is a contract used to redeem USC for AGC and vice versa

## Overview

Contract: [Controller.sol](https://github.com/augmentlabs-io/contracts/blob/main/contracts/Controller.sol)

TokenController is an `Upgradeable` smart contract that acts as a bridge for exchanging USC for AGC and vice versa.

## Dependencies

* **UUPSUpgradeable**: Openzeppelin's smart contract that makes a smart contract upgradeable.
* **Pausable:** Allows for pausing/unpausing in case of emergencies.
* **AccessControl**: Allows for multiple permission roles to exist in the same contract.

## How it works

The TokenController will have perform the following redeeming actions:

* **Redeem USC:** TokenController will burn user's approved [USC tokens](/smart-contracts/usc-token.md) and mint a certain amount of [AGC tokens](/smart-contracts/agc-token.md) to the user.
* **Redeem AGC:** TokenController will burn user's AGC tokens and mint a certain amount of USC to the user.

Only Admin and backend service with **Redeemer** role can call the `redeemUSC` and `redeemAGC` functions.

## Roles

* **Admin (DEFAULT\_ADMIN\_ROLE):** Admin role is able to pause/unpause the smart contract and can perform redeeming actions.\
  \
  **Admin** role will be held be a gnosis safe address to ensure security.
* **Redeemer (REDEEMER\_ROLE): Redeemer** role is able to perform `redeemUSC`  and `redeemAGC` actions. **Redeemer** role will be held by the backend service to perform the redeem actions.
* **Pauser (PAUSER\_ROLE):** **Pauser** role is able to pause/unpause the contract in case of emergencies. Initially no specific address is the holder of the **Pauser** role other than the **Admin.**
* **Upgrader (UPGRADER\_ROLE):** **Upgrader** role is able to upgrade the smart contract for future phases. Initially no specific address is the holder of the **Upgrader** role other than the **Admin.**

## **Participants**

* Gnosis-safe address as **Admin**: This ensures important roles are secure and doesn't have single-point-of-failure. Also for future extension, Admin can grant roles to other addresses if needed.&#x20;
* Backend service as **Redeemer**: This allows the backend service to perform redeem by interacting with the contract directly.
* User: Not allowed to interact with the TokenController due to insufficient permission.
