forked from MyBitFoundation/MyBit-Network.tech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Platform.sol
116 lines (94 loc) · 3.81 KB
/
Platform.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
pragma solidity ^0.4.24;
import '../database/Database.sol';
import '../database/Events.sol';
contract Platform {
Database public database;
Events public events;
// @notice initialize database
constructor(address _database, address _events)
public {
database = Database(_database);
events = Events(_events);
}
// @notice The wallet to receive payments here before initiating crowdsale
// @dev will overwrite old wallet address
function setPlatformFundsWallet(address _walletAddress)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.wallet.funds")), _walletAddress);
//emit LogPlatformWallet(_walletAddress);
events.registration('Platform funds wallet', _walletAddress);
}
// @notice The wallet to receive asset tokens here before initiating crowdsale
// @dev will overwrite old wallet address
function setPlatformAssetsWallet(address _walletAddress)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.wallet.assets")), _walletAddress);
//emit LogPlatformWallet(_walletAddress);
events.registration('Platform assets wallet', _walletAddress);
}
// @notice The token that the platform uses for holding collateral
function setPlatformToken(address _tokenAddress)
external
onlyOwner {
//@dev Set the address for the platform token
database.setAddress(keccak256(abi.encodePacked("platform.token")), _tokenAddress);
events.registration('Platform token', _tokenAddress);
}
// @notice The percentage of the payment that the platform receives when investors contribute
function setPlatformFee(uint _percent)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.fee")), _percent);
}
// @notice Set the token address for the platform listing fee
function setPlatformListingFeeToken(address _tokenAddress)
external
onlyOwner {
//@dev Set the token address for the platform listing fee
database.setAddress(keccak256(abi.encodePacked("platform.listingFeeToken")), _tokenAddress);
events.registration('Platform listing fee token', _tokenAddress);
}
// @notice The amount of DAI the platform receives when an asset is listed
function setPlatformListingFee(uint _amount)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.listingFee")), _amount);
}
// @notice The percentage of the asset tokens the platform receives from the crowdsale
function setPlatformPercentage(uint _percent)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.percentage")), _percent);
}
// @notice Set the address of the token factory that clones the asset tokens
function setTokenFactory(address _factory)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.tokenFactory")), _factory);
}
/*
function setBurnrate(uint _percent)
external
onlyOwner {
require(_percent < 100 && _percent >= 0);
database.setUint(keccak256(abi.encodePacked("platform.burnRate")), _percent);
}
*/
// @notice platform owners can destroy contract here
function destroy()
onlyOwner
external {
events.transaction('PlatformFunds destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Modifiers //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// @notice Sender must be a registered owner
modifier onlyOwner {
require(database.boolStorage(keccak256(abi.encodePacked("owner", msg.sender))));
_;
}
}