Skip to main content

receive

Contract: JBETHERC20ProjectPayer

Interface: IJBProjectPayer

Received funds are paid to the default project ID using the stored default properties.

Use the addToBalance function if there's a preference to do so. Otherwise use pay.

This function is called automatically when the contract receives an ETH payment.

Definition​

receive() external payable virtual override { ... }
  • The function is triggered when the contract receives ETH.
  • The function can be accessed externally by anyone.
  • The function doesn't return anything.

Body​

  1. Pay the ETH received to the default project ID using the default parameters. Use the addToBalance function if there's a preference to do so.

    if (defaultPreferAddToBalance)
    _addToBalanceOf(
    defaultProjectId,
    JBTokens.ETH,
    address(this).balance,
    18, // balance is a fixed point number with 18 decimals.
    defaultMemo,
    defaultMetadata
    );
    else
    _pay(
    defaultProjectId,
    JBTokens.ETH,
    address(this).balance,
    18, // balance is a fixed point number with 18 decimals.
    defaultBeneficiary == address(0) ? msg.sender : defaultBeneficiary,
    0, // Can't determine expectation of returned tokens ahead of time.
    defaultPreferClaimedTokens,
    defaultMemo,
    defaultMetadata
    );

    Library references:

    Internal references: