@@ -206,8 +206,7 @@ contract Curation is CurationV1Storage, ICuration, Governed {
206
206
);
207
207
208
208
// Stake tokens to a curation pool reserve
209
- uint256 signal = _mint (curator, _subgraphDeploymentID, _tokens);
210
- return signal;
209
+ return _mint (curator, _subgraphDeploymentID, _tokens);
211
210
}
212
211
213
212
/**
@@ -231,17 +230,19 @@ contract Curation is CurationV1Storage, ICuration, Governed {
231
230
);
232
231
233
232
// Update balance and get the amount of tokens to refund based on returned signal
234
- uint256 tokens = _burnSignal (curator, _subgraphDeploymentID, _signal);
233
+ (uint256 tokens , uint256 withdrawalFees ) = _burnSignal (
234
+ curator,
235
+ _subgraphDeploymentID,
236
+ _signal
237
+ );
235
238
236
239
// If all signal burnt delete the curation pool
237
240
if (getCurationPoolSignal (_subgraphDeploymentID) == 0 ) {
238
241
delete pools[_subgraphDeploymentID];
239
242
}
240
243
241
- // Calculate withdrawal fees and burn the tokens
242
- uint256 withdrawalFees = uint256 (withdrawalFeePercentage).mul (tokens).div (MAX_PPM);
244
+ // Burn withdrawal fees
243
245
if (withdrawalFees > 0 ) {
244
- tokens = tokens.sub (withdrawalFees);
245
246
token.burn (withdrawalFees);
246
247
}
247
248
@@ -332,13 +333,13 @@ contract Curation is CurationV1Storage, ICuration, Governed {
332
333
* @dev Calculate number of tokens to get when burning signal from a curation pool.
333
334
* @param _subgraphDeploymentID Subgraph deployment to burn signal
334
335
* @param _signal Amount of signal to burn
335
- * @return Amount of tokens to get after burning signal
336
+ * @return Amount of tokens to get after burning signal and withdrawal fees
336
337
*/
337
338
function signalToTokens (bytes32 _subgraphDeploymentID , uint256 _signal )
338
339
public
339
340
override
340
341
view
341
- returns (uint256 )
342
+ returns (uint256 , uint256 )
342
343
{
343
344
CurationPool memory curationPool = pools[_subgraphDeploymentID];
344
345
uint256 curationPoolSignal = getCurationPoolSignal (_subgraphDeploymentID);
@@ -350,13 +351,16 @@ contract Curation is CurationV1Storage, ICuration, Governed {
350
351
curationPoolSignal >= _signal,
351
352
"Signal must be above or equal to signal issued in the curation pool "
352
353
);
353
- return
354
- calculateSaleReturn (
355
- curationPoolSignal,
356
- curationPool.tokens,
357
- uint32 (curationPool.reserveRatio),
358
- _signal
359
- );
354
+
355
+ uint256 tokens = calculateSaleReturn (
356
+ curationPoolSignal,
357
+ curationPool.tokens,
358
+ curationPool.reserveRatio,
359
+ _signal
360
+ );
361
+ uint256 withdrawalFees = tokens.mul (uint256 (withdrawalFeePercentage)).div (MAX_PPM);
362
+
363
+ return (tokens.sub (withdrawalFees), withdrawalFees);
360
364
}
361
365
362
366
/**
@@ -388,23 +392,23 @@ contract Curation is CurationV1Storage, ICuration, Governed {
388
392
* @param _curator Curator address
389
393
* @param _subgraphDeploymentID Subgraph deployment pool to burn signal
390
394
* @param _signal Amount of signal to burn
391
- * @return Number of tokens received
395
+ * @return Number of tokens received and withdrawal fees
392
396
*/
393
397
function _burnSignal (
394
398
address _curator ,
395
399
bytes32 _subgraphDeploymentID ,
396
400
uint256 _signal
397
- ) private returns (uint256 ) {
401
+ ) private returns (uint256 , uint256 ) {
398
402
CurationPool storage curationPool = pools[_subgraphDeploymentID];
399
- uint256 tokens = signalToTokens (_subgraphDeploymentID, _signal);
403
+ ( uint256 tokens , uint256 withdrawalFees ) = signalToTokens (_subgraphDeploymentID, _signal);
400
404
401
405
// Update GRT tokens held as reserves
402
- curationPool.tokens = curationPool.tokens.sub (tokens);
406
+ curationPool.tokens = curationPool.tokens.sub (tokens. add (withdrawalFees) );
403
407
404
408
// Burn signal from curator
405
409
curationPool.gst.burnFrom (_curator, _signal);
406
410
407
- return tokens;
411
+ return ( tokens, withdrawalFees) ;
408
412
}
409
413
410
414
/**
0 commit comments