-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPCOLicenseParamsFacet.sol
258 lines (213 loc) · 8.49 KB
/
PCOLicenseParamsFacet.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import "../libraries/LibPCOLicenseParams.sol";
import "../interfaces/IPCOLicenseParamsStore.sol";
import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol";
import {OwnableInternal} from "@solidstate/contracts/access/ownable/OwnableInternal.sol";
import "../../beneficiary/interfaces/ICFABeneficiary.sol";
import {OwnableStorage} from "@solidstate/contracts/access/ownable/OwnableStorage.sol";
/// @title Public access to global Claimer parameters
contract PCOLicenseParamsFacet is IPCOLicenseParamsStore {
using OwnableStorage for OwnableStorage.Layout;
modifier onlyOwner() {
require(
msg.sender == OwnableStorage.layout().owner,
"Ownable: sender must be owner"
);
_;
}
/**
* @notice Initialize.
* - Must be the contract owner
* @param beneficiary Beneficiary of funds.
* @param paymentToken Payment token.
* @param host Superfluid host
* @param perSecondFeeNumerator The numerator of the network-wide per second contribution fee.
* @param perSecondFeeDenominator The denominator of the network-wide per second contribution fee.
* @param penaltyNumerator The numerator of the penalty to pay to reject a bid.
* @param penaltyDenominator The denominator of the penalty to pay to reject a bid.
* @param bidPeriodLengthInSeconds Bid period length in seconds
* @param reclaimAuctionLength when the required bid amount reaches its minimum value.
*/
function initializeParams(
ICFABeneficiary beneficiary,
ISuperToken paymentToken,
ISuperfluid host,
uint256 perSecondFeeNumerator,
uint256 perSecondFeeDenominator,
uint256 penaltyNumerator,
uint256 penaltyDenominator,
uint256 bidPeriodLengthInSeconds,
uint256 reclaimAuctionLength,
uint256 minForSalePrice
) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.beneficiary = beneficiary;
ds.paymentToken = paymentToken;
ds.host = host;
ds.perSecondFeeNumerator = perSecondFeeNumerator;
ds.perSecondFeeDenominator = perSecondFeeDenominator;
ds.penaltyNumerator = penaltyNumerator;
ds.penaltyDenominator = penaltyDenominator;
ds.bidPeriodLengthInSeconds = bidPeriodLengthInSeconds;
ds.reclaimAuctionLength = reclaimAuctionLength;
ds.minForSalePrice = minForSalePrice;
}
/// @notice Superfluid Host
function getHost() external view override returns (ISuperfluid) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.host;
}
/// @notice Set Superfluid Host
function setHost(ISuperfluid host) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.host = host;
}
/// @notice Payment token
function getPaymentToken() external view override returns (ISuperToken) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.paymentToken;
}
/// @notice Set Payment Token
function setPaymentToken(ISuperToken paymentToken) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.paymentToken = paymentToken;
}
/// @notice Beneficiary
function getBeneficiary() external view override returns (ICFABeneficiary) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.beneficiary;
}
/// @notice Set Beneficiary
function setBeneficiary(ICFABeneficiary beneficiary) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.beneficiary = beneficiary;
}
/// @notice The numerator of the network-wide per second contribution fee.
function getPerSecondFeeNumerator()
external
view
override
returns (uint256)
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.perSecondFeeNumerator;
}
/// @notice Set Per Second Fee Numerator
function setPerSecondFeeNumerator(uint256 perSecondFeeNumerator)
external
onlyOwner
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.perSecondFeeNumerator = perSecondFeeNumerator;
}
/// @notice The denominator of the network-wide per second contribution fee.
function getPerSecondFeeDenominator()
external
view
override
returns (uint256)
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.perSecondFeeDenominator;
}
/// @notice Set Per Second Fee Denominator
function setPerSecondFeeDenominator(uint256 perSecondFeeDenominator)
external
onlyOwner
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.perSecondFeeDenominator = perSecondFeeDenominator;
}
/// @notice The numerator of the penalty rate.
function getPenaltyNumerator() external view override returns (uint256) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.penaltyNumerator;
}
/// @notice Set Penalty Numerator
function setPenaltyNumerator(uint256 penaltyNumerator) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.penaltyNumerator = penaltyNumerator;
}
/// @notice The denominator of the penalty rate.
function getPenaltyDenominator() external view override returns (uint256) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.penaltyDenominator;
}
/// @notice Set Penalty Denominator
function setPenaltyDenominator(uint256 penaltyDenominator)
external
onlyOwner
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.penaltyDenominator = penaltyDenominator;
}
/// @notice the final/minimum required bid reached and maintained at the end of the auction.
function getReclaimAuctionLength()
external
view
override
returns (uint256)
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.reclaimAuctionLength;
}
/// @notice Set Reclaim Auction Length
function setReclaimAuctionLength(uint256 reclaimAuctionLength)
external
onlyOwner
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.reclaimAuctionLength = reclaimAuctionLength;
}
/// @notice Bid period length in seconds
function getBidPeriodLengthInSeconds()
external
view
override
returns (uint256)
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.bidPeriodLengthInSeconds;
}
/// @notice Set Bid Period Length in seconds
function setBidPeriodLengthInSeconds(uint256 bidPeriodLengthInSeconds)
external
onlyOwner
{
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.bidPeriodLengthInSeconds = bidPeriodLengthInSeconds;
}
/// @notice Minimum for sale price
function getMinForSalePrice() external view override returns (uint256) {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
return ds.minForSalePrice;
}
/// @notice Set minimum for sale price
function setMinForSalePrice(uint256 minForSalePrice) external onlyOwner {
LibPCOLicenseParams.DiamondStorage storage ds = LibPCOLicenseParams
.diamondStorage();
ds.minForSalePrice = minForSalePrice;
}
}