Skip to content

Consider improving packing in PerpetualTranche.sol #124

@marktoda

Description

@marktoda
    /// @notice The minimum maturity time in seconds for a tranche below which
    ///         it can be rolled over.
    uint256 public minTrancheMaturitySec;

    /// @notice The maximum maturity time in seconds for a tranche above which
    ///         it can NOT get added into the reserve.
    uint256 public maxTrancheMaturitySec;

    /// @notice The percentage of the reserve value to be held as mature tranches.
    uint256 public matureValueTargetPerc;

each of these could easily fit in smaller sizes to pack them all into 1 storage slot. With some improvements to read-sites can probably save several thousand gas for every afterStateUpdate operation.

uint32 should be enough for the *Sec ones (136 years of maturity window)
*Perc should also fit in uint32 (100% * 10e16 fits in uint32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions