_packAndStoreIntrinsicPropertiesOf
Contract: JBFundingCycleStore
- Step by step
- Code
- Bug bounty
Efficiently stores a funding cycle's provided intrinsic properties.
Definition
function _packAndStoreIntrinsicPropertiesOf(
  uint256 _configuration,
  uint256 _projectId,
  uint256 _number,
  uint256 _weight,
  uint256 _basedOn,
  uint256 _start
) private { ... }
- Arguments:
- _configurationis the configuration of the funding cycle to pack and store.
- _projectIdis the ID of the project to which the funding cycle belongs.
- _numberis the number of the funding cycle.
- _weightis the weight of the funding cycle.
- _basedOnis the configuration of the base funding cycle.
- _startis the start time of this funding cycle.
 
- The function is private to this contract.
- The function doesn't return anything.
Body
- 
The weight property should take up the first 80 bits of the packed uint256.// weight in bits 0-87.
 uint256 packed = _weight;
- 
The based on configuration should take up the next 56 bits. // basedOn in bits 88-143.
 packed |= _basedOn << 88;
- 
The start should take up the next 56 bits. // start in bits 144-199.
 packed |= _start << 144;
- 
The number should take up the last 56 bits. // number in bits 200-255.
 packed |= _number << 200;
- 
Store the packed intrinsic properties for the funding cycle. // Store the packed value.
 _packedIntrinsicPropertiesOf[_projectId][_configuration] = packed;Internal references: 
/**
  @notice
  Efficiently stores a funding cycle's provided intrinsic properties.
  @param _configuration The configuration of the funding cycle to pack and store.
  @param _projectId The ID of the project to which the funding cycle belongs.
  @param _number The number of the funding cycle.
  @param _weight The weight of the funding cycle.
  @param _basedOn The configuration of the base funding cycle.
  @param _start The start time of this funding cycle.
*/
function _packAndStoreIntrinsicPropertiesOf(
  uint256 _configuration,
  uint256 _projectId,
  uint256 _number,
  uint256 _weight,
  uint256 _basedOn,
  uint256 _start
) private {
  // weight in bits 0-87.
  uint256 packed = _weight;
  // basedOn in bits 88-143.
  packed |= _basedOn << 88;
  // start in bits 144-199.
  packed |= _start << 144;
  // number in bits 200-255.
  packed |= _number << 200;
  // Store the packed value.
  _packedIntrinsicPropertiesOf[_projectId][_configuration] = packed;
}
| 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 |