@ballkidz/defifa 0.0.27 → 0.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ballkidz/defifa",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "25.9.0"
@@ -99,13 +99,13 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
99
99
  /// @notice The default Defifa token URI resolver.
100
100
  IJB721TokenUriResolver public immutable override TOKEN_URI_RESOLVER;
101
101
 
102
- /// @notice The Defifa governor.
102
+ /// @notice The governance contract that ratifies scorecards for each game.
103
103
  IDefifaGovernor public immutable override GOVERNOR;
104
104
 
105
105
  /// @notice The controller with which new projects should be deployed.
106
106
  IJBController public immutable override CONTROLLER;
107
107
 
108
- /// @notice The hooks registry.
108
+ /// @notice The Juicebox 721 tiers hook registry used to register deployed games.
109
109
  IJBAddressRegistry public immutable REGISTRY;
110
110
 
111
111
  /// @notice The 721 tiers hook store used by all games.
@@ -141,7 +141,7 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
141
141
  // ------------------------- external views -------------------------- //
142
142
  //*********************************************************************//
143
143
 
144
- /// @notice The current pot the game is being played with.
144
+ /// @notice The current pot the game is played with.
145
145
  /// @param gameId The ID of the game for which the pot applies.
146
146
  /// @param includeCommitments A flag indicating if the portion of the pot committed to fulfill preprogrammed
147
147
  /// obligations should be included.
@@ -203,7 +203,7 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
203
203
  return (ops.minParticipation, ops.scorecardTimeout);
204
204
  }
205
205
 
206
- /// @notice The game times.
206
+ /// @notice Get the countdown, minting, and refund deadline timestamps for a game.
207
207
  /// @param gameId The ID of the game for which the game times apply.
208
208
  /// @return The game's start time, as a unix timestamp.
209
209
  /// @return The game's minting period duration, in seconds.
@@ -213,7 +213,7 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
213
213
  return (ops.start, ops.mintPeriodDuration, ops.refundPeriodDuration);
214
214
  }
215
215
 
216
- /// @notice The token of a game.
216
+ /// @notice Get the ERC-20 token address associated with a given game.
217
217
  /// @param gameId The ID of the game to get the token of.
218
218
  /// @return The game's token.
219
219
  function tokenOf(uint256 gameId) external view override returns (address) {
@@ -129,7 +129,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
129
129
  // ---------------------- external transactions ---------------------- //
130
130
  //*********************************************************************//
131
131
 
132
- /// @notice Attests to a scorecard.
132
+ /// @notice Cast an attestation supporting a proposed scorecard, weighted by the caller's tier voting power.
133
133
  /// @param gameId The ID of the game to which the scorecard belongs.
134
134
  /// @param scorecardId The scorecard ID.
135
135
  /// @return weight The attestation weight that was applied.
@@ -446,7 +446,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
446
446
  }
447
447
 
448
448
  /// @notice The ID of a scorecard representing the provided tier weights.
449
- /// @param gameHook The address where the game is being played.
449
+ /// @param gameHook The address where the game is played.
450
450
  /// @param tierWeights The weights of each tier in the scorecard.
