-
Notifications
You must be signed in to change notification settings - Fork 64
💥 introduced register-unregister wallet in identity #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
💥 introduced register-unregister wallet in identity #138
Conversation
contracts/factory/IdFactory.sol
Outdated
| import { KeyTypes } from "../libraries/KeyTypes.sol"; | ||
|
|
||
| contract IdFactory is IIdFactory, Ownable { | ||
| using ECDSA for bytes32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded as you are using ECDSA.* syntax
contracts/factory/IdFactory.sol
Outdated
| bytes calldata signature, | ||
| uint256 expiry | ||
| ) external override { | ||
| if (wallet == address(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use require
I don't understand this mlx of if...revert and require ??
contracts/factory/IdFactory.sol
Outdated
| if (wallet == address(0)) { | ||
| revert Errors.ZeroAddress(); | ||
| } | ||
| if (block.timestamp > expiry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use require
contracts/factory/IdFactory.sol
Outdated
| revert Errors.ZeroAddress(); | ||
| } | ||
| if (block.timestamp > expiry) { | ||
| revert Errors.SignatureExpired(expiry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use existing error ExpiredSignature
contracts/factory/IdFactory.sol
Outdated
| abi.encode(wallet, identity, expiry, address(this), block.chainid) | ||
| ); | ||
|
|
||
| address signer = _recoverWalletSigner(structHash, signature); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded orphan internal function, inline
contracts/factory/IdFactory.sol
Outdated
| * @dev See {IdFactory-unregisterWalletFromIdentity}. | ||
| */ | ||
| function unregisterWalletFromIdentity(address wallet) external override { | ||
| if (wallet == address(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use require
contracts/factory/IdFactory.sol
Outdated
| if (wallet == address(0)) { | ||
| revert Errors.ZeroAddress(); | ||
| } | ||
| if (_userIdentity[wallet] != msg.sender) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use require
contracts/factory/IdFactory.sol
Outdated
| revert Errors.ZeroAddress(); | ||
| } | ||
| if (_userIdentity[wallet] != msg.sender) { | ||
| revert Errors.WalletNotLinked(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use existing error WalletNotLinkedToIdentity
contracts/factory/IdFactory.sol
Outdated
| bytes32 structHash, | ||
| bytes calldata signature | ||
| ) internal pure returns (address) { | ||
| bytes32 digest = keccak256( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use MessageHashUtils.toEthSignedMessageHash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some branches are not covered (3)
No description provided.