AccessManagerHarness.sol 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.20;
  3. import "../patched/access/manager/AccessManager.sol";
  4. contract AccessManagerHarness is AccessManager {
  5. // override with a storage slot that can basically take any value.
  6. uint32 private _minSetback;
  7. constructor(address initialAdmin) AccessManager(initialAdmin) {}
  8. // FV
  9. function minSetback() public view override returns (uint32) {
  10. return _minSetback;
  11. }
  12. function canCall_immediate(address caller, address target, bytes4 selector) external view returns (bool result) {
  13. (result,) = canCall(caller, target, selector);
  14. }
  15. function canCall_delay(address caller, address target, bytes4 selector) external view returns (uint32 result) {
  16. (,result) = canCall(caller, target, selector);
  17. }
  18. function canCallExtended(address caller, address target, bytes calldata data) external view returns (bool, uint32) {
  19. return _canCallExtended(caller, target, data);
  20. }
  21. function canCallExtended_immediate(address caller, address target, bytes calldata data) external view returns (bool result) {
  22. (result,) = _canCallExtended(caller, target, data);
  23. }
  24. function canCallExtended_delay(address caller, address target, bytes calldata data) external view returns (uint32 result) {
  25. (,result) = _canCallExtended(caller, target, data);
  26. }
  27. function getAdminRestrictions_restricted(bytes calldata data) external view returns (bool result) {
  28. (result,,) = _getAdminRestrictions(data);
  29. }
  30. function getAdminRestrictions_roleAdminId(bytes calldata data) external view returns (uint64 result) {
  31. (,result,) = _getAdminRestrictions(data);
  32. }
  33. function getAdminRestrictions_executionDelay(bytes calldata data) external view returns (uint32 result) {
  34. (,,result) = _getAdminRestrictions(data);
  35. }
  36. function hasRole_isMember(uint64 roleId, address account) external view returns (bool result) {
  37. (result,) = hasRole(roleId, account);
  38. }
  39. function hasRole_executionDelay(uint64 roleId, address account) external view returns (uint32 result) {
  40. (,result) = hasRole(roleId, account);
  41. }
  42. function getAccess_since(uint64 roleId, address account) external view returns (uint48 result) {
  43. (result,,,) = getAccess(roleId, account);
  44. }
  45. function getAccess_currentDelay(uint64 roleId, address account) external view returns (uint32 result) {
  46. (,result,,) = getAccess(roleId, account);
  47. }
  48. function getAccess_pendingDelay(uint64 roleId, address account) external view returns (uint32 result) {
  49. (,,result,) = getAccess(roleId, account);
  50. }
  51. function getAccess_effect(uint64 roleId, address account) external view returns (uint48 result) {
  52. (,,,result) = getAccess(roleId, account);
  53. }
  54. function getTargetAdminDelay_after(address target) public view virtual returns (uint32 result) {
  55. (,result,) = _getTargetAdminDelayFull(target);
  56. }
  57. function getTargetAdminDelay_effect(address target) public view virtual returns (uint48 result) {
  58. (,,result) = _getTargetAdminDelayFull(target);
  59. }
  60. function getRoleGrantDelay_after(uint64 roleId) public view virtual returns (uint32 result) {
  61. (,result,) = _getRoleGrantDelayFull(roleId);
  62. }
  63. function getRoleGrantDelay_effect(uint64 roleId) public view virtual returns (uint48 result) {
  64. (,,result) = _getRoleGrantDelayFull(roleId);
  65. }
  66. function hashExecutionId(address target, bytes4 selector) external pure returns (bytes32) {
  67. return _hashExecutionId(target, selector);
  68. }
  69. function executionId() external view returns (bytes32) {
  70. return _executionId;
  71. }
  72. // Pad with zeros (and don't revert) if data is too short.
  73. function getSelector(bytes calldata data) external pure returns (bytes4) {
  74. return bytes4(data);
  75. }
  76. function getFirstArgumentAsAddress(bytes calldata data) external pure returns (address) {
  77. return abi.decode(data[0x04:0x24], (address));
  78. }
  79. function getFirstArgumentAsUint64(bytes calldata data) external pure returns (uint64) {
  80. return abi.decode(data[0x04:0x24], (uint64));
  81. }
  82. function _checkAuthorized() internal override {
  83. // We need this hack otherwise certora will assume _checkSelector(_msgData()) can return anything :/
  84. require(msg.sig == _checkSelector(_msgData()));
  85. super._checkAuthorized();
  86. }
  87. }