Skip to content

Commit f21b86a

Browse files
committed
curation: rename minimum curation stake to deposit
1 parent ac5db95 commit f21b86a

File tree

8 files changed

+130
-117
lines changed

8 files changed

+130
-117
lines changed

DEPLOYMENT.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,41 +71,45 @@ Example:
7171

7272
```
7373
general:
74-
governor: &governor "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"
74+
arbitrator: &arbitrator "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"
7575
nodeSignerAddress: &nodeSignerAddress "0x0000000000000000000000000000000000000000"
7676
7777
contracts:
7878
Curation:
79-
governor: *governor
80-
token: "${{GraphToken.address}}"
81-
reserveRatio: 500000
82-
minimumCurationStake: "100000000000000000000" # 100 GRT
83-
__calls:
79+
init:
80+
token: "${{GraphToken.address}}"
81+
reserveRatio: 500000 # 50% bonding curve reserve ratio parameter
82+
minimumCurationDeposit: "100000000000000000000" # 100 GRT
83+
proxy: true
84+
calls:
8485
- fn: "setWithdrawalFeePercentage"
85-
withdrawalFeePercentage: 50000
86+
withdrawalFeePercentage: 50000 # 5% fee for redeeming signal
8687
DisputeManager:
87-
governor: *governor
88-
arbitrator: *governor
89-
token: "${{GraphToken.address}}"
90-
staking: "${{Staking.address}}"
91-
minimumDeposit: "100000000000000000000" # 100 GRT
92-
fishermanRewardPercentage: 1000 # in basis points
93-
slashingPercentage: 1000 # in basis points
88+
init:
89+
arbitrator: *arbitrator
90+
token: "${{GraphToken.address}}"
91+
staking: "${{Staking.address}}"
92+
minimumDeposit: "100000000000000000000" # 100 GRT
93+
fishermanRewardPercentage: 100000 # in basis points
94+
slashingPercentage: 50000 # in basis points
9495
EpochManager:
95-
governor: *governor
96-
lengthInBlocks: 5760 # One day in blocks
96+
init:
97+
lengthInBlocks: 5760 # One day in blocks
98+
proxy: true
9799
GNS:
98-
governor: *governor
100+
init:
101+
didRegistry: "0xdca7ef03e98e0dc2b855be647c39abe984fcf21b"
102+
curation: "${{Curation.address}}"
103+
token: "${{GraphToken.address}}"
99104
GraphToken:
100-
governor: *governor
101-
initialSupply: "10000000000000000000000000" # 10000000 GRT
102-
RewardManager:
103-
governor: *governor
105+
init:
106+
initialSupply: "10000000000000000000000000" # 10000000 GRT
104107
Staking:
105-
governor: *governor
106-
token: "${{GraphToken.address}}"
107-
epochManager: "${{EpochManager.address}}"
108-
__calls:
108+
init:
109+
token: "${{GraphToken.address}}"
110+
epochManager: "${{EpochManager.address}}"
111+
proxy: true
112+
calls:
109113
- fn: "setCuration"
110114
curation: "${{Curation.address}}"
111115
- fn: "setChannelDisputeEpochs"
@@ -115,12 +119,13 @@ contracts:
115119
- fn: "setThawingPeriod"
116120
thawingPeriod: 20 # in blocks
117121
MinimumViableMultisig:
118-
node: *nodeSignerAddress
119-
staking: "${{Staking.address}}"
120-
CTDT: "${{IndexerCTDT.address}}"
121-
singleAssetInterpreter: "${{IndexerSingleAssetInterpreter.address}}"
122-
multiAssetInterpreter: "${{IndexerMultiAssetInterpreter.address}}"
123-
withdrawInterpreter: "${{IndexerWithdrawInterpreter.address}}"
122+
init:
123+
node: *nodeSignerAddress
124+
staking: "${{Staking.address}}"
125+
CTDT: "${{IndexerCTDT.address}}"
126+
singleAssetInterpreter: "${{IndexerSingleAssetInterpreter.address}}"
127+
multiAssetInterpreter: "${{IndexerMultiAssetInterpreter.address}}"
128+
withdrawInterpreter: "${{IndexerWithdrawInterpreter.address}}"
124129
```
125130

