CheckpointsImpl.sol 705 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/Checkpoints.sol";
  4. contract CheckpointsImpl {
  5. using Checkpoints for Checkpoints.History;
  6. Checkpoints.History private _totalCheckpoints;
  7. function latest() public view returns (uint256) {
  8. return _totalCheckpoints.latest();
  9. }
  10. function getAtBlock(uint256 blockNumber) public view returns (uint256) {
  11. return _totalCheckpoints.getAtBlock(blockNumber);
  12. }
  13. function push(uint256 value) public returns (uint256, uint256) {
  14. return _totalCheckpoints.push(value);
  15. }
  16. function length() public view returns (uint256) {
  17. return _totalCheckpoints._checkpoints.length;
  18. }
  19. }