Skip to content

Commit

Permalink
Create PiNexusIdentityManager.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 20, 2024
1 parent 6f7f6df commit c081cf9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions contracts/PiNexusIdentityManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pragma solidity ^0.6.0;

import "https://github.com/SidraChain/sidra-chain-contracts/blob/main/contracts/IdentityManager.sol";

contract PiNexusIdentityManager {
address private owner;
mapping (address => Identity) public identities;

struct Identity {
string name;
string email;
string phoneNumber;
uint256 createdAt;
}

constructor() public {
owner = msg.sender;
}

function createIdentity(string memory _name, string memory _email, string memory _phoneNumber) public {
require(msg.sender == owner, "Only the owner can create identities");
Identity memory newIdentity = Identity(_name, _email, _phoneNumber, block.timestamp);
identities[msg.sender] = newIdentity;
}

function updateIdentity(string memory _name, string memory _email, string memory _phoneNumber) public {
require(msg.sender == owner, "Only the owner can update identities");
Identity storage identity = identities[msg.sender];
identity.name = _name;
identity.email = _email;
identity.phoneNumber = _phoneNumber;
}

function verifyIdentity(address _address) public view returns (bool) {
return identities[_address].createdAt > 0;
}
}

0 comments on commit c081cf9

Please sign in to comment.