@ballkidz/defifa 0.0.1

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.
Files changed (59) hide show
  1. package/.gas-snapshot +2 -0
  2. package/CRYPTO_ECON.md +955 -0
  3. package/CRYPTO_ECON.pdf +0 -0
  4. package/CRYPTO_ECON.tex +800 -0
  5. package/README.md +119 -0
  6. package/SKILLS.md +177 -0
  7. package/deployments/defifa-v5/arbitrum_sepolia/DefifaDelegate.json +4867 -0
  8. package/deployments/defifa-v5/arbitrum_sepolia/DefifaDeployer.json +1719 -0
  9. package/deployments/defifa-v5/arbitrum_sepolia/DefifaGovernor.json +1535 -0
  10. package/deployments/defifa-v5/arbitrum_sepolia/DefifaTokenUriResolver.json +295 -0
  11. package/deployments/defifa-v5/base_sepolia/DefifaDelegate.json +4875 -0
  12. package/deployments/defifa-v5/base_sepolia/DefifaDeployer.json +1725 -0
  13. package/deployments/defifa-v5/base_sepolia/DefifaGovernor.json +1543 -0
  14. package/deployments/defifa-v5/base_sepolia/DefifaTokenUriResolver.json +301 -0
  15. package/deployments/defifa-v5/optimism_sepolia/DefifaDelegate.json +4875 -0
  16. package/deployments/defifa-v5/optimism_sepolia/DefifaDeployer.json +1725 -0
  17. package/deployments/defifa-v5/optimism_sepolia/DefifaGovernor.json +1543 -0
  18. package/deployments/defifa-v5/optimism_sepolia/DefifaTokenUriResolver.json +301 -0
  19. package/deployments/defifa-v5/sepolia/DefifaDelegate.json +4875 -0
  20. package/deployments/defifa-v5/sepolia/DefifaDeployer.json +1725 -0
  21. package/deployments/defifa-v5/sepolia/DefifaGovernor.json +1543 -0
  22. package/deployments/defifa-v5/sepolia/DefifaTokenUriResolver.json +301 -0
  23. package/foundry.lock +17 -0
  24. package/foundry.toml +35 -0
  25. package/package.json +33 -0
  26. package/remappings.txt +6 -0
  27. package/script/Deploy.s.sol +109 -0
  28. package/script/helpers/DefifaDeploymentLib.sol +83 -0
  29. package/slither-ci.config.json +10 -0
  30. package/sphinx.lock +521 -0
  31. package/src/DefifaDeployer.sol +894 -0
  32. package/src/DefifaGovernor.sol +490 -0
  33. package/src/DefifaHook.sol +1056 -0
  34. package/src/DefifaProjectOwner.sol +63 -0
  35. package/src/DefifaTokenUriResolver.sol +312 -0
  36. package/src/enums/DefifaGamePhase.sol +11 -0
  37. package/src/enums/DefifaScorecardState.sol +10 -0
  38. package/src/interfaces/IDefifaDeployer.sol +108 -0
  39. package/src/interfaces/IDefifaGamePhaseReporter.sol +8 -0
  40. package/src/interfaces/IDefifaGamePotReporter.sol +8 -0
  41. package/src/interfaces/IDefifaGovernor.sol +132 -0
  42. package/src/interfaces/IDefifaHook.sol +228 -0
  43. package/src/interfaces/IDefifaTokenUriResolver.sol +10 -0
  44. package/src/libraries/DefifaFontImporter.sol +19 -0
  45. package/src/libraries/DefifaHookLib.sol +358 -0
  46. package/src/structs/DefifaAttestations.sol +9 -0
  47. package/src/structs/DefifaDelegation.sol +9 -0
  48. package/src/structs/DefifaLaunchProjectData.sol +59 -0
  49. package/src/structs/DefifaOpsData.sol +20 -0
  50. package/src/structs/DefifaScorecard.sol +9 -0
  51. package/src/structs/DefifaTierCashOutWeight.sol +9 -0
  52. package/src/structs/DefifaTierParams.sol +16 -0
  53. package/test/DefifaFeeAccounting.t.sol +559 -0
  54. package/test/DefifaGovernor.t.sol +1333 -0
  55. package/test/DefifaMintCostInvariant.t.sol +299 -0
  56. package/test/DefifaNoContest.t.sol +922 -0
  57. package/test/DefifaSecurity.t.sol +717 -0
  58. package/test/SVG.t.sol +164 -0
  59. package/test/deployScript.t.sol +144 -0
