Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider improving packing in PerpetualTranche.sol #124

Open
marktoda opened this issue Dec 8, 2022 · 1 comment
Open

Consider improving packing in PerpetualTranche.sol #124

marktoda opened this issue Dec 8, 2022 · 1 comment

Comments

@marktoda
Copy link

marktoda commented Dec 8, 2022

    /// @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)

@marktoda marktoda changed the title Consider improving packing in PerpetualBond.sol Consider improving packing in PerpetualTranche.sol Dec 8, 2022
@marktoda
Copy link
Author

marktoda commented Dec 8, 2022

with sizes as defined above could also pack _decmials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant