-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArtRegistry.sol
57 lines (43 loc) · 2.14 KB
/
ArtRegistry.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
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC721/ERC721Full.sol";
contract artRegistry is ERC721Full {
constructor() public ERC721Full("ArtRegistryToken", "ART") {}
struct ArtWork {
string name;
string artist;
uint appraisalValue;
string tokenJSON;
}
mapping(uint => ArtWork) public artCollection;
function registerArtWork(
address owner,
string memory name,
string memory artist,
uint appraisalValue,
string memory tokenURI,
string memory tokenJSON
) public returns (uint) {
uint tokenID = totalSupply();
_mint(owner,tokenID);
_setTokenURI(tokenID, tokenURI);
artCollection[tokenID] = ArtWork(name, artist, appraisalValue, tokenJSON);
emit Register(owner, name, artist, appraisalValue, tokenURI, tokenJSON);
return tokenID;
}
event Register (address owner, string name, string artist, uint apprasalValue, string tokenURI, string tokenJSON);
function newAppraisal(
uint tokenID,
uint appraisalValue,
string memory tokenURI,
string memory tokenJSON
) public returns(uint) {
artCollection[tokenID].appraisalValue = appraisalValue;
emit Appraisal(tokenID, appraisalValue, tokenURI, tokenJSON);
return artCollection[tokenID].appraisalValue;
}
event Appraisal (uint tokenID, uint appraisalValue, string tokenURI, string tokenJSON);
function imageURI(uint tokenID) public view returns (string memory) {
return artCollection[tokenID].tokenJSON;
}
}