> For the complete documentation index, see [llms.txt](https://docs.inverter.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inverter.network/contracts/technical-reference/modules/funding-manager/bonding-curve/interfaces/iredeemingbondingcurvebase_v1.sol.md).

# IRedeemingBondingCurveBase\_v1.sol

[Git Source](https://github.com/InverterNetwork/inverter-contracts/blob/649b450f02fc8b735c128ff0821467e71966c666/src/modules/fundingManager/bondingCurve/interfaces/IRedeemingBondingCurveBase_v1.sol)

**Author:** Inverter Network

Interface that enables the management of the the redemption of issuance for collateral along a bonding curve in the Inverter Network, including fee handling and sell functionality control.

### Functions

#### sellTo

Redeem tokens and directs the proceeds to a specified receiver address.

*Executes a sell order, with the proceeds being sent directly to the \_receiver's address. This function wraps the `_sellOrder` internal function with specified parameters to handle the transaction and direct the proceeds.*

```solidity
function sellTo(address _receiver, uint _depositAmount, uint _minAmountOut)
    external;
```

**Parameters**

| Name             | Type      | Description                                                                               |
| ---------------- | --------- | ----------------------------------------------------------------------------------------- |
| `_receiver`      | `address` | The address that will receive the redeemed tokens.                                        |
| `_depositAmount` | `uint256` | The amount of tokens to be sold.                                                          |
| `_minAmountOut`  | `uint256` | The minimum acceptable amount of proceeds that the receiver should receive from the sale. |

#### sell

Redeem collateral for the sender's address.

*Redirects to the internal function `_sellOrder` by passing the sender's address and deposit amount.*

```solidity
function sell(uint _depositAmount, uint _minAmountOut) external;
```

**Parameters**

| Name             | Type      | Description                                                                     |
| ---------------- | --------- | ------------------------------------------------------------------------------- |
| `_depositAmount` | `uint256` | The amount of issued token deposited.                                           |
| `_minAmountOut`  | `uint256` | The minimum acceptable amount the user expects to receive from the transaction. |

#### openSell

Opens the selling functionality for the collateral.

*Only callable by the {Orchestrator\_v1} admin. Reverts if selling is already open.*

```solidity
function openSell() external;
```

#### closeSell

Closes the selling functionality for the collateral.

*Only callable by the {Orchestrator\_v1} admin. Reverts if selling is already closed.*

```solidity
function closeSell() external;
```

#### setSellFee

Sets the fee percentage for selling collateral, payed in collateral.

*Only callable by the {Orchestrator\_v1} admin. The fee cannot exceed 10000 basis points. Reverts if an invalid fee is provided.*

```solidity
function setSellFee(uint _fee) external;
```

**Parameters**

| Name   | Type      | Description              |
| ------ | --------- | ------------------------ |
| `_fee` | `uint256` | The fee in basis points. |

#### getStaticPriceForSelling

Calculates and returns the static price for selling the issuance token.

```solidity
function getStaticPriceForSelling() external view returns (uint);
```

**Returns**

| Name     | Type      | Description                                           |
| -------- | --------- | ----------------------------------------------------- |
| `<none>` | `uint256` | uint The static price for selling the issuance token. |

#### calculateSaleReturn

Calculates the amount of tokens to be redeemed based on a given deposit amount.

*This function takes into account any applicable sell fees before computing the collateral amount to be redeemed. Revert when `_depositAmount` is zero.*

```solidity
function calculateSaleReturn(uint _depositAmount)
    external
    returns (uint redeemAmount);
```

**Parameters**

| Name             | Type      | Description                                 |
| ---------------- | --------- | ------------------------------------------- |
| `_depositAmount` | `uint256` | The amount of tokens deposited by the user. |

**Returns**

| Name           | Type      | Description                                                                |
| -------------- | --------- | -------------------------------------------------------------------------- |
| `redeemAmount` | `uint256` | The amount of collateral that will be redeemed as a result of the deposit. |

### Events

#### SellingEnabled

Event emitted when selling is opened.

```solidity
event SellingEnabled();
```

#### SellingDisabled

Event emitted when selling is closed.

```solidity
event SellingDisabled();
```

#### SellFeeUpdated

Event emitted when sell fee is updated.

```solidity
event SellFeeUpdated(uint newSellFee, uint oldSellFee);
```

**Parameters**

| Name         | Type      | Description       |
| ------------ | --------- | ----------------- |
| `newSellFee` | `uint256` | The new sell fee. |
| `oldSellFee` | `uint256` | The old sell fee. |

#### TokensSold

Event emitted when tokens have been succesfully redeemed.

```solidity
event TokensSold(
    address indexed receiver,
    uint depositAmount,
    uint receivedAmount,
    address seller
);
```

**Parameters**

| Name             | Type      | Description                                        |
| ---------------- | --------- | -------------------------------------------------- |
| `receiver`       | `address` | The address that will receive the redeemed tokens. |
| `depositAmount`  | `uint256` | The amount of issued token deposited.              |
| `receivedAmount` | `uint256` | The amount of collateral token received.           |
| `seller`         | `address` | The address that initiated the sell order.         |

### Errors

#### Module\_\_RedeemingBondingCurveBase\_\_SellingFunctionaltiesClosed

Selling functionalities are set to closed.

```solidity
error Module__RedeemingBondingCurveBase__SellingFunctionaltiesClosed();
```

#### Module\_\_RedeemingBondingCurveBase\_\_InsufficientCollateralForProjectFee

Insufficient collateral tokens are held to cover the project collateral fee.

```solidity
error Module__RedeemingBondingCurveBase__InsufficientCollateralForProjectFee();
```
