-
Notifications
You must be signed in to change notification settings - Fork 0
/
cert.sol
91 lines (67 loc) · 2.48 KB
/
cert.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
pragma solidity >=0.4.22 <0.7.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
contract CredentialToken is ERC721 {
string student_id;
string cert_id;
string holder_name;
string date_of_issue;
string issuing_auth;
/**
* @dev Create the Token by Passing the Name and Symbol to the ERC721 Constructor
*/
constructor() ERC721("CertCoin","CERC") public {}
/**
* @dev Function to display name of the token
*/
function namedecl() public view returns (string memory) {
//calling the Built-in function in ERC721
return name();
}
/**
* @dev Function to display symbol of the token
*/
function symboldecl() public view returns (string memory) {
//calling the Built-in function in ERC721
return symbol();
}
/**
* @dev Function to display total count of the token
*/
function totalSupplycount() public view returns (uint256) {
//calling the Built-in function in ERC721
return totalSupply();
}
/**
* @dev Function to Mint a new ERC721 Token
* @param tokenId Unique Token ID
*/
function mintToken(uint256 tokenId,string memory _student_id,string memory _cert_id,string memory _holder_name,string memory _date_of_issue, string memory _issuing_auth ) public {
_mint(msg.sender,tokenId);
student_id = _student_id;
cert_id = _cert_id;
holder_name = _holder_name;
date_of_issue = _date_of_issue;
issuing_auth = _issuing_auth;
}
/**
* @dev Function to Transfer a ERC721 token
* @param from Owner address
* @param to Receiver address
* @param tokenId ERC721 Token ID
*/
function transferMyToken(address from, address to, uint256 tokenId) public {
//Calling the Built-in function in ERC721
_transfer(from, to, tokenId);
}
/**
* @dev Function to Burn a ERC721 token
* @param tokenId ERC721 Token ID
*/
function burnMyToken(uint256 tokenId) public {
//Calling the Built-in function in ERC721
_burn( tokenId);
}
function show_details() public view returns (string memory ,string memory ,string memory , string memory, string memory ){
return (student_id,cert_id,holder_name,date_of_issue,issuing_auth);
}
}