Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3c485a7
trial
Shubhanshu1902 Feb 12, 2022
25336aa
change
Shubhanshu1902 Feb 12, 2022
64461cd
try
Shubhanshu1902 Feb 12, 2022
babcb1d
jai mata dii
Shubhanshu1902 Feb 12, 2022
671693b
try
Shubhanshu1902 Feb 12, 2022
3afd313
tuta futa back end
hypnotic2402 Feb 12, 2022
a857a5c
back end stuff (gives revert error)
hypnotic2402 Feb 12, 2022
ec2131a
back end dunno if works
hypnotic2402 Feb 12, 2022
a924c51
Merge pull request #2 from hypnotic2402/changes
hypnotic2402 Feb 12, 2022
6537837
drwawers
Shubhanshu1902 Feb 13, 2022
f2eb1d3
backend working on local blockchain....(all test cases not considered)
hypnotic2402 Feb 13, 2022
12b4042
returns '-1' on non-existing doc of requested type
hypnotic2402 Feb 13, 2022
a3ec8e6
Merge pull request #3 from hypnotic2402/changes
hypnotic2402 Feb 13, 2022
0ca66e4
push
Shubhanshu1902 Feb 13, 2022
efe5896
Merge branch 'changes' of https://github.com/Shubhanshu1902/DocuBox i…
Shubhanshu1902 Feb 13, 2022
a4b9043
box
Shubhanshu1902 Feb 13, 2022
cb5a3dc
css change
Shubhanshu1902 Feb 13, 2022
a998734
circle animation
naitik-solanki Feb 13, 2022
1d7dea1
hello
Shubhanshu1902 Feb 13, 2022
956acf4
added deploy script (tested on localhost)
hypnotic2402 Feb 13, 2022
d0a5f1b
back end
hypnotic2402 Feb 13, 2022
ed1af82
Merge pull request #4 from hypnotic2402/changes
hypnotic2402 Feb 13, 2022
e4958b2
ch
Shubhanshu1902 Feb 13, 2022
36b54ca
Merge branch 'changes' of https://github.com/Shubhanshu1902/DocuBox i…
Shubhanshu1902 Feb 13, 2022
b64ef23
adddoc
Shubhanshu1902 Feb 13, 2022
2895875
changes
Shubhanshu1902 Feb 13, 2022
3462281
final for hackathon
Shubhanshu1902 Feb 13, 2022
6ed727a
kuch nhi
naitik-solanki Feb 13, 2022
ee73331
ll
Shubhanshu1902 Feb 13, 2022
d63ef83
Merge branch 'changes' of https://github.com/Shubhanshu1902/DocuBox i…
Shubhanshu1902 Feb 13, 2022
31b03bb
hello
Shubhanshu1902 Feb 13, 2022
221083e
Added UI figma and pdf doc
vaibhav-vt Mar 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
cache
.vscode
Binary file added DocuBox.fig
Binary file not shown.
Binary file added Ui_plan.pdf
Binary file not shown.
95 changes: 90 additions & 5 deletions contracts/document.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,99 @@ pragma solidity ^0.8.4;
import "hardhat/console.sol";

contract document{
struct doc_detail{
string type_name;
string hash_data;
string file_password;

uint totalDocs = 0;


struct doc{
string type_name; // eg. aadhaar card, pan card, etc.
string hash_data; // ipvf hash


}

struct user{
// doc[] docs; // Mapping of uploaded Documents
mapping(string => string) docs; // type -> hash
uint nDocs; // number of uploaded Documents

}

mapping(address => user) users;

constructor(){
console.log("totalDocs is " , totalDocs);
}

mapping(address => doc_detail) particular_docs;




// mapping(address => doc_detail) particular_docs;






// Upload(docum) : particular_docs[(this.address)] -> docum
function upload(string memory docum , string memory docType) external { // vm error : revert ..... why ? no but why?.....i need help


// user memory sender = users[msg.sender];
// bool flagExists = false;


// sender.docs[sender.nDocs].type_name = docType;
// sender.docs[sender.nDocs++].hash_data = docum;

// for (uint i = 0; i < users[msg.sender].nDocs; i++){
// // if (sender.docs[i].type_name == docType){

// // }
// if (keccak256(bytes(users[msg.sender].docs[i].type_name)) == keccak256(bytes(docType))){
// flagExists = true;
// }
// }

// require(!flagExists, 'Document Already Exists');

// users[msg.sender].docs[users[msg.sender].nDocs].type_name = docType;
// users[msg.sender].docs[users[msg.sender].nDocs++].hash_data = docum;
users[msg.sender].docs[docType] = docum;
totalDocs++;

// For now if same type entered, it replaces old doc corresponding to the type


}



// Download(docum)

function download(string memory docType) external view returns(string memory) {
// user memory sender = users[msg.sender];
// bool flagExists = false;
// uint docLocation;

// for (uint i = 0; i < users[msg.sender].nDocs; i++){
// if (keccak256(bytes(sender.docs[i].type_name)) == keccak256(bytes(docType))){
// flagExists = true;
// docLocation = i;
// }
// }

// require(flagExists, 'No such Document exists');
// return sender.docs[docLocation].hash_data;
// string memory s = users[msg.sender].docs[docType];
// if (s)
if (keccak256(bytes(users[msg.sender].docs[docType])) == keccak256(bytes(''))){return '-1';}

return users[msg.sender].docs[docType];

}



}
5 changes: 1 addition & 4 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require("@nomiclabs/hardhat-waffle");

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html

task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();

Expand All @@ -10,8 +9,6 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
}
});

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more

/**
* @type import('hardhat/config').HardhatUserConfig
Expand Down
Loading