-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from bc-ticketing/Identity
Identity
- Loading branch information
Showing
2 changed files
with
47 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,45 @@ | ||
pragma solidity ^0.6.8; | ||
|
||
|
||
contract identity{ | ||
address payable owner; | ||
uint idCount; | ||
|
||
constructor() public { | ||
owner = msg.sender; | ||
idCount = 0; | ||
} | ||
|
||
mapping (address => mapping (address => uint) ) approvedIdentity ; | ||
|
||
mapping (address => bytes32) approverInfo; | ||
|
||
function registerApprover( bytes32 ipfsHash ) public returns (bool) { | ||
approverInfo[msg.sender] = ipfsHash; | ||
return true; | ||
} | ||
|
||
function approveIdentity( address identity, uint level) public returns (bool) { | ||
require (approverInfo[msg.sender] != 0, "Please register first"); | ||
approvedIdentity[msg.sender][identity] = level; | ||
return true; | ||
} | ||
|
||
function getSecurityLevel( address approver, address identity) public view returns (uint) { | ||
if (approverInfo[approver] != 0 && approvedIdentity[approver][identity] != 0) { | ||
return approvedIdentity[approver][identity]; | ||
} | ||
else { | ||
return 0; | ||
} | ||
} | ||
function getApproverInfo (address approver) public view returns (bytes32) { | ||
if (approverInfo[approver] != 0) { | ||
return approverInfo[approver]; | ||
} | ||
else { | ||
return 0; | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
const SimpleStorage = artifacts.require("SimpleStorage"); | ||
const EventLibrary = artifacts.require("EventLibrary"); | ||
const EventFactory = artifacts.require("EventFactory"); | ||
const Identity = artifacts.require("Identity"); | ||
|
||
module.exports = function (deployer) { | ||
deployer.deploy(SimpleStorage); | ||
deployer.deploy(EventLibrary); | ||
deployer.deploy(EventFactory); | ||
deployer.deploy(Identity); | ||
}; |