-
Notifications
You must be signed in to change notification settings - Fork 1
/
DMusicUser.sol
58 lines (47 loc) · 1.38 KB
/
DMusicUser.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
contract DmusicUser {
bool public isExist=false;
enum UserType {
Customer,
Artist
}
struct Product {
uint productId;
string productName;
}
mapping(uint => Product) public products;
struct Customer {
string customerName;
bool isExist;
}
struct Artist {
address artistAddress;
string artistName;
bool isExist;
}
mapping(address => Customer) public customerList;
mapping(address => Artist) public artistList;
function registerCustomer(string memory name) public {
isExist = true;
customerList[msg.sender] = Customer({
customerName: name,
isExist: isExist
});
}
function registerArtist(string memory name) public {
isExist = true;
artistList[msg.sender] = Artist({
artistAddress: msg.sender,
artistName: name,
isExist: isExist
});
}
function getArtistDetail(address artistAddress) public view returns (Artist memory) {
return artistList[artistAddress];
}
function getCustomerDetail(address customerAddress) public view returns (Customer memory) {
return customerList[customerAddress];
}
}