Skip to content

Commit 6810453

Browse files
authored
Merge pull request #1088 from JoinColony/maint/add-more-extension-docs
Add even more extension docs
2 parents 0f18c22 + 3966740 commit 6810453

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1258
-37
lines changed

contracts/extensions/EvaluatedExpenditure.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ contract EvaluatedExpenditure is ColonyExtension, BasicMetaTransaction {
3333
mapping(address => uint256) metatransactionNonces;
3434

3535
/// @notice Returns the identifier of the extension
36-
function identifier() public override pure returns (bytes32) {
36+
/// @return _identifier The extension's identifier
37+
function identifier() public override pure returns (bytes32 _identifier) {
3738
return keccak256("EvaluatedExpenditure");
3839
}
3940

4041
/// @notice Returns the version of the extension
41-
function version() public override pure returns (uint256) {
42+
/// @return _version The extension's version number
43+
function version() public override pure returns (uint256 _version) {
4244
return 2;
4345
}
4446

@@ -54,6 +56,7 @@ contract EvaluatedExpenditure is ColonyExtension, BasicMetaTransaction {
5456
function finishUpgrade() public override auth {}
5557

5658
/// @notice Called when deprecating (or undeprecating) the extension
59+
/// @param _deprecated Indicates whether the extension should be deprecated or undeprecated
5760
function deprecate(bool _deprecated) public override auth {
5861
deprecated = _deprecated;
5962
}
@@ -63,6 +66,9 @@ contract EvaluatedExpenditure is ColonyExtension, BasicMetaTransaction {
6366
selfdestruct(address(uint160(address(colony))));
6467
}
6568

69+
/// @notice Gets the next nonce for a meta-transaction
70+
/// @param _userAddress The user's address
71+
/// @return nonce The nonce
6672
function getMetatransactionNonce(address _userAddress) override public view returns (uint256 nonce){
6773
return metatransactionNonces[_userAddress];
6874
}

contracts/extensions/FundingQueue.sol

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
7373
// Technically a circular singly-linked list
7474
mapping (uint256 => uint256) queue; // proposalId => nextProposalId
7575
mapping(address => uint256) metatransactionNonces;
76+
77+
/// @notice Gets the next nonce for a meta-transaction
78+
/// @param userAddress The user's address
79+
/// @return nonce The nonce
7680
function getMetatransactionNonce(address userAddress) override public view returns (uint256 nonce){
7781
return metatransactionNonces[userAddress];
7882
}
@@ -84,12 +88,14 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
8488
// Public functions
8589

8690
/// @notice Returns the identifier of the extension
87-
function identifier() public override pure returns (bytes32) {
91+
/// @return _identifier The extension's identifier
92+
function identifier() public override pure returns (bytes32 _identifier) {
8893
return keccak256("FundingQueue");
8994
}
9095

9196
/// @notice Returns the version of the extension
92-
function version() public override pure returns (uint256) {
97+
/// @return _version The extension's version number
98+
function version() public override pure returns (uint256 _version) {
9399
return 3;
94100
}
95101

@@ -110,6 +116,7 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
110116
function finishUpgrade() public override auth {} // solhint-disable-line no-empty-blocks
111117

112118
/// @notice Called when deprecating (or undeprecating) the extension
119+
/// @param _deprecated Indicates whether the extension should be deprecated or undeprecated
113120
function deprecate(bool _deprecated) public override auth {
114121
deprecated = _deprecated;
115122
}
@@ -119,6 +126,16 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
119126
selfdestruct(address(uint160(address(colony))));
120127
}
121128

129+
// Public
130+
131+
/// @notice Create a new funding proposal
132+
/// @param _domainId The domain the extension has the funding permission
133+
/// @param _fromChildSkillIndex The index of the fromPot's domain in _domainId.children[]
134+
/// @param _toChildSkillIndex The index of the toPot's domain in _domainId.children[]
135+
/// @param _fromPot Funding pot id providing the funds
136+
/// @param _toPot Funding pot id receiving the funds
137+
/// @param _totalRequested The total amount being requested
138+
/// @param _token The token being transferred
122139
function createProposal(
123140
uint256 _domainId,
124141
uint256 _fromChildSkillIndex,
@@ -170,6 +187,9 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
170187
emit ProposalCreated(proposalCount, _fromPot, _toPot, _token, _totalRequested);
171188
}
172189

190+
/// @notice Cancel a funding proposal and remove from linked list
191+
/// @param _id The proposal Id
192+
/// @param _prevId The id of the preceding proposal in the linked list
173193
function cancelProposal(uint256 _id, uint256 _prevId) public {
174194
Proposal storage proposal = proposals[_id];
175195

@@ -189,6 +209,12 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
189209
emit ProposalCancelled(_id);
190210
}
191211

212+
/// @notice Stake a funding proposal
213+
/// @param _id The proposal Id
214+
/// @param _key A reputation hash tree key, of the total reputation in _domainId
215+
/// @param _value Reputation value indicating the total reputation in _domainId
216+
/// @param _branchMask The branchmask of the proof
217+
/// @param _siblings The siblings of the proof
192218
function stakeProposal(
193219
uint256 _id,
194220
bytes memory _key,
@@ -212,6 +238,15 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
212238
emit ProposalStaked(_id, proposal.domainTotalRep);
213239
}
214240

241+
/// @notice Back a funding proposal and advance it along the list
242+
/// @param _id The proposal Id
243+
/// @param _backing The amount of backing to give the proposal (up to user's reputation)
244+
/// @param _currPrevId The current previous proposal in the list
245+
/// @param _newPrevId The new previous proposal after we re-arrange
246+
/// @param _key A reputation hash tree key, of the caller's reputation in _domainId
247+
/// @param _value Reputation value indicating the caller's reputation in _domainId
248+
/// @param _branchMask The branchmask of the proof
249+
/// @param _siblings The siblings of the proof
215250
function backProposal(
216251
uint256 _id,
217252
uint256 _backing,
@@ -269,6 +304,8 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
269304
emit ProposalBacked(_id, _newPrevId, msgSender(), _backing, prevBacking);
270305
}
271306

307+
/// @notice Transfer the marginal funds
308+
/// @param _id The proposal Id
272309
function pingProposal(uint256 _id) public {
273310
Proposal storage proposal = proposals[_id];
274311

@@ -324,6 +361,8 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
324361
emit ProposalPinged(_id, actualFundingToTransfer);
325362
}
326363

364+
/// @notice Reclaim the stake after the proposal is funded
365+
/// @param _id The proposal Id
327366
function reclaimStake(uint256 _id) public {
328367
Proposal storage proposal = proposals[_id];
329368

@@ -338,19 +377,31 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
338377

339378
// Public view functions
340379

341-
function getProposalCount() public view returns (uint256) {
380+
/// @notice Get the total number of proposals
381+
/// @return count The count
382+
function getProposalCount() public view returns (uint256 count) {
342383
return proposalCount;
343384
}
344385

386+
/// @notice Get the proposal struct for a given proposal
387+
/// @param _id The proposal Id
388+
/// @return proposal The proposal struct
345389
function getProposal(uint256 _id) public view returns (Proposal memory proposal) {
346390
return proposals[_id];
347391
}
348392

349-
function getSupport(uint256 _id, address _supporter) public view returns (uint256) {
393+
/// @notice Gets the reputation support from a user to a proposal
394+
/// @param _id The proposal Id
395+
/// @param _supporter The supporter
396+
/// @return support The support amount
397+
function getSupport(uint256 _id, address _supporter) public view returns (uint256 support) {
350398
return supporters[_id][_supporter];
351399
}
352400

353-
function getNextProposalId(uint256 _id) public view returns (uint256) {
401+
/// @notice Gets the id of the next proposal in the list
402+
/// @param _id The proposal Id
403+
/// @return nextId The next proposal Id in the list
404+
function getNextProposalId(uint256 _id) public view returns (uint256 nextId) {
354405
return queue[_id];
355406
}
356407

contracts/extensions/StakedExpenditure.sol

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ contract StakedExpenditure is ColonyExtensionMeta, PatriciaTreeProofs {
5858
// Overrides
5959

6060
/// @notice Returns the identifier of the extension
61-
function identifier() public override pure returns (bytes32) {
61+
/// @return _identifier The extension's identifier
62+
function identifier() public override pure returns (bytes32 _identifier) {
6263
return keccak256("StakedExpenditure");
6364
}
6465

6566
/// @notice Returns the version of the extension
66-
function version() public override pure returns (uint256) {
67+
/// @return _version The extension's version number
68+
function version() public override pure returns (uint256 _version) {
6769
return 1;
6870
}
6971

@@ -79,6 +81,7 @@ contract StakedExpenditure is ColonyExtensionMeta, PatriciaTreeProofs {
7981
function finishUpgrade() public override auth {}
8082

8183
/// @notice Called when deprecating (or undeprecating) the extension
84+
/// @param _deprecated Indicates whether the extension should be deprecated or undeprecated
8285
function deprecate(bool _deprecated) public override auth {
8386
deprecated = _deprecated;
8487
}
@@ -253,13 +256,14 @@ contract StakedExpenditure is ColonyExtensionMeta, PatriciaTreeProofs {
253256
// View
254257

255258
/// @notice Get the stake fraction
256-
/// @return stakeFraction The stake fraction
257-
function getStakeFraction() public view returns (uint256) {
259+
/// @return _stakeFraction The stake fraction
260+
function getStakeFraction() public view returns (uint256 _stakeFraction) {
258261
return stakeFraction;
259262
}
260263

261264
/// @notice Get the stake for an expenditure
262-
/// @param stake The stake, a struct holding the staker's address and the stake amount
265+
/// @param _expenditureId The id of the expenditure to get the stake for
266+
/// @return stake The stake, a struct holding the staker's address and the stake amount
263267
function getStake(uint256 _expenditureId) public view returns (Stake memory stake) {
264268
return stakes[_expenditureId];
265269
}

contracts/extensions/StreamingPayments.sol

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ contract StreamingPayments is ColonyExtensionMeta {
7979
// Public
8080

8181
/// @notice Returns the identifier of the extension
82-
function identifier() public override pure returns (bytes32) {
82+
/// @return _identifier The extension's identifier
83+
function identifier() public override pure returns (bytes32 _identifier) {
8384
return keccak256("StreamingPayments");
8485
}
8586

8687
/// @notice Returns the version of the extension
87-
function version() public override pure returns (uint256) {
88+
/// @return _version The extension's version number
89+
function version() public override pure returns (uint256 _version) {
8890
return 1;
8991
}
9092

@@ -100,6 +102,7 @@ contract StreamingPayments is ColonyExtensionMeta {
100102
function finishUpgrade() public override auth {}
101103

102104
/// @notice Called when deprecating (or undeprecating) the extension
105+
/// @param _deprecated Indicates whether the extension should be deprecated or undeprecated
103106
function deprecate(bool _deprecated) public override auth {
104107
deprecated = _deprecated;
105108
}
@@ -341,6 +344,7 @@ contract StreamingPayments is ColonyExtensionMeta {
341344

342345
/// @notice Cancel the streaming payment, specifically by setting endTime to block.timestamp, and waive claim
343346
/// to specified tokens already earned. Only callable by the recipient.
347+
/// @param _id The id of the streaming payment
344348
/// @param _tokens The tokens to waive any claims to.
345349
function cancelAndWaive(
346350
uint256 _id,
@@ -366,19 +370,32 @@ contract StreamingPayments is ColonyExtensionMeta {
366370

367371
// View
368372

373+
/// @notice Get the streaming payment struct by Id
374+
/// @param _id The id of the streaming payment
375+
/// @return streamingPayment The streaming payment struct
369376
function getStreamingPayment(uint256 _id) public view returns (StreamingPayment memory streamingPayment) {
370377
streamingPayment = streamingPayments[_id];
371378
}
372379

380+
/// @notice Get the payment token struct by Id and token
381+
/// @param _id The id of the streaming payment
382+
/// @param _token The address of the token
383+
/// @return paymentToken The payment token struct
373384
function getPaymentToken(uint256 _id, address _token) public view returns (PaymentToken memory paymentToken) {
374385
paymentToken = paymentTokens[_id][_token];
375386
}
376387

377-
function getNumStreamingPayments() public view returns (uint256) {
388+
/// @notice Get the total number of streaming payments
389+
/// @return numPayments The total number of streaming payments
390+
function getNumStreamingPayments() public view returns (uint256 numPayments) {
378391
return numStreamingPayments;
379392
}
380393

381-
function getAmountEntitledFromStart(uint256 _id, address _token) public view returns (uint256) {
394+
/// @notice Get the amount entitled to claim from the start of the stream
395+
/// @param _id The id of the streaming payment
396+
/// @param _token The address of the token
397+
/// @return amount The amount entitled
398+
function getAmountEntitledFromStart(uint256 _id, address _token) public view returns (uint256 amount) {
382399
StreamingPayment storage streamingPayment = streamingPayments[_id];
383400
PaymentToken storage paymentToken = paymentTokens[_id][_token];
384401
if (streamingPayment.startTime >= block.timestamp){

contracts/extensions/TokenSupplier.sol

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ contract TokenSupplier is ColonyExtension, BasicMetaTransaction {
4343

4444
mapping(address => uint256) metatransactionNonces;
4545

46+
/// @notice Gets the next nonce for a meta-transaction
47+
/// @param userAddress The user's address
48+
/// @return nonce The nonce
4649
function getMetatransactionNonce(address userAddress) override public view returns (uint256 nonce){
4750
return metatransactionNonces[userAddress];
4851
}
@@ -61,12 +64,14 @@ contract TokenSupplier is ColonyExtension, BasicMetaTransaction {
6164
// Public
6265

6366
/// @notice Returns the identifier of the extension
64-
function identifier() public override pure returns (bytes32) {
67+
/// @return _identifier The extension's identifier
68+
function identifier() public override pure returns (bytes32 _identifier) {
6569
return keccak256("TokenSupplier");
6670
}
6771

6872
/// @notice Returns the version of the extension
69-
function version() public override pure returns (uint256) {
73+
/// @return _version The extension's version number
74+
function version() public override pure returns (uint256 _version) {
7075
return 3;
7176
}
7277

@@ -82,7 +87,8 @@ contract TokenSupplier is ColonyExtension, BasicMetaTransaction {
8287
/// @notice Called when upgrading the extension (currently a no-op)
8388
function finishUpgrade() public override auth {}
8489

85-
/// @notice Called when deprecating (or undeprecating) the extension (currently a no-op)
90+
/// @notice Called when deprecating (or undeprecating) the extension
91+
/// @param _deprecated Indicates whether the extension should be deprecated or undeprecated
8692
function deprecate(bool _deprecated) public override auth {}
8793

8894
/// @notice Called when uninstalling the extension
@@ -160,19 +166,27 @@ contract TokenSupplier is ColonyExtension, BasicMetaTransaction {
160166
}
161167
}
162168

163-
function getTokenSupplyCeiling() public view returns (uint256) {
169+
/// @notice Get the token supply ceiling
170+
/// @return supplyCeiling The token supply ceiling
171+
function getTokenSupplyCeiling() public view returns (uint256 supplyCeiling) {
164172
return tokenSupplyCeiling;
165173
}
166174

167-
function getTokenIssuanceRate() public view returns (uint256) {
175+
/// @notice Get the token issuance rate
176+
/// @return issuanceRate The token issuance rate
177+
function getTokenIssuanceRate() public view returns (uint256 issuanceRate) {
168178
return tokenIssuanceRate;
169179
}
170180

171-
function getLastPinged() public view returns (uint256) {
181+
/// @notice Get the time of the last token minting event
182+
/// @return lastPinged The timestamp of the last ping
183+
function getLastPinged() public view returns (uint256 lastPinged) {
172184
return lastIssue;
173185
}
174186

175-
function getLastRateUpdate() public view returns (uint256) {
187+
/// @notice Get the time of the last change in issuance rate
188+
/// @return lastUpdate The timestamp of the last update
189+
function getLastRateUpdate() public view returns (uint256 lastUpdate) {
176190
return lastRateUpdate;
177191
}
178192

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Evaluated Expenditure (`EvaluatedExpenditure`)
2+
3+
Evaluated Expenditures is a simple extension which allows the owner of an expenditure
4+
to update the payout modifiers after the expenditure is locked, effectively enabling
5+
the "evaluation" functionality we initially described as a part of the Tasks flow.
6+
Without this extension, payout modifiers can only be set by the Arbitration permission
7+
once the expenditure is locked, making it tedious to implement evaluation workflows.

docs/.templates/fundingqueue.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Funding Queue (`FundingQueue`)
2+
3+
Funding Queues are a core mechanic described in the Colony whitepaper,
4+
allowing for teams to allocate resources in a distributed manner. Members of
5+
a colony can make and back funding proposals, requesting that some number of tokens be
6+
transferred between domains. The more reputation backing a proposal, the more
7+
quickly the proposal is fulfilled, up to a maximum of half of the source domain's
8+
assets per week. By creating and bacing funding proposals throughout the colony,
9+
a steady flow of resources from the root through the domains can be achieved.

docs/.templates/icolony.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
# Colony (`IColony`)
2+
3+
The main body of functionality of a colony. If extensions can be thought of
4+
as "applications", providing specific functionality, then this contract can
5+
be thought of as the "operating system", providing "system calls" for managing
6+
a colony's underlying resources, such as managing roles & permissions,
7+
creating new domains and expenditures, and moving resources throughout a
8+
colony. Extensions express their functionality by calling these functions
9+
on the colony on which they are installed, and users with the proper
10+
permissions can call these functions directly.

docs/.templates/icolonynetwork.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# Colony Network (`IColonyNetwork`)
2+
3+
The functions for managing the Colony Network as a whole. Includes functions
4+
for creating and upgrading colonies, managing the reputation mining process,
5+
managing the skills used in colonies, and managing colony ENS names.
6+
These functions are not publically callable, but rather callable by
7+
the Meta Colony, a special colony which controls the network.

0 commit comments

Comments
 (0)