126131
### Address book

contracts/curation/Curation.sol

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import "./ICuration.sol";
1414
* @dev Allows curators to signal on subgraph deployments that might be relevant to indexers by
1515
* staking Graph Tokens (GRT). Additionally, curators earn fees from the Query Market related to the
1616
* subgraph deployment they curate.
17-
* A curators stake goes to a curation pool along with the stakes of other curators,
17+
* A curators deposit goes to a curation pool along with the deposits of other curators,
1818
* only one such pool exists for each subgraph deployment.
1919
* The contract mints Graph Signal Tokens (GST) according to a bonding curve for each individual
2020
* curation pool where GRT is deposited.
@@ -27,13 +27,13 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
2727
// 100% in parts per million
2828
uint32 private constant MAX_PPM = 1000000;
2929

30-
// Amount of signal you get with your minimum token stake
31-
uint256 private constant SIGNAL_PER_MINIMUM_STAKE = 1 ether;
30+
// Amount of signal you get with your minimum token deposit
31+
uint256 private constant SIGNAL_PER_MINIMUM_DEPOSIT = 1e18; // 1 signal as 18 decimal number
3232

3333
// -- Events --
3434

3535
/**
36-
* @dev Emitted when `curator` staked `tokens` on `subgraphDeploymentID` as curation signal.
36+
* @dev Emitted when `curator` deposited `tokens` on `subgraphDeploymentID` as curation signal.
3737
* The `curator` receives `signal` amount according to the curation pool bonding curve.
3838
*/
3939
event Signalled(
@@ -69,28 +69,28 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
6969
address _governor,
7070
address _token,
7171
uint32 _defaultReserveRatio,
72-
uint256 _minimumCurationStake
72+
uint256 _minimumCurationDeposit
7373
) external onlyImpl {
7474
Governed._initialize(_governor);
7575
BancorFormula._initialize();
7676

7777
token = IGraphToken(_token);
7878
defaultReserveRatio = _defaultReserveRatio;
79-
minimumCurationStake = _minimumCurationStake;
79+
minimumCurationDeposit = _minimumCurationDeposit;
8080
}
8181

8282
/**
8383
* @dev Accept to be an implementation of proxy and run initializer.
8484
* @param _proxy Graph proxy delegate caller
8585
* @param _token Address of the Graph Protocol token
8686
* @param _defaultReserveRatio Reserve ratio to initialize the bonding curve of CurationPool
87-
* @param _minimumCurationStake Minimum amount of tokens that curators can stake
87+
* @param _minimumCurationDeposit Minimum amount of tokens that curators can deposit
8888
*/
8989
function acceptProxy(
9090
GraphProxy _proxy,
9191
address _token,
9292
uint32 _defaultReserveRatio,
93-
uint256 _minimumCurationStake
93+
uint256 _minimumCurationDeposit
9494
) external {
9595
// Accept to be the implementation for this proxy
9696
_acceptUpgrade(_proxy);
@@ -100,7 +100,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
100100
_proxy.admin(), // default governor is proxy admin
101101
_token,
102102
_defaultReserveRatio,
103-
_minimumCurationStake
103+
_minimumCurationDeposit
104104
);
105105
}
106106

@@ -132,19 +132,23 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
132132
}
133133

