setDefaultValues
Contract: JBETHERC20ProjectPayer
Interface: IJBProjectPayer
- Step by step
 - Code
 - Events
 - Bug bounty
 
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:
_projectIdis the ID of the project whose treasury should be forwarded this contract's received payments._beneficiaryis the address that'll receive the project's tokens._preferClaimedTokensis a flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet._memois the memo that'll be used._metadatais the metadata that'll be sent._defaultPreferAddToBalanceis a flag indicating if received payments should call thepayfunction or theaddToBalancefunction of a project.
 - Through the 
onlyOwnermodifier, 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 
IJBProjectPayerinterface. - The function doesn't return anything.
 
Body
- 
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:
 - 
Set the default beneficiary if it has changed.
// Set the default beneficiary if it has changed.
if (_beneficiary != defaultBeneficiary) defaultBeneficiary = _beneficiary;Internal references:
 - 
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:
 - 
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:
 - 
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:
 - 
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:
 - 
Emit a
SetDefaultValuesevent with all relevant parameters.emit SetDefaultValues(
_projectId,
_beneficiary,
_preferClaimedTokens,
_memo,
_metadata,
_defaultPreferAddToBalance,
msg.sender
);Event references:
 
/**
  @notice
  Sets the default values that determine how to interact with a protocol treasury when this contract receives ETH directly.
  @param _projectId The ID of the project whose treasury should be forwarded this contract's received payments.
  @param _beneficiary The address that'll receive the project's tokens.
  @param _preferClaimedTokens A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet.
  @param _memo The memo that'll be used.
  @param _metadata The metadata that'll be sent.
  @param _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project.
*/
function setDefaultValues(
  uint256 _projectId,
  address payable _beneficiary,
  bool _preferClaimedTokens,
  string memory _memo,
  bytes memory _metadata,
  bool _defaultPreferAddToBalance
) external virtual override onlyOwner {
  // Set the default project ID if it has changed.
  if (_projectId != defaultProjectId) defaultProjectId = _projectId;
  // Set the default beneficiary if it has changed.
  if (_beneficiary != defaultBeneficiary) defaultBeneficiary = _beneficiary;
  // Set the default claimed token preference if it has changed.
  if (_preferClaimedTokens != defaultPreferClaimedTokens)
    defaultPreferClaimedTokens = _preferClaimedTokens;
  // Set the default memo if it has changed.
  if (keccak256(abi.encodePacked(_memo)) != keccak256(abi.encodePacked(defaultMemo)))
    defaultMemo = _memo;
  // Set the default metadata if it has changed.
  if (keccak256(abi.encodePacked(_metadata)) != keccak256(abi.encodePacked(defaultMetadata)))
    defaultMetadata = _metadata;
  // Set the add to balance preference if it has changed.
  if (_defaultPreferAddToBalance != defaultPreferAddToBalance)
    defaultPreferAddToBalance = _defaultPreferAddToBalance;
  emit SetDefaultValues(
    _projectId,
    _beneficiary,
    _preferClaimedTokens,
    _memo,
    _metadata,
    _defaultPreferAddToBalance,
    msg.sender
  );
}
| Name | Data | 
|---|---|
SetDefaultValues | 
  | 
| 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 |