Skip to main content

JBETHERC20ProjectPayer

Sends ETH or ERC20's to a project treasury as it receives direct payments or has it's functions called.

Inherit from this contract or borrow from its logic to forward ETH or ERC20's to project treasuries from within other contracts.

Code

https://github.com/jbx-protocol/juice-contracts-v2/blob/main/contracts/JBETHERC20ProjectPayer.sol

Addresses

There can be several instances of this contract deployed.

Interfaces

NameDescription
IJBProjectPayerGeneral interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.

Inheritance

ContractDescription
OwnableIncludes convenience functionality for specifying an address that owns the contract, with modifiers that only allow access by the owner.
ERC165Introspection on interface adherance.

Constructor

/**
@param _defaultProjectId The ID of the project whose treasury should be forwarded this contract's received payments.
@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 _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project.
@param _directory A contract storing directories of terminals and controllers for each project.
@param _owner The address that will own the contract.
*/
constructor(
uint256 _defaultProjectId,
address payable _defaultBeneficiary,
bool _defaultPreferClaimedTokens,
string memory _defaultMemo,
bytes memory _defaultMetadata,
bool _defaultPreferAddToBalance,
IJBDirectory _directory,
address _owner
) {
defaultProjectId = _defaultProjectId;
defaultBeneficiary = _defaultBeneficiary;
defaultPreferClaimedTokens = _defaultPreferClaimedTokens;
defaultMemo = _defaultMemo;
defaultMetadata = _defaultMetadata;
defaultPreferAddToBalance = _defaultPreferAddToBalance;
directory = _directory;

_transferOwnership(_owner);
}
  • _defaultProjectId is the ID of the project whose treasury should be forwarded this contract's received payments.
  • _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 the memo that'll be passed along to the emitted event..
  • _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 the pay function or the addToBalance function of a project.
  • _directory is a contract storing directories of terminals and controllers for each project.
  • _owner is the address that will own the contract.

Events

NameData
SetDefaultValues
  • uint256 indexed projectId
  • address indexed beneficiary
  • bool preferClaimedTokens
  • string memo
  • bytes metadata
  • bool preferAddToBalance
  • address caller

Properties

NameDefinition
directory

Returns

defaultProjectId

Returns

  • uint256
defaultBeneficiary

Returns

  • address
defaultPreferClaimedTokens

Returns

  • bool
defaultMemo

Returns

  • string
defaultMetadata

Returns

  • bytes
defaultPreferAddToBalance

Returns

  • bool

Read

FunctionDefinition
supportsInterface

Params

  • uint256 _interfaceId

Returns

  • bool

Write

FunctionDefinition
receive

Traits

  • payable
  • virtual
setDefaultValues

Traits

Params

  • uint256 _projectId
  • address payable _beneficiary
  • bool _preferClaimedTokens
  • string _memo
  • bytes _metadata
pay

Traits

  • payable
  • virtual

Params

  • uint256 _projectId
  • address _token
  • uint256 _amount
  • uint256 _decimals
  • address _beneficiary
  • uint256 _minReturnedTokens
  • bool _preferClaimedTokens
  • string _memo
  • bytes _metadata
addToBalanceOf

Traits

  • payable
  • virtual

Params

  • uint256 _projectId
  • address _token
  • uint256 _amount
  • uint256 _decimals
  • string _memo
  • bytes _metadata
_pay

Traits

  • internal
  • virtual

Params

  • uint256 _projectId
  • address _token
  • uint256 _amount
  • uint256 _decimals
  • address _beneficiary
  • uint256 _minReturnedTokens
  • bool _preferClaimedTokens
  • string _memo
  • bytes _metadata
_addToBalanceOf

Traits

  • internal
  • virtual

Params

  • uint256 _projectId
  • address _token
  • uint256 _amount
  • uint256 _decimals
  • string _memo