IRedeemingBondingCurveBase_v1.sol

Git Source

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.

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.

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.

function openSell() external;

closeSell

Closes the selling functionality for the collateral.

Only callable by the {Orchestrator_v1} admin. Reverts if selling is already closed.

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.

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.

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.

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.

event SellingEnabled();

SellingDisabled

Event emitted when selling is closed.

event SellingDisabled();

SellFeeUpdated

Event emitted when sell fee is updated.

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.

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.

error Module__RedeemingBondingCurveBase__SellingFunctionaltiesClosed();

Module__RedeemingBondingCurveBase__InsufficientCollateralForProjectFee

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

error Module__RedeemingBondingCurveBase__InsufficientCollateralForProjectFee();

Last updated