CheckpointsImplUpgradeable.sol 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/CheckpointsUpgradeable.sol";
  4. import "../proxy/utils/Initializable.sol";
  5. contract CheckpointsImplUpgradeable is Initializable {
  6. function __CheckpointsImpl_init() internal onlyInitializing {
  7. }
  8. function __CheckpointsImpl_init_unchained() internal onlyInitializing {
  9. }
  10. using CheckpointsUpgradeable for CheckpointsUpgradeable.History;
  11. CheckpointsUpgradeable.History private _totalCheckpoints;
  12. function latest() public view returns (uint256) {
  13. return _totalCheckpoints.latest();
  14. }
  15. function getAtBlock(uint256 blockNumber) public view returns (uint256) {
  16. return _totalCheckpoints.getAtBlock(blockNumber);
  17. }
  18. function push(uint256 value) public returns (uint256, uint256) {
  19. return _totalCheckpoints.push(value);
  20. }
  21. /**
  22. * This empty reserved space is put in place to allow future versions to add new
  23. * variables without shifting down storage in the inheritance chain.
  24. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  25. */
  26. uint256[49] private __gap;
  27. }