# RevenueSplitBuyBack

## Process

![](/files/rLYBcitqwDVuHGOrpPWn)

## Functions

### notifyRedistributionAmount()

`function notifyRedistributionAmount (address _mAsset, uint256 _amount) external`

Simply transfers the mAsset from the sender to here

| Parameter | Type    | Description               |
| --------- | ------- | ------------------------- |
| `_mAsset` | address | Address of mAsset         |
| `_amount` | uint256 | Units of mAsset collected |

### buyBackRewards()

`function buyBackRewards (address[] mAssets, uint256[] minBassetsAmount, uint256[] minRewardsAmounts, bytes[] uniswapPaths) external`

Buys reward tokens, eg MTA, using mAssets like mUSD or mBTC from protocol governance fees.

| Parameter           | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mAssets`           | address\[] | Addresses of mAssets that are to be sold for rewards. eg mUSD and mBTC.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `minBassetsAmount`  | uint256\[] | <p>Minimum amount of bAsset tokens to receive for each redeem of mAssets. </p><p></p><p>The amount uses the decimal places of the bAsset. </p><p>Example 1: Redeeming 10,000 mUSD with a min 2% slippage to USDC which has 6 decimal places.</p><p>minBassetsAmounts = 10,000 mAssets \* slippage 0.98 \* USDC decimals 1e6 = 1e4 \* 0.98 \* 1e6 = 1e10 \* 0.98 = 98e8</p><p></p><p>Example 2: Redeeming 1 mBTC with a min 5% slippage to WBTC which has 8 decimal places. minBassetsAmounts = 1 mAsset \* slippage 0.95 \* WBTC decimals 1e8 = 0.95 \* 1e8 = 95e6</p>                                                                      |
| `minRewardsAmounts` | uint256\[] | <p>Minimum amount of reward tokens received from the sale of bAssets. The amount uses the decimal places of the rewards token.</p><p></p><p>Example 1: Swapping 10,000 USDC with a min 1% slippage to MTA which has 18 decimal places. minRewardsAmounts = 10,000 USDC \* slippage 0.99 \* MTA decimals 1e18 \* MTA/USD rate 1.2 = 1e4 \* 0.99 \* 1e18 \* 1.2 = 1e22 \* 0.99 = 99e20 </p><p></p><p>Example 1: Swapping 1 WBTC with a min 3% slippage to MTA which has 18 decimal places. minRewardsAmounts = 1 WBTC \* slippage 0.97 \* MTA decimals 1e18 \* MTA/BTC rate 0.00001 = 1 \* 0.97 \* 1e18 \* 0.00001 = 0.97 \* 1e13 = 97e11</p> |
| `uniswapPaths`      | bytes\[]   | The Uniswap V3 bytes encoded paths.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

### donateRewards()

`function donateRewards () external`

Donates purchased rewards, eg MTA, to staking contracts via the Emissions Controller.

### addStakingContract()

`function addStakingContract (uint16 _stakingDialId) external`

Adds a new staking contract that will receive MTA rewards

| Parameter        | Type   | Description                                                            |
| ---------------- | ------ | ---------------------------------------------------------------------- |
| `_stakingDialId` | uint16 | dial identifier from the Emissions Controller of the staking contract. |


---

# 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://developers.mstable.org/emissions-controller/revenuesplitbuyback.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.
