IFM_BC_Bancor_Redeeming_VirtualSupply_v1.sol

Git Source

Author: Inverter Network

This contract enables the issuance and redeeming of tokens on a bonding curve, using a virtual supply for both the issuance and the collateral as input.

Functions

setReserveRatioForBuying

Set the reserve ratio used for issuing tokens on a bonding curve.

This function can only be called by the {Orchestrator_v1} admin.

function setReserveRatioForBuying(uint32 _reserveRatio) external;

Parameters

Name
Type
Description

_reserveRatio

uint32

The new reserve ratio for buying, expressed in PPM.

setReserveRatioForSelling

Set the reserve ratio used for redeeming tokens on a bonding curve.

This function can only be called by the {Orchestrator_v1} admin.

function setReserveRatioForSelling(uint32 _reserveRatio) external;

Parameters

Name
Type
Description

_reserveRatio

uint32

The new reserve ratio for selling, expressed in PPM.

getReserveRatioForBuying

Returns reserve ratio set for buying, used in the {BancorFormula} contract.

function getReserveRatioForBuying() external view returns (uint32);

Returns

Name
Type
Description

<none>

uint32

Reserve Ratio for buying.

getReserveRatioForSelling

Returns reserve ratio set for selling, used in the {BancorFormula} contract.

function getReserveRatioForSelling() external view returns (uint32);

Returns

Name
Type
Description

<none>

uint32

Reserve Ratio for selling.

Events

BuyReserveRatioSet

Event emitted when the reserve ratio for buying is updated.

event BuyReserveRatioSet(uint32 newBuyReserveRatio, uint32 oldBuyReserveRatio);

Parameters

Name
Type
Description

newBuyReserveRatio

uint32

The new reserve ratio for buying.

oldBuyReserveRatio

uint32

The old reserve ratio for buying.

SellReserveRatioSet

Event emitted when the reserve ratio for selling is updated.

event SellReserveRatioSet(
    uint32 newSellReserveRatio, uint32 oldSellReserveRatio
);

Parameters

Name
Type
Description

newSellReserveRatio

uint32

The new reserve ratio for selling.

oldSellReserveRatio

uint32

The old reserve ratio for selling.

Errors

Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidReserveRatio

Reserve ratio can not be be bigger than 100% expressed in PPM.

error Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidReserveRatio();

Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidTokenDecimal

To avoid destructive precision loss when using the Bancor Formula, the Token decimals should:

  • Not be lower than 7 decimals.

  • Higher or equal to the collateral token decimals.

error Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidTokenDecimal();

Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidBancorFormula

Invalid Bancor Formula contract

error Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidBancorFormula();

Module__FM_BC_Bancor_Redeeming_VirtualSupply__CurveInteractionsMustBeClosed

Buying and Selling must be closed before changing the virtual supply.

error Module__FM_BC_Bancor_Redeeming_VirtualSupply__CurveInteractionsMustBeClosed(
);

Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidOrchestratorTokenWithdrawAmount

Funding manager does not hold the amount of collateral the payment client tries to transfer.

error Module__FM_BC_Bancor_Redeeming_VirtualSupply__InvalidOrchestratorTokenWithdrawAmount(
);

Structs

BondingCurveProperties

Struct used to store information about the bonding curve properties.

struct BondingCurveProperties {
    address formula;
    uint32 reserveRatioForBuying;
    uint32 reserveRatioForSelling;
    uint buyFee;
    uint sellFee;
    bool buyIsOpen;
    bool sellIsOpen;
    uint initialIssuanceSupply;
    uint initialCollateralSupply;
}

Properties

Name
Type
Description

formula

address

The formula contract used to calculate the issuance and redemption rate.

reserveRatioForBuying

uint32

The reserve ratio, expressed in PPM, used for issuance on the bonding curve.

reserveRatioForSelling

uint32

The reserve ratio, expressed in PPM, used for redeeming on the bonding curve.

buyFee

uint256

The buy fee expressed in base points.

sellFee

uint256

The sell fee expressed in base points.

buyIsOpen

bool

The indicator used for enabling/disabling the buying functionalities on deployment.

sellIsOpen

bool

The indicator used for enabling/disabling the selling functionalities on deployment.

initialIssuanceSupply

uint256

The initial virtual issuance token supply.

initialCollateralSupply

uint256

The initial virtual collateral token supply.

Last updated