451
451
  function scorecardIdOf(
452
452
  address gameHook,
@@ -465,10 +465,10 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
465
465
  // ----------------------- public transactions ----------------------- //
466
466
  //*********************************************************************//
467
467
 
468
- /// @notice Initializes a game.
468
+ /// @notice Initialize governance for a newly deployed game, setting the initial block number for vote accounting.
469
469
  /// @param gameId The ID of the game.
470
- /// @param attestationStartTime The amount of time between a scorecard being submitted and attestations to it being
471
- /// enabled, measured in seconds.
470
+ /// @param attestationStartTime The amount of time between a scorecard submission and attestations becoming enabled,
471
+ /// measured in seconds.
472
472
  /// @param attestationGracePeriod The amount of time that must go by before a scorecard can be ratified.
473
473
  /// @param timelockDuration The cooling period after quorum is met before a scorecard can be ratified.
474
474
  function initializeGame(
@@ -523,9 +523,8 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
523
523
  return uint256(uint48(_packedScorecardInfoOf[gameId] >> 48));
524
524
  }
525
525
 
526
- /// @notice The amount of time between a scorecard being submitted and attestations to it being enabled, measured in
527
- /// seconds.
528
- /// @dev This can be increased to leave time for users to acquire attestation power, or delegate it, before
526
+ /// @notice The amount of time between a scorecard submission and attestations becoming enabled, measured in
527
+ /// seconds. @dev This can be increased to leave time for users to acquire attestation power, or delegate it, before
529
528
  /// a scorecard becomes live.
530
529
  /// @param gameId The ID of the game to get the attestation delay of.
531
530
  /// @return The delay, in seconds.
@@ -541,7 +540,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
541
540
  /// MAX_ATTESTATION_POWER_TIER; a holder of 1-of-100 gets MAX_ATTESTATION_POWER_TIER / 100.
542
541
  /// This ensures each game outcome (tier) has equal governance weight — the scorecard reflects
543
542
  /// consensus across outcomes, not dominance by whichever outcome sold the most tokens.
544
- /// @param gameId The ID of the game for which attestations are being counted.
543
+ /// @param gameId The ID of the game to count attestations for.
545
544
  /// @param account The account to get attestations for.
546
545
  /// @param timestamp The timestamp to measure attestations from.
547
546
  /// @return attestationPower The amount of attestation power of an account.
@@ -748,7 +747,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
748
747
  return eligibleTierWeights / 2;
749
748
  }
750
749
 
751
- /// @notice The state of a proposal.
750
+ /// @notice Get the current governance state (pending, active, defeated, succeeded) of a scorecard proposal.
752
751
  /// @param gameId The ID of the game to get a proposal state of.
753
752
  /// @param scorecardId The ID of the proposal to get the state of.
754
753
  /// @return The state.
@@ -839,7 +838,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
839
838
  }
840
839
 
841
840
  /// @notice A value representing the contents of a scorecard.
842
- /// @param gameHook The address where the game is being played.
841
+ /// @param gameHook The address where the game is played.
843
842
  /// @param calldataBytes The calldata that will be sent if the scorecard is ratified.
844
843
  function _hashScorecardOf(address gameHook, bytes memory calldataBytes) internal pure virtual returns (uint256) {
845
844
  return uint256(keccak256(abi.encode(gameHook, calldataBytes)));
@@ -82,16 +82,16 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
82
82
 
83
83
  /// @notice The delegation status for each address and for each tier.
84
84
  /// _delegator The delegator.
85
- /// _tierId The ID of the tier being delegated.
85
+ /// _tierId The ID of the tier to delegate.
86
86
  mapping(address => mapping(uint256 => address)) internal _tierDelegation;
87
87
 
88
88
  /// @notice The delegation checkpoints for each address and for each tier.
89
89
  /// _delegator The delegator.
90
- /// _tierId The ID of the tier being checked.
90
+ /// _tierId The ID of the tier to check.
91
91
  mapping(address => mapping(uint256 => Checkpoints.Trace208)) internal _delegateTierCheckpoints;
92
92
 
93
93
  /// @notice The total delegation status for each tier.
94
- /// _tierId The ID of the tier being checked.
94
+ /// _tierId The ID of the tier to check.
95
95
  mapping(uint256 => Checkpoints.Trace208) internal _totalTierCheckpoints;
96
96
 
97
97
  /// @notice The first owner of each token ID, stored on first transfer out.
@@ -132,7 +132,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
132
132
  /// @notice The address of the origin 'DefifaHook', used to check in the init if the contract is the original or not
133
133
  address public immutable override CODE_ORIGIN;
134
134
 
135
- /// @notice Contract metadata uri.
135
+ /// @notice The contract-level metadata URI used by marketplaces to display collection information.
136
136
  string public override contractURI;
137
137
 
138
138
  /// @notice The address that'll be set as the attestation delegate by default.
@@ -852,7 +852,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
852
852
  emit TierCashOutWeightsSet(tierWeights, msg.sender);
853
853
  }
