receive
Contract: JBETHERC20ProjectPayer
Interface: IJBProjectPayer
- Step by step
- Code
- Bug bounty
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β
-
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:
JBTokens
.ETH
Internal references:
/**
@notice
Received funds are paid to the default project ID using the stored default properties.
@dev
Use the `addToBalance` function if there's a preference to do so. Otherwise use `pay`.
@dev
This function is called automatically when the contract receives an ETH payment.
*/
receive() external payable virtual override {
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
);
}
Category | Description | Reward |
---|---|---|
Optimization | Help make this operation more efficient. | 0.5ETH |
Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH |
High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |