-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
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,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; | ||
} | ||
} |