@@ -22,32 +22,32 @@ contract Curation is CurationV1Storage, ICuration, Governed {
22
22
// 100% in parts per million
23
23
uint32 private constant MAX_PPM = 1000000 ;
24
24
25
- // Amount of shares you get with your minimum token stake
26
- uint256 private constant SHARES_PER_MINIMUM_STAKE = 1 ether ;
25
+ // Amount of signal you get with your minimum token stake
26
+ uint256 private constant SIGNAL_PER_MINIMUM_STAKE = 1 ether ;
27
27
28
28
// -- Events --
29
29
30
30
/**
31
31
* @dev Emitted when `curator` staked `tokens` on `subgraphDeploymentID` as curation signal.
32
- * The `curator` receives `shares ` amount according to the curation pool bonding curve.
32
+ * The `curator` receives `signal ` amount according to the curation pool bonding curve.
33
33
*/
34
- event Staked (
34
+ event Signalled (
35
35
address indexed curator ,
36
36
bytes32 indexed subgraphDeploymentID ,
37
37
uint256 tokens ,
38
- uint256 shares
38
+ uint256 signal
39
39
);
40
40
41
41
/**
42
- * @dev Emitted when `curator` redeemed `shares ` for a `subgraphDeploymentID`.
42
+ * @dev Emitted when `curator` burned `signal ` for a `subgraphDeploymentID`.
43
43
* The curator will receive `tokens` according to the value of the bonding curve.
44
44
* An amount of `withdrawalFees` will be collected and burned.
45
45
*/
46
- event Redeemed (
46
+ event Burned (
47
47
address indexed curator ,
48
48
bytes32 indexed subgraphDeploymentID ,
49
49
uint256 tokens ,
50
- uint256 shares ,
50
+ uint256 signal ,
51
51
uint256 withdrawalFees
52
52
);
53
53
@@ -176,11 +176,11 @@ contract Curation is CurationV1Storage, ICuration, Governed {
176
176
}
177
177
178
178
/**
179
- * @dev Stake Graph Tokens in exchange for shares of a SubgraphDeployment curation pool.
180
- * @param _subgraphDeploymentID SubgraphDeployment where the curator is staking Graph Tokens
179
+ * @dev Stake Graph Tokens in exchange for signal of a SubgraphDeployment curation pool.
180
+ * @param _subgraphDeploymentID Subgraph deployment pool from where to mint signal
181
181
* @param _tokens Amount of Graph Tokens to stake
182
182
*/
183
- function stake (bytes32 _subgraphDeploymentID , uint256 _tokens ) external override {
183
+ function mint (bytes32 _subgraphDeploymentID , uint256 _tokens ) external override {
184
184
address curator = msg .sender ;
185
185
186
186
// Need to stake some funds
@@ -193,30 +193,30 @@ contract Curation is CurationV1Storage, ICuration, Governed {
193
193
);
194
194
195
195
// Stake tokens to a curation pool reserve
196
- _stake (curator, _subgraphDeploymentID, _tokens);
196
+ _mint (curator, _subgraphDeploymentID, _tokens);
197
197
}
198
198
199
199
/**
200
- * @dev Return an amount of shares to get tokens back.
201
- * @notice Redeem _shares from the SubgraphDeployment curation pool
202
- * @param _subgraphDeploymentID SubgraphDeployment the curator is returning shares
203
- * @param _shares Amount of shares to return
200
+ * @dev Return an amount of signal to get tokens back.
201
+ * @notice Burn _signal from the SubgraphDeployment curation pool
202
+ * @param _subgraphDeploymentID SubgraphDeployment the curator is returning signal
203
+ * @param _signal Amount of signal to return
204
204
*/
205
- function redeem (bytes32 _subgraphDeploymentID , uint256 _shares ) external override {
205
+ function burn (bytes32 _subgraphDeploymentID , uint256 _signal ) external override {
206
206
address curator = msg .sender ;
207
207
CurationPool storage curationPool = pools[_subgraphDeploymentID];
208
208
209
- require (_shares > 0 , "Cannot redeem zero shares " );
209
+ require (_signal > 0 , "Cannot burn zero signal " );
210
210
require (
211
- curationPool.curatorShares [curator] >= _shares ,
212
- "Cannot redeem more shares than you own "
211
+ curationPool.curatorSignal [curator] >= _signal ,
212
+ "Cannot burn more signal than you own "
213
213
);
214
214
215
- // Update balance and get the amount of tokens to refund based on returned shares
216
- uint256 tokens = _sellShares (curator, _subgraphDeploymentID, _shares );
215
+ // Update balance and get the amount of tokens to refund based on returned signal
216
+ uint256 tokens = _burnSignal (curator, _subgraphDeploymentID, _signal );
217
217
218
- // If all shares redeemed delete the curation pool
219
- if (curationPool.shares == 0 ) {
218
+ // If all signal burnt delete the curation pool
219
+ if (curationPool.signal == 0 ) {
220
220
delete pools[_subgraphDeploymentID];
221
221
}
222
222
@@ -230,7 +230,7 @@ contract Curation is CurationV1Storage, ICuration, Governed {
230
230
// Return the tokens to the curator
231
231
require (token.transfer (curator, tokens), "Error sending curator tokens " );
232
232
233
- emit Redeemed (curator, _subgraphDeploymentID, tokens, _shares , withdrawalFees);
233
+ emit Burned (curator, _subgraphDeploymentID, tokens, _signal , withdrawalFees);
234
234
}
235
235
236
236
/**
@@ -252,141 +252,141 @@ contract Curation is CurationV1Storage, ICuration, Governed {
252
252
}
253
253
254
254
/**
255
- * @dev Get the number of shares a curator has on a curation pool.
256
- * @param _curator Curator owning the shares
257
- * @param _subgraphDeploymentID SubgraphDeployment of issued shares
258
- * @return Number of shares owned by a curator for the SubgraphDeployment
255
+ * @dev Get the amount of signal a curator has on a curation pool.
256
+ * @param _curator Curator owning signal
257
+ * @param _subgraphDeploymentID SubgraphDeployment of issued signal
258
+ * @return Amount of signal owned by a curator for the SubgraphDeployment
259
259
*/
260
- function getCuratorShares (address _curator , bytes32 _subgraphDeploymentID )
260
+ function getCuratorSignal (address _curator , bytes32 _subgraphDeploymentID )
261
261
public
262
262
view
263
263
returns (uint256 )
264
264
{
265
- return pools[_subgraphDeploymentID].curatorShares [_curator];
265
+ return pools[_subgraphDeploymentID].curatorSignal [_curator];
266
266
}
267
267
268
268
/**
269
- * @dev Calculate number of shares that can be bought with tokens in a curation pool.
270
- * @param _subgraphDeploymentID SubgraphDeployment to buy shares
271
- * @param _tokens Amount of tokens used to buy shares
272
- * @return Amount of shares that can be bought
269
+ * @dev Calculate amount of signal that can be bought with tokens in a curation pool.
270
+ * @param _subgraphDeploymentID Subgraph deployment to mint signal
271
+ * @param _tokens Amount of tokens used to mint signal
272
+ * @return Amount of signal that can be bought
273
273
*/
274
- function tokensToShares (bytes32 _subgraphDeploymentID , uint256 _tokens )
274
+ function tokensToSignal (bytes32 _subgraphDeploymentID , uint256 _tokens )
275
275
public
276
276
view
277
277
returns (uint256 )
278
278
{
279
279
// Handle initialization of bonding curve
280
280
uint256 tokens = _tokens;
281
- uint256 shares = 0 ;
281
+ uint256 signal = 0 ;
282
282
CurationPool memory curationPool = pools[_subgraphDeploymentID];
283
283
if (curationPool.tokens == 0 ) {
284
284
curationPool = CurationPool (
285
285
minimumCurationStake,
286
- SHARES_PER_MINIMUM_STAKE ,
286
+ SIGNAL_PER_MINIMUM_STAKE ,
287
287
defaultReserveRatio
288
288
);
289
289
tokens = tokens.sub (curationPool.tokens);
290
- shares = curationPool.shares ;
290
+ signal = curationPool.signal ;
291
291
}
292
292
293
293
return
294
294
calculatePurchaseReturn (
295
- curationPool.shares ,
295
+ curationPool.signal ,
296
296
curationPool.tokens,
297
297
uint32 (curationPool.reserveRatio),
298
298
tokens
299
- ) + shares ;
299
+ ) + signal ;
300
300
}
301
301
302
302
/**
303
- * @dev Calculate number of tokens to get when selling shares from a curation pool.
304
- * @param _subgraphDeploymentID SubgraphDeployment to sell shares
305
- * @param _shares Amount of shares to sell
306
- * @return Amount of tokens to get after selling shares
303
+ * @dev Calculate number of tokens to get when burning signal from a curation pool.
304
+ * @param _subgraphDeploymentID Subgraph deployment to burn signal
305
+ * @param _signal Amount of signal to burn
306
+ * @return Amount of tokens to get after burning signal
307
307
*/
308
- function sharesToTokens (bytes32 _subgraphDeploymentID , uint256 _shares )
308
+ function signalToTokens (bytes32 _subgraphDeploymentID , uint256 _signal )
309
309
public
310
310
view
311
311
returns (uint256 )
312
312
{
313
313
CurationPool memory curationPool = pools[_subgraphDeploymentID];
314
314
require (
315
315
curationPool.tokens > 0 ,
316
- "SubgraphDeployment must be curated to perform calculations "
316
+ "Subgraph deployment must be curated to perform calculations "
317
317
);
318
318
require (
319
- curationPool.shares >= _shares ,
320
- "Shares must be above or equal to shares issued in the curation pool "
319
+ curationPool.signal >= _signal ,
320
+ "Signal must be above or equal to signal issued in the curation pool "
321
321
);
322
322
return
323
323
calculateSaleReturn (
324
- curationPool.shares ,
324
+ curationPool.signal ,
325
325
curationPool.tokens,
326
326
uint32 (curationPool.reserveRatio),
327
- _shares
327
+ _signal
328
328
);
329
329
}
330
330
331
331
/**
332
- * @dev Update balances after buy of shares and deposit of tokens.
333
- * @param _curator Curator
334
- * @param _subgraphDeploymentID SubgraphDeployment
332
+ * @dev Update balances after mint of signal and deposit of tokens.
333
+ * @param _curator Curator address
334
+ * @param _subgraphDeploymentID Subgraph deployment from where to mint signal
335
335
* @param _tokens Amount of tokens
336
- * @return Number of shares bought
336
+ * @return Amount of signal bought
337
337
*/
338
- function _buyShares (
338
+ function _mintSignal (
339
339
address _curator ,
340
340
bytes32 _subgraphDeploymentID ,
341
341
uint256 _tokens
342
342
) private returns (uint256 ) {
343
343
CurationPool storage curationPool = pools[_subgraphDeploymentID];
344
- uint256 shares = tokensToShares (_subgraphDeploymentID, _tokens);
344
+ uint256 signal = tokensToSignal (_subgraphDeploymentID, _tokens);
345
345
346
346
// Update tokens
347
347
curationPool.tokens = curationPool.tokens.add (_tokens);
348
348
349
- // Update shares
350
- curationPool.shares = curationPool.shares .add (shares );
351
- curationPool.curatorShares [_curator] = curationPool.curatorShares [_curator].add (shares );
349
+ // Update signal
350
+ curationPool.signal = curationPool.signal .add (signal );
351
+ curationPool.curatorSignal [_curator] = curationPool.curatorSignal [_curator].add (signal );
352
352
353
- return shares ;
353
+ return signal ;
354
354
}
355
355
356
356
/**
357
- * @dev Update balances after sell of shares and return of tokens.
358
- * @param _curator Curator
359
- * @param _subgraphDeploymentID SubgraphDeployment
360
- * @param _shares Amount of shares
357
+ * @dev Update balances after burn of signal and return of tokens.
358
+ * @param _curator Curator address
359
+ * @param _subgraphDeploymentID Subgraph deployment pool to burn signal
360
+ * @param _signal Amount of signal
361
361
* @return Number of tokens received
362
362
*/
363
- function _sellShares (
363
+ function _burnSignal (
364
364
address _curator ,
365
365
bytes32 _subgraphDeploymentID ,
366
- uint256 _shares
366
+ uint256 _signal
367
367
) private returns (uint256 ) {
368
368
CurationPool storage curationPool = pools[_subgraphDeploymentID];
369
- uint256 tokens = sharesToTokens (_subgraphDeploymentID, _shares );
369
+ uint256 tokens = signalToTokens (_subgraphDeploymentID, _signal );
370
370
371
371
// Update tokens
372
372
curationPool.tokens = curationPool.tokens.sub (tokens);
373
373
374
- // Update shares
375
- curationPool.shares = curationPool.shares .sub (_shares );
376
- curationPool.curatorShares [_curator] = curationPool.curatorShares [_curator].sub (_shares );
374
+ // Update signal
375
+ curationPool.signal = curationPool.signal .sub (_signal );
376
+ curationPool.curatorSignal [_curator] = curationPool.curatorSignal [_curator].sub (_signal );
377
377
378
378
return tokens;
379
379
}
380
380
381
381
/**
382
382
* @dev Assign Graph Tokens received from staking to the curation pool reserve.
383
- * @param _subgraphDeploymentID SubgraphDeployment where funds should be allocated as reserves
383
+ * @param _subgraphDeploymentID Subgraph deployment where funds should be allocated as reserves
384
384
* @param _tokens Amount of Graph Tokens to add to reserves
385
385
*/
386
386
function _collect (bytes32 _subgraphDeploymentID , uint256 _tokens ) private {
387
387
require (
388
388
_isCurated (_subgraphDeploymentID),
389
- "SubgraphDeployment must be curated to collect fees "
389
+ "Subgraph deployment must be curated to collect fees "
390
390
);
391
391
392
392
// Collect new funds into reserve
@@ -397,12 +397,12 @@ contract Curation is CurationV1Storage, ICuration, Governed {
397
397
}
398
398
399
399
/**
400
- * @dev Deposit Graph Tokens in exchange for shares of a curation pool.
400
+ * @dev Deposit Graph Tokens in exchange for signal of a curation pool.
401
401
* @param _curator Address of the staking party
402
- * @param _subgraphDeploymentID SubgraphDeployment where the curator is staking tokens
402
+ * @param _subgraphDeploymentID Subgraph deployment from where the curator is minting
403
403
* @param _tokens Amount of Graph Tokens to stake
404
404
*/
405
- function _stake (
405
+ function _mint (
406
406
address _curator ,
407
407
bytes32 _subgraphDeploymentID ,
408
408
uint256 _tokens
@@ -418,8 +418,8 @@ contract Curation is CurationV1Storage, ICuration, Governed {
418
418
}
419
419
420
420
// Update balances
421
- uint256 shares = _buyShares (_curator, _subgraphDeploymentID, _tokens);
421
+ uint256 signal = _mintSignal (_curator, _subgraphDeploymentID, _tokens);
422
422
423
- emit Staked (_curator, _subgraphDeploymentID, _tokens, shares );
423
+ emit Signalled (_curator, _subgraphDeploymentID, _tokens, signal );
424
424
}
425
425
}
0 commit comments