Skip to content

Commit

Permalink
Merge pull request #45 from bc-ticketing/Identity
Browse files Browse the repository at this point in the history
Identity
  • Loading branch information
Simon Bachmann authored Jun 25, 2020
2 parents 75247fc + b902c7d commit 83305bf
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
45 changes: 45 additions & 0 deletions contracts/Identity.sol
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;
}
}

}
2 changes: 2 additions & 0 deletions migrations/2_deploy_contracts.js
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);
};

0 comments on commit 83305bf

Please sign in to comment.