# UnifiController.sol

**Primary Uses -** The Unifi Controller is responsible for the setting the variables of UP minting on individual pairs as well as updating the redeem value of UP tokens globally.&#x20;

## uTrade V2 Controller Code / Interfaces

|                                             |           |
| ------------------------------------------- | --------- |
| uTrade V2 Controller (Solidity)             | Link Here |
| uTrade V2 Controller Interface as JSON      | Link Here |
| uTrade V2 Controller as Typescript          | Link Here |
| Import statement codeblock (when available) |           |

## uTrade V2 Controller Contract Addresses

| Network              | Address                                                                                                                                |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| ETH Main Net         | `0xCE17B79C9Ccf709528F120f66Fd3498B33D4F72F` ([Link](https://etherscan.io/address/0xCE17B79C9Ccf709528F120f66Fd3498B33D4F72F))         |
| ETH Ropsten Test Net | `0x4F916649463F4A74c536F3B6C599f66BBB94e4fc` ([Link](https://ropsten.etherscan.io/address/0x4F916649463F4A74c536F3B6C599f66BBB94e4fc)) |

## Events

### SwapFeesUPminted

```
event SwapFeesUpminted(address indexed pool, uint amountUPMinted, address defaultPoolAddress, uint platforUPFees);
```

The `SwapFeeUpminted` event is emitted whenever UP is minted. In the majority of cases, this will occur any time a trade occurs.&#x20;

#### Parameter Breakdown

| Parameter            | Type    | Description                                                                                     |
| -------------------- | ------- | ----------------------------------------------------------------------------------------------- |
| *pool*               | address | The liquidity pool where the UP was minted.                                                     |
| *amountUPMinted*     | uint    | The amount of UP minted during this event.                                                      |
| *defaultPoolAddress* | address | The pool representing the 'Super Pair' reward for UNIFI holders.                                |
| *platforUPFees*      | uint    | The amount of UP collected by the platform for increasing the redeem value and for Super Pairs. |

### UpdatePoolRewards

```
event UpdatePoolRewards(address indexed pool, uint rewards);    
```

The `UpdatePoolRewards` event is emitted when the amount of UP claimable by the liquidity providers in the liquidity pool is updated. This event occurs when a trade occurs and results in UP being minted for liquidity providers, or a liquidity provider performs a claim UP transaction.

#### Parameter Breakdown

| Parameter | Type    | Description                                                                      |
| --------- | ------- | -------------------------------------------------------------------------------- |
| *pool*    | address | The liquidity pool where the UP was minted.                                      |
| *rewards* | uint    | The amount of UP available to be claimed by all liquidity providers in the pool. |

## Read-Only Functions

#### feeSetter

```
function feeSetter() external view returns (address);
```

The `feeSetter` function returns the address of uTrade V2's Smart Contract which sets the fees for trading.

### WBNB

```
function WETH() external view returns (address);
```

The `WETH` function will return the address of WETH on Ethereum. As this does not change, it will always return `0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`.

### UNIFIUPVault

```
function UNIFIUPVault() external view returns (address);
```

The `UNIFIUPVault` function returns the address of the UPEth vault. This vault contains the ETH that is redeemable for UP.

### nativeFeeTo

```
function nativeFeeTo() external view returns (address);
```

The `nativeFeeTo` function returns the address where, in the case of Unifi Protocol collecting native token fees, the fees would be sent to.
