Skip to content

Commit ee44102

Browse files
abarmatdavekay100
authored andcommitted
curation: provide an explicit getter for the curation tax in the interface with the same name than the variable to avoid having two getters
1 parent 80d5bbd commit ee44102

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

contracts/curation/Curation.sol

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
154154
"Curation tax percentage must be below or equal to MAX_PPM"
155155
);
156156

157-
curationTaxPercentage = _percentage;
157+
_curationTaxPercentage = _percentage;
158158
emit ParameterUpdated("curationTaxPercentage");
159159
}
160160

@@ -359,13 +359,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
359359
* @dev Get curation tax percentage
360360
* @return Amount the curation tax percentage in PPM
361361
*/
362-
function getCurationTaxPercentage()
363-
external
364-
override
365-
view
366-
returns (uint32)
367-
{
368-
return curationTaxPercentage;
362+
function curationTaxPercentage() external override view returns (uint32) {
363+
return _curationTaxPercentage;
369364
}
370365

371366
/**
@@ -381,7 +376,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
381376
view
382377
returns (uint256, uint256)
383378
{
384-
uint256 curationTax = _tokensIn.mul(uint256(curationTaxPercentage)).div(MAX_PPM);
379+
uint256 curationTax = _tokensIn.mul(uint256(_curationTaxPercentage)).div(MAX_PPM);
385380
uint256 signalOut = _tokensToSignal(_subgraphDeploymentID, _tokensIn.sub(curationTax));
386381
return (signalOut, curationTax);
387382
}

contracts/curation/CurationStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contract CurationV1Storage is Managed {
1010

1111
// Tax charged when curator deposit funds
1212
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
13-
uint32 public curationTaxPercentage;
13+
uint32 internal _curationTaxPercentage;
1414

1515
// Default reserve ratio to configure curator shares bonding curve
1616
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)

contracts/curation/ICuration.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ interface ICuration {
6060
view
6161
returns (uint256);
6262

63-
function getCurationTaxPercentage() external view returns (uint32);
63+
function curationTaxPercentage() external view returns (uint32);
6464
}

contracts/discovery/GNS.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
370370
uint256 tokens = curation.burn(namePool.subgraphDeploymentID, namePool.vSignal, 0);
371371

372372
// Take the owner cut of the curation tax, add it to the total
373-
uint32 curationTaxPercentage = curation.getCurationTaxPercentage();
373+
uint32 curationTaxPercentage = curation.curationTaxPercentage();
374374
uint256 tokensWithTax = _chargeOwnerTax(tokens, _graphAccount, curationTaxPercentage);
375375

376376
// Update pool: constant nSignal, vSignal can change
@@ -557,9 +557,9 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
557557

558558
// The total after tax, plus owner partial repay, divided by
559559
// the tax, to adjust it slightly upwards. ex:
560-
// 100 GRT, 5 GRT Tax, owner pays 100% --> 5 GRT
561-
// To get 100 in the protocol after tax, Owner deposits
562-
// ~5.26, as ~105.26 * .95 = 100
560+
// 100 GRT, 5 GRT Tax, owner pays 100% --> 5 GRT
561+
// To get 100 in the protocol after tax, Owner deposits
562+
// ~5.26, as ~105.26 * .95 = 100
563563
uint256 totalAdjustedUp = totalWithOwnerTax.mul(MAX_PPM).div(
564564
uint256(MAX_PPM).sub(uint256(_curationTaxPercentage))
565565
);
@@ -587,8 +587,8 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
587587
uint256 _tokensIn
588588
)
589589
public
590-
view
591590
override
591+
view
592592
returns (
593593
uint256,
594594
uint256,
@@ -615,7 +615,7 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
615615
address _graphAccount,
616616
uint256 _subgraphNumber,
617617
uint256 _nSignalIn
618-
) public view override returns (uint256, uint256) {
618+
) public override view returns (uint256, uint256) {
619619
NameCurationPool storage namePool = nameSignals[_graphAccount][_subgraphNumber];
620620
uint256 vSignal = nSignalToVSignal(_graphAccount, _subgraphNumber, _nSignalIn);
621621
uint256 tokensOut = curation().signalToTokens(namePool.subgraphDeploymentID, vSignal);
@@ -633,7 +633,7 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
633633
address _graphAccount,
634634
uint256 _subgraphNumber,
635635
uint256 _vSignalIn
636-
) public view override returns (uint256) {
636+
) public override view returns (uint256) {
637637
NameCurationPool storage namePool = nameSignals[_graphAccount][_subgraphNumber];
638638

639639
// Handle initialization by using 1:1 version to name signal
@@ -661,7 +661,7 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
661661
address _graphAccount,
662662
uint256 _subgraphNumber,
663663
uint256 _nSignalIn
664-
) public view override returns (uint256) {
664+
) public override view returns (uint256) {
665665
NameCurationPool storage namePool = nameSignals[_graphAccount][_subgraphNumber];
666666
return
667667
BancorFormula(bondingCurve).calculateSaleReturn(
@@ -683,7 +683,7 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
683683
address _graphAccount,
684684
uint256 _subgraphNumber,
685685
address _curator
686-
) public view override returns (uint256) {
686+
) public override view returns (uint256) {
687687
return nameSignals[_graphAccount][_subgraphNumber].curatorNSignal[_curator];
688688
}
689689

@@ -695,8 +695,8 @@ contract GNS is GNSV1Storage, GraphUpgradeable, IGNS {
695695
*/
696696
function isPublished(address _graphAccount, uint256 _subgraphNumber)
697697
public
698-
view
699698
override
699+
view
700700
returns (bool)
701701
{
702702
return subgraphs[_graphAccount][_subgraphNumber] != 0;

0 commit comments

Comments
 (0)