@@ -0,0 +1,800 @@
1
+ \documentclass[11pt,a4paper]{article}
2
+
3
+ \usepackage[utf8]{inputenc}
4
+ \usepackage[T1]{fontenc}
5
+ \usepackage{lmodern}
6
+ \usepackage{amsmath,amssymb,amsthm}
7
+ \usepackage{graphicx}
8
+ \usepackage{hyperref}
9
+ \usepackage{geometry}
10
+ \usepackage{booktabs}
11
+ \usepackage{enumitem}
12
+ \usepackage{float}
13
+ \usepackage{xcolor}
14
+
15
+ \geometry{margin=1in}
16
+ \emergencystretch=1.5em
17
+
18
+ \hypersetup{
19
+ colorlinks=true,
20
+ linkcolor=blue!70!black,
21
+ urlcolor=blue!70!black,
22
+ citecolor=blue!70!black
23
+ }
24
+
25
+ \newtheorem{theorem}{Theorem}
26
+ \newtheorem{corollary}[theorem]{Corollary}
27
+ \newtheorem{definition}{Definition}
28
+
29
+ \title{\textbf{Cryptoeconomics of Defifa}}
30
+ \author{Claude Opus 4.6 (Anthropic) in coordination with Jango from the Defifa Team.\\[4pt]
31
+ \small This analysis was generated by Claude Opus 4.6 based on its study of the Defifa V5 codebase\\
32
+ \small and the \href{https://cryptoeconlab.com/paper/pub-0?paper=https\%253A\%252F\%252Fstorage.googleapis.com\%252Fcel-public-resources\%252FRevnet-Whitepaper.pdf}{Revnet Whitepaper} by CryptoEconLab.}
33
+ \date{March 2026}
34
+
35
+ \begin{document}
36
+
37
+ \maketitle
38
+
39
+ \begin{abstract}
40
+ Defifa is a prediction-game protocol built on Juicebox V5 that transforms NFT minting into a parimutuel wagering mechanism with governance-ratified outcomes. Players purchase ERC-721 game pieces representing competing tiers (teams, candidates, outcomes), forming a shared treasury. After the event concludes, a decentralized attestation process ratifies a scorecard that assigns weights to each tier, redistributing the treasury proportionally. This paper formalizes the cryptoeconomic mechanics of Defifa games: the prize distribution formula, the attestation governance model, the fee extraction pipeline, the protocol-token incentive layer, and the rational actor strategies that emerge. We derive solvency guarantees, characterize equilibrium behavior under various participation profiles, analyze the game-theoretic properties of the scorecard ratification process, and identify the parameter regimes that maximize game integrity and participant welfare.
41
+ \end{abstract}
42
+
43
+ \tableofcontents
44
+ \newpage
45
+
46
+ %==========================================================================
47
+ \section{Introduction}
48
+ %==========================================================================
49
+
50
+ \subsection{What is Defifa?}
51
+
52
+ Defifa is a prediction-game protocol that transforms the act of purchasing an NFT into a wager on the outcome of a real-world event. It is deployed using the Juicebox V5 protocol and governed by a combination of immutable smart-contract rules and a minimal, time-bounded governance process for outcome resolution.
53
+
54
+ A Defifa game is a \emph{tokenized parimutuel pool}: money goes in via NFT purchases, forming a shared pot; after the event concludes, a governance process assigns weights to each tier (team, outcome, candidate), and the pot is distributed proportionally. The game pieces are ERC-721 tokens organized into tiers, where each tier represents a distinct prediction. The purchase price of a tier token is fixed at game creation, and the payout is determined by post-event scorecard ratification.
55
+
56
+ Defifa games are:
57
+ \begin{itemize}[nosep]
58
+ \item \textbf{Deterministic in structure}: all phases, durations, tier prices, and fee schedules are fixed at deployment.
59
+ \item \textbf{Governance-minimal}: the only human input is the scorecard---a mapping from tiers to weights---ratified through an attestation process.
60
+ \item \textbf{Self-custodial}: all funds remain in the Juicebox treasury; no operator can access them outside the protocol rules.
61
+ \item \textbf{Composable}: games are standard Juicebox projects, inheriting the full protocol's accounting, terminal, and hook infrastructure.
62
+ \end{itemize}
63
+
64
+ \subsection{How a Defifa Game Works (at a glance)}
65
+
66
+ \begin{enumerate}[nosep]
67
+ \item \textbf{Mint (pot formation).} During the mint phase, anyone can purchase NFTs representing tiers. Each NFT has a fixed price denominated in the game's base asset (e.g., ETH). All payments flow into a shared treasury---the \emph{pot}. Players may delegate their attestation power to a chosen delegate at mint time.
68
+
69
+ \item \textbf{Refund (optional exit window).} If configured, a refund phase follows minting. During this period, players may burn their NFTs to reclaim the original mint price, allowing a risk-free exit for those who change their minds. No new mints are accepted.
70
+
71
+ \item \textbf{Score (outcome resolution).} Once the real-world event concludes, anyone may propose a \emph{scorecard}---a vector of weights summing to $W_{\text{total}} = 10^{18}$---assigning each tier its share of the pot. NFT holders attest to the scorecard they believe reflects the correct outcome. Once a scorecard achieves quorum, it can be ratified.
72
+
73
+ \item \textbf{Complete (prize distribution).} After ratification, protocol fees are extracted, and the remaining pot is available for claims. Each NFT holder burns their token to receive their proportional share, plus any accrued protocol tokens (\$DEFIFA and \$BASE\_\allowbreak{}PROTOCOL).
74
+ \end{enumerate}
75
+
76
+ \subsection{The Design Parameters}
77
+
78
+ A Defifa game is fully specified at deployment by a parameter tuple:
79
+ \begin{equation}
80
+ \mathcal{G} = \left( \{T_i\}_{i=1}^{N}, \; t_{\text{mint}}, \; t_{\text{refund}}, \; t_{\text{start}}, \; \phi_{\text{defifa}}, \; \phi_{\text{base}}, \; \mathcal{S}, \; \tau_{\text{attest}}, \; \tau_{\text{grace}} \right)
81
+ \end{equation}
82
+
83
+ Where:
84
+ \begin{enumerate}[nosep]
85
+ \item \textbf{Tier configuration} $\{T_i\}_{i=1}^{N}$: For each of the $N$ tiers, a fixed price $p_i$, an optional reserved rate $\rho_i$, and a reserved-token beneficiary address. The initial supply per tier is set to $999{,}999{,}999$ (effectively unlimited).
86
+
87
+ \item \textbf{Mint period duration} ($t_{\text{mint}}$): How long the minting window stays open, in seconds.
88
+
89
+ \item \textbf{Refund period duration} ($t_{\text{refund}}$): How long the refund window stays open after minting closes. May be zero (no refund phase).
90
+
91
+ \item \textbf{Game start time} ($t_{\text{start}}$): When the scoring phase begins---typically aligned with the real-world event's conclusion.
92
+
93
+ \item \textbf{Defifa fee divisor} ($\phi_{\text{defifa}}$): The fraction $1/\phi_{\text{defifa}}$ of the pot sent to the Defifa protocol project. Default: $\phi_{\text{defifa}} = 20$ (5\%).
94
+
95
+ \item \textbf{Base protocol fee divisor} ($\phi_{\text{base}}$): The fraction $1/\phi_{\text{base}}$ of the pot sent to the base protocol project. Default: $\phi_{\text{base}} = 20$ (5\%).
96
+
97
+ \item \textbf{Splits} ($\mathcal{S}$): Additional payout splits configured at deployment (e.g., for game organizers, charities).
98
+
99
+ \item \textbf{Attestation start time} ($\tau_{\text{attest}}$): Delay before attestation voting opens on a submitted scorecard.
100
+
101
+ \item \textbf{Attestation grace period} ($\tau_{\text{grace}}$): Duration of the attestation voting window.
102
+ \end{enumerate}
103
+
104
+ Once set, the tuple $\mathcal{G}$ is immutable. Phase transitions occur automatically by timestamp, with the scoring phase having infinite duration (duration $= 0$) until the scorecard is ratified.
105
+
106
+ %==========================================================================
107
+ \section{Mathematical Model of Defifa Economics}
108
+ %==========================================================================
109
+
110
+ \subsection{Parameters and State Variables}
111
+
112
+ The economic behavior of a Defifa game is determined jointly by:
113
+ \begin{enumerate}[nosep]
114
+ \item The immutable game parameters $\mathcal{G}$ (cf.\ Section 1.3), fixed at deployment;
115
+ \item The evolving state variables, which track the pot, token supplies, and claim status over time.
116
+ \end{enumerate}
117
+
118
+ \textbf{State variables.} The core dynamic variables are listed in Table~\ref{tab:state}.
119
+
120
+ \begin{table}[H]
121
+ \centering
122
+ \begin{tabular}{ll}
123
+ \toprule
124
+ \textbf{Variable} & \textbf{Description} \\
125
+ \midrule
126
+ $B(t)$ & Pot (treasury balance) at time $t$ \\
127
+ $n_i(t)$ & Number of NFTs minted in tier $i$ at time $t$ \\
128
+ $N_{\text{total}}(t)$ & Total NFTs outstanding: $\sum_i n_i(t)$ \\
129
+ $M(t)$ & Total mint cost accumulated: $\sum_i n_i(t) \cdot p_i$ \\
130
+ $w_i$ & Scorecard weight assigned to tier $i$ ($\sum_i w_i = W_{\text{total}}$) \\
131
+ $d_i(t)$ & Tokens redeemed from tier $i$ after ratification \\
132
+ $B_{\text{prize}}$ & Net prize pool after fee extraction \\
133
+ \bottomrule
134
+ \end{tabular}
135
+ \caption{Core state variables of a Defifa game.}
136
+ \label{tab:state}
137
+ \end{table}
138
+
139
+ At any time $t$, the state of the game is fully determined by the pair
140
+ $\bigl(\mathcal{G}, \; \{B(t), n_i(t), w_i, d_i(t)\}\bigr)$,
141
+ where $\mathcal{G}$ is the fixed game configuration and the second component evolves endogenously as players interact.
142
+
143
+ \subsection{Minting --- Pot Formation}
144
+
145
+ During the mint phase $[t_{\text{mint\_start}},\; t_{\text{mint\_start}} + t_{\text{mint}})$, any participant may purchase NFTs from any tier $i$ at the fixed price $p_i$ per token.
146
+
147
+ \textbf{Minted quantity.} For a payment amount $x$ of base asset directed at tier $i$:
148
+ \begin{equation}
149
+ q_i = \left\lfloor \frac{x}{p_i} \right\rfloor
150
+ \end{equation}
151
+
152
+ \textbf{Reserved minting.} If tier $i$ has a reserved rate $\rho_i > 0$, then for every $\rho_i$ tokens minted by paying players, one additional token is minted to the reserved-token beneficiary. Reserved tokens are \emph{not} paid for, but their cost is counted toward $M(t)$ for purposes of protocol-token distribution (cf.\ Section~2.6).
153
+
154
+ \textbf{State updates.} At the instant of a mint event where player $j$ purchases $q$ tokens of tier $i$:
155
+ \begin{align}
156
+ B(t^+) &= B(t^-) + q \cdot p_i \tag{Treasury balance} \\
157
+ n_i(t^+) &= n_i(t^-) + q \tag{Tier supply} \\
158
+ M(t^+) &= M(t^-) + q \cdot p_i \tag{Total mint cost}
159
+ \end{align}
160
+
161
+ \textbf{Pot composition.} At the end of the mint phase, the pot is:
162
+ \begin{equation}
163
+ B_{\text{mint}} = \sum_{i=1}^{N} n_i \cdot p_i
164
+ \end{equation}
165
+
166
+ This is the total capital at risk in the game, and represents the complete prize pool before fee extraction.
167
+
168
+ \subsection{Refund --- Optionality Window}
169
+
170
+ If $t_{\text{refund}} > 0$, a refund phase follows minting. During $[t_{\text{mint\_end}},\; t_{\text{mint\_end}} + t_{\text{refund}})$:
171
+ \begin{itemize}[nosep]
172
+ \item No new mints are accepted (\texttt{pausePay} $=$ \texttt{true}).
173
+ \item Any NFT holder may burn their token to reclaim its mint price.
174
+ \end{itemize}
175
+
176
+ \textbf{Refund mechanics.} A player burning $q$ tokens of tier $i$ receives exactly $q \cdot p_i$ base asset from the treasury:
177
+ \begin{equation}
178
+ R_{\text{refund}} = q \cdot p_i
179
+ \end{equation}
180
+
181
+ \textbf{State updates.} After a refund:
182
+ \begin{align}
183
+ B(t^+) &= B(t^-) - q \cdot p_i \\
184
+ n_i(t^+) &= n_i(t^-) - q \\
185
+ M(t^+) &= M(t^-) - q \cdot p_i
186
+ \end{align}
187
+
188
+ The refund phase creates a \emph{free option} for participants: they can observe late-breaking information (injury reports, market movements, team changes) and exit at zero cost.
189
+
190
+ \textbf{Key property.} The refund is dollar-for-dollar: every token refunded removes exactly its mint price from the pot, preserving the per-NFT backing ratio $B(t) / N_{\text{total}}(t)$ for uniform-priced games.
191
+
192
+ \subsection{Prize Distribution --- The Scorecard Formula}
193
+
194
+ After the real-world event concludes and a scorecard is ratified, the game enters the COMPLETE phase.
195
+
196
+ \textbf{The scorecard.} A scorecard is a vector of weights $\mathbf{w} = (w_1, w_2, \ldots, w_N)$ satisfying:
197
+ \begin{equation}
198
+ \sum_{i=1}^{N} w_i = W_{\text{total}} = 10^{18}
199
+ \end{equation}
200
+
201
+ Each $w_i \in [0, W_{\text{total}}]$ represents the fraction of the prize pool allocated to tier $i$'s holders.
202
+
203
+ \textbf{Per-token weight.} The weight assigned to a single NFT in tier $i$ is:
204
+ \begin{equation}
205
+ w_i^{\text{token}} = \frac{w_i}{\hat{n}_i}
206
+ \end{equation}
207
+
208
+ where $\hat{n}_i$ is the \emph{effective} number of tokens eligible for redemption in tier $i$ at the time the scorecard is ratified:
209
+ \begin{equation}
210
+ \hat{n}_i = n_i^{\text{minted}} - n_i^{\text{remaining}} - (n_i^{\text{burned}} - d_i)
211
+ \end{equation}
212
+
213
+ Here $n_i^{\text{minted}}$ is the initial supply, $n_i^{\text{remaining}}$ is the unminted supply, $n_i^{\text{burned}}$ is the total burned count, and $d_i$ is the number of tokens redeemed \emph{in the complete phase specifically}. This formula ensures that as tokens are redeemed in the complete phase, the denominator adjusts to maintain fair distribution for remaining holders.
214
+
215
+ \textbf{Cash-out value.} When a player burns a set of token IDs $\{k_1, k_2, \ldots, k_m\}$, the total claim is:
216
+ \begin{equation}
217
+ \boxed{C(\{k_j\}) = \frac{\displaystyle\sum_{j=1}^{m} w_{i(k_j)}^{\text{token}}}{W_{\text{total}}} \cdot \bigl(B_{\text{prize}} + A_{\text{redeemed}}\bigr)}
218
+ \label{eq:cashout}
219
+ \end{equation}
220
+
221
+ where $i(k_j)$ is the tier of token $k_j$, $B_{\text{prize}}$ is the current treasury balance (post-fee), and $A_{\text{redeemed}}$ is the cumulative amount already redeemed by prior players.
222
+
223
+ The term $(B_{\text{prize}} + A_{\text{redeemed}})$ reconstructs the \emph{original} post-fee pot, ensuring that the order of redemptions does not affect the payout per token. This is a critical design property: it makes Defifa a \emph{path-independent} mechanism.
224
+
225
+ \textbf{Special cases:}
226
+ \begin{itemize}[nosep]
227
+ \item \textbf{Winner-take-all:} $w_j = W_{\text{total}}$ for a single tier $j$, all others zero.
228
+ \item \textbf{Proportional split:} $w_i = W_{\text{total}} \cdot n_i / N_{\text{total}}$, weights by participation count.
229
+ \item \textbf{No contest (by convention):} All $w_i$ set proportionally to return mint prices, effectively implementing a full refund through the standard scorecard mechanism.
230
+ \end{itemize}
231
+
232
+ \subsection{Fee Extraction Pipeline}
233
+
234
+ Before prize distribution begins, the Deployer contract extracts protocol fees by calling \texttt{fulfill\-Commitments\-Of}. This triggers a \texttt{send\-Payouts\-Of} call on the terminal, distributing the pot according to the scoring-phase splits.
235
+
236
+ \textbf{Split structure.} The splits configured at game launch allocate the pot as follows:
237
+ \begin{enumerate}[nosep]
238
+ \item \textbf{Base protocol fee:} $1/\phi_{\text{base}}$ of the pot to the base protocol project (default: 5\%)
239
+ \item \textbf{Defifa fee:} $1/\phi_{\text{defifa}}$ of the pot to the Defifa project (default: 5\%)
240
+ \item \textbf{Custom splits} ($\mathcal{S}$): Any additional game-creator-defined splits
241
+ \item \textbf{Remainder:} Returned to the game's treasury via \texttt{addToBalanceOf}
242
+ \end{enumerate}
243
+
244
+ \textbf{Fee formulas.} Let $B_{\text{pot}}$ be the treasury balance at commitment fulfillment:
245
+ \begin{align}
246
+ F_{\text{base}} &= \frac{B_{\text{pot}}}{\phi_{\text{base}}} \\[4pt]
247
+ F_{\text{defifa}} &= \frac{B_{\text{pot}}}{\phi_{\text{defifa}}} \\[4pt]
248
+ F_{\text{custom}} &= \sum_{s \in \mathcal{S}} \frac{B_{\text{pot}} \cdot \text{percent}_s}{\text{SPLITS\_TOTAL\_PERCENT}}
249
+ \end{align}
250
+
251
+ The prize pool available for player claims is:
252
+ \begin{equation}
253
+ \boxed{B_{\text{prize}} = B_{\text{pot}} - F_{\text{base}} - F_{\text{defifa}} - F_{\text{custom}}}
254
+ \end{equation}
255
+
256
+ With default parameters ($\phi_{\text{base}} = \phi_{\text{defifa}} = 20$, no custom splits):
257
+ \begin{equation}
258
+ B_{\text{prize}} = B_{\text{pot}} \cdot \left(1 - \tfrac{1}{20} - \tfrac{1}{20}\right) = 0.9 \cdot B_{\text{pot}}
259
+ \end{equation}
260
+
261
+ \textbf{Fee recycling.} The fees paid to the Defifa and base protocol projects are processed as standard Juicebox payments, which mint project tokens (\$DEFIFA, \$BASE\_PROTOCOL) to the beneficiary---in this case, the game's hook contract. These tokens are later distributed to players upon claim (Section~2.6).
262
+
263
+ \subsection{Protocol Token Allocation}
264
+
265
+ When fees are paid to the Defifa and base protocol projects, those projects mint their respective tokens to the game hook's address. The hook contract accumulates these tokens and distributes them proportionally when players burn their NFTs in the COMPLETE phase.
266
+
267
+ \textbf{Token allocation per player.} For a player burning tokens with cumulative mint cost $c$:
268
+ \begin{align}
269
+ X_{\text{defifa}} &= \frac{c}{M} \cdot D_{\text{total}} \\[4pt]
270
+ X_{\text{base}} &= \frac{c}{M} \cdot P_{\text{total}}
271
+ \end{align}
272
+
273
+ where $M$ is the total mint cost of all tokens ever minted, $D_{\text{total}}$ is the total \$DEFIFA tokens held by the hook, and $P_{\text{total}}$ is the total \$BASE\_PROTOCOL tokens held by the hook.
274
+
275
+ \textbf{Key property.} Protocol token distribution is proportional to \emph{original mint cost}, not to scorecard weight. This means that even holders of losing tiers ($w_i = 0$) receive protocol tokens when burning their NFTs, creating a partial consolation mechanism that rewards participation regardless of outcome.
276
+
277
+ %==========================================================================
278
+ \section{Attestation Governance and Scorecard Ratification}
279
+ %==========================================================================
280
+
281
+ \subsection{Voting Power Model}
282
+
283
+ The attestation mechanism uses a \emph{per-tier proportional representation} model rather than a simple one-token-one-vote system.
284
+
285
+ \textbf{Attestation units.} Each tier $i$ carries a maximum attestation power of:
286
+ \begin{equation}
287
+ V_{\max} = 10^9 \quad \text{(MAX\_ATTESTATION\_POWER\_TIER)}
288
+ \end{equation}
289
+
290
+ This maximum is shared among all holders of tier $i$. A holder's attestation weight for tier $i$ is:
291
+ \begin{equation}
292
+ \boxed{v_i^{\text{holder}} = V_{\max} \cdot \frac{n_i^{\text{holder}}}{n_i^{\text{total}}}}
293
+ \end{equation}
294
+
295
+ where $n_i^{\text{holder}}$ is the number of tier-$i$ tokens delegated to (or held by) the attestor, and $n_i^{\text{total}}$ is the total minted supply of tier $i$ at the attestation snapshot timestamp.
296
+
297
+ \textbf{Total attestation weight.} A holder's total attestation power across all tiers is:
298
+ \begin{equation}
299
+ v^{\text{holder}} = \sum_{i \,:\, n_i^{\text{holder}} > 0} V_{\max} \cdot \frac{n_i^{\text{holder}}}{n_i^{\text{total}}}
300
+ \end{equation}
301
+
302
+ \textbf{Checkpoint-based snapshots.} Attestation power is measured at a fixed historical timestamp (the scorecard's \texttt{attestationsBegin} time), using historical checkpoints. This prevents vote-buying attacks where an actor acquires tokens immediately before voting.
303
+
304
+ \textbf{Delegation.} During the mint phase only, holders may delegate their attestation units to a chosen delegate address per tier. Delegation is per-tier, snapshot-locked, and mint-phase-only.
305
+
306
+ \subsection{Quorum and Ratification Conditions}
307
+
308
+ \textbf{Quorum calculation.} The quorum required for scorecard ratification is:
309
+ \begin{equation}
310
+ \boxed{Q = \frac{N_{\text{minted\_tiers}}}{2} \cdot V_{\max}}
311
+ \end{equation}
312
+
313
+ where $N_{\text{minted\_tiers}}$ is the number of tiers that have at least one minted token.
314
+
315
+ \textbf{Example.} For a game with 4 tiers (all minted):
316
+ $$Q = \frac{4}{2} \cdot 10^9 = 2 \times 10^9$$
317
+
318
+ This requires the equivalent of 2 full tiers' worth of unanimous attestation---for instance, all holders of 2 tiers attesting, or 50\% of holders across all 4 tiers.
319
+
320
+ \textbf{Ratification conditions.} A scorecard can be ratified when all three conditions are met:
321
+ \begin{enumerate}[nosep]
322
+ \item The scorecard's grace period has expired,
323
+ \item The attestation count meets or exceeds quorum,
324
+ \item No other scorecard has been ratified for this game.
325
+ \end{enumerate}
326
+
327
+ \subsection{Scorecard Lifecycle}
328
+
329
+ Each submitted scorecard passes through five states:
330
+
331
+ \begin{table}[H]
332
+ \centering
333
+ \begin{tabular}{ll}
334
+ \toprule
335
+ \textbf{State} & \textbf{Condition} \\
336
+ \midrule
337
+ PENDING & \texttt{attestationsBegin} $>$ \texttt{block.timestamp} \\
338
+ ACTIVE & \texttt{attestationsBegin} $\leq$ \texttt{now} $\leq$ \texttt{gracePeriodEnds} \\
339
+ SUCCEEDED & Grace period expired AND attestations $\geq$ quorum \\
340
+ DEFEATED & A different scorecard was ratified \\
341
+ RATIFIED & This scorecard was ratified \\
342
+ \bottomrule
343
+ \end{tabular}
344
+ \caption{Scorecard lifecycle states.}
345
+ \end{table}
346
+
347
+ Multiple scorecards may coexist in ACTIVE or SUCCEEDED state simultaneously, but only one can ever be ratified. This creates a competitive dynamic where multiple proposed outcomes compete for attestation support.
348
+
349
+ \subsection{Resistance to Strategic Manipulation}
350
+
351
+ The attestation model incorporates several defenses:
352
+
353
+ \textbf{Defense 1: Per-tier cap.} No single tier's holders can contribute more than $V_{\max}$ attestation units, regardless of how many tokens they hold.
354
+
355
+ \textbf{Defense 2: Checkpoint snapshots.} Attestation power is computed at a fixed historical timestamp. Acquiring tokens after the snapshot provides zero additional voting power.
356
+
357
+ \textbf{Defense 3: Mint-phase-only delegation.} Delegation is locked after the mint phase, preventing last-minute delegation changes during the scoring phase.
358
+
359
+ \textbf{Defense 4: 50\% quorum across tiers.} Requiring half of all minted tiers' worth of attestation power means no coalition controlling fewer than half the minted tiers can unilaterally ratify a fraudulent scorecard.
360
+
361
+ \textbf{Remaining attack surface.} A coalition controlling sufficient attestation power across $\lceil N_{\text{minted}}/2 \rceil$ tiers can ratify an arbitrary scorecard. The critical insight is that attestation power within a tier is \emph{proportional to token holdings}, not absolute. An attacker holding 100\% of a tier's supply---even just 1 token---receives the full $V_{\text{max}} = 10^9$ attestation power for that tier.
362
+
363
+ \textbf{Worst-case attack cost (heavily minted tiers).} When all tiers are well-populated, the attacker must acquire majority holdings in at least $\lceil N/2 \rceil$ tiers:
364
+ \begin{equation}
365
+ C_{\text{attack}}^{\text{worst}} \geq \sum_{i \in \text{majority set}} \left\lceil \frac{n_i + 1}{2} \right\rceil \cdot p_i
366
+ \end{equation}
367
+
368
+ \textbf{Best-case attack cost (sparse tiers).} When some tiers have zero or minimal mints, the attacker can buy 1 token in each unminted tier, becoming the sole holder and receiving full attestation power:
369
+ \begin{equation}\label{eq:cheapattack}
370
+ C_{\text{attack}}^{\text{best}} = \sum_{i \in \text{cheapest } \lceil N/2 \rceil \text{ unminted}} p_i
371
+ \end{equation}
372
+
373
+ This is potentially orders of magnitude cheaper. In a 32-tier game at 0.01~ETH where 16 tiers have zero mints, the attacker spends $16 \times 0.01 = 0.16$~ETH to meet quorum---regardless of pot size. \textbf{This is the most significant governance vulnerability identified} and is discussed further in Section~9.2.
374
+
375
+ For the attack to be profitable, the attacker must redirect more than $C_{\text{attack}}$ in prize value:
376
+ \begin{equation}
377
+ B_{\text{prize}} > C_{\text{attack}} \cdot \frac{W_{\text{total}}}{\sum_{i \in \text{majority}} w_i^{\text{proposed}}}
378
+ \end{equation}
379
+
380
+ For the sparse-tier attack, this condition is almost always satisfied when the pot is nontrivial. Games with broad, uniform participation across all tiers are resistant; games with uneven participation are vulnerable.
381
+
382
+ %==========================================================================
383
+ \section{Price Dynamics and Value Flows}
384
+ %==========================================================================
385
+
386
+ \subsection{NFT Intrinsic Value During Minting}
387
+
388
+ During the mint phase, the intrinsic value of a tier-$i$ NFT depends on the holder's subjective probability assessment.
389
+
390
+ \textbf{Expected value at mint.} Let $\pi_i$ be a player's subjective probability that tier $i$ wins. The expected post-fee payout for one tier-$i$ NFT in a winner-take-all game is:
391
+ \begin{equation}
392
+ \mathbb{E}[V_i] = \pi_i \cdot \frac{B_{\text{prize}}}{n_i} + X_i^{\text{protocol}}
393
+ \end{equation}
394
+
395
+ A rational risk-neutral player mints tier $i$ when $\mathbb{E}[V_i] > p_i$, which requires:
396
+ \begin{equation}
397
+ \pi_i > \frac{p_i - X_i^{\text{protocol}}}{B_{\text{prize}} / n_i}
398
+ \end{equation}
399
+
400
+ This threshold probability decreases as the pot grows (more participants in other tiers create larger prizes) and increases as more tokens of tier $i$ are minted (diluting the per-token payout within the tier).
401
+
402
+ \subsection{Post-Scorecard Valuation}
403
+
404
+ After the scorecard is ratified and fees are extracted, each NFT has a deterministic value:
405
+ \begin{equation}
406
+ V_i^{\text{token}} = \frac{w_i}{\hat{n}_i \cdot W_{\text{total}}} \cdot (B_{\text{prize}} + A_{\text{redeemed}}) + V_i^{\text{protocol}}
407
+ \end{equation}
408
+
409
+ \textbf{Winning tier (full weight).} In a winner-take-all game with $w_j = W_{\text{total}}$:
410
+ $$V_j^{\text{token}} = \frac{B_{\text{prize}} + A_{\text{redeemed}}}{\hat{n}_j} + V_j^{\text{protocol}}$$
411
+
412
+ \textbf{Losing tier (zero weight).} When $w_i = 0$:
413
+ $$V_i^{\text{token}} = V_i^{\text{protocol}}$$
414
+
415
+ Losing-tier tokens have zero prize value but retain protocol-token value.
416
+
417
+ \subsection{Secondary Market Implications}
418
+
419
+ \textbf{Pre-ratification.} NFT value is driven by subjective outcome probabilities. Prices reflect the market's consensus probability-weighted expected payout, analogous to prediction-market shares.
420
+
421
+ \textbf{Post-ratification.} NFT value is deterministic and publicly computable. Any secondary-market price deviating from the redemption value creates an arbitrage:
422
+ \begin{itemize}[nosep]
423
+ \item If $P_{\text{market}} < V_i^{\text{token}}$: buy on the market, burn for profit.
424
+ \item If $P_{\text{market}} > V_i^{\text{token}}$: never occurs rationally (burn dominates holding).
425
+ \end{itemize}
426
+
427
+ Post-ratification secondary markets should converge immediately to redemption value, eliminating any residual price discovery.
428
+
429
+ %==========================================================================
430
+ \section{Rational Actor Analysis}
431
+ %==========================================================================
432
+
433
+ \subsection{Mint-Phase Strategy: Entry Timing}
434
+
435
+ In a fixed-price game, there is no direct price advantage to minting early vs.\ late within the mint phase. However, strategic considerations arise.
436
+
437
+ \textbf{Equilibrium.} In a Nash equilibrium of the minting game with risk-neutral players, each player mints the tier maximizing their expected payoff. Denoting by $\pi_i$ the true probability of tier $i$ winning and by $f_i = n_i \cdot p_i / B$ the fraction of the pot allocated to tier $i$:
438
+ \begin{equation}
439
+ \mathbb{E}[\text{return}_i] = \frac{\pi_i}{f_i} \cdot (1 - \phi) - 1
440
+ \end{equation}
441
+
442
+ where $\phi = 1/\phi_{\text{defifa}} + 1/\phi_{\text{base}} + \phi_{\text{custom}}$ is the total fee rate.
443
+
444
+ In equilibrium, expected returns equalize across tiers: $\mathbb{E}[\text{return}_i] = \mathbb{E}[\text{return}_j]$ for all $i,j$ with non-zero minting, which implies:
445
+ \begin{equation}
446
+ \frac{\pi_i}{f_i} = \frac{\pi_j}{f_j} \quad \Rightarrow \quad f_i = \pi_i
447
+ \end{equation}
448
+
449
+ \textbf{Result.} In equilibrium, the fraction of the pot in each tier equals the market's consensus probability of that tier winning. This is the classical parimutuel result: the pot allocation \emph{reveals} the collective probability assessment.
450
+
451
+ \subsection{Refund-Phase Strategy: Option Exercise}
452
+
453
+ The refund phase creates a \emph{free put option} on each minted NFT, struck at the mint price.
454
+
455
+ \textbf{Option value.} Let $V_i(t_{\text{refund\_end}})$ be the expected value of a tier-$i$ token at the end of the refund phase. The refund option has value:
456
+ \begin{equation}
457
+ O_i = \max\bigl(p_i - V_i(t_{\text{refund\_end}}),\; 0\bigr)
458
+ \end{equation}
459
+
460
+ A rational player exercises (refunds) when $V_i(t_{\text{refund\_end}}) < p_i$, which occurs when new information shifts the expected outcome against their chosen tier.
461
+
462
+ The refund phase serves three purposes:
463
+ \begin{enumerate}[nosep]
464
+ \item \textbf{Risk reduction}: allows players to participate speculatively with a guaranteed exit.
465
+ \item \textbf{Information revelation}: refund activity signals belief updates.
466
+ \item \textbf{Adverse selection mitigation}: partially solves the ``winner's curse'' problem.
467
+ \end{enumerate}
468
+
469
+ \subsection{Scoring-Phase Strategy: Attestation Delegation}
470
+
471
+ \textbf{Equilibrium.} In the unique subgame-perfect equilibrium of the attestation game (assuming common knowledge of the event outcome):
472
+ \begin{enumerate}[nosep]
473
+ \item All holders attest to the \emph{truthful} scorecard---the one reflecting the actual event outcome.
474
+ \item The truthful scorecard achieves quorum, as holders of winning tiers have the strongest incentive to attest.
475
+ \end{enumerate}
476
+
477
+ \subsection{Complete-Phase Strategy: Claim vs Hold}
478
+
479
+ \textbf{Dominant strategy.} For risk-neutral players with positive time preference, burning immediately weakly dominates holding. The claim value does not depreciate (the path-independent formula ensures later claimants receive the same amount), but the time value of money favors immediate realization. Holding is justified only by expected protocol-token appreciation exceeding the discount rate:
480
+ \begin{equation}
481
+ \frac{dP_D}{dt} \cdot \frac{p_i}{M} \cdot D_{\text{total}} > r \cdot V_i^{\text{token}}
482
+ \end{equation}
483
+
484
+ where $r$ is the player's discount rate.
485
+
486
+ %==========================================================================
487
+ \section{Solvency and Conservation Laws}
488
+ %==========================================================================
489
+
490
+ \subsection{The Conservation Guarantee}
491
+
492
+ \begin{theorem}[Prize Pool Conservation]
493
+ For any scorecard $\mathbf{w}$ with $\sum_i w_i = W_{\text{total}}$ and any sequence of redemptions, the total amount paid out to all NFT holders equals $B_{\text{prize}}$.
494
+ \end{theorem}
495
+
496
+ \begin{proof}
497
+ The total claim across all tokens is:
498
+ $$\sum_{i=1}^{N} n_i^{\text{eligible}} \cdot \frac{w_i}{\hat{n}_i \cdot W_{\text{total}}} \cdot (B_{\text{prize}} + A_{\text{redeemed}})$$
499
+
500
+ Since $n_i^{\text{eligible}} = \hat{n}_i$ at the start (before any complete-phase redemptions), and the term $(B_{\text{prize}} + A_{\text{redeemed}})$ is invariant, this equals:
501
+ $$\sum_{i=1}^{N} \frac{w_i}{W_{\text{total}}} \cdot B_{\text{prize}} = \frac{B_{\text{prize}}}{W_{\text{total}}} \sum_{i=1}^{N} w_i = B_{\text{prize}}$$
502
+ \end{proof}
503
+
504
+ This guarantees that the treasury is exactly drained after all eligible tokens are redeemed---there is no residual and no shortfall.
505
+
506
+ \subsection{Solvency Under Sequential Cash-Outs}
507
+
508
+ \begin{corollary}[Order Independence]
509
+ The payout to any individual NFT holder is independent of the order in which other holders redeem their tokens.
510
+ \end{corollary}
511
+
512
+ \begin{proof}
513
+ The per-token claim formula (Eq.~\ref{eq:cashout}) uses $(B_{\text{prize}} + A_{\text{redeemed}})$ as the reference pot, which is constant regardless of how many tokens have been redeemed. As each token is redeemed, both $n_i^{\text{burned}}$ and $d_i$ increment by 1, leaving $\hat{n}_i$ invariant. Therefore, each token receives the same payout regardless of when it is redeemed.
514
+ \end{proof}
515
+
516
+ \subsection{Fee Impact on Total Claimable Value}
517
+
518
+ The total value available to players (prize + protocol tokens) is:
519
+ \begin{equation}
520
+ V_{\text{total}} = B_{\text{prize}} + V_{\text{protocol}} = B_{\text{pot}} \cdot (1 - \phi) + V_{\text{protocol}}
521
+ \end{equation}
522
+
523
+ With default fees ($\phi = 10\%$):
524
+ $$V_{\text{total}} = 0.9 \cdot B_{\text{pot}} + V_{\text{protocol}}$$
525
+
526
+ Whether the net present value exceeds the mint cost depends on whether $V_{\text{protocol}} > 0.1 \cdot B_{\text{pot}}$---whether protocol token value compensates for the fee extraction.
527
+
528
+ %==========================================================================
529
+ \section{Game-Theoretic Properties}
530
+ %==========================================================================
531
+
532
+ \subsection{Defifa as a Parimutuel Mechanism}
533
+
534
+ Defifa implements a \emph{generalized parimutuel mechanism} with several distinctive features:
535
+
536
+ \begin{table}[H]
537
+ \centering
538
+ \begin{tabular}{lll}
539
+ \toprule
540
+ \textbf{Property} & \textbf{Traditional Parimutuel} & \textbf{Defifa} \\
541
+ \midrule
542
+ Outcome resolution & Centralized oracle & Decentralized attestation \\
543
+ Payout computation & House-computed odds & On-chain formula \\
544
+ Fee structure & Fixed takeout rate & Split-based, configurable \\
545
+ Asset type & Fungible bet tickets & Non-fungible ERC-721 \\
546
+ Secondary market & Typically none & Full ERC-721 transferability \\
547
+ Refund option & Typically none & Configurable refund phase \\
548
+ Token rewards & None & Protocol token distribution \\
549
+ \bottomrule
550
+ \end{tabular}
551
+ \caption{Comparison: Traditional parimutuel vs.\ Defifa.}
552
+ \end{table}
553
+
554
+ \textbf{Parimutuel equivalence.} Under uniform pricing ($p_i = p$), binary scorecard (one winner), and no refund phase, a Defifa game is equivalent to a classical parimutuel pool with odds:
555
+ \begin{equation}
556
+ \text{odds}_i = \frac{B_{\text{prize}}}{n_i \cdot p} = \frac{(1 - \phi) \cdot \sum_k n_k}{n_i}
557
+ \end{equation}
558
+
559
+ \subsection{Information Aggregation}
560
+
561
+ The minting and refund dynamics create a multi-round price-discovery mechanism:
562
+
563
+ \textbf{Round 1 (Mint phase).} Players reveal information through tier selection. Under equilibrium, the pot distribution converges to the collective probability distribution.
564
+
565
+ \textbf{Round 2 (Refund phase).} Players who received new information can exit, and the refund pattern reveals belief updates.
566
+
567
+ \textbf{Round 3 (Secondary market).} If NFTs trade on secondary markets during the scoring phase, prices reflect the most current probability assessments.
568
+
569
+ This three-round structure is informationally richer than single-shot betting mechanisms.
570
+
571
+ \subsection{Multi-Game Dynamics and Protocol Flywheel}
572
+
573
+ Defifa generates a \emph{protocol-level flywheel} through its fee-token mechanism:
574
+
575
+ \begin{enumerate}[nosep]
576
+ \item Game fees $\to$ minted to protocol projects as payments,
577
+ \item Protocol tokens are issued to the game hook,
578
+ \item Players claim protocol tokens upon burning NFTs,
579
+ \item Protocol token value reflects aggregate fee revenue across all games,
580
+ \item Higher token value $\to$ higher expected returns $\to$ more participation $\to$ more fees.
581
+ \end{enumerate}
582
+
583
+ \textbf{Flywheel dynamics.} Let $G$ be the number of active games, $\bar{B}$ the average pot size, and $\phi$ the fee rate. The aggregate fee revenue is:
584
+ \begin{equation}
585
+ R = G \cdot \bar{B} \cdot \phi
586
+ \end{equation}
587
+
588
+ The fraction of the pot recovered through protocol tokens is:
589
+ \begin{equation}
590
+ \frac{V_{\text{protocol}}^{\text{game}}}{\bar{B}} = \phi^2 \cdot \mu \cdot G
591
+ \end{equation}
592
+
593
+ where $\mu$ is the revenue multiple of protocol token valuation. This shows that the protocol-token recovery rate increases linearly with the number of games $G$, creating a positive network effect.
594
+
595
+ %==========================================================================
596
+ \section{Parameter Design Space}
597
+ %==========================================================================
598
+
599
+ \subsection{Tier Count and Price Calibration}
600
+
601
+ \textbf{Tier count.} The number of tiers $N$ affects quorum difficulty ($Q \propto N$), per-tier dilution, and attack cost. Optimal regime: $4 \leq N \leq 32$ balances governance tractability with outcome granularity.
602
+
603
+ \textbf{Price calibration.} Uniform pricing ($p_i = p$) creates clean parimutuel dynamics where pot fractions equal minting fractions. Non-uniform pricing allows odds-adjustment at design time. Recommended: uniform pricing between 0.01 and 1~ETH per NFT.
604
+
605
+ \subsection{Timing Parameters}
606
+
607
+ \textbf{Mint duration}: Should approximate time until event, capped at $\sim$30 days.
608
+
609
+ \textbf{Refund duration}: 1--7 days provides meaningful optionality without excessive uncertainty.
610
+
611
+ \textbf{Attestation start time}: 1--24 hours delay for preparation.
612
+
613
+ \textbf{Attestation grace period}: 1--7 days for broad participation.
614
+
615
+ \subsection{Fee Calibration and Protocol Sustainability}
616
+
617
+ The default fee structure is competitive with existing markets:
618
+
619
+ \begin{table}[H]
620
+ \centering
621
+ \begin{tabular}{ll}
622
+ \toprule
623
+ \textbf{Platform} & \textbf{Takeout Rate} \\
624
+ \midrule
625
+ Horse racing (parimutuel) & 15--25\% \\
626
+ Sports betting (vig) & 4--10\% \\
627
+ Prediction markets (fees) & 1--5\% \\
628
+ \textbf{Defifa (default)} & \textbf{10\%} \\
629
+ \bottomrule
630
+ \end{tabular}
631
+ \caption{Fee comparison across prediction platforms.}
632
+ \end{table}
633
+
634
+ The effective fee rate, accounting for protocol token rebates, is:
635
+ \begin{equation}
636
+ \phi_{\text{eff}} = \phi \cdot (1 - \alpha)
637
+ \end{equation}
638
+
639
+ where $\alpha$ is the fraction of fee value retained in protocol tokens. For $\alpha = 0.5$: $\phi_{\text{eff}} = 5\%$, competitive with low-fee prediction markets.
640
+
641
+ %==========================================================================
642
+ \section{Open Problems and Mechanism Design Recommendations}
643
+ %==========================================================================
644
+
645
+ The formal analysis in Sections~2--8 reveals several structural properties of the Defifa mechanism that merit attention. This section catalogs open problems discovered through systematic code review and game-theoretic analysis, ordered by severity, and proposes concrete protocol-level mitigations.
646
+
647
+ \subsection{Governance Deadlock and Fund Recovery: A Deep Study}
648
+
649
+ \textbf{Severity: Significant (design consideration).}
650
+
651
+ \subsubsection{Historical Context}
652
+
653
+ The original Defifa (Juicebox~V3 era) included \texttt{NO\_CONTEST} and \texttt{NO\_CONTEST\_INEVITABLE} phases. In~V3, each game phase had to be manually advanced by calling \texttt{queueNextPhaseOf()}. If nobody called this function before a funding cycle ``rolled over,'' the \texttt{\_noContestInevitable()} check detected the rollover and \texttt{\_queueNoContest()} reconfigured the project for permanent full-price refunds (\texttt{duration=0}, \texttt{cashOutTaxRate=0}, \texttt{pausePay=true}). The~V5 port pre-queues all rulesets at launch, eliminating the rollover risk---but also eliminating the sole trigger for no-contest. The dead code was removed as part of the~V5 cleanup (see AUDIT\_FINDINGS L-D5). This section formally analyzes whether a new form of no-contest should be reintroduced.
654
+
655
+ \subsubsection{Exhaustive Deadlock Scenario Analysis}
656
+
657
+ We identify five distinct scenarios in which game funds could become permanently inaccessible:
658
+
659
+ \textbf{Scenario~A: No scorecard submitted.} The game reaches SCORING. Nobody calls \texttt{submitScorecardFor()}. All tier cash-out weights remain zero. The hook returns \texttt{cashOutCount = 0} and \texttt{afterCashOutRecordedWith} reverts with \texttt{NOTHING\_TO\_CLAIM}. Funds remain in the treasury indefinitely.
660
+
661
+ \textbf{Scenario~B: Quorum unreachable.} A scorecard exists but attestation power is fragmented. No single scorecard accumulates 50\% of eligible attestation weight. The governor's \texttt{stateOf()} returns ACTIVE indefinitely---there is no expiry on attestation.
662
+
663
+ \textbf{Scenario~C: Dead attestation delegate.} The \texttt{defaultAttestationDelegate} is set to an inaccessible address. Since delegation can only be changed during MINT, the accumulated attestation power is irrecoverably locked after MINT ends.
664
+
665
+ \textbf{Scenario~D: Attestation power in dead addresses.} If $>50\%$ of game pieces are transferred to contracts that cannot call \texttt{attestToScorecardFrom()}, exercisable attestation power drops below quorum permanently.
666
+
667
+ \textbf{Scenario~E: Split target reverts on ratification.} \texttt{ratifyScorecardFrom()} calls \texttt{fulfillCommitmentsOf()}, which calls \texttt{sendPayoutsOf()}. If a split target reverts, the entire ratification transaction fails despite a governance-approved scorecard.
668
+
669
+ \begin{table}[h]
670
+ \centering
671
+ \begin{tabular}{lccc}
672
+ \toprule
673
+ Scenario & Funds stuck? & Delegate resolves? & Automated? \\
674
+ \midrule
675
+ A: No scorecard & Yes & Yes, if active & No \\
676
+ B: Quorum unreachable & Yes & Yes, if has power & No \\
677
+ C: Dead delegate & Yes & No & No \\
678
+ D: Dead attestation holders & Yes & No & No \\
679
+ E: Split target reverts & Yes & No & No \\
680
+ \bottomrule
681
+ \end{tabular}
682
+ \end{table}
683
+
684
+ \subsubsection{Effectiveness of the Default Attestation Delegate}
685
+
686
+ When set, the \texttt{defaultAttestationDelegate} receives attestation units from every minter who does not specify a custom delegate. If no minter re-delegates, the delegate holds 100\% of attestation power---easily exceeding quorum. It resolves Scenarios~A and~B in the common case.
687
+
688
+ However, it provides no hard guarantee because it depends on four assumptions: (1)~the delegate is set (\texttt{address(0)} is valid), (2)~the delegate remains operational, (3)~the delegate acts honestly (it could self-ratify a malicious scorecard), and (4)~minters do not re-delegate. The delegate is an excellent first line of defense---a trusted, social mechanism---but not a trustless, automated one.
689
+
690
+ \subsubsection{Candidate Mechanism~A: Minimum Participation Threshold}
691
+
692
+ At game initialization, the organizer sets \texttt{minParticipation}---a minimum treasury balance required to proceed to SCORING. If the balance is below this threshold, the game enters a no-contest state where cash-outs return mint prices. Implementation: one new \texttt{uint256} in the ops data; \texttt{currentGamePhaseOf()} checks the balance before returning SCORING.
693
+
694
+ \emph{What it solves:} Ghost games with negligible participation skip directly to refundability. \emph{What it does not solve:} Post-threshold governance deadlocks (Scenarios~B--E). \emph{Attack surface:} A majority holder can refund enough tokens to push the balance below threshold, unilaterally killing the game. \emph{Mitigation:} Set the threshold conservatively low (${\sim}10\%$ of expected pot).
695
+
696
+ \subsubsection{Candidate Mechanism~B: Scorecard Ratification Timeout}
697
+
698
+ At game initialization, the organizer sets \texttt{scorecardTimeout}---a duration after SCORING begins. If no scorecard is ratified within this window, the game enters a no-contest state. Implementation: one new \texttt{uint256}; \texttt{currentGamePhaseOf()} checks \texttt{block.timestamp > scoringStart + timeout}.
699
+
700
+ \emph{What it solves:} All five deadlock scenarios (A--E). This is the only mechanism providing a hard, trustless, time-bounded guarantee. \emph{Interaction with the governor:} Partially-attested scorecards expire gracefully. The critical edge case is a SUCCEEDED scorecard that hasn't been ratified when the timeout fires---mitigated by generous timeouts (90--180~days) or a short ``ratification grace period.'' \emph{Attack surface:} Minimal---an adversary cannot accelerate the timeout.
701
+
702
+ \subsubsection{Do We Need a Formal State?}
703
+
704
+ Both mechanisms can be implemented as \emph{computed states} in \texttt{currentGamePhaseOf()}---no on-chain state transition required. The SCORING ruleset already has \texttt{cashOutTaxRate = 0} and \texttt{pausePay = true}, which are the correct parameters for refunds. Adding a named enum value provides clearer UI/indexer signaling, but the behavior itself requires no new handler logic beyond the existing MINT/REFUND refund path.
705
+
706
+ \subsubsection{Assessment and Recommendation}
707
+
708
+ The \texttt{defaultAttestationDelegate} resolves the vast majority of practical deadlocks and is sufficient for games with trusted organizers. However, for permissionless, trustless game creation, a hard guarantee is essential. We recommend:
709
+
710
+ \begin{enumerate}[nosep]
711
+ \item \textbf{Scorecard ratification timeout} as the primary safety mechanism. Covers all five deadlock scenarios. Implementation cost: one \texttt{uint256}, one timestamp comparison. Recommended default: 90~days.
712
+ \item \textbf{Minimum participation threshold} as an optional complement. Provides early termination for non-viable games. Implementation cost: one \texttt{uint256}, one balance check.
713
+ \item Both mechanisms should be \textbf{optional} (default: 0 = disabled) to preserve backward compatibility.
714
+ \item The game should \textbf{remain fully playable without either mechanism}---they are safety nets, not requirements.
715
+ \end{enumerate}
716
+
717
+ The combination of delegate (fast-path social resolution) + timeout (hard backstop) + threshold (early exit) provides defense in depth where each mechanism covers the failure modes of the others.
718
+
719
+ \subsection{Cheap Cross-Tier Attestation Capture}
720
+
721
+ \textbf{Severity: Critical.}
722
+
723
+ As identified in the corrected attack cost analysis (Equation~\ref{eq:cheapattack}), the per-tier attestation power cap creates an unintended vulnerability in games with uneven participation. The mechanism assigns equal maximum attestation power ($V_{\text{max}} = 10^9$) to every tier \emph{regardless of minted supply}. A tier with 1~token has the same governance weight as a tier with 10,000 tokens.
724
+
725
+ \textbf{The attack.} An adversary identifies $\lceil N/2 \rceil$ tiers with zero or minimal mints. They purchase 1 token in each, becoming the sole holder and receiving full $V_{\text{max}}$ per tier. Their total attestation power: $A_{\text{attacker}} = \lceil N/2 \rceil \cdot V_{\text{max}} \geq Q$. They meet quorum unilaterally and ratify a scorecard directing $W_{\text{total}}$ to their tokens.
726
+
727
+ \textbf{Numerical example.} A 32-tier game at 0.01~ETH. Popular tiers accumulate 1,000 tokens each; 16 tiers receive no organic mints. The attacker buys 1 token in each empty tier for 0.16~ETH total and ratifies a scorecard directing ${\sim}144$~ETH to one of their tiers. \textbf{Return on investment: ${\sim}900\times$.}
728
+
729
+ \textbf{Root cause.} The quorum function counts \emph{any tier with nonzero supply} as eligible, conflating ``meaningful community participation'' with ``a tier a single actor created a position in.''
730
+
731
+ \textbf{Recommended fix.} Introduce a minimum supply threshold for quorum eligibility:
732
+ \begin{equation}
733
+ Q = \frac{1}{2} \sum_{i=1}^{N} \mathbf{1}\!\left[n_i \geq n_{\text{min}}\right] \cdot V_{\text{max}}
734
+ \end{equation}
735
+ where $n_{\text{min}} \geq 2$. Alternatively, weight each tier's attestation power by a concave function of supply, such as $\min(V_{\text{max}}, \sqrt{n_i} \cdot V_{\text{max}} / \sqrt{n_{\text{ref}}})$.
736
+
737
+ \subsection{Prize Pool Under-Allocation}
738
+
739
+ \textbf{Severity: Significant.}
740
+
741
+ The weight validation in \texttt{setTierCashOutWeightsTo} uses a strict greater-than check: \texttt{if (\_cumulativeCashOutWeight > TOTAL\_CASHOUT\_WEIGHT) revert}. A scorecard with weights summing to \emph{less than} $W_{\text{total}}$ passes validation. The residual $B_{\text{prize}} \cdot (1 - \sum_i w_i / W_{\text{total}})$ remains permanently trapped in the treasury, breaking the conservation guarantee of Theorem~6.1 (which assumes $\sum_i w_i = W_{\text{total}}$).
742
+
743
+ \textbf{Recommended fix.} Change to exact equality: \texttt{if (\_cumulativeCashOutWeight != TOTAL\_CASHOUT\_WEIGHT) revert}.
744
+
745
+ \subsection{Attestation Timing Misconfiguration}
746
+
747
+ \textbf{Severity: Significant.}
748
+
749
+ Both \texttt{attestationsBegin} and \texttt{gracePeriodEnds} are computed relative to \texttt{block.timestamp} at submission time---not relative to each other. If $\tau_{\text{grace}} < \tau_{\text{attest\_start}}$, the grace period expires \emph{before attestations begin}, creating a zero-length effective attestation window. Additionally, \texttt{initializeGame} performs no validation on the relationship between these parameters.
750
+
751
+ \textbf{Recommended fix.} Compute \texttt{gracePeriodEnds} relative to \texttt{attestationsBegin}: $t_{\text{grace\_end}} = t_{\text{attest\_begin}} + \tau_{\text{grace}}$, or validate in \texttt{initializeGame} that $\tau_{\text{grace}} \geq \tau_{\text{attest\_start}}$.
752
+
753
+ \subsection{Pre-Scoring Scorecard Submission}
754
+
755
+ \textbf{Severity: Moderate.}
756
+
757
+ The \texttt{submitScorecardFor} function contains no game-phase check. Scorecards can be submitted and accumulate attestations during the MINT phase---before the underlying event has occurred. While \texttt{setTierCashOutWeightsTo} enforces SCORING for weight application, pre-accumulated attestations let a coordinated group achieve SUCCEEDED state before scoring opens, then ratify instantly.
758
+
759
+ \textbf{Recommended fix.} Add a phase check requiring SCORING phase for scorecard submission.
760
+
761
+ \subsection{Fee Extraction Fragility}
762
+
763
+ \textbf{Severity: Moderate.}
764
+
765
+ In \texttt{fulfillCommitmentsOf}, the function calls \texttt{sendPayoutsOf} with \texttt{minTokensPaidOut} set to the full treasury balance. The split structure returns ${\sim}90\%$ back via \texttt{addToBalanceOf}. If the terminal interprets \texttt{minTokensPaidOut} as the minimum that permanently leaves the project, this transaction reverts---permanently blocking fee extraction and game completion.
766
+
767
+ \textbf{Recommended fix.} Set \texttt{minTokensPaidOut} to~0 or to the expected fee amount.
768
+
769
+ %==========================================================================
770
+ \section{Conclusions and Practical Implications}
771
+ %==========================================================================
772
+
773
+ This paper has formalized the cryptoeconomic mechanisms of Defifa: a prediction-game protocol that transforms NFT minting into a parimutuel wagering mechanism with governance-ratified outcomes.
774
+
775
+ \textbf{Prize Distribution Mechanics.} Defifa implements a path-independent, weight-proportional prize distribution through Equation~\ref{eq:cashout}. Using $(B_{\text{prize}} + A_{\text{redeemed}})$ as the reference pot ensures every token holder receives the same payout regardless of redemption order. Theorem~6.1 proves total payouts exactly exhaust the prize pool (provided $\sum_i w_i = W_{\text{total}}$; see Section~9.3).
776
+
777
+ \textbf{Governance Security.} The attestation model (Section~3) achieves a balance between decentralization and efficiency. The per-tier cap on attestation power ($V_{\text{max}} = 10^9$) prevents any single tier from dominating governance, while the 50\% quorum across minted tiers ensures broad participation. However, Section~9 identifies a critical governance vulnerability: cheap cross-tier attestation capture (9.2), where an attacker buying 1~token in each of $N/2$ unpopular tiers can unilaterally meet quorum. The corrected attack cost (Eq.~\ref{eq:cheapattack}) shows that governance security depends not just on tier count and prices, but critically on participation uniformity across tiers. The deep study in Section~9.1 identifies five distinct deadlock scenarios and evaluates two candidate safety mechanisms (participation thresholds and ratification timeouts), concluding that both are valuable optional additions but that the existing system remains fully playable without them when games have active organizers and trusted delegates.
778
+
779
+ \textbf{Market Efficiency.} The equilibrium analysis demonstrates convergence to the classical parimutuel result: pot fractions equal consensus probabilities. The three-round information structure (mint $\to$ refund $\to$ secondary) provides richer information aggregation than single-shot mechanisms.
780
+
781
+ \textbf{Protocol Sustainability.} The fee-token flywheel creates positive network effects where more games increase protocol token value, which reduces effective fee rates, which attracts more players.
782
+
783
+ \textbf{Practical Recommendations.}
784
+ \begin{enumerate}[nosep]
785
+ \item \textbf{Tier count}: 4--32 tiers for governance security and outcome expressiveness.
786
+ \item \textbf{Pricing}: Uniform pricing between 0.01--1 ETH for clean parimutuel dynamics.
787
+ \item \textbf{Refund phase}: 1--7 days for meaningful optionality.
788
+ \item \textbf{Attestation}: Trusted default delegate; 24-hour start delay; 3-day grace period. Ensure $\tau_{\text{grace}} \geq \tau_{\text{attest\_start}}$ (Section~9.4).
789
+ \item \textbf{Fees}: Default 10\% split is competitive; organizer splits should not exceed 5\%.
790
+ \item \textbf{Participation}: Ensure all tiers attract meaningful participation to resist cheap governance capture (Section~9.2). Consider minimum-supply quorum thresholds.
791
+ \item \textbf{Deadlock protection}: For permissionless games, set a scorecard ratification timeout (90--180~days recommended) and optionally a minimum participation threshold. For trusted-organizer games, the \texttt{defaultAttestationDelegate} is sufficient (Section~9.1).
792
+ \end{enumerate}
793
+
794
+ \textbf{Synthesis.} Defifa implements a rigorous approach to prediction gaming through the composition of three well-understood mechanisms: parimutuel pooling for price formation, attestation governance for outcome resolution, and Juicebox V5 for treasury management. The mathematical analysis confirms that the system conserves value and converges to informationally efficient equilibria. The protocol token layer adds a novel incentive dimension that aligns participant, organizer, and protocol interests around game volume growth.
795
+
796
+ The open problems identified in Section~9---particularly the cheap cross-tier attestation capture (9.2) and prize pool under-allocation (9.3)---represent the most important areas for protocol hardening before production deployment at scale. The recommended mitigations (minimum-supply quorum thresholds, exact weight validation) are backwards-compatible and address the identified vulnerabilities without altering the core mechanism design. The deep study of governance deadlock (9.1) confirms that the existing architecture is sound---the \texttt{defaultAttestationDelegate} resolves the majority of practical deadlocks---but that optional safety mechanisms (ratification timeout, participation threshold) provide valuable defense in depth for permissionless deployment without adding mandatory complexity.
797
+
798
+ The elegance of Defifa resides in its architectural composability: prediction games with arbitrary outcomes, arbitrary tier structures, and arbitrary payout distributions emerge from the same set of parameters, executed deterministically by immutable smart contracts with a single, time-bounded governance input. The game remains fully playable and efficient without additional states---the proposed safety mechanisms are optional parameters that expand the design space for risk-averse game creators while preserving the protocol's minimalist architecture for those who prefer it.
799
+
800
+ \end{document}