-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathTavernNFTs.sol
84 lines (73 loc) · 3.9 KB
/
TavernNFTs.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
pragma solidity ^0.4.24;
import "../../node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "../../node_modules/zeppelin-solidity/contracts/ownership/Superuser.sol";
import "./ITavernNFTs.sol";
/**
* @title TavernNFTs - LORDLESS tavern NFTs Contract
* TavernNFTs records the relationship of Tavern ownership.
*
* ████████╗ █████╗ ██╗ ██╗ ███████╗ ██████╗ ███╗ ██╗ ███╗ ██╗ ███████╗ ████████╗ ███████╗ ██╗
* ╚══██╔══╝ ██╔══██╗ ██║ ██║ ██╔════╝ ██╔══██╗ ████╗ ██║ ████╗ ██║ ██╔════╝ ╚══██╔══╝ ██╔════╝ ██║
* ██║ ███████║ ██║ ██║ █████╗ ██████╔╝ ██╔██╗ ██║ ██╔██╗ ██║ █████╗ ██║ ███████╗ ██║
* ██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝ ██╔══██╗ ██║╚██╗██║ ██║╚██╗██║ ██╔══╝ ██║ ╚════██║ ╚═╝
* ██║ ██║ ██║ ╚████╔╝ ███████╗ ██║ ██║ ██║ ╚████║ ██║ ╚████║ ██║ ██║ ███████║ ██╗
* ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝ ╚═╝
*
* ---
* POWERED BY
* ╦ ╔═╗ ╦═╗ ╔╦╗ ╦ ╔═╗ ╔═╗ ╔═╗ ╔╦╗ ╔═╗ ╔═╗ ╔╦╗
* ║ ║ ║ ╠╦╝ ║║ ║ ║╣ ╚═╗ ╚═╗ ║ ║╣ ╠═╣ ║║║
* ╩═╝ ╚═╝ ╩╚═ ═╩╝ ╩═╝ ╚═╝ ╚═╝ ╚═╝ ╩ ╚═╝ ╩ ╩ ╩ ╩
* game at https://lordless.io
* code at https://github.com/lordlessio
*/
interface TavernInterface {
function tavern(uint256 tokenId) external view returns (uint256, int, int, uint8, uint256);
}
contract TavernNFTs is ERC721Token, Superuser, ITavernNFTs {
constructor(string name, string symbol) public
ERC721Token(name, symbol)
{ }
TavernInterface public tavernContract;
uint16 public constant MAX_SUPPLY = 4000; // Tavern MAX SUPPLY
/**
* @dev set the Tavern contract address
* @return tavern Tavern contract address
*/
function setTavernContract(address tavern) onlySuperuser external {
tavernContract = TavernInterface(tavern);
emit SetTavernContract(tavern);
}
function mint(address to, uint256 tokenId) onlySuperuser public {
require(tokenId < MAX_SUPPLY);
super._mint(to, tokenId);
}
function batchMint(address[] tos, uint256[] tokenIds) onlySuperuser external {
uint256 i = 0;
while (i < tokenIds.length) {
super._mint(tos[i], tokenIds[i]);
i += 1;
}
}
function burn(uint256 tokenId) onlySuperuser public {
super._burn(ownerOf(tokenId), tokenId);
}
/**
* @dev Future use on ipfs or other decentralized storage platforms
*/
function setTokenURI(uint256 _tokenId, string _uri) onlyOwnerOrSuperuser public {
super._setTokenURI(_tokenId, _uri);
}
/**
* @dev get a Tavern's infomation
* @param tokenId tokenId
* @return uint256 Tavern's construction time
* @return int Tavern's longitude value
* @return int Tavern's latitude value
* @return uint8 Tavern's popularity
* @return uint256 Tavern's activeness
*/
function tavern(uint256 tokenId) external view returns (uint256, int, int, uint8, uint256){
return tavernContract.tavern(tokenId);
}
}