IBondingCurveBase_v1.sol

Git Source

Functions

buyFor

Buy tokens on behalf of a specified receiver address.

Redirects to the internal function _buyOrder by passing the receiver address and deposit amount.

function buyFor(address _receiver, uint _depositAmount, uint _minAmountOut)
    external;

Parameters

Name
Type
Description

_receiver

address

The address that will receive the bought tokens.

_depositAmount

uint256

The amount of collateral token deposited.

_minAmountOut

uint256

The minimum acceptable amount the user expects to receive from the transaction.

buy

Buy tokens for the sender's address.

Redirects to the internal function _buyOrder by passing the sender's address and deposit amount.

function buy(uint _depositAmount, uint _minAmountOut) external;

Parameters

Name
Type
Description

_depositAmount

uint256

The amount of collateral token depoisited.

_minAmountOut

uint256

The minimum acceptable amount the user expects to receive from the transaction.

openBuy

Opens the buying functionality for the token.

Only callable by the {Orchestrator_v1} admin. Reverts if buying is already open.

closeBuy

Closes the buying functionality for the token.

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

setBuyFee

Sets the fee percentage for buying tokens, payed in collateral.

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

Parameters

Name
Type
Description

_fee

uint256

The fee in basis points.

getStaticPriceForBuying

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

Returns

Name
Type
Description

<none>

uint256

uint The static price for buying the issuance token.

calculatePurchaseReturn

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

This function takes into account any applicable buy fees before computing the token amount to be minted. Revert when _depositAmount is zero.

Parameters

Name
Type
Description

_depositAmount

uint256

The amount of tokens deposited by the user.

Returns

Name
Type
Description

mintAmount

uint256

The amount of new tokens that will be minted as a result of the deposit.

withdrawProjectCollateralFee

Withdraw project collateral fee to the receiver address.

Parameters

Name
Type
Description

_receiver

address

The address that will receive the fee.

_amount

uint256

The amount of fee to withdraw.

projectCollateralFeeCollected

Returns the amount of fee in collateral token collected by the project.

getIssuanceToken

Returns the address of the issuance token.

Events

BuyingEnabled

Event emitted when buying is opened.

BuyingDisabled

Event emitted when buying is closed.

BuyFeeUpdated

Event emitted when buy fee is updated.

IssuanceTokenSet

Event emitted when the issuance token is updated.

ProjectCollateralFeeWithdrawn

Event emitted when project collateral fee is withdrawn.

ProjectCollateralFeeAdded

Event emitted when project collateral fee is added.

TokensBought

Event emitted when tokens have been succesfully issued.

Parameters

Name
Type
Description

receiver

address

The address that will receive the issued tokens.

depositAmount

uint256

The amount of collateral token deposited.

receivedAmount

uint256

The amount of issued token received.

buyer

address

The address that initiated the buy order.

TokenDecimalsUpdated

Event emitted when the decimals of the issuance token are updated.

Parameters

Name
Type
Description

oldDecimals

uint8

The old decimals of the issuance token.

newDecimals

uint8

The new decimals of the issuance token.

ProtocolFeeMinted

Event emitted when protocol fee has been minted to the treasury.

Parameters

Name
Type
Description

token

address

The token minted as protocol fee.

treasury

address

The protocol treasury address receiving the token fee amount.

feeAmount

uint256

The fee amount minted to the treasury.

Errors

Module__BondingCurveBase__InvalidFeePercentage

Percentage amount is bigger than 100%, i.e. 10_000.

Module__BondingCurveBase__InvalidDepositAmount

Deposit amount has to be larger than zero.

Module__BondingCurveBase__BuyingFunctionaltiesClosed

Buying functionalities are set to closed.

Module__BondingCurveBase__InvalidRecipient

Receiver address can not be zero address or. Bonding Curve Funding Manager itself.

Module__BondingCurveBase__InsufficientOutputAmount

Actual buy amount is lower than the minimum acceptable amount.

Module__BondingCurveBase__FeeAmountToHigh

The combination of protocol fee and workflow fee cant be higher than 100%.

Module__BondingCurveBase__InvalidWithdrawAmount

Withdrawl amount is bigger than project fee collected.

Module__BondingCurveBase__TradeAmountTooLow

Buy amount in relation to fee percentage to small, results in round down fee amount to zero.

Module__BondingCurveBase__InvalidMinAmountOut

The minimum amount out cannot be zero.

Structs

IssuanceToken

Struct used to store information about the issuance token.

Properties

Name
Type
Description

name

string

The name of the issuance token.

symbol

string

The symbol of the issuance token.

decimals

uint8

The decimals used within the issuance token.

maxSupply

uint256

The maximum supply of the issuance token.

Last updated