854
854
 
855
- /// @notice Delegate attestations.
855
+ /// @notice Delegate this account's voting power for a single tier to a specified delegate.
856
856
  /// @param delegatee The account to delegate tier attestation units to.
857
857
  /// @param tierId The ID of the tier to delegate attestation units for.
858
858
  function setTierDelegateTo(address delegatee, uint256 tierId) public virtual override {
@@ -867,7 +867,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
867
867
  _delegateTier({account: msg.sender, delegatee: delegatee, tierId: tierId});
868
868
  }
869
869
 
870
- /// @notice Delegate attestations.
870
+ /// @notice Delegate this account's voting power across multiple tiers to specified delegates.
871
871
  /// @param delegations An array of tiers to set delegates for.
872
872
  function setTierDelegatesTo(DefifaDelegation[] memory delegations) external virtual override {
873
873
  // Make sure the current game phase is the minting phase.
@@ -949,7 +949,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
949
949
  /// @notice Delegate all attestation units for the specified tier.
950
950
  /// @param account The account delegating tier attestation units.
951
951
  /// @param delegatee The account to delegate tier attestation units to.
952
- /// @param tierId The ID of the tier for which attestation units are being transferred.
952
+ /// @param tierId The ID of the tier to transfer attestation units for.
953
953
  function _delegateTier(address account, address delegatee, uint256 tierId) internal virtual {
954
954
  // Get the current delegatee
955
955
  address oldDelegate = _tierDelegation[account][tierId];
@@ -1036,7 +1036,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
1036
1036
  /// @notice Moves delegated tier attestations from one delegate to another.
1037
1037
  /// @param from The account to transfer tier attestation units from.
1038
1038
  /// @param to The account to transfer tier attestation units to.
1039
- /// @param tierId The ID of the tier for which attestation units are being transferred.
1039
+ /// @param tierId The ID of the tier to transfer attestation units for.
1040
1040
  /// @param amount The amount of attestation units to delegate.
1041
1041
  function _moveTierDelegateAttestations(address from, address to, uint256 tierId, uint256 amount) internal {
1042
1042
  // Nothing to do if moving to the same account, or no amount is being moved.
@@ -1145,7 +1145,7 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
1145
1145
  /// register a burn, `to` should be zero. Total supply of attestation units will be adjusted with mints and burns.
1146
1146
  /// @param from The account to transfer tier attestation units from.
1147
1147
  /// @param to The account to transfer tier attestation units to.
1148
- /// @param tierId The ID of the tier for which attestation units are being transferred.
1148
+ /// @param tierId The ID of the tier to transfer attestation units for.
1149
1149
  /// @param amount The amount of attestation units to delegate.
1150
1150
  function _transferTierAttestationUnits(address from, address to, uint256 tierId, uint256 amount) internal virtual {
1151
1151
  if (from == address(0) || to == address(0)) {
@@ -1193,8 +1193,8 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
1193
1193
  }
1194
1194
 
1195
1195
  /// @notice Before transferring an NFT, register its first owner (if necessary).
1196
- /// @param to The address the NFT is being transferred to.
1197
- /// @param tokenId The token ID of the NFT being transferred.
1196
+ /// @param to The address to transfer the NFT to.
1197
+ /// @param tokenId The token ID of the NFT to transfer.
1198
1198
  /// @param auth The address authorizing the transfer.
1199
1199
  /// @return from The address the token was transferred from.
1200
1200
  function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address from) {
@@ -15,7 +15,7 @@ import {IDefifaHook} from "./IDefifaHook.sol";
15
15
  /// and commitment fulfillment.
16
16
  interface IDefifaDeployer {
17
17
  /// @notice Emitted when a commitment payout fails during fulfillment.
18
- /// @param gameId The ID of the game being fulfilled.
18
+ /// @param gameId The ID of the game that was fulfilled.
19
19
  /// @param amount The amount that failed to pay out.
20
20
  /// @param reason The revert reason bytes from the failed payout.
21
21
  event CommitmentPayoutFailed(uint256 indexed gameId, uint256 amount, bytes reason);
@@ -81,7 +81,7 @@ interface IDefifaDeployer {
81
81
  /// @return The project ID.
82
82
  function DEFIFA_PROJECT_ID() external view returns (uint256);
83
83
 
84
- /// @notice The governor contract used for scorecard governance.
84
+ /// @notice The governor contract responsible for scorecard submission and attestation-based ratification.
85
85
  /// @return The governor contract.
86
86
  function GOVERNOR() external view returns (IDefifaGovernor);
87
87
 
@@ -116,12 +116,12 @@ interface IDefifaDeployer {
116
116
  /// @return scorecardTimeout The scorecard timeout duration.
117
117
  function safetyParamsOf(uint256 gameId) external view returns (uint256 minParticipation, uint32 scorecardTimeout);
118
118
 
119
- /// @notice The timing parameters for a game.
119
+ /// @notice The timing parameters for a game (start time, mint duration, and refund period).
120
120
  /// @param gameId The ID of the game.
121
121
  /// @return The mint duration, start time, and refund period.
122
122
  function timesFor(uint256 gameId) external view returns (uint48, uint24, uint24);
123
123
 
124
- /// @notice The token address for a game.
124
+ /// @notice The token address used for payments and cash outs in a specific game.
125
125
  /// @param gameId The ID of the game.
126
126
  /// @return The token address.
127
127
  function tokenOf(uint256 gameId) external view returns (address);
@@ -24,7 +24,7 @@ interface IDefifaGovernor {
24
24
 
25
25
  /// @notice Emitted when an account attests to a scorecard.
26
26
  /// @param gameId The ID of the game.
27
- /// @param scorecardId The ID of the scorecard being attested to.
27
+ /// @param scorecardId The ID of the scorecard attested to.
28
28
  /// @param weight The attestation weight applied.
29
29
  /// @param caller The address that submitted the attestation.
30
30
  event ScorecardAttested(uint256 indexed gameId, uint256 indexed scorecardId, uint256 weight, address caller);
@@ -143,7 +143,8 @@ interface IDefifaGovernor {
143
143
  /// @return The scorecard ID.
144
144
  function scorecardIdOf(address gameHook, DefifaTierCashOutWeight[] calldata tierWeights) external returns (uint256);
145
145
 
146
- /// @notice The state of a scorecard.
146
+ /// @notice The governance state of a submitted scorecard (PENDING, ACTIVE, DEFEATED, SUCCEEDED, QUEUED, or
147
+ /// RATIFIED).
147
148
  /// @param gameId The ID of the game.
148
149
  /// @param scorecardId The ID of the scorecard.
149
150
  /// @return The scorecard state.
@@ -154,13 +155,14 @@ interface IDefifaGovernor {
154
155
  /// @return The timelock duration in seconds.
155
156
  function timelockDurationOf(uint256 gameId) external view returns (uint256);
156
157
 
157
- /// @notice Attest to a submitted scorecard.
158
+ /// @notice Attest to a submitted scorecard using your NFT voting power, adding your weight toward ratification.
158
159
  /// @param gameId The ID of the game.
159
160
  /// @param scorecardId The ID of the scorecard to attest to.
160
161
  /// @return weight The attestation weight applied.
161
162
  function attestToScorecardFrom(uint256 gameId, uint256 scorecardId) external returns (uint256 weight);
162
163
 
163
- /// @notice Initialize a game's governance parameters.
164
+ /// @notice Initialize governance parameters for a game sets when attestation begins, the grace period, and
165
+ /// timelock duration.
164
166
  /// @param gameId The ID of the game.
165
167
  /// @param attestationStartTime The timestamp when attestation begins.
166
168
  /// @param attestationGracePeriod The grace period duration in seconds.
@@ -100,7 +100,7 @@ interface IDefifaHook is IJB721Hook {
100
100
  /// @return The code origin address.
101
101
  function CODE_ORIGIN() external view returns (address);
102
102
 
103
- /// @notice The contract-level metadata URI.
103
+ /// @notice The contract-level metadata URI (used by marketplaces for collection-level info).
104
104
  /// @return The contract URI string.
105
105
  function contractURI() external view returns (string memory);
106
106
 
@@ -257,12 +257,12 @@ interface IDefifaHook is IJB721Hook {
257
257
  /// @param tierWeights The tier cash out weights to set.
258
258
  function setTierCashOutWeightsTo(DefifaTierCashOutWeight[] memory tierWeights) external;
259
259
 
260
- /// @notice Set the attestation delegate for a specific tier.
260
+ /// @notice Delegate your attestation voting power for a specific tier to another address.
261
261
  /// @param delegatee The address to delegate to.
262
262
  /// @param tierId The tier ID.
263
263
  function setTierDelegateTo(address delegatee, uint256 tierId) external;
264
264
 
265
- /// @notice Set attestation delegates for multiple tiers at once.
265
+ /// @notice Delegate your attestation voting power for multiple tiers to other addresses in a single call.
266
266
  /// @param delegations The delegation assignments.
267
267
  function setTierDelegatesTo(DefifaDelegation[] memory delegations) external;
268
268
  }
@@ -244,7 +244,7 @@ library DefifaHookLib {
244
244
 
245
245
  /// @notice Compute the cash out count for the beforeCashOutRecorded hook.
246
246
  /// @param gamePhase The current game phase.
247
- /// @param cumulativeMintPrice The cumulative mint price of the tokens being cashed out.
247
+ /// @param cumulativeMintPrice The cumulative mint price of the tokens to cash out.
248
248
  /// @param surplusValue The surplus value from the context.
249
249
  /// @param totalAmountRedeemed The amount already redeemed.
250
250
  /// @param cumulativeCashOutWeight The cumulative cash out weight of the tokens.
@@ -294,7 +294,7 @@ library DefifaHookLib {
294
294
 
295
295
  /// @notice Computes the attestation units for tiers during payment processing.
296
296
  /// @dev Returns parallel arrays: tier IDs, cumulative attestation units per tier, and whether to switch delegate.
297
- /// @param tierIdsToMint The tier IDs being minted (must be in ascending order).
297
+ /// @param tierIdsToMint The tier IDs to mint (must be in ascending order).
298
298
  /// @param hookStore The 721 tiers hook store.
299
299
  /// @param hook The hook address.
300
300
  /// @return tierIds The unique tier IDs.
@@ -10,7 +10,7 @@ import {DefifaTierParams} from "./DefifaTierParams.sol";
10
10
 
11
11
  /// @notice All parameters needed to launch a new Defifa game — the name, tiers, timing, splits, and governance
12
12
  /// configuration.
13
- /// @custom:member name The name of the game being created.
13
+ /// @custom:member name The name of the game to create.
14
14
  /// @custom:member projectUri Metadata to associate with the project.
15
15
  /// @custom:member contractUri The URI to associate with the 721.
16
16
  /// @custom:member baseUri The URI base to prepend onto any tier token URIs.
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  /// @notice Operational parameters stored for a deployed game — the token, timing, and contest rules.
5
- /// @custom:member token The token being used by the game.
5
+ /// @custom:member token The token used by the game.
6
6
  /// @custom:member start The time at which the game should start, measured in seconds.
7
7
  /// @custom:member mintPeriodDuration The duration of the game's mint phase, measured in seconds.
8
8
  /// @custom:member refundPeriodDuration The time between the mint phase and the start time when mint's are no longer