JBPayoutRedemptionPaymentTerminal3_1
Generic terminal managing all inflows and outflows of funds into the protocol ecosystem.
Inherits: JBSingleTokenPaymentTerminal
, JBOperatable
, Ownable
, IJBPayoutRedemptionPaymentTerminal3_1
A project can transfer its funds, along with the power to reconfigure and mint/burn their tokens, from this contract to another allowed terminal of the same token type contract at any time.
Adheres to:
IJBPayoutRedemptionPaymentTerminal3_1
: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
Inherits from:
JBSingleTokenPaymentTerminal
: Generic terminal managing all inflows of funds into the protocol ecosystem for one token.JBOperatable
: Includes convenience functionality for checking a message sender's permissions before executing certain transactions.Ownable
: Includes convenience functionality for checking a message sender's permissions before executing certain transactions.*
State Variables
_FEE_CAP
Maximum fee that can be set for a funding cycle configuration.
Out of MAX_FEE (50_000_000 / 1_000_000_000).
uint256 internal constant _FEE_CAP = 50_000_000;
_FEE_BENEFICIARY_PROJECT_ID
The fee beneficiary project ID is 1, as it should be the first project launched during the deployment process.
uint256 internal constant _FEE_BENEFICIARY_PROJECT_ID = 1;
_heldFeesOf
Fees that are being held to be processed later.
- _projectId The ID of the project for which fees are being held.
mapping(uint256 => JBFee[]) internal _heldFeesOf;
projects
Mints ERC-721's that represent project ownership and transfers.
IJBProjects public immutable override projects;
directory
The directory of terminals and controllers for projects.
IJBDirectory public immutable override directory;
splitsStore
The contract that stores splits for each project.
IJBSplitsStore public immutable override splitsStore;
prices
The contract that exposes price feeds.
IJBPrices public immutable override prices;
store
The contract that stores and manages the terminal's data.
IJBSingleTokenPaymentTerminalStore public immutable override store;
baseWeightCurrency
The currency to base token issuance on.
If this differs from currency
, there must be a price feed available to convert currency
to baseWeightCurrency
.
uint256 public immutable override baseWeightCurrency;
payoutSplitsGroup
The group that payout splits coming from this terminal are identified by.
uint256 public immutable override payoutSplitsGroup;
fee
The platform fee percent.
Out of MAX_FEE (25_000_000 / 1_000_000_000)
uint256 public override fee = 25_000_000;
feeGauge
The data source that returns a discount to apply to a project's fee.
IJBFeeGauge public override feeGauge;
isFeelessAddress
Addresses that can be paid towards from this terminal without incurring a fee.
Only addresses that are considered to be contained within the ecosystem can be feeless. Funds sent outside the ecosystem may incur fees despite being stored as feeless.
- _address The address that can be paid toward.
mapping(address => bool) public override isFeelessAddress;
Functions
isTerminalOf
A modifier that verifies this terminal is a terminal of provided project ID.
modifier isTerminalOf(uint256 _projectId);
currentEthOverflowOf
Gets the current overflowed amount in this terminal for a specified project, in terms of ETH.
The current overflow is represented as a fixed point number with 18 decimals.
function currentEthOverflowOf(uint256 _projectId) external view virtual override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_projectId | uint256 | The ID of the project to get overflow for. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The current amount of ETH overflow that project has in this terminal, as a fixed point number with 18 decimals. |
heldFeesOf
The fees that are currently being held to be processed later for each project.
function heldFeesOf(uint256 _projectId) external view override returns (JBFee[] memory);
Parameters
Name | Type | Description |
---|---|---|
_projectId | uint256 | The ID of the project for which fees are being held. |
Returns
Name | Type | Description |
---|---|---|
<none> | JBFee[] | An array of fees that are being held. |
supportsInterface
Indicates if this contract adheres to the specified interface.
See IERC165-supportsInterface
.
function supportsInterface(bytes4 _interfaceId)
public
view
virtual
override(JBSingleTokenPaymentTerminal, IERC165)
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_interfaceId | bytes4 | The ID of the interface to check for adherance to. |
_balance
Checks the balance of tokens in this contract.
function _balance() internal view virtual returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The contract's balance. |
constructor
constructor(
address _token,
uint256 _decimals,
uint256 _currency,
uint256 _baseWeightCurrency,
uint256 _payoutSplitsGroup,
IJBOperatorStore _operatorStore,
IJBProjects _projects,
IJBDirectory _directory,
IJBSplitsStore _splitsStore,
IJBPrices _prices,
IJBSingleTokenPaymentTerminalStore _store,
address _owner
) payable JBSingleTokenPaymentTerminal(_token, _decimals, _currency) JBOperatable(_operatorStore);
Parameters
Name | Type | Description |
---|---|---|
_token | address | The token that this terminal manages. |
_decimals | uint256 | The number of decimals the token fixed point amounts are expected to have. |
_currency | uint256 | The currency that this terminal's token adheres to for price feeds. |
_baseWeightCurrency | uint256 | The currency to base token issuance on. |
_payoutSplitsGroup | uint256 | The group that denotes payout splits from this terminal in the splits store. |
_operatorStore | IJBOperatorStore | A contract storing operator assignments. |
_projects | IJBProjects | A contract which mints ERC-721's that represent project ownership and transfers. |
_directory | IJBDirectory | A contract storing directories of terminals and controllers for each project. |
_splitsStore | IJBSplitsStore | A contract that stores splits for each project. |
_prices | IJBPrices | A contract that exposes price feeds. |
_store | IJBSingleTokenPaymentTerminalStore | A contract that stores the terminal's data. |
_owner | address | The address that will own this contract. |
pay
Contribute tokens to a project.
function pay(
uint256 _projectId,
uint256 _amount,
address _token,
address _beneficiary,
uint256 _minReturnedTokens,
bool _preferClaimedTokens,
string calldata _memo,
bytes calldata _metadata
) external payable virtual override isTerminalOf(_projectId) returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_projectId | uint256 | The ID of the project being paid. |
_amount | uint256 | The amount of terminal tokens being received, as a fixed point number with the same amount of decimals as this terminal. If this terminal's token is ETH, this is ignored and msg.value is used in its place. |
_token | address | The token being paid. This terminal ignores this property since it only manages one token. |
_beneficiary | address | The address to mint tokens for and pass along to the funding cycle's data source and delegate. |
_minReturnedTokens | uint256 | The minimum number of project tokens expected in return, as a fixed point number with the same amount of decimals as this terminal. |
_preferClaimedTokens | bool | A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas. |
_memo | string | A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. |
_metadata | bytes | Bytes to send along to the data source, delegate, and emitted event, if provided. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of tokens minted for the beneficiary, as a fixed point number with 18 decimals. |
redeemTokensOf
Holders can redeem their tokens to claim the project's overflowed tokens, or to trigger rules determined by the project's current funding cycle's data source.
Only a token holder or a designated operator can redeem its tokens.
function redeemTokensOf(
address _holder,
uint256 _projectId,
uint256 _tokenCount,
address _token,
uint256 _minReturnedTokens,
address payable _beneficiary,
string memory _memo,
bytes memory _metadata
)
external
virtual
override
requirePermission(_holder, _projectId, JBOperations.REDEEM)
returns (uint256 reclaimAmount);