134134
/**
135-
* @dev Set the minimum stake amount for curators.
136-
* @notice Update the minimum stake amount to `_minimumCurationStake`
137-
* @param _minimumCurationStake Minimum amount of tokens required stake
135+
* @dev Set the minimum deposit amount for curators.
136+
* @notice Update the minimum deposit amount to `_minimumCurationDeposit`
137+
* @param _minimumCurationDeposit Minimum amount of tokens required deposit
138138
*/
139-
function setMinimumCurationStake(uint256 _minimumCurationStake) external override onlyGovernor {
140-
require(_minimumCurationStake > 0, "Minimum curation stake cannot be 0");
141-
minimumCurationStake = _minimumCurationStake;
142-
emit ParameterUpdated("minimumCurationStake");
139+
function setMinimumCurationDeposit(uint256 _minimumCurationDeposit)
140+
external
141+
override
142+
onlyGovernor
143+
{
144+
require(_minimumCurationDeposit > 0, "Minimum curation deposit cannot be 0");
145+
minimumCurationDeposit = _minimumCurationDeposit;
146+
emit ParameterUpdated("minimumCurationDeposit");
143147
}
144148

145149
/**
146-
* @dev Set the fee percentage to charge when a curator withdraws stake.
147-
* @param _percentage Percentage fee charged when withdrawing stake
150+
* @dev Set the fee percentage to charge when a curator withdraws GRT tokens.
151+
* @param _percentage Percentage fee charged when withdrawing GRT tokens
148152
*/
149153
function setWithdrawalFeePercentage(uint32 _percentage) external override onlyGovernor {
150154
// Must be within 0% to 100% (inclusive)
@@ -175,9 +179,9 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
175179
}
176180

177181
/**
178-
* @dev Stake Graph Tokens in exchange for signal of a SubgraphDeployment curation pool.
182+
* @dev Deposit Graph Tokens in exchange for signal of a SubgraphDeployment curation pool.
179183
* @param _subgraphDeploymentID Subgraph deployment pool from where to mint signal
180-
* @param _tokens Amount of Graph Tokens to stake
184+
* @param _tokens Amount of Graph Tokens to deposit
181185
* @return Signal minted
182186
*/
183187
function mint(bytes32 _subgraphDeploymentID, uint256 _tokens)
@@ -187,16 +191,16 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
187191
{
188192
address curator = msg.sender;
189193

190-
// Need to stake some funds
191-
require(_tokens > 0, "Cannot stake zero tokens");
194+
// Need to deposit some funds
195+
require(_tokens > 0, "Cannot deposit zero tokens");
192196

193197
// Transfer tokens from the curator to this contract
194198
require(
195199
token.transferFrom(curator, address(this), _tokens),
196-
"Cannot transfer tokens to stake"
200+
"Cannot transfer tokens to deposit"
197201
);
198202

199-
// Stake tokens to a curation pool reserve
203+
// Deposit tokens to a curation pool reserve
200204
return _mint(curator, _subgraphDeploymentID, _tokens);
201205
}
202206

@@ -245,7 +249,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
245249
}
246250

247251
/**
248-
* @dev Check if any Graph tokens are staked for a SubgraphDeployment.
252+
* @dev Check if any GRT tokens are deposited for a SubgraphDeployment.
249253
* @param _subgraphDeploymentID SubgraphDeployment to check if curated
250254
* @return True if curated
251255
*/
@@ -309,9 +313,9 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
309313

310314
// Init curation pool
311315
if (curationPool.tokens == 0) {
312-
newTokens = newTokens.sub(minimumCurationStake);
313-
curTokens = minimumCurationStake;
314-
curSignal = SIGNAL_PER_MINIMUM_STAKE;
316+
newTokens = newTokens.sub(minimumCurationDeposit);
317+
curTokens = minimumCurationDeposit;
318+
curSignal = SIGNAL_PER_MINIMUM_DEPOSIT;
315319
reserveRatio = defaultReserveRatio;
316320
}
317321

