// gkc_hash_code : 01GJ46WV2DZAGQM3EVM8ZB69CM // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./interfaces/IDelegation.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract Registry is IDelegation, Initializable, EIP712Upgradeable, AccessControlUpgradeable { struct Registration { uint256 tokenId; address identityAddress; } function __Registry_init() internal onlyInitializing {} function _EIP712NameHash() internal pure override returns (bytes32) { return keccak256(bytes(name())); } function _EIP712VersionHash() internal pure override returns (bytes32) { return keccak256(bytes(version())); } function version() public pure returns (string memory) { return '1.0.0'; } function name() public pure returns (string memory) { return 'ID-Management'; } /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 private constant _DELEGATION_TYPEHASH = keccak256("Registry(address account,uint nonce)"); function initialize() external virtual initializer { __Registry_init(); __AccessControl_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } mapping(address => Registration) public registers; function register(address account, uint256 tokenId, IDelegation identityAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { // TODO: need require registers[account].tokenId = tokenId; registers[account].identityAddress = address(identityAddress); } function updateRegistration(address account, uint256 tokenId, IDelegation identityAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { // TODO: need require registers[account].tokenId = tokenId; registers[account].identityAddress = address(identityAddress); } function removeRegistration(address account) external { // TODO: need require delete registers[account]; } function validateCredentials(uint256 tokenId, string message, uint8 v, bytes32 r, bytes32 s) external onlyRole(DEFAULT_ADMIN_ROLE) returns(bool) { // TODO } }
0.7.1