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:
_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 thepay
function or theaddToBalance
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β
-
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
SetDefaultValues
event 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 |