Skip to main content

setDefaultValues

Contract: JBETHERC20ProjectPayer

Interface: IJBProjectPayer

Sets the default values that determine how to interact with a protocol treasury when this contract receives ETH directly.

Definition​

function setDefaultValues(
uint256 _projectId,
address payable _beneficiary,
bool _preferClaimedTokens,
string memory _memo,
bytes memory _metadata,
bool _defaultPreferAddToBalance
) external virtual override onlyOwner { ... }
  • Arguments:
    • _projectId is the ID of the project whose treasury should be forwarded this contract's received payments.
    • _beneficiary is the address that'll receive the project's tokens.
    • _preferClaimedTokens is a flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet.
    • _memo is the memo that'll be used.
    • _metadata is the metadata that'll be sent.
    • _defaultPreferAddToBalance is a flag indicating if received payments should call the pay function or the addToBalance function of a project.
  • Through the onlyOwner modifier, this function can only be accessed by the address that owns this contract.
  • The function can be overriden by inheriting contracts.
  • The function overrides a function definition from the IJBProjectPayer interface.
  • The function doesn't return anything.

Body​

  1. Set the default project ID if it has changed.

    // Set the default project ID if it has changed.
    if (_projectId != defaultProjectId) defaultProjectId = _projectId;

    Internal references:

  2. Set the default beneficiary if it has changed.

    // Set the default beneficiary if it has changed.
    if (_beneficiary != defaultBeneficiary) defaultBeneficiary = _beneficiary;

    Internal references:

  3. Set the default claimed token preference if it has changed.

    // Set the default claimed token preference if it has changed.
    if (_preferClaimedTokens != defaultPreferClaimedTokens)
    defaultPreferClaimedTokens = _preferClaimedTokens;

    Internal references:

  4. Set the default memo if it has changed.

    // Set the default memo if it has changed.
    if (keccak256(abi.encodePacked(_memo)) != keccak256(abi.encodePacked(defaultMemo)))
    defaultMemo = _memo;

    Internal references:

  5. Set the default metadata if it has changed.

    // Set the default metadata if it has changed.
    if (keccak256(abi.encodePacked(_metadata)) != keccak256(abi.encodePacked(defaultMetadata)))
    defaultMetadata = _metadata;

    Internal references:

  6. Set the default metadata if it has changed.

    // Set the add to balance preference if it has changed.
    if (_defaultPreferAddToBalance != defaultPreferAddToBalance)
    defaultPreferAddToBalance = _defaultPreferAddToBalance;

    Internal references:

  7. Emit a SetDefaultValues event with all relevant parameters.

    emit SetDefaultValues(
    _projectId,
    _beneficiary,
    _preferClaimedTokens,
    _memo,
    _metadata,
    _defaultPreferAddToBalance,
    msg.sender
    );

    Event references: