# RevenueSplitBuyBack

## Process

![](https://1563241728-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgJxLWD6SqMELu7agWt%2Fuploads%2FL15VD5RSWEar5JI3hvLh%2FbuyBackForStakers.png?alt=media\&token=c1eb0f2e-3da1-4a93-8123-54c7984d9900)

## 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. |
