Skip to content

Commit 245c6cb

Browse files
authored
Cleanup interfaces (#70)
1 parent 427938e commit 245c6cb

File tree

3 files changed

+57
-50
lines changed

3 files changed

+57
-50
lines changed

src/grants/base/StandardFunding.sol

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ abstract contract StandardFunding is Funding, IStandardFunding {
126126
// update Treasury with unused funds from last two distributions
127127
{
128128
// Check if any last distribution exists and its challenge stage is over
129-
if ( currentDistributionId > 0 && (block.number > _getChallengeStageEndBlock(currentDistributionEndBlock))) {
129+
if (currentDistributionId > 0 && (block.number > _getChallengeStageEndBlock(currentDistributionEndBlock))) {
130130
// Add unused funds from last distribution to treasury
131131
_updateTreasury(currentDistributionId);
132132
}
133133

134134
// checks if any second last distribution exist and its unused funds are not added into treasury
135-
if ( currentDistributionId > 1 && !_isSurplusFundsUpdated[currentDistributionId - 1]) {
135+
if (currentDistributionId > 1 && !_isSurplusFundsUpdated[currentDistributionId - 1]) {
136136
// Add unused funds from second last distribution to treasury
137137
_updateTreasury(currentDistributionId - 1);
138138
}
@@ -300,7 +300,7 @@ abstract contract StandardFunding is Funding, IStandardFunding {
300300
function updateSlate(
301301
uint256[] calldata proposalIds_,
302302
uint24 distributionId_
303-
) external override returns (bool) {
303+
) external override returns (bool newTopSlate_) {
304304
QuarterlyDistribution storage currentDistribution = _distributions[distributionId_];
305305

306306
// store number of proposals for reduced gas cost of iterations
@@ -313,12 +313,12 @@ abstract contract StandardFunding is Funding, IStandardFunding {
313313
bytes32 currentSlateHash = currentDistribution.fundedSlateHash;
314314
bytes32 newSlateHash = keccak256(abi.encode(proposalIds_));
315315

316-
// check if slate of proposals is new top slate
317-
bool newTopSlate = currentSlateHash == 0 ||
316+
// check if slate of proposals is better than the existing slate, and is thus the new top slate
317+
newTopSlate_ = currentSlateHash == 0 ||
318318
(currentSlateHash!= 0 && sum > _sumProposalFundingVotes(_fundedProposalSlates[currentSlateHash]));
319319

320320
// if slate of proposals is new top slate, update state
321-
if (newTopSlate) {
321+
if (newTopSlate_) {
322322
uint256[] storage existingSlate = _fundedProposalSlates[newSlateHash];
323323

324324
for (uint i = 0; i < numProposalsInSlate; ) {
@@ -337,8 +337,6 @@ abstract contract StandardFunding is Funding, IStandardFunding {
337337
newSlateHash
338338
);
339339
}
340-
341-
return newTopSlate;
342340
}
343341

344342
/// @inheritdoc IStandardFunding

src/grants/interfaces/IExtraordinaryFunding.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface IExtraordinaryFunding {
4747
* @param targets_ The addresses of the contracts to call.
4848
* @param values_ The amounts of ETH to send to each target.
4949
* @param calldatas_ The calldata to send to each target.
50-
* @param descriptionHash_ The hash of the proposal's description.
50+
* @param descriptionHash_ The hash of the proposal's description string.
5151
* @return proposalId_ The ID of the executed proposal.
5252
*/
5353
function executeExtraordinary(
@@ -95,7 +95,7 @@ interface IExtraordinaryFunding {
9595

9696
/**
9797
* @notice Get the number of ajna tokens equivalent to a given percentage.
98-
* @param percentage_ The percentage of the Non treasury to retrieve, in WAD.
98+
* @param percentage_ The percentage of the non-treasury to retrieve, in WAD.
9999
* @return The number of tokens, in WAD.
100100
*/
101101
function getSliceOfNonTreasury(

src/grants/interfaces/IStandardFunding.sol

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -68,36 +68,36 @@ interface IStandardFunding {
6868

6969
/**
7070
* @notice Emitted when a new top ten slate is submitted and set as the leading optimized slate.
71-
* @param distributionId_ Id of the distribution period.
72-
* @param fundedSlateHash_ Hash of the proposals to be funded.
71+
* @param distributionId Id of the distribution period.
72+
* @param fundedSlateHash Hash of the proposals to be funded.
7373
*/
7474
event FundedSlateUpdated(
75-
uint256 indexed distributionId_,
76-
bytes32 indexed fundedSlateHash_
75+
uint256 indexed distributionId,
76+
bytes32 indexed fundedSlateHash
7777
);
7878

7979
/**
8080
* @notice Emitted at the beginning of a new quarterly distribution period.
81-
* @param distributionId_ Id of the new distribution period.
82-
* @param startBlock_ Block number of the quarterly distrubtions start.
83-
* @param endBlock_ Block number of the quarterly distrubtions end.
81+
* @param distributionId Id of the new distribution period.
82+
* @param startBlock Block number of the quarterly distrubtions start.
83+
* @param endBlock Block number of the quarterly distrubtions end.
8484
*/
8585
event QuarterlyDistributionStarted(
86-
uint256 indexed distributionId_,
87-
uint256 startBlock_,
88-
uint256 endBlock_
86+
uint256 indexed distributionId,
87+
uint256 startBlock,
88+
uint256 endBlock
8989
);
9090

9191
/**
9292
* @notice Emitted when delegatee claims his rewards.
93-
* @param delegateeAddress_ Address of delegatee.
94-
* @param distributionId_ Id of distribution period.
95-
* @param rewardClaimed_ Amount of Reward Claimed.
93+
* @param delegateeAddress Address of delegatee.
94+
* @param distributionId Id of distribution period.
95+
* @param rewardClaimed Amount of Reward Claimed.
9696
*/
9797
event DelegateRewardClaimed(
98-
address indexed delegateeAddress_,
99-
uint256 indexed distributionId_,
100-
uint256 rewardClaimed_
98+
address indexed delegateeAddress,
99+
uint256 indexed distributionId,
100+
uint256 rewardClaimed
101101
);
102102

103103
/***************/
@@ -120,7 +120,7 @@ interface IStandardFunding {
120120
* @notice Contains information about proposals in a distribution period.
121121
*/
122122
struct Proposal {
123-
uint256 proposalId; // OZ.Governor proposalId. Hash of proposeStandard inputs
123+
uint256 proposalId; // OZ.Governor compliant proposalId. Hash of proposeStandard inputs
124124
uint24 distributionId; // Id of the distribution period in which the proposal was made
125125
bool executed; // whether the proposal has been executed
126126
uint128 votesReceived; // accumulator of screening votes received by a proposal
@@ -159,15 +159,15 @@ interface IStandardFunding {
159159
/*****************************************/
160160

161161
/**
162-
* @notice Check if a slate of proposals meets requirements, and maximizes votes. If so, update QuarterlyDistribution.
163-
* @param proposalIds_ Array of proposal Ids to check.
164-
* @param distributionId_ Id of the current quarterly distribution.
165-
* @return isNewTopSlate Boolean indicating whether the new proposal slate was set as the new top slate for distribution.
162+
* @notice Start a new Distribution Period and reset appropriate state.
163+
* @dev Can be kicked off by anyone assuming a distribution period isn't already active.
164+
* @return newDistributionId_ The new distribution period Id.
166165
*/
167-
function updateSlate(
168-
uint256[] calldata proposalIds_,
169-
uint24 distributionId_
170-
) external returns (bool);
166+
function startNewDistributionPeriod() external returns (uint24 newDistributionId_);
167+
168+
/************************************/
169+
/*** Delegation Rewards Functions ***/
170+
/************************************/
171171

172172
/**
173173
* @notice distributes delegate reward based on delegatee Vote share.
@@ -179,13 +179,6 @@ interface IStandardFunding {
179179
uint24 distributionId_
180180
) external returns(uint256 rewardClaimed_);
181181

182-
/**
183-
* @notice Start a new Distribution Period and reset appropriate state.
184-
* @dev Can be kicked off by anyone assuming a distribution period isn't already active.
185-
* @return newDistributionId_ The new distribution period Id.
186-
*/
187-
function startNewDistributionPeriod() external returns (uint24 newDistributionId_);
188-
189182
/**************************/
190183
/*** Proposal Functions ***/
191184
/**************************/
@@ -194,7 +187,11 @@ interface IStandardFunding {
194187
* @notice Execute a proposal that has been approved by the community.
195188
* @dev Calls out to Governor.execute().
196189
* @dev Check for proposal being succesfully funded or previously executed is handled by Governor.execute().
197-
* @return proposalId_ of the executed proposal.
190+
* @param targets_ List of contracts the proposal calldata will interact with. Should be the Ajna token contract for all proposals.
191+
* @param values_ List of values to be sent with the proposal calldata. Should be 0 for all proposals.
192+
* @param calldatas_ List of calldata to be executed. Should be the transfer() method.
193+
* @param descriptionHash_ Hash of proposal's description string.
194+
* @return proposalId_ The id of the executed proposal.
198195
*/
199196
function executeStandard(
200197
address[] memory targets_,
@@ -206,10 +203,11 @@ interface IStandardFunding {
206203
/**
207204
* @notice Submit a new proposal to the Grant Coordination Fund Standard Funding mechanism.
208205
* @dev All proposals can be submitted by anyone. There can only be one value in each array. Interface inherits from OZ.propose().
209-
* @param targets_ List of contracts the proposal calldata will interact with. Should be the Ajna token contract for all proposals.
210-
* @param values_ List of values to be sent with the proposal calldata. Should be 0 for all proposals.
211-
* @param calldatas_ List of calldata to be executed. Should be the transfer() method.
212-
* @return proposalId_ The id of the newly created proposal.
206+
* @param targets_ List of contracts the proposal calldata will interact with. Should be the Ajna token contract for all proposals.
207+
* @param values_ List of values to be sent with the proposal calldata. Should be 0 for all proposals.
208+
* @param calldatas_ List of calldata to be executed. Should be the transfer() method.
209+
* @param description_ Proposal's description string.
210+
* @return proposalId_ The id of the newly created proposal.
213211
*/
214212
function proposeStandard(
215213
address[] memory targets_,
@@ -218,6 +216,17 @@ interface IStandardFunding {
218216
string memory description_
219217
) external returns (uint256 proposalId_);
220218

219+
/**
220+
* @notice Check if a slate of proposals meets requirements, and maximizes votes. If so, update QuarterlyDistribution.
221+
* @param proposalIds_ Array of proposal Ids to check.
222+
* @param distributionId_ Id of the current quarterly distribution.
223+
* @return newTopSlate_ Boolean indicating whether the new proposal slate was set as the new top slate for distribution.
224+
*/
225+
function updateSlate(
226+
uint256[] calldata proposalIds_,
227+
uint24 distributionId_
228+
) external returns (bool newTopSlate_);
229+
221230
/************************/
222231
/*** Voting Functions ***/
223232
/************************/
@@ -251,7 +260,7 @@ interface IStandardFunding {
251260

252261
/**
253262
* @notice Retrieve the delegate reward accrued to a voter in a given distribution period.
254-
* @param distributionId_ The distributionId to calculate rewards for.
263+
* @param distributionId_ The to calculate rewards for.
255264
* @param voter_ The address of the voter to calculate rewards for.
256265
* @return rewards_ The rewards earned by the voter for voting in that distribution period.
257266
*/
@@ -325,7 +334,7 @@ interface IStandardFunding {
325334
/**
326335
* @notice Generate a unique hash of a list of proposal Ids for usage as a key for comparing proposal slates.
327336
* @param proposalIds_ Array of proposal Ids to hash.
328-
* @return Bytes32 hash of the list of proposals.
337+
* @return Bytes32 Hash of the list of proposals.
329338
*/
330339
function getSlateHash(
331340
uint256[] calldata proposalIds_
@@ -368,7 +377,7 @@ interface IStandardFunding {
368377
* @notice Get the voter's voting power in the screening stage of a distribution period.
369378
* @param distributionId_ The distributionId of the distribution period to check.
370379
* @param account_ The address of the voter to check.
371-
* @return votes_ The voter's voting power.
380+
* @return votes_ The voter's voting power.
372381
*/
373382
function getVotesScreening(uint24 distributionId_, address account_) external view returns (uint256 votes_);
374383

0 commit comments

Comments
 (0)