@bananapus/core-v6 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/foundry.toml +0 -1
- package/package.json +2 -2
- package/src/JBChainlinkV3PriceFeed.sol +1 -5
- package/src/JBChainlinkV3SequencerPriceFeed.sol +1 -1
- package/src/JBController.sol +277 -277
- package/src/JBDeadline.sol +1 -1
- package/src/JBDirectory.sol +93 -93
- package/src/JBERC20.sol +43 -39
- package/src/JBFeelessAddresses.sol +12 -12
- package/src/JBFundAccessLimits.sol +82 -82
- package/src/JBMultiTerminal.sol +313 -313
- package/src/JBPermissions.sol +104 -100
- package/src/JBPrices.sol +68 -68
- package/src/JBProjects.sol +31 -31
- package/src/JBRulesets.sol +422 -422
- package/src/JBSplits.sol +116 -116
- package/src/JBTerminalStore.sol +651 -651
- package/src/JBTokens.sol +41 -41
- package/src/interfaces/IJBCashOutTerminal.sol +25 -7
- package/src/interfaces/IJBController.sol +78 -3
- package/src/interfaces/IJBDirectory.sol +25 -0
- package/src/interfaces/IJBFeeTerminal.sol +31 -0
- package/src/interfaces/IJBFeelessAddresses.sol +4 -0
- package/src/interfaces/IJBFundAccessLimits.sol +5 -0
- package/src/interfaces/IJBMigratable.sol +12 -8
- package/src/interfaces/IJBPayoutTerminal.sol +56 -9
- package/src/interfaces/IJBPermissions.sol +14 -7
- package/src/interfaces/IJBPermitTerminal.sol +4 -0
- package/src/interfaces/IJBPrices.sol +6 -0
- package/src/interfaces/IJBProjects.sol +8 -0
- package/src/interfaces/IJBRulesetApprovalHook.sol +1 -1
- package/src/interfaces/IJBRulesetDataHook.sol +23 -23
- package/src/interfaces/IJBRulesets.sol +54 -33
- package/src/interfaces/IJBSplits.sol +6 -0
- package/src/interfaces/IJBTerminal.sol +36 -0
- package/src/interfaces/IJBTerminalStore.sol +63 -63
- package/src/interfaces/IJBToken.sol +5 -5
- package/src/interfaces/IJBTokens.sol +50 -8
- package/test/TestDurationUnderflow.sol +3 -2
|
@@ -14,29 +14,6 @@ import {JBRuleset} from "./../structs/JBRuleset.sol";
|
|
|
14
14
|
/// @dev If a project's ruleset has `useDataHookForPay` or `useDataHookForCashOut` enabled, its `dataHook` is called by
|
|
15
15
|
/// the terminal upon payments/cash outs (respectively).
|
|
16
16
|
interface IJBRulesetDataHook is IERC165 {
|
|
17
|
-
/// @notice Returns whether an address has permission to mint a project's tokens on-demand.
|
|
18
|
-
/// @param projectId The ID of the project whose token can be minted.
|
|
19
|
-
/// @param ruleset The ruleset to check the token minting permission of.
|
|
20
|
-
/// @param addr The address to check the token minting permission of.
|
|
21
|
-
/// @return flag A flag indicating whether the address has permission.
|
|
22
|
-
function hasMintPermissionFor(
|
|
23
|
-
uint256 projectId,
|
|
24
|
-
JBRuleset memory ruleset,
|
|
25
|
-
address addr
|
|
26
|
-
)
|
|
27
|
-
external
|
|
28
|
-
view
|
|
29
|
-
returns (bool flag);
|
|
30
|
-
|
|
31
|
-
/// @notice Calculates data before a payment is recorded in the terminal store.
|
|
32
|
-
/// @param context The context passed to this data hook by the `pay(...)` function.
|
|
33
|
-
/// @return weight The new weight to use, overriding the ruleset's weight.
|
|
34
|
-
/// @return hookSpecifications The amount and data to send to pay hooks instead of adding to the terminal's balance.
|
|
35
|
-
function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
|
|
36
|
-
external
|
|
37
|
-
view
|
|
38
|
-
returns (uint256 weight, JBPayHookSpecification[] memory hookSpecifications);
|
|
39
|
-
|
|
40
17
|
/// @notice Calculates data before a cash out is recorded in the terminal store.
|
|
41
18
|
/// @param context The context passed to this data hook by the `cashOutTokensOf(...)` function.
|
|
42
19
|
/// @return cashOutTaxRate The rate determining the reclaimable amount for a given surplus and token supply.
|
|
@@ -53,4 +30,27 @@ interface IJBRulesetDataHook is IERC165 {
|
|
|
53
30
|
uint256 totalSupply,
|
|
54
31
|
JBCashOutHookSpecification[] memory hookSpecifications
|
|
55
32
|
);
|
|
33
|
+
|
|
34
|
+
/// @notice Calculates data before a payment is recorded in the terminal store.
|
|
35
|
+
/// @param context The context passed to this data hook by the `pay(...)` function.
|
|
36
|
+
/// @return weight The new weight to use, overriding the ruleset's weight.
|
|
37
|
+
/// @return hookSpecifications The amount and data to send to pay hooks instead of adding to the terminal's balance.
|
|
38
|
+
function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
|
|
39
|
+
external
|
|
40
|
+
view
|
|
41
|
+
returns (uint256 weight, JBPayHookSpecification[] memory hookSpecifications);
|
|
42
|
+
|
|
43
|
+
/// @notice Returns whether an address has permission to mint a project's tokens on-demand.
|
|
44
|
+
/// @param projectId The ID of the project whose token can be minted.
|
|
45
|
+
/// @param ruleset The ruleset to check the token minting permission of.
|
|
46
|
+
/// @param addr The address to check the token minting permission of.
|
|
47
|
+
/// @return flag A flag indicating whether the address has permission.
|
|
48
|
+
function hasMintPermissionFor(
|
|
49
|
+
uint256 projectId,
|
|
50
|
+
JBRuleset memory ruleset,
|
|
51
|
+
address addr
|
|
52
|
+
)
|
|
53
|
+
external
|
|
54
|
+
view
|
|
55
|
+
returns (bool flag);
|
|
56
56
|
}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
+
import {IJBRulesetApprovalHook} from "./IJBRulesetApprovalHook.sol";
|
|
4
5
|
import {JBApprovalStatus} from "./../enums/JBApprovalStatus.sol";
|
|
5
6
|
import {JBRuleset} from "./../structs/JBRuleset.sol";
|
|
6
|
-
import {IJBRulesetApprovalHook} from "./IJBRulesetApprovalHook.sol";
|
|
7
7
|
|
|
8
8
|
/// @notice Manages rulesets and queuing for projects.
|
|
9
9
|
interface IJBRulesets {
|
|
10
|
+
/// @notice A ruleset was initialized from a base ruleset.
|
|
11
|
+
/// @param rulesetId The ID of the initialized ruleset.
|
|
12
|
+
/// @param projectId The ID of the project the ruleset belongs to.
|
|
13
|
+
/// @param basedOnId The ID of the base ruleset the new ruleset was derived from.
|
|
14
|
+
/// @param caller The address that initialized the ruleset.
|
|
10
15
|
event RulesetInitialized(
|
|
11
16
|
uint256 indexed rulesetId, uint256 indexed projectId, uint256 indexed basedOnId, address caller
|
|
12
17
|
);
|
|
18
|
+
|
|
19
|
+
/// @notice A ruleset was queued for a project.
|
|
20
|
+
/// @param rulesetId The ID of the queued ruleset.
|
|
21
|
+
/// @param projectId The ID of the project the ruleset was queued for.
|
|
22
|
+
/// @param duration The duration of the ruleset in seconds.
|
|
23
|
+
/// @param weight The weight of the ruleset.
|
|
24
|
+
/// @param weightCutPercent The percent by which the weight decreases each cycle.
|
|
25
|
+
/// @param approvalHook The approval hook for the ruleset.
|
|
26
|
+
/// @param metadata The packed ruleset metadata.
|
|
27
|
+
/// @param mustStartAtOrAfter The earliest time the ruleset can start.
|
|
28
|
+
/// @param caller The address that queued the ruleset.
|
|
13
29
|
event RulesetQueued(
|
|
14
30
|
uint256 indexed rulesetId,
|
|
15
31
|
uint256 indexed projectId,
|
|
@@ -22,12 +38,26 @@ interface IJBRulesets {
|
|
|
22
38
|
address caller
|
|
23
39
|
);
|
|
24
40
|
|
|
41
|
+
/// @notice A ruleset's weight cache was updated.
|
|
42
|
+
/// @param projectId The ID of the project whose weight cache was updated.
|
|
43
|
+
/// @param weight The cached weight value.
|
|
44
|
+
/// @param weightCutMultiple The weight cut multiple used for caching.
|
|
45
|
+
/// @param caller The address that updated the weight cache.
|
|
25
46
|
event WeightCacheUpdated(uint256 projectId, uint112 weight, uint256 weightCutMultiple, address caller);
|
|
26
47
|
|
|
27
|
-
/// @notice Returns
|
|
28
|
-
/// @param projectId The ID of the project to get
|
|
29
|
-
/// @
|
|
30
|
-
|
|
48
|
+
/// @notice Returns an array of rulesets for a project, sorted from latest to earliest.
|
|
49
|
+
/// @param projectId The ID of the project to get rulesets of.
|
|
50
|
+
/// @param startingId The ID of the ruleset to begin with. If 0, the latest ruleset is used.
|
|
51
|
+
/// @param size The maximum number of rulesets to return.
|
|
52
|
+
/// @return rulesets The array of rulesets.
|
|
53
|
+
function allOf(
|
|
54
|
+
uint256 projectId,
|
|
55
|
+
uint256 startingId,
|
|
56
|
+
uint256 size
|
|
57
|
+
)
|
|
58
|
+
external
|
|
59
|
+
view
|
|
60
|
+
returns (JBRuleset[] memory rulesets);
|
|
31
61
|
|
|
32
62
|
/// @notice Returns the approval status of the latest queued ruleset relative to the current ruleset.
|
|
33
63
|
/// @param projectId The ID of the project to check.
|
|
@@ -39,21 +69,6 @@ interface IJBRulesets {
|
|
|
39
69
|
/// @return ruleset The current ruleset.
|
|
40
70
|
function currentOf(uint256 projectId) external view returns (JBRuleset memory ruleset);
|
|
41
71
|
|
|
42
|
-
/// @notice Derives the cycle number from the base ruleset's parameters and a given start time.
|
|
43
|
-
/// @param baseRulesetCycleNumber The cycle number of the base ruleset.
|
|
44
|
-
/// @param baseRulesetStart The start time of the base ruleset.
|
|
45
|
-
/// @param baseRulesetDuration The duration of the base ruleset.
|
|
46
|
-
/// @param start The start time to derive the cycle number for.
|
|
47
|
-
/// @return The derived cycle number.
|
|
48
|
-
function deriveCycleNumberFrom(
|
|
49
|
-
uint256 baseRulesetCycleNumber,
|
|
50
|
-
uint256 baseRulesetStart,
|
|
51
|
-
uint256 baseRulesetDuration,
|
|
52
|
-
uint256 start
|
|
53
|
-
)
|
|
54
|
-
external
|
|
55
|
-
returns (uint256);
|
|
56
|
-
|
|
57
72
|
/// @notice Derives the start time from the base ruleset's parameters.
|
|
58
73
|
/// @param baseRulesetStart The start time of the base ruleset.
|
|
59
74
|
/// @param baseRulesetDuration The duration of the base ruleset.
|
|
@@ -105,25 +120,31 @@ interface IJBRulesets {
|
|
|
105
120
|
view
|
|
106
121
|
returns (JBRuleset memory ruleset, JBApprovalStatus approvalStatus);
|
|
107
122
|
|
|
108
|
-
/// @notice Returns
|
|
109
|
-
/// @param projectId The ID of the project to get
|
|
110
|
-
/// @
|
|
111
|
-
|
|
112
|
-
/// @return rulesets The array of rulesets.
|
|
113
|
-
function allOf(
|
|
114
|
-
uint256 projectId,
|
|
115
|
-
uint256 startingId,
|
|
116
|
-
uint256 size
|
|
117
|
-
)
|
|
118
|
-
external
|
|
119
|
-
view
|
|
120
|
-
returns (JBRuleset[] memory rulesets);
|
|
123
|
+
/// @notice Returns the ID of the latest ruleset queued for a project.
|
|
124
|
+
/// @param projectId The ID of the project to get the latest ruleset ID of.
|
|
125
|
+
/// @return The latest ruleset ID.
|
|
126
|
+
function latestRulesetIdOf(uint256 projectId) external view returns (uint256);
|
|
121
127
|
|
|
122
128
|
/// @notice Returns the upcoming ruleset for a project.
|
|
123
129
|
/// @param projectId The ID of the project to get the upcoming ruleset of.
|
|
124
130
|
/// @return ruleset The upcoming ruleset.
|
|
125
131
|
function upcomingOf(uint256 projectId) external view returns (JBRuleset memory ruleset);
|
|
126
132
|
|
|
133
|
+
/// @notice Derives the cycle number from the base ruleset's parameters and a given start time.
|
|
134
|
+
/// @param baseRulesetCycleNumber The cycle number of the base ruleset.
|
|
135
|
+
/// @param baseRulesetStart The start time of the base ruleset.
|
|
136
|
+
/// @param baseRulesetDuration The duration of the base ruleset.
|
|
137
|
+
/// @param start The start time to derive the cycle number for.
|
|
138
|
+
/// @return The derived cycle number.
|
|
139
|
+
function deriveCycleNumberFrom(
|
|
140
|
+
uint256 baseRulesetCycleNumber,
|
|
141
|
+
uint256 baseRulesetStart,
|
|
142
|
+
uint256 baseRulesetDuration,
|
|
143
|
+
uint256 start
|
|
144
|
+
)
|
|
145
|
+
external
|
|
146
|
+
returns (uint256);
|
|
147
|
+
|
|
127
148
|
/// @notice Queues a new ruleset for a project.
|
|
128
149
|
/// @param projectId The ID of the project to queue the ruleset for.
|
|
129
150
|
/// @param duration The duration of the ruleset in seconds.
|
|
@@ -6,6 +6,12 @@ import {JBSplitGroup} from "./../structs/JBSplitGroup.sol";
|
|
|
6
6
|
|
|
7
7
|
/// @notice Stores and manages splits for each project.
|
|
8
8
|
interface IJBSplits {
|
|
9
|
+
/// @notice A split was set for a project.
|
|
10
|
+
/// @param projectId The ID of the project the split was set for.
|
|
11
|
+
/// @param rulesetId The ID of the ruleset the split is active in.
|
|
12
|
+
/// @param groupId The ID of the split group.
|
|
13
|
+
/// @param split The split that was set.
|
|
14
|
+
/// @param caller The address that set the split.
|
|
9
15
|
event SetSplit(
|
|
10
16
|
uint256 indexed projectId, uint256 indexed rulesetId, uint256 indexed groupId, JBSplit split, address caller
|
|
11
17
|
);
|
|
@@ -9,16 +9,47 @@ import {JBAfterPayRecordedContext} from "../structs/JBAfterPayRecordedContext.so
|
|
|
9
9
|
|
|
10
10
|
/// @notice A terminal that accepts payments and can be migrated.
|
|
11
11
|
interface IJBTerminal is IERC165 {
|
|
12
|
+
/// @notice Funds were added to a project's balance.
|
|
13
|
+
/// @param projectId The ID of the project that received the funds.
|
|
14
|
+
/// @param amount The amount of tokens added.
|
|
15
|
+
/// @param returnedFees The amount of fees returned.
|
|
16
|
+
/// @param memo A memo associated with the addition.
|
|
17
|
+
/// @param metadata Extra metadata associated with the addition.
|
|
18
|
+
/// @param caller The address that added the funds.
|
|
12
19
|
event AddToBalance(
|
|
13
20
|
uint256 indexed projectId, uint256 amount, uint256 returnedFees, string memo, bytes metadata, address caller
|
|
14
21
|
);
|
|
22
|
+
|
|
23
|
+
/// @notice A pay hook was called after a payment was recorded.
|
|
24
|
+
/// @param hook The pay hook that was called.
|
|
25
|
+
/// @param context The context passed to the hook.
|
|
26
|
+
/// @param specificationAmount The amount specified for the hook.
|
|
27
|
+
/// @param caller The address that called the pay function.
|
|
15
28
|
event HookAfterRecordPay(
|
|
16
29
|
IJBPayHook indexed hook, JBAfterPayRecordedContext context, uint256 specificationAmount, address caller
|
|
17
30
|
);
|
|
18
31
|
|
|
32
|
+
/// @notice A project's balance was migrated to another terminal.
|
|
33
|
+
/// @param projectId The ID of the project that was migrated.
|
|
34
|
+
/// @param token The token that was migrated.
|
|
35
|
+
/// @param to The terminal the balance was migrated to.
|
|
36
|
+
/// @param amount The amount of tokens migrated.
|
|
37
|
+
/// @param caller The address that called the migrate function.
|
|
19
38
|
event MigrateTerminal(
|
|
20
39
|
uint256 indexed projectId, address indexed token, IJBTerminal indexed to, uint256 amount, address caller
|
|
21
40
|
);
|
|
41
|
+
|
|
42
|
+
/// @notice A payment was made to a project.
|
|
43
|
+
/// @param rulesetId The ID of the ruleset during the payment.
|
|
44
|
+
/// @param rulesetCycleNumber The cycle number of the ruleset during the payment.
|
|
45
|
+
/// @param projectId The ID of the project that received the payment.
|
|
46
|
+
/// @param payer The address that made the payment.
|
|
47
|
+
/// @param beneficiary The address that received the project tokens.
|
|
48
|
+
/// @param amount The amount of tokens paid.
|
|
49
|
+
/// @param newlyIssuedTokenCount The number of project tokens minted.
|
|
50
|
+
/// @param memo A memo associated with the payment.
|
|
51
|
+
/// @param metadata Extra metadata associated with the payment.
|
|
52
|
+
/// @param caller The address that called the pay function.
|
|
22
53
|
event Pay(
|
|
23
54
|
uint256 indexed rulesetId,
|
|
24
55
|
uint256 indexed rulesetCycleNumber,
|
|
@@ -31,6 +62,11 @@ interface IJBTerminal is IERC165 {
|
|
|
31
62
|
bytes metadata,
|
|
32
63
|
address caller
|
|
33
64
|
);
|
|
65
|
+
|
|
66
|
+
/// @notice An accounting context was set for a project's token.
|
|
67
|
+
/// @param projectId The ID of the project the accounting context was set for.
|
|
68
|
+
/// @param context The accounting context that was set.
|
|
69
|
+
/// @param caller The address that set the accounting context.
|
|
34
70
|
event SetAccountingContext(uint256 indexed projectId, JBAccountingContext context, address caller);
|
|
35
71
|
|
|
36
72
|
/// @notice Returns the accounting context for a project's token.
|
|
@@ -29,42 +29,6 @@ interface IJBTerminalStore {
|
|
|
29
29
|
/// @return The balance.
|
|
30
30
|
function balanceOf(address terminal, uint256 projectId, address token) external view returns (uint256);
|
|
31
31
|
|
|
32
|
-
/// @notice Returns the amount of payout limit used by a terminal for a project in a given cycle.
|
|
33
|
-
/// @param terminal The terminal to get the used payout limit of.
|
|
34
|
-
/// @param projectId The ID of the project.
|
|
35
|
-
/// @param token The token the payout limit is denominated in.
|
|
36
|
-
/// @param rulesetCycleNumber The cycle number to get the used payout limit for.
|
|
37
|
-
/// @param currency The currency the payout limit is denominated in.
|
|
38
|
-
/// @return The amount of payout limit used.
|
|
39
|
-
function usedPayoutLimitOf(
|
|
40
|
-
address terminal,
|
|
41
|
-
uint256 projectId,
|
|
42
|
-
address token,
|
|
43
|
-
uint256 rulesetCycleNumber,
|
|
44
|
-
uint256 currency
|
|
45
|
-
)
|
|
46
|
-
external
|
|
47
|
-
view
|
|
48
|
-
returns (uint256);
|
|
49
|
-
|
|
50
|
-
/// @notice Returns the amount of surplus allowance used by a terminal for a project in a given ruleset.
|
|
51
|
-
/// @param terminal The terminal to get the used surplus allowance of.
|
|
52
|
-
/// @param projectId The ID of the project.
|
|
53
|
-
/// @param token The token the surplus allowance is denominated in.
|
|
54
|
-
/// @param rulesetId The ID of the ruleset to get the used surplus allowance for.
|
|
55
|
-
/// @param currency The currency the surplus allowance is denominated in.
|
|
56
|
-
/// @return The amount of surplus allowance used.
|
|
57
|
-
function usedSurplusAllowanceOf(
|
|
58
|
-
address terminal,
|
|
59
|
-
uint256 projectId,
|
|
60
|
-
address token,
|
|
61
|
-
uint256 rulesetId,
|
|
62
|
-
uint256 currency
|
|
63
|
-
)
|
|
64
|
-
external
|
|
65
|
-
view
|
|
66
|
-
returns (uint256);
|
|
67
|
-
|
|
68
32
|
/// @notice Returns the reclaimable surplus for a project given a cash-out count, total supply, and surplus.
|
|
69
33
|
/// @param projectId The ID of the project.
|
|
70
34
|
/// @param cashOutCount The number of tokens being cashed out.
|
|
@@ -133,12 +97,75 @@ interface IJBTerminalStore {
|
|
|
133
97
|
view
|
|
134
98
|
returns (uint256);
|
|
135
99
|
|
|
100
|
+
/// @notice Returns the amount of payout limit used by a terminal for a project in a given cycle.
|
|
101
|
+
/// @param terminal The terminal to get the used payout limit of.
|
|
102
|
+
/// @param projectId The ID of the project.
|
|
103
|
+
/// @param token The token the payout limit is denominated in.
|
|
104
|
+
/// @param rulesetCycleNumber The cycle number to get the used payout limit for.
|
|
105
|
+
/// @param currency The currency the payout limit is denominated in.
|
|
106
|
+
/// @return The amount of payout limit used.
|
|
107
|
+
function usedPayoutLimitOf(
|
|
108
|
+
address terminal,
|
|
109
|
+
uint256 projectId,
|
|
110
|
+
address token,
|
|
111
|
+
uint256 rulesetCycleNumber,
|
|
112
|
+
uint256 currency
|
|
113
|
+
)
|
|
114
|
+
external
|
|
115
|
+
view
|
|
116
|
+
returns (uint256);
|
|
117
|
+
|
|
118
|
+
/// @notice Returns the amount of surplus allowance used by a terminal for a project in a given ruleset.
|
|
119
|
+
/// @param terminal The terminal to get the used surplus allowance of.
|
|
120
|
+
/// @param projectId The ID of the project.
|
|
121
|
+
/// @param token The token the surplus allowance is denominated in.
|
|
122
|
+
/// @param rulesetId The ID of the ruleset to get the used surplus allowance for.
|
|
123
|
+
/// @param currency The currency the surplus allowance is denominated in.
|
|
124
|
+
/// @return The amount of surplus allowance used.
|
|
125
|
+
function usedSurplusAllowanceOf(
|
|
126
|
+
address terminal,
|
|
127
|
+
uint256 projectId,
|
|
128
|
+
address token,
|
|
129
|
+
uint256 rulesetId,
|
|
130
|
+
uint256 currency
|
|
131
|
+
)
|
|
132
|
+
external
|
|
133
|
+
view
|
|
134
|
+
returns (uint256);
|
|
135
|
+
|
|
136
136
|
/// @notice Records a balance addition for a project.
|
|
137
137
|
/// @param projectId The ID of the project.
|
|
138
138
|
/// @param token The token being added.
|
|
139
139
|
/// @param amount The amount being added.
|
|
140
140
|
function recordAddedBalanceFor(uint256 projectId, address token, uint256 amount) external;
|
|
141
141
|
|
|
142
|
+
/// @notice Records a cash out from a project.
|
|
143
|
+
/// @param holder The address cashing out.
|
|
144
|
+
/// @param projectId The ID of the project being cashed out from.
|
|
145
|
+
/// @param cashOutCount The number of project tokens being cashed out.
|
|
146
|
+
/// @param accountingContext The accounting context of the token being reclaimed.
|
|
147
|
+
/// @param balanceAccountingContexts The accounting contexts to include in the balance calculation.
|
|
148
|
+
/// @param metadata Extra data to pass along to the data hook.
|
|
149
|
+
/// @return ruleset The project's current ruleset.
|
|
150
|
+
/// @return reclaimAmount The amount reclaimed.
|
|
151
|
+
/// @return cashOutTaxRate The cash out tax rate applied.
|
|
152
|
+
/// @return hookSpecifications Any cash out hook specifications from the data hook.
|
|
153
|
+
function recordCashOutFor(
|
|
154
|
+
address holder,
|
|
155
|
+
uint256 projectId,
|
|
156
|
+
uint256 cashOutCount,
|
|
157
|
+
JBAccountingContext calldata accountingContext,
|
|
158
|
+
JBAccountingContext[] calldata balanceAccountingContexts,
|
|
159
|
+
bytes calldata metadata
|
|
160
|
+
)
|
|
161
|
+
external
|
|
162
|
+
returns (
|
|
163
|
+
JBRuleset memory ruleset,
|
|
164
|
+
uint256 reclaimAmount,
|
|
165
|
+
uint256 cashOutTaxRate,
|
|
166
|
+
JBCashOutHookSpecification[] memory hookSpecifications
|
|
167
|
+
);
|
|
168
|
+
|
|
142
169
|
/// @notice Records a payment to a project.
|
|
143
170
|
/// @param payer The address of the payer.
|
|
144
171
|
/// @param amount The amount being paid.
|
|
@@ -174,33 +201,6 @@ interface IJBTerminalStore {
|
|
|
174
201
|
external
|
|
175
202
|
returns (JBRuleset memory ruleset, uint256 amountPaidOut);
|
|
176
203
|
|
|
177
|
-
/// @notice Records a cash out from a project.
|
|
178
|
-
/// @param holder The address cashing out.
|
|
179
|
-
/// @param projectId The ID of the project being cashed out from.
|
|
180
|
-
/// @param cashOutCount The number of project tokens being cashed out.
|
|
181
|
-
/// @param accountingContext The accounting context of the token being reclaimed.
|
|
182
|
-
/// @param balanceAccountingContexts The accounting contexts to include in the balance calculation.
|
|
183
|
-
/// @param metadata Extra data to pass along to the data hook.
|
|
184
|
-
/// @return ruleset The project's current ruleset.
|
|
185
|
-
/// @return reclaimAmount The amount reclaimed.
|
|
186
|
-
/// @return cashOutTaxRate The cash out tax rate applied.
|
|
187
|
-
/// @return hookSpecifications Any cash out hook specifications from the data hook.
|
|
188
|
-
function recordCashOutFor(
|
|
189
|
-
address holder,
|
|
190
|
-
uint256 projectId,
|
|
191
|
-
uint256 cashOutCount,
|
|
192
|
-
JBAccountingContext calldata accountingContext,
|
|
193
|
-
JBAccountingContext[] calldata balanceAccountingContexts,
|
|
194
|
-
bytes calldata metadata
|
|
195
|
-
)
|
|
196
|
-
external
|
|
197
|
-
returns (
|
|
198
|
-
JBRuleset memory ruleset,
|
|
199
|
-
uint256 reclaimAmount,
|
|
200
|
-
uint256 cashOutTaxRate,
|
|
201
|
-
JBCashOutHookSpecification[] memory hookSpecifications
|
|
202
|
-
);
|
|
203
|
-
|
|
204
204
|
/// @notice Records a terminal migration for a project.
|
|
205
205
|
/// @param projectId The ID of the project being migrated.
|
|
206
206
|
/// @param token The token being migrated.
|
|
@@ -21,17 +21,17 @@ interface IJBToken {
|
|
|
21
21
|
/// @return The total supply.
|
|
22
22
|
function totalSupply() external view returns (uint256);
|
|
23
23
|
|
|
24
|
+
/// @notice Burns tokens from an account.
|
|
25
|
+
/// @param account The address to burn tokens from.
|
|
26
|
+
/// @param amount The amount of tokens to burn.
|
|
27
|
+
function burn(address account, uint256 amount) external;
|
|
28
|
+
|
|
24
29
|
/// @notice Initializes the token with a name, symbol, and owner.
|
|
25
30
|
/// @param name The token's name.
|
|
26
31
|
/// @param symbol The token's symbol.
|
|
27
32
|
/// @param owner The token contract's owner.
|
|
28
33
|
function initialize(string memory name, string memory symbol, address owner) external;
|
|
29
34
|
|
|
30
|
-
/// @notice Burns tokens from an account.
|
|
31
|
-
/// @param account The address to burn tokens from.
|
|
32
|
-
/// @param amount The amount of tokens to burn.
|
|
33
|
-
function burn(address account, uint256 amount) external;
|
|
34
|
-
|
|
35
35
|
/// @notice Mints tokens to an account.
|
|
36
36
|
/// @param account The address to mint tokens to.
|
|
37
37
|
/// @param amount The amount of tokens to mint.
|
|
@@ -5,9 +5,13 @@ import {IJBToken} from "./IJBToken.sol";
|
|
|
5
5
|
|
|
6
6
|
/// @notice Manages minting, burning, and balances of projects' tokens and token credits.
|
|
7
7
|
interface IJBTokens {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/// @notice Tokens or credits were burned from a holder's balance.
|
|
9
|
+
/// @param holder The address whose tokens were burned.
|
|
10
|
+
/// @param projectId The ID of the project whose tokens were burned.
|
|
11
|
+
/// @param count The number of tokens burned.
|
|
12
|
+
/// @param creditBalance The holder's remaining credit balance after the burn.
|
|
13
|
+
/// @param tokenBalance The holder's remaining token balance after the burn.
|
|
14
|
+
/// @param caller The address that called the burn function.
|
|
11
15
|
event Burn(
|
|
12
16
|
address indexed holder,
|
|
13
17
|
uint256 indexed projectId,
|
|
@@ -16,6 +20,14 @@ interface IJBTokens {
|
|
|
16
20
|
uint256 tokenBalance,
|
|
17
21
|
address caller
|
|
18
22
|
);
|
|
23
|
+
|
|
24
|
+
/// @notice Credits were claimed as ERC-20 tokens.
|
|
25
|
+
/// @param holder The address whose credits were claimed.
|
|
26
|
+
/// @param projectId The ID of the project whose tokens were claimed.
|
|
27
|
+
/// @param creditBalance The holder's remaining credit balance after the claim.
|
|
28
|
+
/// @param count The number of tokens claimed.
|
|
29
|
+
/// @param beneficiary The address that received the claimed tokens.
|
|
30
|
+
/// @param caller The address that called the claim function.
|
|
19
31
|
event ClaimTokens(
|
|
20
32
|
address indexed holder,
|
|
21
33
|
uint256 indexed projectId,
|
|
@@ -24,10 +36,40 @@ interface IJBTokens {
|
|
|
24
36
|
address beneficiary,
|
|
25
37
|
address caller
|
|
26
38
|
);
|
|
39
|
+
|
|
40
|
+
/// @notice An ERC-20 token was deployed for a project.
|
|
41
|
+
/// @param projectId The ID of the project the token was deployed for.
|
|
42
|
+
/// @param token The deployed token.
|
|
43
|
+
/// @param name The token's name.
|
|
44
|
+
/// @param symbol The token's symbol.
|
|
45
|
+
/// @param salt The salt used for deterministic deployment.
|
|
46
|
+
/// @param caller The address that deployed the token.
|
|
47
|
+
event DeployERC20(
|
|
48
|
+
uint256 indexed projectId, IJBToken indexed token, string name, string symbol, bytes32 salt, address caller
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/// @notice Tokens or credits were minted for a holder.
|
|
52
|
+
/// @param holder The address that received the minted tokens.
|
|
53
|
+
/// @param projectId The ID of the project whose tokens were minted.
|
|
54
|
+
/// @param count The number of tokens minted.
|
|
55
|
+
/// @param tokensWereClaimed Whether the tokens were claimed as ERC-20 tokens.
|
|
56
|
+
/// @param caller The address that called the mint function.
|
|
27
57
|
event Mint(
|
|
28
58
|
address indexed holder, uint256 indexed projectId, uint256 count, bool tokensWereClaimed, address caller
|
|
29
59
|
);
|
|
60
|
+
|
|
61
|
+
/// @notice A project's token was set.
|
|
62
|
+
/// @param projectId The ID of the project whose token was set.
|
|
63
|
+
/// @param token The token that was set.
|
|
64
|
+
/// @param caller The address that set the token.
|
|
30
65
|
event SetToken(uint256 indexed projectId, IJBToken indexed token, address caller);
|
|
66
|
+
|
|
67
|
+
/// @notice Credits were transferred from one holder to another.
|
|
68
|
+
/// @param holder The address that transferred the credits.
|
|
69
|
+
/// @param projectId The ID of the project whose credits were transferred.
|
|
70
|
+
/// @param recipient The address that received the credits.
|
|
71
|
+
/// @param count The number of credits transferred.
|
|
72
|
+
/// @param caller The address that called the transfer function.
|
|
31
73
|
event TransferCredits(
|
|
32
74
|
address indexed holder, uint256 indexed projectId, address indexed recipient, uint256 count, address caller
|
|
33
75
|
);
|
|
@@ -48,17 +90,17 @@ interface IJBTokens {
|
|
|
48
90
|
/// @return The project's token.
|
|
49
91
|
function tokenOf(uint256 projectId) external view returns (IJBToken);
|
|
50
92
|
|
|
51
|
-
/// @notice Returns the total credit supply for a project.
|
|
52
|
-
/// @param projectId The ID of the project to get the total credit supply of.
|
|
53
|
-
/// @return The total credit supply.
|
|
54
|
-
function totalCreditSupplyOf(uint256 projectId) external view returns (uint256);
|
|
55
|
-
|
|
56
93
|
/// @notice Returns the total balance (tokens + credits) for a holder and project.
|
|
57
94
|
/// @param holder The address to get the total balance of.
|
|
58
95
|
/// @param projectId The ID of the project to get the total balance for.
|
|
59
96
|
/// @return balance The combined token and credit balance.
|
|
60
97
|
function totalBalanceOf(address holder, uint256 projectId) external view returns (uint256 balance);
|
|
61
98
|
|
|
99
|
+
/// @notice Returns the total credit supply for a project.
|
|
100
|
+
/// @param projectId The ID of the project to get the total credit supply of.
|
|
101
|
+
/// @return The total credit supply.
|
|
102
|
+
function totalCreditSupplyOf(uint256 projectId) external view returns (uint256);
|
|
103
|
+
|
|
62
104
|
/// @notice Returns the total supply (tokens + credits) for a project.
|
|
63
105
|
/// @param projectId The ID of the project to get the total supply of.
|
|
64
106
|
/// @return The total supply.
|
|
@@ -110,8 +110,9 @@ contract TestDurationUnderflow is TestBaseWorkflow {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/// @notice Normal case: duration < block.timestamp. No underflow even without the fix.
|
|
113
|
-
function test_harness_normalDuration_noUnderflow() public
|
|
114
|
-
//
|
|
113
|
+
function test_harness_normalDuration_noUnderflow() public {
|
|
114
|
+
// Warp to a realistic timestamp so that `block.timestamp - 30 days` doesn't underflow.
|
|
115
|
+
vm.warp(1_643_802_347);
|
|
115
116
|
JBRuleset memory base =
|
|
116
117
|
_makeBaseRuleset({start: uint48(block.timestamp - 30 days), duration: uint32(7 days), weight: 1000e18});
|
|
117
118
|
|