@ballkidz/defifa 0.0.27 → 0.0.29
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/CRYPTO_ECON.md +3 -3
- package/package.json +1 -1
- package/src/DefifaDeployer.sol +22 -17
- package/src/DefifaGovernor.sol +10 -11
- package/src/DefifaHook.sol +11 -11
- package/src/DefifaTokenUriResolver.sol +13 -3
- package/src/interfaces/IDefifaDeployer.sol +4 -4
- package/src/interfaces/IDefifaGovernor.sol +6 -4
- package/src/interfaces/IDefifaHook.sol +3 -3
- package/src/libraries/DefifaHookLib.sol +2 -2
- package/src/structs/DefifaLaunchProjectData.sol +1 -1
- package/src/structs/DefifaOpsData.sol +1 -1
package/CRYPTO_ECON.md
CHANGED
|
@@ -777,11 +777,11 @@ Defifa includes a comprehensive safety system — the **NO_CONTEST** mechanism
|
|
|
777
777
|
|
|
778
778
|
#### 9.1.1 Trigger 1: Minimum Participation Threshold
|
|
779
779
|
|
|
780
|
-
**Mechanism.** At game creation, the organizer sets `minParticipation` — a minimum
|
|
780
|
+
**Mechanism.** At game creation, the organizer sets `minParticipation` — a minimum token supply required for the game to proceed to scoring. The `currentGamePhaseOf()` function checks the total token supply (via `CONTROLLER.TOKENS().totalSupplyOf(gameId)`) against this threshold before returning SCORING. If the supply is below the threshold, it returns NO_CONTEST.
|
|
781
781
|
|
|
782
782
|
**What it solves.** Ghost games with negligible participation skip directly to refundability without requiring any governance action. A 32-team World Cup game with `minParticipation = 1 ETH` won't enter scoring if only 50 people mint (0.5 ETH pot).
|
|
783
783
|
|
|
784
|
-
**Attack surface.** An adversary who wants to force no-contest can
|
|
784
|
+
**Attack surface.** An adversary who wants to force no-contest can cash out enough tokens during the refund phase to push the supply below the threshold. Note that direct balance top-ups (via `addToBalanceOf`) cannot inflate participation since the check uses token supply, not treasury balance. Mitigation: set the threshold conservatively low relative to expected participation.
|
|
785
785
|
|
|
786
786
|
**Configuration.** Set to 0 to disable. The threshold is set at launch before any minting occurs, so calibration depends on organizer judgment.
|
|
787
787
|
|
|
@@ -820,7 +820,7 @@ The phase resolution follows strict priority:
|
|
|
820
820
|
|
|
821
821
|
2. **Explicit trigger is sticky.** Once `noContestTriggeredFor[gameId]` is set, the game stays in NO_CONTEST permanently (cannot transition to SCORING even if conditions change).
|
|
822
822
|
|
|
823
|
-
3. **Both thresholds are checked independently.** A game can enter NO_CONTEST from either `minParticipation` (
|
|
823
|
+
3. **Both thresholds are checked independently.** A game can enter NO_CONTEST from either `minParticipation` (token supply too low) or `scorecardTimeout` (time elapsed) — whichever condition is met first.
|
|
824
824
|
|
|
825
825
|
#### 9.1.5 The Default Attestation Delegate
|
|
826
826
|
|
package/package.json
CHANGED
package/src/DefifaDeployer.sol
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) {
|
|
@@ -254,13 +254,12 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
|
|
|
254
254
|
// Get the game's ops data for the safety mechanism checks. Cache to avoid repeated SLOAD.
|
|
255
255
|
DefifaOpsData memory ops = _opsOf[gameId];
|
|
256
256
|
|
|
257
|
-
// Check minimum participation threshold
|
|
258
|
-
//
|
|
257
|
+
// Check minimum participation threshold using token supply (not terminal balance).
|
|
258
|
+
// Token supply reflects actual minted participation — direct `addToBalanceOf` top-ups
|
|
259
|
+
// don't mint tokens and therefore can't bypass this check.
|
|
259
260
|
if (ops.minParticipation > 0) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
.balanceOf({terminal: address(terminal), projectId: gameId, token: ops.token});
|
|
263
|
-
if (balance < ops.minParticipation) return DefifaGamePhase.NO_CONTEST;
|
|
261
|
+
uint256 totalTokenSupply = CONTROLLER.TOKENS().totalSupplyOf(gameId);
|
|
262
|
+
if (totalTokenSupply < ops.minParticipation) return DefifaGamePhase.NO_CONTEST;
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
// Check scorecard ratification timeout: if enough time has passed without a ratified scorecard, the game is
|
|
@@ -427,13 +426,19 @@ contract DefifaDeployer is IDefifaDeployer, IDefifaGamePhaseReporter, IDefifaGam
|
|
|
427
426
|
revert DefifaDeployer_InvalidCurrency();
|
|
428
427
|
}
|
|
429
428
|
|
|
430
|
-
// If a scorecard timeout is set, it must exceed the
|
|
429
|
+
// If a scorecard timeout is set, it must exceed the full ratification window:
|
|
430
|
+
// attestation delay (time from scoring start to attestation start) + grace period + timelock.
|
|
431
431
|
// Otherwise the game would enter NO_CONTEST before a scorecard could ever reach SUCCEEDED.
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
if (launchProjectData.scorecardTimeout > 0) {
|
|
433
|
+
// Attestation delay: how long after scoring starts before attestations can begin.
|
|
434
|
+
uint256 attestationDelay = launchProjectData.attestationStartTime > launchProjectData.start
|
|
435
|
+
? launchProjectData.attestationStartTime - launchProjectData.start
|
|
436
|
+
: 0;
|
|
437
|
+
if (
|
|
438
|
+
launchProjectData.scorecardTimeout
|
|
439
|
+
<= attestationDelay + launchProjectData.attestationGracePeriod + launchProjectData.timelockDuration
|
|
440
|
+
) revert DefifaDeployer_InvalidGameConfiguration();
|
|
441
|
+
}
|
|
437
442
|
|
|
438
443
|
// Reserve the game ID up front so permissionless project creations cannot invalidate hook deployment.
|
|
439
444
|
gameId = CONTROLLER.PROJECTS().createFor(address(this));
|
package/src/DefifaGovernor.sol
CHANGED
|
@@ -129,7 +129,7 @@ contract DefifaGovernor is Ownable, IDefifaGovernor {
|
|
|
129
129
|
// ---------------------- external transactions ---------------------- //
|
|
130
130
|
//*********************************************************************//
|
|
131
131
|
|
|
132
|
-
/// @notice
|
|
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
|
|
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
|
|
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
|
|
471
|
-
///
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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)));
|
package/src/DefifaHook.sol
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1197
|
-
/// @param tokenId The token ID of the NFT
|
|
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) {
|
|
@@ -282,9 +282,19 @@ contract DefifaTokenUriResolver is IDefifaTokenUriResolver, IJB721TokenUriResolv
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// Concatenate the strings
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
if (isEth) {
|
|
286
|
+
return string(abi.encodePacked("\u039E", integerPart, ".", decimalPartStr));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Try to get the token symbol; fall back to a truncated hex address if the call reverts.
|
|
290
|
+
string memory tokenSymbol;
|
|
291
|
+
try IERC20Metadata(token).symbol() returns (string memory s) {
|
|
292
|
+
tokenSymbol = _escapeSvg(s);
|
|
293
|
+
} catch {
|
|
294
|
+
tokenSymbol = Strings.toHexString(uint160(token), 20);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return string(abi.encodePacked(integerPart, ".", decimalPartStr, " ", tokenSymbol));
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
/// @notice Gets a substring.
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|