Generic terminal managing all inflows and outflows of funds into the protocol ecosystem.
Generic terminal managing all inflows and outflows of funds into the protocol ecosystem.
@dev
@dev
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.
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.
@dev
@dev
Adheres to -
Adheres to -
IJBPayoutRedemptionPaymentTerminal: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
IJBPayoutRedemptionPaymentTerminal3_1: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
@dev
@dev
Inherits from -
Inherits from -
JBSingleTokenPaymentTerminal: Generic terminal managing all inflows of funds into the protocol ecosystem for one token.
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.
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.
Ownable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions.
*/
*/
abstract contract JBPayoutRedemptionPaymentTerminal is
abstract contract JBPayoutRedemptionPaymentTerminal3_1 is
JBSingleTokenPaymentTerminal,
JBSingleTokenPaymentTerminal,
JBOperatable,
JBOperatable,
Ownable,
Ownable,
IJBPayoutRedemptionPaymentTerminal
IJBPayoutRedemptionPaymentTerminal3_1
{
{
// A library that parses the packed funding cycle metadata into a friendlier format.
// A library that parses the packed funding cycle metadata into a friendlier format.
using JBFundingCycleMetadataResolver for JBFundingCycle;
using JBFundingCycleMetadataResolver for JBFundingCycle;
The data source that returns a discount to apply to a project's fee.
The data source that returns a discount to apply to a project's fee.
*/
*/
IJBFeeGauge public override feeGauge;
IJBFeeGauge public override feeGauge;
/**
/**
@notice
@notice
Addresses that can be paid towards from this terminal without incurring a fee.
Addresses that can be paid towards from this terminal without incurring a fee.
@dev
@dev
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.
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.
_address The address that can be paid toward.
*/
*/
mapping(address => bool) public override isFeelessAddress;
mapping(address => bool) public override isFeelessAddress;
@param _projectId The ID of the project being paid.
@param _projectId The ID of the project being paid.
@param _amount 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.
@param _amount 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.
@param _token The token being paid. This terminal ignores this property since it only manages one token.
@param _token The token being paid. This terminal ignores this property since it only manages one token.
@param _beneficiary The address to mint tokens for and pass along to the funding cycle's data source and delegate.
@param _beneficiary The address to mint tokens for and pass along to the funding cycle's data source and delegate.
@param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with the same amount of decimals as this terminal.
@param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with the same amount of decimals as this terminal.
@param _preferClaimedTokens 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.
@param _preferClaimedTokens 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.
@param _memo 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.
@param _memo 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.
@param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.
@param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.
@return The number of tokens minted for the beneficiary, as a fixed point number with 18 decimals.
@return The number of tokens minted for the beneficiary, as a fixed point number with 18 decimals.
// The amount should reflect the change in balance.
// The amount should reflect the change in balance.
_amount = _balance() - _balanceBefore;
_amount = _balance() - _balanceBefore;
}
}
// If this terminal's token is ETH, override _amount with msg.value.
// If this terminal's token is ETH, override _amount with msg.value.
else _amount = msg.value;
else _amount = msg.value;
return
return
_pay(
_pay(
_amount,
_amount,
msg.sender,
msg.sender,
_projectId,
_projectId,
_beneficiary,
_beneficiary,
_minReturnedTokens,
_minReturnedTokens,
_preferClaimedTokens,
_preferClaimedTokens,
_memo,
_memo,
_metadata
_metadata
);
);
}
}
/**
/**
@notice
@notice
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.
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.
@dev
@dev
Only a token holder or a designated operator can redeem its tokens.
Only a token holder or a designated operator can redeem its tokens.
@param _holder The account to redeem tokens for.
@param _holder The account to redeem tokens for.
@param _projectId The ID of the project to which the tokens being redeemed belong.
@param _projectId The ID of the project to which the tokens being redeemed belong.
@param _tokenCount The number of project tokens to redeem, as a fixed point number with 18 decimals.
@param _tokenCount The number of project tokens to redeem, as a fixed point number with 18 decimals.
@param _token The token being reclaimed. This terminal ignores this property since it only manages one token.
@param _token The token being reclaimed. This terminal ignores this property since it only manages one token.
@param _minReturnedTokens The minimum amount of terminal tokens expected in return, as a fixed point number with the same amount of decimals as the terminal.
@param _minReturnedTokens The minimum amount of terminal tokens expected in return, as a fixed point number with the same amount of decimals as the terminal.
@param _beneficiary The address to send the terminal tokens to.
@param _beneficiary The address to send the terminal tokens to.
@param _memo A memo to pass along to the emitted event.
@param _memo A memo to pass along to the emitted event.
@param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.
@param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.
@return reclaimAmount The amount of terminal tokens that the project tokens were redeemed for, as a fixed point number with 18 decimals.
@return reclaimAmount The amount of terminal tokens that the project tokens were redeemed for, as a fixed point number with 18 decimals.
_token; // Prevents unused var compiler and natspec complaints.
_token; // Prevents unused var compiler and natspec complaints.
return
return
_redeemTokensOf(
_redeemTokensOf(
_holder,
_holder,
_projectId,
_projectId,
_tokenCount,
_tokenCount,
_minReturnedTokens,
_minReturnedTokens,
_beneficiary,
_beneficiary,
_memo,
_memo,
_metadata
_metadata
);
);
}
}
/**
/**
@notice
@notice
Distributes payouts for a project with the distribution limit of its current funding cycle.
Distributes payouts for a project with the distribution limit of its current funding cycle.
@dev
@dev
Payouts are sent to the preprogrammed splits. Any leftover is sent to the project's owner.
Payouts are sent to the preprogrammed splits. Any leftover is sent to the project's owner.
@dev
@dev
Anyone can distribute payouts on a project's behalf. The project can preconfigure a wildcard split that is used to send funds to msg.sender. This can be used to incentivize calling this function.
Anyone can distribute payouts on a project's behalf. The project can preconfigure a wildcard split that is used to send funds to msg.sender. This can be used to incentivize calling this function.
@dev
@dev
All funds distributed outside of this contract or any feeless terminals incure the protocol fee.
All funds distributed outside of this contract or any feeless terminals incure the protocol fee.
@param _projectId The ID of the project having its payouts distributed.
@param _projectId The ID of the project having its payouts distributed.
@param _amount The amount of terminal tokens to distribute, as a fixed point number with same number of decimals as this terminal.
@param _amount The amount of terminal tokens to distribute, as a fixed point number with same number of decimals as this terminal.
@param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's distribution limit currency.
@param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's distribution limit currency.
@param _token The token being distributed. This terminal ignores this property since it only manages one token.
@param _token The token being distributed. This terminal ignores this property since it only manages one token.
@param _minReturnedTokens The minimum number of terminal tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with the same number of decimals as this terminal.
@param _minReturnedTokens The minimum number of terminal tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with the same number of decimals as this terminal.
@param _memo A memo to pass along to the emitted event.
@param _metadata Bytes to send along to the emitted event, if provided.
@return netLeftoverDistributionAmount The amount that was sent to the project owner, as a fixed point number with the same amount of decimals as this terminal.
@return netLeftoverDistributionAmount The amount that was sent to the project owner, as a fixed point number with the same amount of decimals as this terminal.
Allows a project to send funds from its overflow up to the preconfigured allowance.
Allows a project to send funds from its overflow up to the preconfigured allowance.
@dev
@dev
Only a project's owner or a designated operator can use its allowance.
Only a project's owner or a designated operator can use its allowance.
@dev
@dev
Incurs the protocol fee.
Incurs the protocol fee.
@param _projectId The ID of the project to use the allowance of.
@param _projectId The ID of the project to use the allowance of.
@param _amount The amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal.
@param _amount The amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal.
@param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency.
@param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency.
@param _token The token being distributed. This terminal ignores this property since it only manages one token.
@param _token The token being distributed. This terminal ignores this property since it only manages one token.
@param _minReturnedTokens The minimum number of tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with 18 decimals.
@param _minReturnedTokens The minimum number of tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with 18 decimals.
@param _beneficiary The address to send the funds to.
@param _beneficiary The address to send the funds to.
@param _memo A memo to pass along to the emitted event.
@param _memo A memo to pass along to the emitted event.
@param _metadata Bytes to send along to the emitted event, if provided.
@return netDistributedAmount The amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.
@return netDistributedAmount The amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.
Receives funds belonging to the specified project.
Receives funds belonging to the specified project.
@param _projectId The ID of the project to which the funds received belong.
@param _projectId The ID of the project to which the funds received belong.
@param _amount The amount of tokens to add, as a fixed point number with the same number of decimals as this terminal. If this is an ETH terminal, this is ignored and msg.value is used instead.
@param _amount The amount of tokens to add, as a fixed point number with the same number of decimals as this terminal. If this is an ETH terminal, this is ignored and msg.value is used instead.
@param _token The token being paid. This terminal ignores this property since it only manages one currency.
@param _token The token being paid. This terminal ignores this property since it only manages one currency.
@param _memo A memo to pass along to the emitted event.
@param _memo A memo to pass along to the emitted event.
@param _metadata Extra data to pass along to the emitted event.
@param _metadata Extra data to pass along to the emitted event.