FM_BC_Restricted_Bancor_Redeeming_VirtualSupply_v1.sol
Inherits: FM_BC_Bancor_Redeeming_VirtualSupply_v1
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. It integrates Aragon's Bancor Formula to manage the calculations for token issuance and redemption rates based on specified reserve ratios.
It overrides the buyFor()
and sellTo()
functions of its parent contract to limit them to callers holding a "Curve Interaction" role. Since the upstream functions buy()
and sell()
call these functions internally, they also become gated. PLEASE NOTE: This means that the workflow itself can only mint tokens through buying and selling by somebody with the CURVE_INTERACTION_ROLE
, but NOT that there are no other ways to mint tokens. The Bonding Curve uses an external token contract, and there is no guarantee that said uses an external token contract, and there is no guarantee that said contract won't have an additional way to mint tokens (and potentially sell them on the cruve to receive backing collateral)
State Variables
CURVE_INTERACTION_ROLE
Minter/Burner Role.
__gap
Storage gap for future upgrades.
Functions
buyFor
Buy tokens on behalf of a specified receiver address. This function is subject to a transactional limit, determined by the deposit token's decimal precision and the underlying bonding curve algorithm.
Adds additional role check to the buyFor function.
Parameters
_receiver
address
The address that will receive the bought tokens.
_depositAmount
uint256
The amount of collateral token depoisited.
_minAmountOut
uint256
The minimum acceptable amount the user expects to receive from the transaction.
sellTo
Redeem tokens and direct the proceeds to a specified receiver address. This function is subject to a transactional limit, determined by the issuing token's decimal precision and the underlying bonding curve algorithm.
Adds addtional role check to the sellTo function.
Parameters
_receiver
address
The address that will receive the redeemed tokens.
_depositAmount
uint256
The amount of issued token to deposited.
_minAmountOut
uint256
The minimum acceptable amount the user expects to receive from the transaction.
Errors
Module__FM_BC_Restricted_Bancor_Redeeming_VirtualSupply__FeatureDeactivated
The feature is deactivated in this implementation.
Last updated