@openzeppelin/confidential-contracts 0.5.0-rc.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/contracts/BatcherConfidential.json +11 -0
  2. package/build/contracts/CheckpointsConfidential.json +2 -2
  3. package/build/contracts/ERC7984BalanceCapHookModule.json +2 -37
  4. package/build/contracts/ERC7984HolderCapHookModule.json +2 -37
  5. package/build/contracts/ERC7984HookModule.json +0 -35
  6. package/build/contracts/ERC7984Hooked.json +0 -5
  7. package/build/contracts/ERC7984Utils.json +2 -2
  8. package/build/contracts/FHESafeMath.json +2 -2
  9. package/build/contracts/IERC7984HookModule.json +0 -13
  10. package/finance/BatcherConfidential.sol +15 -3
  11. package/governance/utils/VotesConfidential.sol +1 -1
  12. package/interfaces/IERC7984HookModule.sol +1 -8
  13. package/interfaces/IERC7984Receiver.sol +1 -1
  14. package/interfaces/IERC7984Rwa.sol +1 -1
  15. package/package.json +1 -1
  16. package/token/ERC7984/ERC7984.sol +5 -2
  17. package/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol +1 -1
  18. package/token/ERC7984/extensions/ERC7984Freezable.sol +2 -2
  19. package/token/ERC7984/extensions/ERC7984Hooked.sol +7 -8
  20. package/token/ERC7984/extensions/ERC7984Restricted.sol +1 -1
  21. package/token/ERC7984/extensions/ERC7984Rwa.sol +20 -2
  22. package/token/ERC7984/utils/ERC7984BalanceCapHookModule.sol +12 -17
  23. package/token/ERC7984/utils/ERC7984HolderCapHookModule.sol +27 -31
  24. package/token/ERC7984/utils/ERC7984HookModule.sol +3 -42
  25. package/utils/FHESafeMath.sol +1 -1
  26. package/utils/HandleAccessManager.sol +1 -1
  27. package/utils/structs/CheckpointsConfidential.sol +1 -1
  28. package/build/contracts/ERC7984IdentityCheck.json +0 -691
  29. package/build/contracts/IIdentityRegistry.json +0 -30
  30. package/token/ERC7984/extensions/ERC7984IdentityCheck.sol +0 -58
@@ -1,58 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Confidential Contracts (last updated v0.5.0-rc.0) (token/ERC7984/extensions/ERC7984IdentityCheck.sol)
3
-
4
- pragma solidity ^0.8.27;
5
-
6
- import {euint64} from "@fhevm/solidity/lib/FHE.sol";
7
- import {ERC7984} from "../ERC7984.sol";
8
-
9
- /**
10
- * @dev Extension of {ERC7984} that enforces identity verification
11
- * on token recipients by querying an external identity registry.
12
- *
13
- * See https://github.com/ERC-3643/ERC-3643/blob/main/contracts/registry/interface/IIdentityRegistry.sol[IIdentityRegistry]
14
- * for more information.
15
- */
16
- abstract contract ERC7984IdentityCheck is ERC7984 {
17
- /// @dev Emitted when the identity registry is updated.
18
- event IdentityRegistryUpdated(address indexed oldRegistry, address indexed newRegistry);
19
-
20
- /// @dev The provided registry address is invalid.
21
- error ERC7984InvalidIdentityRegistry(address registry);
22
-
23
- /// @dev The `account` is not verified in the identity registry.
24
- error ERC7984InvalidIdentity(address account);
25
-
26
- address private _identityRegistry;
27
-
28
- constructor(address identityRegistry_) {
29
- _setIdentityRegistry(identityRegistry_);
30
- }
31
-
32
- /// @dev See {ERC7984-_update}. Performs identity check on the recipient before updating the balance.
33
- function _update(address from, address to, euint64 amount) internal virtual override returns (euint64) {
34
- if (to != address(0) && !IIdentityRegistry(_identityRegistry).isVerified(to)) {
35
- revert ERC7984InvalidIdentity(to);
36
- }
37
- return super._update(from, to, amount);
38
- }
39
-
40
- /// @dev Returns the address of the identity registry.
41
- function identityRegistry() public view virtual returns (address) {
42
- return _identityRegistry;
43
- }
44
-
45
- /// @dev Sets the identity registry. Inheriting contracts are responsible for access control.
46
- function _setIdentityRegistry(address identityRegistry_) internal virtual {
47
- require(
48
- identityRegistry_ != address(0) && identityRegistry_.code.length != 0,
49
- ERC7984InvalidIdentityRegistry(identityRegistry_)
50
- );
51
- emit IdentityRegistryUpdated(_identityRegistry, identityRegistry_);
52
- _identityRegistry = identityRegistry_;
53
- }
54
- }
55
-
56
- interface IIdentityRegistry {
57
- function isVerified(address account) external view returns (bool);
58
- }