@@ -424,7 +428,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
424428
* @dev Deposit Graph Tokens in exchange for signal of a curation pool.
425429
* @param _curator Address of the staking party
426430
* @param _subgraphDeploymentID Subgraph deployment from where the curator is minting
427-
* @param _tokens Amount of Graph Tokens to stake
431+
* @param _tokens Amount of Graph Tokens to deposit
428432
* @return Signal minted
429433
*/
430434
function _mint(
@@ -436,7 +440,10 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration, Governed {
436440

437441
// If it hasn't been curated before then initialize the curve
438442
if (!isCurated(_subgraphDeploymentID)) {
439-
require(_tokens >= minimumCurationStake, "Curation stake is below minimum required");
443+
require(
444+
_tokens >= minimumCurationDeposit,
445+
"Curation deposit is below minimum required"
446+
);
440447

441448
// Initialize
442449
curationPool.reserveRatio = defaultReserveRatio;

contracts/curation/CurationStorage.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ contract CurationV1Storage is BancorFormula {
1717

1818
// -- State --
1919

20-
// Fee charged when curator withdraw stake
20+
// Fee charged when curator withdraw deposit
2121
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
2222
uint32 public withdrawalFeePercentage;
2323

2424
// Default reserve ratio to configure curator shares bonding curve
2525
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
2626
uint32 public defaultReserveRatio;
2727

28-
// Minimum amount allowed to be staked by curators
28+
// Minimum amount allowed to be deposit by curators
2929
// This is the `startPoolBalance` for the bonding curve
30-
uint256 public minimumCurationStake;
30+
uint256 public minimumCurationDeposit;
3131

3232
// Mapping of subgraphDeploymentID => CurationPool
3333
// There is only one CurationPool per SubgraphDeploymentID

contracts/curation/ICuration.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface ICuration {
77

88
function setStaking(address _staking) external;
99

10-
function setMinimumCurationStake(uint256 _minimumCurationStake) external;
10+
function setMinimumCurationDeposit(uint256 _minimumCurationDeposit) external;
1111

1212
function setWithdrawalFeePercentage(uint32 _percentage) external;
1313

graph.config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ contracts:
77
init:
88
token: "${{GraphToken.address}}"
99
reserveRatio: 500000 # 50% bonding curve reserve ratio parameter
10-
minimumCurationStake: "100000000000000000000" # 100 GRT
10+
minimumCurationDeposit: "100000000000000000000" # 100 GRT
1111
proxy: true
1212
calls:
1313
- fn: "setWithdrawalFeePercentage"

test/curation/configuration.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,26 @@ describe('Curation:Config', () => {
8686
})
8787
})
8888

89-
describe('minimumCurationStake', function () {
90-
it('should set `minimumCurationStake`', async function () {
89+
describe('minimumCurationDeposit', function () {
90+
it('should set `minimumCurationDeposit`', async function () {
9191
// Set right in the constructor
92-
expect(await curation.minimumCurationStake()).eq(defaults.curation.minimumCurationStake)
92+
expect(await curation.minimumCurationDeposit()).eq(defaults.curation.minimumCurationDeposit)
9393

9494
// Can set if allowed
9595
const newValue = toBN('100')
96-
await curation.connect(governor.signer).setMinimumCurationStake(newValue)
97-
expect(await curation.minimumCurationStake()).eq(newValue)
96+
await curation.connect(governor.signer).setMinimumCurationDeposit(newValue)
97+
expect(await curation.minimumCurationDeposit()).eq(newValue)
9898
})
9999

100-
it('reject set `minimumCurationStake` if out of bounds', async function () {
101-
const tx = curation.connect(governor.signer).setMinimumCurationStake(0)
102-
await expect(tx).revertedWith('Minimum curation stake cannot be 0')
100+
it('reject set `minimumCurationDeposit` if out of bounds', async function () {
101+
const tx = curation.connect(governor.signer).setMinimumCurationDeposit(0)
102+
await expect(tx).revertedWith('Minimum curation deposit cannot be 0')
103103
})
104104

105-
it('reject set `minimumCurationStake` if not allowed', async function () {
105+
it('reject set `minimumCurationDeposit` if not allowed', async function () {
106106
const tx = curation
107107
.connect(me.signer)
108-
.setMinimumCurationStake(defaults.curation.minimumCurationStake)
108+
.setMinimumCurationDeposit(defaults.curation.minimumCurationDeposit)
109109
await expect(tx).revertedWith('Only Governor can call')
110110
})
111111
})

0 commit comments

Comments
 (0)