-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,227 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
deployments/arbitrumone/solcInputs/c8adce9942919fd992f7532e82a0e082.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"@openzeppelin/contracts/access/IAccessControl.sol": { | ||
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" | ||
}, | ||
"@venusprotocol/solidity-utilities/contracts/validators.sol": { | ||
"content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.25;\n\n/// @notice Thrown if the supplied address is a zero address where it is not allowed\nerror ZeroAddressNotAllowed();\n\n/// @notice Thrown if the supplied value is 0 where it is not allowed\nerror ZeroValueNotAllowed();\n\n/// @notice Checks if the provided address is nonzero, reverts otherwise\n/// @param address_ Address to check\n/// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address\nfunction ensureNonzeroAddress(address address_) pure {\n if (address_ == address(0)) {\n revert ZeroAddressNotAllowed();\n }\n}\n\n/// @notice Checks if the provided value is nonzero, reverts otherwise\n/// @param value_ Value to check\n/// @custom:error ZeroValueNotAllowed is thrown if the provided value is 0\nfunction ensureNonzeroValue(uint256 value_) pure {\n if (value_ == 0) {\n revert ZeroValueNotAllowed();\n }\n}\n" | ||
}, | ||
"contracts/Governance/IAccessControlManagerV8.sol": { | ||
"content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity ^0.8.25;\n\nimport \"@openzeppelin/contracts/access/IAccessControl.sol\";\n\n/**\n * @title IAccessControlManagerV8\n * @author Venus\n * @notice Interface implemented by the `AccessControlManagerV8` contract.\n */\ninterface IAccessControlManagerV8 is IAccessControl {\n function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;\n\n function revokeCallPermission(\n address contractAddress,\n string calldata functionSig,\n address accountToRevoke\n ) external;\n\n function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);\n\n function hasPermission(\n address account,\n address contractAddress,\n string calldata functionSig\n ) external view returns (bool);\n}\n" | ||
}, | ||
"contracts/Utils/ACMCommandsAggregator.sol": { | ||
"content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.25;\n\nimport { IAccessControlManagerV8 } from \"../Governance/IAccessControlManagerV8.sol\";\nimport { ensureNonzeroAddress } from \"@venusprotocol/solidity-utilities/contracts/validators.sol\";\n\n/**\n * @title ACMCommandsAggregator\n * @author Venus\n * @notice This contract is a helper to aggregate multiple grant and revoke permissions in batches and execute them in one go.\n */\ncontract ACMCommandsAggregator {\n /*\n * @notice Struct to store permission details\n */\n struct Permission {\n /*\n * @notice Address of the contract\n */\n address contractAddress;\n /*\n * @notice Function signature\n */\n string functionSig;\n /*\n * @notice Address of the account\n */\n address account;\n }\n\n /**\n * @notice Access control manager contract\n */\n IAccessControlManagerV8 public immutable ACM;\n\n /*\n * @notice 2D array to store grant permissions in batches\n */\n Permission[][] public grantPermissions;\n\n /*\n * @notice 2D array to store revoke permissions in batches\n */\n Permission[][] public revokePermissions;\n\n /*\n * @notice Event emitted when grant permissions are added\n */\n event GrantPermissionsAdded(uint256 index);\n\n /*\n * @notice Event emitted when revoke permissions are added\n */\n event RevokePermissionsAdded(uint256 index);\n\n /*\n * @notice Event emitted when grant permissions are executed\n */\n event GrantPermissionsExecuted(uint256 index);\n\n /*\n * @notice Event emitted when revoke permissions are executed\n */\n event RevokePermissionsExecuted(uint256 index);\n\n /*\n * @notice Error to be thrown when permissions are empty\n */\n error EmptyPermissions();\n\n /*\n * @notice Constructor to set the access control manager\n * @param _acm Address of the access control manager\n */\n constructor(IAccessControlManagerV8 _acm) {\n ensureNonzeroAddress(address(_acm));\n ACM = _acm;\n }\n\n /*\n * @notice Function to add grant permissions\n * @param _permissions Array of permissions\n * @custom:event Emits GrantPermissionsAdded event\n */\n function addGrantPermissions(Permission[] memory _permissions) external {\n if (_permissions.length == 0) {\n revert EmptyPermissions();\n }\n\n uint256 index = grantPermissions.length;\n grantPermissions.push();\n\n for (uint256 i; i < _permissions.length; ++i) {\n grantPermissions[index].push(\n Permission(_permissions[i].contractAddress, _permissions[i].functionSig, _permissions[i].account)\n );\n }\n\n emit GrantPermissionsAdded(index);\n }\n\n /*\n * @notice Function to add revoke permissions\n * @param _permissions Array of permissions\n * @custom:event Emits RevokePermissionsAdded event\n */\n function addRevokePermissions(Permission[] memory _permissions) external {\n if (_permissions.length == 0) {\n revert EmptyPermissions();\n }\n\n uint256 index = revokePermissions.length;\n revokePermissions.push();\n\n for (uint256 i; i < _permissions.length; ++i) {\n revokePermissions[index].push(\n Permission(_permissions[i].contractAddress, _permissions[i].functionSig, _permissions[i].account)\n );\n }\n\n emit RevokePermissionsAdded(index);\n }\n\n /*\n * @notice Function to execute grant permissions\n * @param index Index of the permissions array\n * @custom:event Emits GrantPermissionsExecuted event\n */\n function executeGrantPermissions(uint256 index) external {\n uint256 length = grantPermissions[index].length;\n for (uint256 i; i < length; ++i) {\n Permission memory permission = grantPermissions[index][i];\n ACM.giveCallPermission(permission.contractAddress, permission.functionSig, permission.account);\n }\n\n emit GrantPermissionsExecuted(index);\n }\n\n /*\n * @notice Function to execute revoke permissions\n * @param index Index of the permissions array\n * @custom:event Emits RevokePermissionsExecuted event\n */\n function executeRevokePermissions(uint256 index) external {\n uint256 length = revokePermissions[index].length;\n for (uint256 i; i < length; ++i) {\n Permission memory permission = revokePermissions[index][i];\n ACM.revokeCallPermission(permission.contractAddress, permission.functionSig, permission.account);\n }\n\n emit RevokePermissionsExecuted(index);\n }\n}\n" | ||
} | ||
}, | ||
"settings": { | ||
"optimizer": { | ||
"enabled": true, | ||
"runs": 10000 | ||
}, | ||
"evmVersion": "paris", | ||
"outputSelection": { | ||
"*": { | ||
"*": [ | ||
"storageLayout", | ||
"abi", | ||
"evm.bytecode", | ||
"evm.deployedBytecode", | ||
"evm.methodIdentifiers", | ||
"metadata", | ||
"devdoc", | ||
"userdoc", | ||
"evm.gasEstimates" | ||
], | ||
"": ["ast"] | ||
} | ||
}, | ||
"metadata": { | ||
"useLiteralContent": true | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.