JBETHERC20SplitsPayer
Sends ETH or ERC20's to a group of splits as it receives direct payments or has its functions called.
Inherit from this contract or borrow from its logic to forward ETH or ERC20's to a group of splits from within other contracts.
Code
https://github.com/jbx-protocol/juice-contracts-v2/blob/main/contracts/JBETHERC20SplitsPayer.sol
Addresses
There can be several instances of this contract deployed.
Interfaces
Name | Description |
---|---|
IJBSplitsPayer | General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. |
Inheritance
Contract | Description |
---|---|
JBETHERC20ProjectPayer | Sends ETH or ERC20's to a project treasury as it receives direct payments or has it's functions called. |
ReentrancyGuard | Contract module that helps prevent reentrant calls to a function. |
ERC165 | Introspection on interface adherance. |
Constructor
/**
@param _defaultSplitsProjectId The ID of project for which the default splits are stored.
@param _defaultSplitsDomain The splits domain to payout when this contract receives direct payments.
@param _defaultSplitsGroup The splits group to payout when this contract receives direct payments.
@param _splitsStore A contract that stores splits for each project.
@param _defaultProjectId The ID of the project whose treasury should be forwarded the splits payer contract's received payment leftovers after distributing to the default splits group.
@param _defaultBeneficiary The address that'll receive the project's tokens.
@param _defaultPreferClaimedTokens A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet.
@param _defaultMemo 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 _defaultMetadata Bytes to send along to the project's data source and delegate, if provided.
@param _preferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project.
@param _owner The address that will own the contract.
*/
constructor(
uint256 _defaultSplitsProjectId,
uint256 _defaultSplitsDomain,
uint256 _defaultSplitsGroup,
IJBSplitsStore _splitsStore,
uint256 _defaultProjectId,
address payable _defaultBeneficiary,
bool _defaultPreferClaimedTokens,
string memory _defaultMemo,
bytes memory _defaultMetadata,
bool _preferAddToBalance,
address _owner
)
JBETHERC20ProjectPayer(
_defaultProjectId,
_defaultBeneficiary,
_defaultPreferClaimedTokens,
_defaultMemo,
_defaultMetadata,
_preferAddToBalance,
_splitsStore.directory(),
_owner
)
{
defaultSplitsProjectId = _defaultSplitsProjectId;
defaultSplitsDomain = _defaultSplitsDomain;
defaultSplitsGroup = _defaultSplitsGroup;
splitsStore = _splitsStore;
}
_defaultSplitsProjectId
is the ID of project for which the default splits are stored._defaultSplitsDomain
is the splits domain to payout when this contract receives direct payments._defaultSplitsGroup
is the splits group to payout when this contract receives direct payments._splitsStore
is a contract that stores splits for each project._defaultProjectId
is the ID of the project whose treasury should be forwarded the splits payer contract's received payment leftovers after distributing to the default splits group._defaultBeneficiary
is the address that'll receive the project's tokens._defaultPreferClaimedTokens
is a flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet._defaultMemo
is 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._defaultMetadata
are bytes to send along to the project's data source and delegate, if provided._defaultPreferAddToBalance
is a flag indicating if received payments should call thepay
function or theaddToBalance
function of a project._owner
is the address that will own the contract.
Events
Name | Data |
---|---|
SetDefaultSplits |
|
Pay |
|
AddToBalance |
|
DistributeToSplitGroup |
|
DistributeToSplit |
|
Properties
Name | Definition |
---|---|
splitsStore | Returns |
defaultSplitsProjectId | Returns
|
defaultSplitsDomain | Returns
|
defaultSplitsGroup | Returns
|
Read
Function | Definition |
---|---|
supportsInterface | Params
Returns
|
Write
Function | Definition |
---|---|
receive | Traits
|
setDefaultSplits | Traits
Params
|
pay | Traits
Params
|
addToBalanceOf | Traits
Params
|
_payToSplits | Traits
Params
|