From 4fe5c898d1f62246fb9665f6fe2f63fc72cf083c Mon Sep 17 00:00:00 2001 From: Aman Date: Fri, 26 Nov 2021 13:19:45 +0530 Subject: [PATCH] Contract changes and redeploy --- ethereum/contracts/identity.sol | 44 ++++++++++++++------------------- ethereum/details.txt | 16 ++++++------ 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/ethereum/contracts/identity.sol b/ethereum/contracts/identity.sol index 357e2f1..531fd75 100644 --- a/ethereum/contracts/identity.sol +++ b/ethereum/contracts/identity.sol @@ -162,28 +162,6 @@ contract Identity { IssuerDetail[_Issuer].Request[IssuerDetail[_Issuer].ReqCount++] = NewRequest; } - //Modify An Identity - function modifyId(string memory _Hash, address _Issuer,string memory _Sign , - uint _IdNum , string memory _IssuerHash) registered(msg.sender) issue(_Issuer) public{ - require(_IdNum < UserDetail[msg.sender].IdCount , "Id does not Exist"); - - identity memory NewId; - NewId.Name = IssuerDetail[_Issuer].IssueId; - NewId.Hash = _Hash; - NewId.Owner = msg.sender; - NewId.Issuer = _Issuer; - NewId.OwnerSignature = _Sign; - NewId.IssuerSignature = "Pending"; - UserDetail[msg.sender].Ids[_IdNum] = NewId; - - //create a verification request - verifyIdRequest memory NewRequest; - NewRequest.Owner = msg.sender; - NewRequest.Hash = _IssuerHash; - NewRequest.Status = 1; - IssuerDetail[_Issuer].Request[IssuerDetail[_Issuer].ReqCount++] = NewRequest; - } - //Delete An Identity function deleteId(uint _IdNum) registered(msg.sender) public { require(_IdNum < UserDetail[msg.sender].IdCount , "Id does not Exist"); @@ -213,7 +191,8 @@ contract Identity { break; } } - require(flag == true, "User Identity Not Found");//use revert + if(flag == false) + revert("User Identity Not Found"); IssuerDetail[msg.sender].Request[_ReqNo].Status = 2; } @@ -236,7 +215,10 @@ contract Identity { break; } } - require(flag == true, "User Identity Not Found"); + } + + function totalId() public view returns (uint){ + return UserDetail[msg.sender].IdCount; } function getId(uint _IdNo, address account) public view returns (identity memory){ @@ -244,8 +226,20 @@ contract Identity { return UserDetail[account].Ids[_IdNo]; } - function getRequest(uint _RqNo) public issue(msg.sender) view returns (verifyIdRequest memory){ + function totalIssuer() public view returns (uint){ + return Issuer.length; + } + + function totalRequest() public view returns (uint){ + return IssuerDetail[msg.sender].ReqCount; + } + + function getRequest(uint _RqNo) issue(msg.sender) public view returns (verifyIdRequest memory){ require(_RqNo < IssuerDetail[msg.sender].ReqCount, "Request does not exist"); return IssuerDetail[msg.sender].Request[_RqNo]; } + + function issuerVerificationRequestCount() public view returns (uint){ + return IssuerVerificationRequest.length; + } } diff --git a/ethereum/details.txt b/ethereum/details.txt index 4039b07..a71554f 100644 --- a/ethereum/details.txt +++ b/ethereum/details.txt @@ -1,11 +1,11 @@ -> transaction hash: 0x7c7b3e3fd1d3383d48b3c60be9ed2e0fdecfd14e877b6599318d6f4222002ba8 - > Blocks: 3 Seconds: 14 - > contract address: 0x384D0D5eD8A094511b804dcde855f6AAe3416476 - > block number: 11379394 - > block timestamp: 1636281478 + > transaction hash: 0x158e33e030162391d6e396f40ac6a678b223bda4932d6939da643f8525a28d8f + > Blocks: 2 Seconds: 25 + > contract address: 0xc5a422571d21EeCe071Ac2f61dc6c9FcC61137A6 + > block number: 11497990 + > block timestamp: 1637907064 > account: 0x35B84d6848D16415177c64D64504663b998A6ab4 - > balance: 4.435744650856135872 - > gas used: 2476618 (0x25ca4a) + > balance: 2.164354919362498411 + > gas used: 2295852 (0x23082c) > gas price: 20 gwei > value sent: 0 ETH - > total cost: 0.04953236 ETH \ No newline at end of file + > total cost: 0.04591704 ETH \ No newline at end of file