@ballkidz/defifa 0.0.12 → 0.0.13

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 (37) hide show
  1. package/CHANGE_LOG.md +60 -5
  2. package/CRYPTO_ECON.md +505 -270
  3. package/CRYPTO_ECON.pdf +0 -0
  4. package/CRYPTO_ECON.tex +438 -241
  5. package/RISKS.md +9 -1
  6. package/SKILLS.md +3 -2
  7. package/package.json +6 -6
  8. package/src/DefifaDeployer.sol +128 -130
  9. package/src/DefifaGovernor.sol +278 -83
  10. package/src/DefifaHook.sol +158 -171
  11. package/src/enums/DefifaScorecardState.sol +1 -0
  12. package/src/interfaces/IDefifaGovernor.sol +41 -2
  13. package/src/libraries/DefifaHookLib.sol +69 -62
  14. package/src/structs/DefifaAttestations.sol +3 -3
  15. package/src/structs/DefifaLaunchProjectData.sol +1 -0
  16. package/src/structs/DefifaScorecard.sol +2 -0
  17. package/test/BWAFunctionComparison.t.sol +1320 -0
  18. package/test/DefifaAdversarialQuorum.t.sol +52 -37
  19. package/test/DefifaAuditLowGuards.t.sol +9 -5
  20. package/test/DefifaFeeAccounting.t.sol +2 -1
  21. package/test/DefifaGovernanceHardening.t.sol +1311 -0
  22. package/test/DefifaGovernor.t.sol +4 -2
  23. package/test/DefifaHookRegressions.t.sol +2 -1
  24. package/test/DefifaMintCostInvariant.t.sol +2 -1
  25. package/test/DefifaNoContest.t.sol +3 -2
  26. package/test/DefifaSecurity.t.sol +54 -41
  27. package/test/DefifaUSDC.t.sol +3 -2
  28. package/test/Fork.t.sol +11 -12
  29. package/test/TestAuditGaps.sol +6 -4
  30. package/test/TestQALastMile.t.sol +4 -2
  31. package/test/audit/{CodexAttestationDoubleCount.t.sol → AttestationDoubleCount.t.sol} +3 -2
  32. package/test/audit/FixPendingReserveDilution.t.sol +366 -0
  33. package/test/audit/PendingReserveDilution.t.sol +298 -0
  34. package/test/audit/PendingReserveQuorumGrief.t.sol +355 -0
  35. package/test/regression/AttestationDelegateBeneficiary.t.sol +2 -1
  36. package/test/regression/FulfillmentBlocksRatification.t.sol +2 -1
  37. package/test/regression/GracePeriodBypass.t.sol +2 -1
package/CRYPTO_ECON.tex CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  \title{\textbf{Cryptoeconomics of Defifa}}
30
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\\
31
+ \small This analysis was generated by Claude Opus 4.6 based on its study of the Defifa V6 codebase\\
32
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
33
  \date{March 2026}
34
34
 
@@ -37,7 +37,9 @@
37
37
  \maketitle
38
38
 
39
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.
40
+ Defifa is a prediction-game protocol built on Juicebox V6 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
+
42
+ Throughout, we illustrate the mechanics with a running example: a \textbf{FIFA World Cup game with 32 tiers}---one per national team---priced at 0.01~ETH each.
41
43
  \end{abstract}
42
44
 
43
45
  \tableofcontents
@@ -49,9 +51,11 @@ Defifa is a prediction-game protocol built on Juicebox V5 that transforms NFT mi
49
51
 
50
52
  \subsection{What is Defifa?}
51
53
 
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.
54
+ 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 V6 protocol and governed by a combination of immutable smart-contract rules and a minimal, time-bounded governance process for outcome resolution.
55
+
56
+ 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 is uniform across all tiers---enforced at the protocol level---and the payout is determined by post-event scorecard ratification.
53
57
 
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.
58
+ \textbf{Running example: World Cup 2026.} Imagine a Defifa game for the FIFA World Cup with 32 tiers---one for each national team---priced at 0.01~ETH each. Argentina is Tier~1, France is Tier~2, Brazil is Tier~3, \ldots, and Saudi Arabia is Tier~32. Anyone can mint NFTs for the team they believe will win (or perform well), and after the tournament, a scorecard assigns weights reflecting the actual results.
55
59
 
56
60
  Defifa games are:
57
61
  \begin{itemize}[nosep]
@@ -64,25 +68,31 @@ Defifa games are:
64
68
  \subsection{How a Defifa Game Works (at a glance)}
65
69
 
66
70
  \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.
71
+ \item \textbf{Mint (pot formation).} During the mint phase, anyone can purchase NFTs representing tiers at the game's uniform price. All payments flow into a shared treasury---the \emph{pot}. Players may delegate their attestation power to a chosen delegate at mint time.
68
72
 
69
73
  \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
74
 
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.
75
+ \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. Scorecard submission is restricted to the SCORING phase---no pre-scoring submissions are allowed.
76
+
77
+ \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 \$NANA).
72
78
 
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).
79
+ \item \textbf{No contest (safety fallback).} If the game fails to attract sufficient participation or the scorecard is not ratified within the configured timeout, the game enters a NO\_CONTEST state where all players can reclaim their original mint prices.
74
80
  \end{enumerate}
75
81
 
82
+ \textbf{World Cup example.} The World Cup game mints for 30 days before the tournament. Fans buy Argentina NFTs, France NFTs, etc. After the final, someone submits a scorecard: the champion's tier gets 40\% of the weight, the runner-up gets 20\%, semifinalists get 10\% each, and quarterfinalists share the remaining 20\%. Holders attest, the scorecard is ratified, fees are extracted, and holders of the champion's NFTs receive their proportional share of a now-concentrated prize pool.
83
+
76
84
  \subsection{The Design Parameters}
77
85
 
78
86
  A Defifa game is fully specified at deployment by a parameter tuple:
79
87
  \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)
88
+ \mathcal{G} = \left( \{T_i\}_{i=1}^{N}, \; p, \; t_{\text{mint}}, \; t_{\text{refund}}, \; t_{\text{start}}, \; \phi_{\text{defifa}}, \; \phi_{\text{base}}, \; \mathcal{S}, \; \tau_{\text{attest}}, \; \tau_{\text{grace}}, \; m_{\text{min}}, \; \tau_{\text{timeout}} \right)
81
89
  \end{equation}
82
90
 
83
91
  Where:
84
92
  \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).
93
+ \item \textbf{Tier configuration} $\{T_i\}_{i=1}^{N}$: For each of the $N$ tiers (maximum~128), an optional reserved rate $\rho_i$, a reserved-token beneficiary address, a name, and an optional IPFS URI. The initial supply per tier is set to $999{,}999{,}999$ (effectively unlimited).
94
+
95
+ \item \textbf{Uniform tier price} ($p$): A single fixed price applied to all tiers, denominated in the game's base asset. Uniform pricing is enforced at the protocol level via the \texttt{tierPrice} parameter, ensuring that price-based voting power is equal across tiers.
86
96
 
87
97
  \item \textbf{Mint period duration} ($t_{\text{mint}}$): How long the minting window stays open, in seconds.
88
98
 
@@ -92,16 +102,20 @@ Where:
92
102
 
93
103
  \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
104
 
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\%).
105
+ \item \textbf{Base protocol fee divisor} ($\phi_{\text{base}}$): The fraction $1/\phi_{\text{base}}$ of the pot sent to the base protocol (NANA) project. Default: $\phi_{\text{base}} = 40$ (2.5\%).
96
106
 
97
107
  \item \textbf{Splits} ($\mathcal{S}$): Additional payout splits configured at deployment (e.g., for game organizers, charities).
98
108
 
99
- \item \textbf{Attestation start time} ($\tau_{\text{attest}}$): Delay before attestation voting opens on a submitted scorecard.
109
+ \item \textbf{Attestation start time} ($\tau_{\text{attest}}$): The earliest time at which attestation voting opens on submitted scorecards.
110
+
111
+ \item \textbf{Attestation grace period} ($\tau_{\text{grace}}$): Minimum duration attestations must remain open after $\tau_{\text{attest}}$. Protocol-enforced minimum: 1~day.
100
112
 
101
- \item \textbf{Attestation grace period} ($\tau_{\text{grace}}$): Duration of the attestation voting window.
113
+ \item \textbf{Minimum participation} ($m_{\text{min}}$): The minimum treasury balance required for the game to proceed to scoring. If the balance is below this threshold when SCORING would begin, the game enters NO\_CONTEST. Set to~0 to disable.
114
+
115
+ \item \textbf{Scorecard timeout} ($\tau_{\text{timeout}}$): The maximum time (in seconds) after the scoring phase begins for a scorecard to be ratified. If exceeded without ratification, the game enters NO\_CONTEST. Set to~0 to disable.
102
116
  \end{enumerate}
103
117
 
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.
118
+ 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 or the timeout elapses.
105
119
 
106
120
  %==========================================================================
107
121
  \section{Mathematical Model of Defifa Economics}
@@ -111,7 +125,7 @@ Once set, the tuple $\mathcal{G}$ is immutable. Phase transitions occur automati
111
125
 
112
126
  The economic behavior of a Defifa game is determined jointly by:
113
127
  \begin{enumerate}[nosep]
114
- \item The immutable game parameters $\mathcal{G}$ (cf.\ Section 1.3), fixed at deployment;
128
+ \item The immutable game parameters $\mathcal{G}$ (cf.\ Section~1.3), fixed at deployment;
115
129
  \item The evolving state variables, which track the pot, token supplies, and claim status over time.
116
130
  \end{enumerate}
117
131
 
@@ -126,7 +140,7 @@ The economic behavior of a Defifa game is determined jointly by:
126
140
  $B(t)$ & Pot (treasury balance) at time $t$ \\
127
141
  $n_i(t)$ & Number of NFTs minted in tier $i$ at time $t$ \\
128
142
  $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$ \\
143
+ $M(t)$ & Total mint cost accumulated: $N_{\text{total}}(t) \cdot p$ \\
130
144
  $w_i$ & Scorecard weight assigned to tier $i$ ($\sum_i w_i = W_{\text{total}}$) \\
131
145
  $d_i(t)$ & Tokens redeemed from tier $i$ after ratification \\
132
146
  $B_{\text{prize}}$ & Net prize pool after fee extraction \\
@@ -136,34 +150,32 @@ $B_{\text{prize}}$ & Net prize pool after fee extraction \\
136
150
  \label{tab:state}
137
151
  \end{table}
138
152
 
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.
153
+ Note that because all tiers share a uniform price $p$, the total mint cost simplifies to $M(t) = N_{\text{total}}(t) \cdot p$ and the pot composition is $B(t) = M(t)$. This uniformity is a deliberate design choice that ensures fair parimutuel dynamics---the pot fraction in each tier reflects only the \emph{count} of mints, not differential pricing.
142
154
 
143
155
  \subsection{Minting --- Pot Formation}
144
156
 
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.
157
+ 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 uniform price $p$ per token.
146
158
 
147
159
  \textbf{Minted quantity.} For a payment amount $x$ of base asset directed at tier $i$:
148
160
  \begin{equation}
149
- q_i = \left\lfloor \frac{x}{p_i} \right\rfloor
161
+ q_i = \left\lfloor \frac{x}{p} \right\rfloor
150
162
  \end{equation}
151
163
 
152
164
  \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
165
 
154
166
  \textbf{State updates.} At the instant of a mint event where player $j$ purchases $q$ tokens of tier $i$:
155
167
  \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}
168
+ B(t^+) &= B(t^-) + q \cdot p \\
169
+ n_i(t^+) &= n_i(t^-) + q \\
170
+ M(t^+) &= M(t^-) + q \cdot p
159
171
  \end{align}
160
172
 
161
173
  \textbf{Pot composition.} At the end of the mint phase, the pot is:
162
174
  \begin{equation}
163
- B_{\text{mint}} = \sum_{i=1}^{N} n_i \cdot p_i
175
+ B_{\text{mint}} = \sum_{i=1}^{N} n_i \cdot p = N_{\text{total}} \cdot p
164
176
  \end{equation}
165
177
 
166
- This is the total capital at risk in the game, and represents the complete prize pool before fee extraction.
178
+ \textbf{World Cup example.} Suppose the game attracts 15,000 total mints across 32 tiers. Argentina: 2,000 (13.3\%), France: 1,800 (12.0\%), Brazil: 1,500 (10.0\%), \ldots, Saudi Arabia: 10 (0.07\%). Total pot: $15{,}000 \times 0.01 = 150$~ETH. The pot fractions reveal the crowd's consensus probabilities.
167
179
 
168
180
  \subsection{Refund --- Optionality Window}
169
181
 
@@ -173,21 +185,14 @@ If $t_{\text{refund}} > 0$, a refund phase follows minting. During $[t_{\text{mi
173
185
  \item Any NFT holder may burn their token to reclaim its mint price.
174
186
  \end{itemize}
175
187
 
176
- \textbf{Refund mechanics.} A player burning $q$ tokens of tier $i$ receives exactly $q \cdot p_i$ base asset from the treasury:
188
+ \textbf{Refund mechanics.} A player burning $q$ tokens of tier $i$ receives exactly $q \cdot p$ base asset from the treasury:
177
189
  \begin{equation}
178
- R_{\text{refund}} = q \cdot p_i
190
+ R_{\text{refund}} = q \cdot p
179
191
  \end{equation}
180
192
 
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}
193
+ Because all tiers share the uniform price $p$, the per-NFT backing ratio $B(t) / N_{\text{total}}(t) = p$ is always preserved.
187
194
 
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.
195
+ \textbf{World Cup example.} Two days before the tournament, a star player for Brazil suffers an injury. 300 Brazil holders refund their NFTs, reducing the pot from 150~ETH to 147~ETH. The refund activity signals the belief shift---other participants observe the on-chain volume and update their expectations.
191
196
 
192
197
  \subsection{Prize Distribution --- The Scorecard Formula}
193
198
 
@@ -198,19 +203,19 @@ After the real-world event concludes and a scorecard is ratified, the game enter
198
203
  \sum_{i=1}^{N} w_i = W_{\text{total}} = 10^{18}
199
204
  \end{equation}
200
205
 
201
- Each $w_i \in [0, W_{\text{total}}]$ represents the fraction of the prize pool allocated to tier $i$'s holders.
206
+ The exact-sum constraint is enforced on-chain---the \texttt{validateAndBuildWeights} function in \texttt{DefifaHookLib} reverts if the cumulative weight does not equal \texttt{TOTAL\_CASHOUT\_WEIGHT} exactly.
202
207
 
203
208
  \textbf{Per-token weight.} The weight assigned to a single NFT in tier $i$ is:
204
209
  \begin{equation}
205
210
  w_i^{\text{token}} = \frac{w_i}{\hat{n}_i}
206
211
  \end{equation}
207
212
 
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:
213
+ where $\hat{n}_i$ is the \emph{effective} number of tokens eligible for redemption in tier $i$:
209
214
  \begin{equation}
210
- \hat{n}_i = n_i^{\text{minted}} - n_i^{\text{remaining}} - (n_i^{\text{burned}} - d_i)
215
+ \hat{n}_i = n_i^{\text{minted}} - n_i^{\text{remaining}} - (n_i^{\text{burned}} - d_i) + n_i^{\text{pendingReserves}}
211
216
  \end{equation}
212
217
 
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.
218
+ Including pending reserves in the denominator prevents paid holders from front-running reserve mints to extract disproportionate value.
214
219
 
215
220
  \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
221
  \begin{equation}
@@ -222,43 +227,42 @@ where $i(k_j)$ is the tier of token $k_j$, $B_{\text{prize}}$ is the current tre
222
227
 
223
228
  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
229
 
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}
230
+ \textbf{World Cup example.} Argentina wins; scorecard assigns 40\% to Argentina ($w_1 = 4 \times 10^{17}$). Post-fee pot: $147 \times 0.925 = 135.975$~ETH. An Argentina holder with 1~NFT receives: $\frac{4 \times 10^{17} / 2{,}000}{10^{18}} \times 135.975 \approx 0.0272$~ETH---a 2.72x return on their 0.01~ETH mint.
231
231
 
232
232
  \subsection{Fee Extraction Pipeline}
233
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.
234
+ Before prize distribution begins, the Deployer contract extracts protocol fees by calling \texttt{fulfill\-Commitments\-Of}. This function computes the fee amount and sends only the fee portion as payouts via \texttt{send\-Payouts\-Of}, while the remaining balance stays in the treasury as surplus for player cash-outs.
235
235
 
236
- \textbf{Split structure.} The splits configured at game launch allocate the pot as follows:
236
+ \textbf{Split structure.} The splits configured at game launch allocate fees as follows:
237
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\%)
238
+ \item \textbf{Defifa fee:} $1/\phi_{\text{defifa}}$ of the pot to the Defifa project (default: $\phi_{\text{defifa}} = 20$, i.e., 5\%)
239
+ \item \textbf{Base protocol fee:} $1/\phi_{\text{base}}$ of the pot to the base protocol (NANA) project (default: $\phi_{\text{base}} = 40$, i.e., 2.5\%)
240
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}
241
+ \item \textbf{Remainder:} Stays in the game's treasury as surplus for player cash-outs
242
242
  \end{enumerate}
243
243
 
244
244
  \textbf{Fee formulas.} Let $B_{\text{pot}}$ be the treasury balance at commitment fulfillment:
245
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]
246
+ F_{\text{defifa}} &= \frac{B_{\text{pot}}}{\phi_{\text{defifa}}} = \frac{B_{\text{pot}}}{20} = 0.05 \cdot B_{\text{pot}} \\[4pt]
247
+ F_{\text{base}} &= \frac{B_{\text{pot}}}{\phi_{\text{base}}} = \frac{B_{\text{pot}}}{40} = 0.025 \cdot B_{\text{pot}} \\[4pt]
248
248
  F_{\text{custom}} &= \sum_{s \in \mathcal{S}} \frac{B_{\text{pot}} \cdot \text{percent}_s}{\text{SPLITS\_TOTAL\_PERCENT}}
249
249
  \end{align}
250
250
 
251
251
  The prize pool available for player claims is:
252
252
  \begin{equation}
253
- \boxed{B_{\text{prize}} = B_{\text{pot}} - F_{\text{base}} - F_{\text{defifa}} - F_{\text{custom}}}
253
+ \boxed{B_{\text{prize}} = B_{\text{pot}} - F_{\text{defifa}} - F_{\text{base}} - F_{\text{custom}}}
254
254
  \end{equation}
255
255
 
256
- With default parameters ($\phi_{\text{base}} = \phi_{\text{defifa}} = 20$, no custom splits):
256
+ With default parameters ($\phi_{\text{defifa}} = 20$, $\phi_{\text{base}} = 40$, no custom splits), the total fee rate is \textbf{7.5\%}:
257
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}}
258
+ B_{\text{prize}} = B_{\text{pot}} \cdot \left(1 - \tfrac{1}{20} - \tfrac{1}{40}\right) = 0.925 \cdot B_{\text{pot}}
259
259
  \end{equation}
260
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).
261
+ \textbf{Resilient fee handling.} The \texttt{sendPayoutsOf} call is wrapped in a try-catch. If the payout fails for any reason, the \texttt{CommitmentPayoutFailed} event is emitted, the fulfilled commitments value is set to a sentinel~(1), and the final ruleset is still queued. Players can cash out immediately---the fee amount stays in the pot, slightly benefiting cash-out recipients. This ensures the game always reaches completion regardless of fee-collection failures.
262
+
263
+ \textbf{Fee recycling.} The fees paid to the Defifa and base protocol projects are processed as standard Juicebox payments, which mint project tokens (\$DEFIFA, \$NANA) to the game's hook contract. These tokens are later distributed to players upon claim (Section~2.6).
264
+
265
+ \textbf{World Cup example.} With a 147~ETH pot: Defifa fee: $147 / 20 = 7.35$~ETH (5\%). Base protocol fee: $147 / 40 = 3.675$~ETH (2.5\%). Total fees: 11.025~ETH (7.5\%). Prize pool: $147 - 11.025 = 135.975$~ETH (92.5\%).
262
266
 
263
267
  \subsection{Protocol Token Allocation}
264
268
 
@@ -267,12 +271,12 @@ When fees are paid to the Defifa and base protocol projects, those projects mint
267
271
  \textbf{Token allocation per player.} For a player burning tokens with cumulative mint cost $c$:
268
272
  \begin{align}
269
273
  X_{\text{defifa}} &= \frac{c}{M} \cdot D_{\text{total}} \\[4pt]
270
- X_{\text{base}} &= \frac{c}{M} \cdot P_{\text{total}}
274
+ X_{\text{nana}} &= \frac{c}{M} \cdot P_{\text{total}}
271
275
  \end{align}
272
276
 
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.
277
+ 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 \$NANA tokens held by the hook.
274
278
 
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.
279
+ \textbf{Key property.} Protocol token distribution is proportional to \emph{original mint cost}, not to scorecard weight. Since all tiers share the same price $p$, each NFT generates the same protocol-token claim regardless of tier. Even holders of losing tiers ($w_i = 0$) receive protocol tokens when burning---a consolation that rewards participation regardless of outcome.
276
280
 
277
281
  %==========================================================================
278
282
  \section{Attestation Governance and Scorecard Ratification}
@@ -299,9 +303,11 @@ where $n_i^{\text{holder}}$ is the number of tier-$i$ tokens delegated to (or he
299
303
  v^{\text{holder}} = \sum_{i \,:\, n_i^{\text{holder}} > 0} V_{\max} \cdot \frac{n_i^{\text{holder}}}{n_i^{\text{total}}}
300
304
  \end{equation}
301
305
 
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.
306
+ \textbf{Checkpoint-based snapshots.} Attestation power is measured at the scorecard's \texttt{attestationsBegin} timestamp---always a past timestamp set during \texttt{submitScorecardFor}. This prevents same-block transfer manipulation.
303
307
 
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.
308
+ \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 (the \texttt{\_update} function enforces \texttt{DELEGATE\_CHANGES\_UNAVAILABLE\_IN\_THIS\_PHASE} after MINT).
309
+
310
+ \textbf{World Cup example.} Argentina (Tier~1) has 2,000 NFTs. A fan holding 100 Argentina NFTs has attestation power: $10^9 \times 100/2{,}000 = 50{,}000{,}000$ from Tier~1. Despite Argentina having the most mints, each \emph{tier} contributes equally to governance weight---Argentina's 2,000 holders collectively cap at $10^9$, the same as Saudi Arabia's 10 holders.
305
311
 
306
312
  \subsection{Quorum and Ratification Conditions}
307
313
 
@@ -312,14 +318,14 @@ v^{\text{holder}} = \sum_{i \,:\, n_i^{\text{holder}} > 0} V_{\max} \cdot \frac{
312
318
 
313
319
  where $N_{\text{minted\_tiers}}$ is the number of tiers that have at least one minted token.
314
320
 
315
- \textbf{Example.} For a game with 4 tiers (all minted):
316
- $$Q = \frac{4}{2} \cdot 10^9 = 2 \times 10^9$$
321
+ \textbf{World Cup example.} All 32 tiers have minted tokens:
322
+ $$Q = \frac{32}{2} \cdot 10^9 = 16 \times 10^9$$
317
323
 
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.
324
+ This requires the equivalent of 16 full tiers' worth of unanimous attestation. If the default delegate holds delegated power from a majority of minters across 16+ tiers, they can single-handedly meet quorum---which is exactly the intended fast path for games with trusted organizers.
319
325
 
320
326
  \textbf{Ratification conditions.} A scorecard can be ratified when all three conditions are met:
321
327
  \begin{enumerate}[nosep]
322
- \item The scorecard's grace period has expired,
328
+ \item The scorecard's grace period has expired ($\texttt{gracePeriodEnds} \leq \texttt{block.timestamp}$),
323
329
  \item The attestation count meets or exceeds quorum,
324
330
  \item No other scorecard has been ratified for this game.
325
331
  \end{enumerate}
@@ -335,7 +341,7 @@ Each submitted scorecard passes through five states:
335
341
  \textbf{State} & \textbf{Condition} \\
336
342
  \midrule
337
343
  PENDING & \texttt{attestationsBegin} $>$ \texttt{block.timestamp} \\
338
- ACTIVE & \texttt{attestationsBegin} $\leq$ \texttt{now} $\leq$ \texttt{gracePeriodEnds} \\
344
+ ACTIVE & \texttt{attestationsBegin} $\leq$ \texttt{now} and (grace not expired or quorum not met) \\
339
345
  SUCCEEDED & Grace period expired AND attestations $\geq$ quorum \\
340
346
  DEFEATED & A different scorecard was ratified \\
341
347
  RATIFIED & This scorecard was ratified \\
@@ -344,7 +350,9 @@ RATIFIED & This scorecard was ratified \\
344
350
  \caption{Scorecard lifecycle states.}
345
351
  \end{table}
346
352
 
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.
353
+ Multiple scorecards may coexist in ACTIVE or SUCCEEDED state simultaneously, but only one can ever be ratified. Scorecards that fail to reach quorum remain ACTIVE indefinitely---the game's \texttt{scorecardTimeout} provides the ultimate backstop (see Section~9.1).
354
+
355
+ The grace period is computed relative to \texttt{attestationsBegin}, not submission time: $t_{\text{grace\_end}} = t_{\text{attest\_begin}} + \tau_{\text{grace}}$. This prevents the grace period from expiring before attestations even start.
348
356
 
349
357
  \subsection{Resistance to Strategic Manipulation}
350
358
 
@@ -352,32 +360,27 @@ The attestation model incorporates several defenses:
352
360
 
353
361
  \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
362
 
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.
363
+ \textbf{Defense 2: Checkpoint snapshots.} Attestation power is computed at a fixed historical timestamp (\texttt{attestationsBegin}). Acquiring tokens after the snapshot provides zero additional voting power.
356
364
 
357
365
  \textbf{Defense 3: Mint-phase-only delegation.} Delegation is locked after the mint phase, preventing last-minute delegation changes during the scoring phase.
358
366
 
359
367
  \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
368
 
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.
369
+ \textbf{Defense 5: Scoring-phase-only submission.} Scorecard submission is restricted to the SCORING phase, preventing pre-accumulation of attestations during minting.
362
370
 
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:
371
+ \textbf{Remaining attack surface.} A coalition controlling sufficient attestation power across $\lceil N_{\text{minted}}/2 \rceil$ tiers can ratify an arbitrary scorecard. 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.
372
+
373
+ \textbf{Worst-case attack cost (heavily minted tiers):}
364
374
  \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
375
+ C_{\text{attack}}^{\text{worst}} \geq \sum_{i \in \text{majority set}} \left\lceil \frac{n_i + 1}{2} \right\rceil \cdot p
366
376
  \end{equation}
367
377
 
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:
378
+ \textbf{Best-case attack cost (sparse tiers):}
369
379
  \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}}}
380
+ C_{\text{attack}}^{\text{best}} = \lceil N/2 \rceil \cdot p
378
381
  \end{equation}
379
382
 
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.
383
+ This is potentially orders of magnitude cheaper. See Section~9.2 for a full analysis of governance attack economics and mitigations.
381
384
 
382
385
  %==========================================================================
383
386
  \section{Price Dynamics and Value Flows}
@@ -385,19 +388,17 @@ For the sparse-tier attack, this condition is almost always satisfied when the p
385
388
 
386
389
  \subsection{NFT Intrinsic Value During Minting}
387
390
 
388
- During the mint phase, the intrinsic value of a tier-$i$ NFT depends on the holder's subjective probability assessment.
389
-
390
391
  \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
392
  \begin{equation}
392
393
  \mathbb{E}[V_i] = \pi_i \cdot \frac{B_{\text{prize}}}{n_i} + X_i^{\text{protocol}}
393
394
  \end{equation}
394
395
 
395
- A rational risk-neutral player mints tier $i$ when $\mathbb{E}[V_i] > p_i$, which requires:
396
+ A rational risk-neutral player mints tier $i$ when $\mathbb{E}[V_i] > p$, which requires:
396
397
  \begin{equation}
397
- \pi_i > \frac{p_i - X_i^{\text{protocol}}}{B_{\text{prize}} / n_i}
398
+ \pi_i > \frac{p - X_i^{\text{protocol}}}{B_{\text{prize}} / n_i}
398
399
  \end{equation}
399
400
 
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
+ \textbf{World Cup example.} Argentina has 2,000 mints. If the scorecard assigns 40\% to the winner, an Argentina holder's expected value is $\pi_A \times 0.4 \times 135.975 / 2{,}000$. For this to exceed 0.01~ETH: $\pi_A > 36.8\%$. If you believe Argentina has a $>37\%$ chance of winning, minting is positive expected value.
401
402
 
402
403
  \subsection{Post-Scorecard Valuation}
403
404
 
@@ -406,25 +407,15 @@ After the scorecard is ratified and fees are extracted, each NFT has a determini
406
407
  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
408
  \end{equation}
408
409
 
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}}$$
410
+ \textbf{Winning tier:} $V_j^{\text{token}} = \frac{B_{\text{prize}} + A_{\text{redeemed}}}{\hat{n}_j} + V_j^{\text{protocol}}$
414
411
 
415
- Losing-tier tokens have zero prize value but retain protocol-token value.
412
+ \textbf{Losing tier ($w_i = 0$):} $V_i^{\text{token}} = V_i^{\text{protocol}}$ (protocol tokens only).
416
413
 
417
414
  \subsection{Secondary Market Implications}
418
415
 
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}
416
+ \textbf{Pre-ratification.} NFT value is driven by subjective outcome probabilities, analogous to prediction-market shares.
426
417
 
427
- Post-ratification secondary markets should converge immediately to redemption value, eliminating any residual price discovery.
418
+ \textbf{Post-ratification.} NFT value is deterministic and publicly computable. Any price deviation from redemption value creates an arbitrage, so secondary markets should converge immediately to redemption value.
428
419
 
429
420
  %==========================================================================
430
421
  \section{Rational Actor Analysis}
@@ -432,43 +423,31 @@ Post-ratification secondary markets should converge immediately to redemption va
432
423
 
433
424
  \subsection{Mint-Phase Strategy: Entry Timing}
434
425
 
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$:
426
+ \textbf{Equilibrium.} In a Nash equilibrium of the minting game with risk-neutral players, denoting by $\pi_i$ the true probability of tier $i$ winning and by $f_i = n_i / N_{\text{total}}$ the fraction of NFTs allocated to tier $i$:
438
427
  \begin{equation}
439
428
  \mathbb{E}[\text{return}_i] = \frac{\pi_i}{f_i} \cdot (1 - \phi) - 1
440
429
  \end{equation}
441
430
 
442
- where $\phi = 1/\phi_{\text{defifa}} + 1/\phi_{\text{base}} + \phi_{\text{custom}}$ is the total fee rate.
431
+ where $\phi = 1/\phi_{\text{defifa}} + 1/\phi_{\text{base}} + \phi_{\text{custom}}$ is the total fee rate (default: 7.5\%).
443
432
 
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}
433
+ In equilibrium, expected returns equalize across tiers: $f_i = \pi_i$.
448
434
 
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.
435
+ \textbf{Result.} In equilibrium, the fraction of NFTs in each tier equals the market's consensus probability of that tier winning. This is the classical parimutuel result.
450
436
 
451
- \subsection{Refund-Phase Strategy: Option Exercise}
437
+ \textbf{World Cup example.} Argentina's 2,000 mints out of 15,000 total = 13.3\% share. In equilibrium, this implies a 13.3\% probability of winning---approximately matching real-world bookmaker odds.
452
438
 
453
- The refund phase creates a \emph{free put option} on each minted NFT, struck at the mint price.
439
+ \subsection{Refund-Phase Strategy: Option Exercise}
454
440
 
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:
441
+ The refund phase creates a \emph{free put option} on each minted NFT, struck at the mint price $p$:
456
442
  \begin{equation}
457
- O_i = \max\bigl(p_i - V_i(t_{\text{refund\_end}}),\; 0\bigr)
443
+ O_i = \max\bigl(p - V_i(t_{\text{refund\_end}}),\; 0\bigr)
458
444
  \end{equation}
459
445
 
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.
446
+ A rational player exercises (refunds) when new information shifts the expected outcome against their chosen tier.
461
447
 
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}
448
+ \subsection{Scoring-Phase Strategy: Attestation}
470
449
 
471
- \textbf{Equilibrium.} In the unique subgame-perfect equilibrium of the attestation game (assuming common knowledge of the event outcome):
450
+ \textbf{Equilibrium.} In the unique subgame-perfect equilibrium (assuming common knowledge of the event outcome):
472
451
  \begin{enumerate}[nosep]
473
452
  \item All holders attest to the \emph{truthful} scorecard---the one reflecting the actual event outcome.
474
453
  \item The truthful scorecard achieves quorum, as holders of winning tiers have the strongest incentive to attest.
@@ -476,13 +455,11 @@ The refund phase serves three purposes:
476
455
 
477
456
  \subsection{Complete-Phase Strategy: Claim vs Hold}
478
457
 
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:
458
+ \textbf{Dominant strategy.} For risk-neutral players, burning immediately weakly dominates holding. The claim value does not depreciate (path-independence), but the time value of money favors immediate realization. Holding is justified only by expected protocol-token appreciation exceeding the discount rate:
480
459
  \begin{equation}
481
- \frac{dP_D}{dt} \cdot \frac{p_i}{M} \cdot D_{\text{total}} > r \cdot V_i^{\text{token}}
460
+ \frac{dP_D}{dt} \cdot \frac{p}{M} \cdot D_{\text{total}} > r \cdot V_i^{\text{token}}
482
461
  \end{equation}
483
462
 
484
- where $r$ is the player's discount rate.
485
-
486
463
  %==========================================================================
487
464
  \section{Solvency and Conservation Laws}
488
465
  %==========================================================================
@@ -497,11 +474,13 @@ For any scorecard $\mathbf{w}$ with $\sum_i w_i = W_{\text{total}}$ and any sequ
497
474
  The total claim across all tokens is:
498
475
  $$\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
476
 
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:
477
+ Since $n_i^{\text{eligible}} = \hat{n}_i$ at the start, and $(B_{\text{prize}} + A_{\text{redeemed}})$ is invariant, this equals:
501
478
  $$\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
479
  \end{proof}
503
480
 
504
- This guarantees that the treasury is exactly drained after all eligible tokens are redeemed---there is no residual and no shortfall.
481
+ This guarantee is strengthened by the exact-sum validation on-chain:
482
+ \texttt{validate\-And\-Build\-Weights} reverts if $\sum_i w_i \neq W_{\text{total}}$.
483
+ Under-allocated scorecards are rejected.
505
484
 
506
485
  \subsection{Solvency Under Sequential Cash-Outs}
507
486
 
@@ -510,7 +489,7 @@ The payout to any individual NFT holder is independent of the order in which oth
510
489
  \end{corollary}
511
490
 
512
491
  \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.
492
+ The per-token claim formula (Eq.~\ref{eq:cashout}) uses $(B_{\text{prize}} + A_{\text{redeemed}})$ as the reference pot, which is constant. As each token is redeemed, both $n_i^{\text{burned}}$ and $d_i$ increment by~1, leaving $\hat{n}_i$ invariant.
514
493
  \end{proof}
515
494
 
516
495
  \subsection{Fee Impact on Total Claimable Value}
@@ -520,10 +499,10 @@ The total value available to players (prize + protocol tokens) is:
520
499
  V_{\text{total}} = B_{\text{prize}} + V_{\text{protocol}} = B_{\text{pot}} \cdot (1 - \phi) + V_{\text{protocol}}
521
500
  \end{equation}
522
501
 
523
- With default fees ($\phi = 10\%$):
524
- $$V_{\text{total}} = 0.9 \cdot B_{\text{pot}} + V_{\text{protocol}}$$
502
+ With default fees ($\phi = 7.5\%$):
503
+ $$V_{\text{total}} = 0.925 \cdot B_{\text{pot}} + V_{\text{protocol}}$$
525
504
 
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.
505
+ Whether the net present value exceeds the mint cost depends on whether $V_{\text{protocol}} > 0.075 \cdot B_{\text{pot}}$---whether protocol token value compensates for the fee extraction.
527
506
 
528
507
  %==========================================================================
529
508
  \section{Game-Theoretic Properties}
@@ -546,41 +525,32 @@ Asset type & Fungible bet tickets & Non-fungible ERC-721 \\
546
525
  Secondary market & Typically none & Full ERC-721 transferability \\
547
526
  Refund option & Typically none & Configurable refund phase \\
548
527
  Token rewards & None & Protocol token distribution \\
528
+ Safety fallback & None & NO\_CONTEST with full refunds \\
549
529
  \bottomrule
550
530
  \end{tabular}
551
531
  \caption{Comparison: Traditional parimutuel vs.\ Defifa.}
552
532
  \end{table}
553
533
 
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:
534
+ \textbf{Parimutuel equivalence.} Under uniform pricing (enforced by protocol---always true), binary scorecard, and no refund phase, Defifa is equivalent to a classical parimutuel pool with odds:
555
535
  \begin{equation}
556
- \text{odds}_i = \frac{B_{\text{prize}}}{n_i \cdot p} = \frac{(1 - \phi) \cdot \sum_k n_k}{n_i}
536
+ \text{odds}_i = \frac{B_{\text{prize}}}{n_i \cdot p} = \frac{(1 - \phi) \cdot N_{\text{total}}}{n_i}
557
537
  \end{equation}
558
538
 
539
+ \textbf{World Cup example (winner-take-all).} Argentina ($n_1 = 2{,}000$) out of 15,000 total mints: $\text{odds}_{\text{Argentina}} = \frac{0.925 \times 15{,}000}{2{,}000} = 6.94\times$. A 0.01~ETH bet pays 0.069~ETH---precisely classical parimutuel odds with a 7.5\% takeout rate.
540
+
559
541
  \subsection{Information Aggregation}
560
542
 
561
543
  The minting and refund dynamics create a multi-round price-discovery mechanism:
562
544
 
563
- \textbf{Round 1 (Mint phase).} Players reveal information through tier selection. Under equilibrium, the pot distribution converges to the collective probability distribution.
545
+ \textbf{Round~1 (Mint phase).} Players reveal information through tier selection. Under equilibrium, the mint distribution converges to the collective probability distribution.
564
546
 
565
- \textbf{Round 2 (Refund phase).} Players who received new information can exit, and the refund pattern reveals belief updates.
547
+ \textbf{Round~2 (Refund phase).} Players who received new information can exit, revealing belief updates.
566
548
 
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.
549
+ \textbf{Round~3 (Secondary market).} If NFTs trade on secondary markets during the scoring phase, prices reflect the most current probability assessments.
570
550
 
571
551
  \subsection{Multi-Game Dynamics and Protocol Flywheel}
572
552
 
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:
553
+ Defifa generates a \emph{protocol-level flywheel} through its fee-token mechanism. Let $G$ be the number of active games, $\bar{B}$ the average pot size, and $\phi$ the fee rate (default: 7.5\%). The aggregate fee revenue is:
584
554
  \begin{equation}
585
555
  R = G \cdot \bar{B} \cdot \phi
586
556
  \end{equation}
@@ -590,7 +560,7 @@ The fraction of the pot recovered through protocol tokens is:
590
560
  \frac{V_{\text{protocol}}^{\text{game}}}{\bar{B}} = \phi^2 \cdot \mu \cdot G
591
561
  \end{equation}
592
562
 
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.
563
+ where $\mu$ is the revenue multiple of protocol token valuation. For $\phi = 0.075$, $\mu = 10$, and $G = 100$: recovery rate $= 0.005625 \times 10 \times 100 = 5.625\times$. While extreme, this demonstrates the positive network effect: more games create more protocol token value.
594
564
 
595
565
  %==========================================================================
596
566
  \section{Parameter Design Space}
@@ -598,19 +568,13 @@ where $\mu$ is the revenue multiple of protocol token valuation. This shows that
598
568
 
599
569
  \subsection{Tier Count and Price Calibration}
600
570
 
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.
571
+ \textbf{Tier count} (maximum: 128). More tiers increase governance robustness but potentially slow ratification. Optimal: $4 \leq N \leq 32$. A 32-team World Cup game is the sweet spot.
602
572
 
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.
573
+ \textbf{Price calibration.} Since all tiers share a uniform price $p$ (enforced by the protocol), the price affects accessibility, pot size per capita, and attack economics. Recommended: 0.01--0.1~ETH per NFT.
604
574
 
605
575
  \subsection{Timing Parameters}
606
576
 
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.
577
+ \textbf{Mint duration}: $t_{\text{mint}} \approx \min(\text{time until event}, 30\text{ days})$. \textbf{Refund duration}: 1--7 days. \textbf{Attestation grace period}: 3--7 days (minimum: 1 day, enforced by protocol). \textbf{Scorecard timeout}: 90--180 days for permissionless games, 30 days for trusted-organizer games.
614
578
 
615
579
  \subsection{Fee Calibration and Protocol Sustainability}
616
580
 
@@ -625,7 +589,7 @@ The default fee structure is competitive with existing markets:
625
589
  Horse racing (parimutuel) & 15--25\% \\
626
590
  Sports betting (vig) & 4--10\% \\
627
591
  Prediction markets (fees) & 1--5\% \\
628
- \textbf{Defifa (default)} & \textbf{10\%} \\
592
+ \textbf{Defifa (default)} & \textbf{7.5\%} \\
629
593
  \bottomrule
630
594
  \end{tabular}
631
595
  \caption{Fee comparison across prediction platforms.}
@@ -636,135 +600,365 @@ The effective fee rate, accounting for protocol token rebates, is:
636
600
  \phi_{\text{eff}} = \phi \cdot (1 - \alpha)
637
601
  \end{equation}
638
602
 
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.
603
+ where $\alpha$ is the fraction of fee value retained in protocol tokens. For $\alpha = 0.5$: $\phi_{\text{eff}} = 0.075 \times 0.5 = 3.75\%$, highly competitive with low-fee prediction markets.
640
604
 
641
605
  %==========================================================================
642
- \section{Open Problems and Mechanism Design Recommendations}
606
+ \section{Safety Mechanisms}
643
607
  %==========================================================================
644
608
 
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.
609
+ Defifa includes a comprehensive safety system---the \textbf{NO\_CONTEST} mechanism---that prevents funds from being permanently locked when governance fails or the game is non-viable. NO\_CONTEST is a first-class game phase (defined in the \texttt{DefifaGamePhase} enum) with three complementary triggers.
610
+
611
+ \subsection{The No-Contest System}
612
+
613
+ \subsubsection{Trigger~1: Minimum Participation Threshold}
614
+
615
+ At game creation, the organizer sets \texttt{minParticipation}---a minimum treasury balance required for the game to proceed to scoring. The \texttt{currentGamePhaseOf()} function checks the balance against this threshold before returning SCORING. If below, it returns NO\_CONTEST.
646
616
 
647
- \subsection{Governance Deadlock and Fund Recovery: A Deep Study}
617
+ \emph{What it solves:} Ghost games with negligible participation skip directly to refundability. \emph{Attack surface:} A majority holder can refund enough tokens to push the balance below threshold. \emph{Mitigation:} Set the threshold conservatively low (${\sim}10\%$ of expected pot). Set to~0 to disable.
648
618
 
649
- \textbf{Severity: Significant (design consideration).}
619
+ \subsubsection{Trigger~2: Scorecard Ratification Timeout}
650
620
 
651
- \subsubsection{Historical Context}
621
+ At game creation, the organizer sets \texttt{scorecardTimeout}---a duration after SCORING begins. If no scorecard is ratified within this window, \texttt{currentGamePhaseOf()} returns NO\_CONTEST.
622
+
623
+ \emph{What it solves:} All governance deadlock scenarios---no scorecard submitted, quorum unreachable, dead delegate, dead attestation holders. This is the only mechanism providing a hard, trustless, time-bounded guarantee that funds cannot be locked permanently. Set to~0 to disable.
624
+
625
+ \subsubsection{Trigger~3: Explicit Activation}
626
+
627
+ Once \texttt{currentGamePhaseOf()} returns NO\_CONTEST (from either trigger), anyone calls \texttt{triggerNoContestFor(gameId)}. This:
628
+ \begin{enumerate}[nosep]
629
+ \item Sets \texttt{noContestTriggeredFor[gameId] = true} (permanent flag)
630
+ \item Queues a new ruleset with no payout limits, making surplus equal to balance
631
+ \item Enables full-refund cash-outs at mint price
632
+ \end{enumerate}
652
633
 
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.
634
+ During NO\_CONTEST, the \texttt{computeCashOutCount} function returns the cumulative mint price---identical to MINT/REFUND phase behavior, implementing a complete refund.
654
635
 
655
- \subsubsection{Exhaustive Deadlock Scenario Analysis}
636
+ \subsubsection{Priority Rules}
656
637
 
657
- We identify five distinct scenarios in which game funds could become permanently inaccessible:
638
+ COMPLETE takes priority over NO\_CONTEST---a ratified scorecard is final. Once \texttt{noContestTriggeredFor} is set, the game stays in NO\_CONTEST permanently.
658
639
 
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.
640
+ \subsubsection{Defense in Depth}
660
641
 
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.
642
+ The \texttt{defaultAttestationDelegate} provides a social fast-path for routine governance. Combined with the automated NO\_CONTEST triggers, this creates layered safety: delegate (fast-path social resolution) + timeout (hard backstop) + threshold (early exit for ghost games).
662
643
 
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.
644
+ \subsection{Governance Attack Economics}
664
645
 
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.
646
+ \textbf{All governance systems are manipulatable with sufficient capital.} The relevant question is not \emph{whether} an attack is possible, but whether the \textbf{mechanism structurally prevents profit} regardless of how much the attacker spends. Making attacks ``more expensive'' is insufficient---a sufficiently capitalized adversary will pay any price. The defense must be structural, not economic.
666
647
 
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.
648
+ \subsubsection{The Scaling Problem (Current Design)}
668
649
 
669
- \begin{table}[h]
650
+ The per-tier attestation power cap assigns equal $V_{\text{max}} = 10^9$ to every tier regardless of supply. An adversary buys 1~token in each of $\lceil N/2 \rceil$ sparse tiers at cost $C_{\text{attack}} = \lceil N/2 \rceil \cdot p$, while the pot scales as $B_{\text{pot}} = \sum_i n_i \cdot p$:
651
+ \begin{equation}
652
+ \text{ROI} \approx \frac{2 \cdot N_{\text{total}}}{N}
653
+ \end{equation}
654
+
655
+ Attack cost is $O(N)$ while the pot is $O(N_{\text{total}})$, so ROI grows linearly with participation. For our 32-team World Cup at 0.01~ETH: 0.16~ETH to capture a 138.75~ETH pot---an $867\times$ return. No amount of threshold-tuning fixes this: any defense based on ``make it cost more'' fails against unlimited capital.
656
+
657
+ \subsubsection{Benefit-Weighted Attestation: The Structural Fix}
658
+
659
+ The insight: \textbf{the beneficiaries of a scorecard should not be the ones who ratify it.} The more a tier receives from a scorecard, the less that tier's attestation power counts toward ratifying it.
660
+
661
+ For a scorecard $S$ with weights $\{w_1, \ldots, w_N\}$, tier $i$'s effective attestation power:
662
+ \begin{equation}\label{eq:bwa}
663
+ \boxed{V_i^{\text{eff}}(S) = V_{\text{max}} \cdot \left(1 - \frac{w_i}{W_{\text{total}}}\right)}
664
+ \end{equation}
665
+
666
+ This is the \textbf{perfect proportion}: a pure linear reduction where benefit and governance power are complementary. The function has a critical mathematical invariant---total available attestation power is \emph{constant} for every valid scorecard:
667
+ \begin{equation}
668
+ \sum_{i=1}^{N} V_i^{\text{eff}}(S)
669
+ = V_{\text{max}} \cdot \sum_{i=1}^{N}\!\left(1 - \frac{w_i}{W_{\text{total}}}\right)
670
+ = V_{\text{max}} \cdot (N - 1)
671
+ \end{equation}
672
+
673
+ since $\sum w_i = W_{\text{total}}$. The mechanism does not favor concentrated scorecards over distributed ones in terms of \emph{how much} power exists---it only changes \emph{who} holds it.
674
+
675
+ \textbf{Why linear is optimal.} Stronger-than-linear functions (e.g., quadratic $(1-x)^2$) reduce total available power for distributed scorecards relative to concentrated ones---the opposite of what is desired. Weaker-than-linear functions leave too much power with beneficiaries. The linear form uniquely preserves the $(N-1) \cdot V_{\text{max}}$ invariant while providing maximal separation between beneficiary and non-beneficiary power.
676
+
677
+ \subsubsection{Why This Kills the Attack}
678
+
679
+ \textbf{Fraudulent scorecard} (100\% to attacker's monopoly tier):
680
+
681
+ \begin{table}[H]
670
682
  \centering
671
- \begin{tabular}{lccc}
683
+ \begin{tabular}{lll}
672
684
  \toprule
673
- Scenario & Funds stuck? & Delegate resolves? & Automated? \\
685
+ \textbf{Tier} & \textbf{Weight} & \textbf{Effective power} \\
674
686
  \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 \\
687
+ Attacker's tier & 100\% & $V_{\text{max}} \times 0 = 0$ \\
688
+ Each of 31 others & 0\% & $V_{\text{max}} \times 1.0$ \\
680
689
  \bottomrule
681
690
  \end{tabular}
682
691
  \end{table}
683
692
 
684
- \subsubsection{Effectiveness of the Default Attestation Delegate}
693
+ The attacker has \textbf{zero} attestation power for their own scorecard. No amount of capital changes this. The fraudulent scorecard accumulates 0 attestation and dies.
694
+
695
+ \textbf{Truthful scorecard} (Argentina wins 40\%):
685
696
 
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.
697
+ \begin{table}[H]
698
+ \centering
699
+ \begin{tabular}{lll}
700
+ \toprule
701
+ \textbf{Tier} & \textbf{Weight} & \textbf{Effective power} \\
702
+ \midrule
703
+ Argentina & 40\% & $0.6 \times V_{\text{max}}$ \\
704
+ Runner-up & 20\% & $0.8 \times V_{\text{max}}$ \\
705
+ Semi-finalists ($\times 2$) & 10\% each & $0.9 \times V_{\text{max}}$ each \\
706
+ Other 28 tiers & $\approx$0\% & $\approx V_{\text{max}}$ each \\
707
+ \midrule
708
+ \textbf{Total available} & & $31 \times V_{\text{max}}$ \\
709
+ \textbf{Quorum} & & $16 \times V_{\text{max}}$ \\
710
+ \bottomrule
711
+ \end{tabular}
712
+ \end{table}
687
713
 
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.
714
+ The truthful scorecard has nearly $2\times$ the attestation power needed. The delegate marshals power from non-winning tiers (full strength), and even the winning tiers retain 60--90\% power.
689
715
 
690
- \subsubsection{Candidate Mechanism~A: Minimum Participation Threshold}
716
+ \subsubsection{Scaling Against Unlimited Capital}
691
717
 
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.
718
+ The attacker's fallback: buy into \emph{non-winning} tiers to accumulate attestation power for a fraudulent scorecard. But those purchases go \emph{into the pot}---the attacker enriches the treasury they are trying to steal.
693
719
 
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).
720
+ \textbf{Attacker buys 1 token in 16 sparse tiers (0.16~ETH):} winning tier contributes 0 power; 15 other sparse tiers contribute $15 \times V_{\text{max}}$; honest tiers $\approx 0.03 \times V_{\text{max}}$. Total $\approx 15.03 \times V_{\text{max}} < 16 \times V_{\text{max}} =$ quorum. \textbf{Fails}---one tier short because the winning tier is dead weight.
695
721
 
696
- \subsubsection{Candidate Mechanism~B: Scorecard Ratification Timeout}
722
+ \textbf{Attacker buys massively into honest tiers (80~ETH):} gains 50\% share in 16 honest tiers, adding $8 \times V_{\text{max}}$. Total $\approx 23 \times V_{\text{max}} >$ quorum. \textbf{Passes}---but invested 80~ETH to attack an 80~ETH pot. Net extraction = honest holders' original contribution. Attack cost now \textbf{scales linearly with the pot}---not because we made it expensive, but because the structure demands it.
697
723
 
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}.
724
+ \subsubsection{Dead Token Economics: The Attack Tax}
699
725
 
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.
726
+ The key insight making governance manipulation structurally unprofitable: \textbf{tokens purchased for governance power in non-winning tiers are dead money under a fraudulent scorecard.}
701
727
 
702
- \subsubsection{Do We Need a Formal State?}
728
+ Under BWA, an attacker needs tokens in non-winning tiers (full governance power) to ratify a scorecard that benefits their winning tiers (zero power). But under the fraudulent scorecard, those non-winning tiers receive 0\% of the pot. The attacker's non-winning tokens are a sunk cost---capital destroyed in the act of governance manipulation.
703
729
 
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.
730
+ Combined with the 7.5\% fee extraction (5\% Defifa + 2.5\% base protocol), this creates a formal profitability condition.
705
731
 
706
- \subsubsection{Assessment and Recommendation}
732
+ \begin{theorem}[Attack Profitability Threshold]\label{thm:profitability}
733
+ In a Defifa game with $N$ tiers, fee rate $\phi = 7.5\%$, and BWA, an attacker controlling fraction $\alpha_w$ of winning-tier tokens and fraction $\alpha_v$ of non-winning (voting) tier tokens profits if and only if:
734
+ \begin{equation}
735
+ \alpha_w > \alpha_v \cdot \frac{N-1}{(1-\phi)N - 1}
736
+ \end{equation}
737
+ \end{theorem}
707
738
 
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:
739
+ For the default fee rate ($\phi = 0.075$):
740
+
741
+ \begin{table}[H]
742
+ \centering
743
+ \begin{tabular}{lll}
744
+ \toprule
745
+ $N$ (tiers) & Threshold $\alpha_w / \alpha_v$ & Interpretation \\
746
+ \midrule
747
+ 2 & 1.176 & Must own 17.6\% more of winning tiers \\
748
+ 4 & 1.111 & Must own 11.1\% more \\
749
+ 8 & 1.094 & Must own 9.4\% more \\
750
+ 32 & 1.084 & Must own 8.4\% more \\
751
+ 128 & 1.082 & Converges to $1/(1-\phi) \approx 1.081$ \\
752
+ \bottomrule
753
+ \end{tabular}
754
+ \caption{Profitability threshold by tier count.}
755
+ \end{table}
756
+
757
+ \begin{corollary}[Uniform Buyer Loss]
758
+ An attacker who buys uniformly across all tiers ($\alpha_w = \alpha_v$) always loses money---their return is $(1-\phi) \cdot \alpha \cdot \text{pot}$ while their cost is $\alpha \cdot \text{pot}$, yielding a guaranteed $-7.5\%$ loss regardless of the scorecard, tier count, or pot size.
759
+ \end{corollary}
760
+
761
+ \begin{corollary}[Dead Token Tax]
762
+ In a game with $N$ tiers where the attacker claims weight for 1 tier, $(N-1)/N$ of the attacker's governance tokens are dead---they cost money to buy but return nothing. For the World Cup ($N = 32$), 96.9\% of the attacker's governance investment is dead money.
763
+ \end{corollary}
764
+
765
+ \subsubsection{The Complete Defense Stack}
766
+
767
+ \begin{table}[H]
768
+ \centering
769
+ \begin{tabular}{lll}
770
+ \toprule
771
+ \textbf{Layer} & \textbf{Mechanism} & \textbf{Defends against} \\
772
+ \midrule
773
+ Structural & Benefit-weighted attestation & Self-interested manipulation \\
774
+ Economic & Dead token tax + fee extraction & Profitability of residual attacks \\
775
+ Temporal & Post-ratification timelock (\S9.4) & Fraud slipping through BWA \\
776
+ Adaptive & Graduated quorum (\S9.4) & Concentrated fraudulent scorecards \\
777
+ Corrective & Attestation withdrawal (\S9.4) & Social engineering / phishing \\
778
+ Social & Trusted delegate & Coordination failure \\
779
+ Parametric & \texttt{minParticipation} + \texttt{scorecardTimeout} & Ghost games, deadlock \\
780
+ Design & Uniform participation (\S9.3) & 51\% ownership concentration \\
781
+ \bottomrule
782
+ \end{tabular}
783
+ \caption{Layered governance defense stack.}
784
+ \end{table}
785
+
786
+ \textbf{The irreducible limit.} Like all proof-of-stake systems, Defifa has a 51\% security threshold: an attacker who controls $>$50\% of every tier's tokens can ratify any scorecard. This is the fundamental limit of all token-weighted governance and cannot be eliminated by mechanism design alone. The defense is \emph{game design}---structuring games so that organic participation makes 51\% ownership prohibitively expensive.
787
+
788
+ \textbf{The bottom line.} Benefit-weighted attestation transforms Defifa governance from an economic arms race into a structural equilibrium. The ``perfect proportion''---$\text{power} = 1 - \text{benefit}$---is the unique linear function that preserves constant total attestation across all valid scorecards while maximally separating beneficiary power from non-beneficiary power. Combined with dead token economics and fee extraction, self-serving governance is not just structurally difficult---it is provably unprofitable under the conditions identified in Section~9.3.
789
+
790
+ \subsection{Resilient Game Design}\label{sec:game-design}
791
+
792
+ The profitability threshold from Section~9.2 implies specific design principles that make Defifa games structurally resistant to governance attacks. This section derives the conditions under which attack profitability goes to zero and identifies the proven ideal game design.
793
+
794
+ \subsubsection{The Uniform Participation Theorem}
795
+
796
+ \begin{theorem}[Uniform Participation]\label{thm:uniform}
797
+ In a Defifa game with BWA, if all $N$ tiers have equal supply ($n_i = n$ for all $i$), then no attacker controlling any fraction $\alpha$ of the total supply can profit from governance manipulation.
798
+ \end{theorem}
799
+
800
+ \begin{proof}
801
+ Under uniform supply, any buyer's ownership fraction is identical across all tiers: $\alpha_w = \alpha_v = \alpha$. The profitability condition (Theorem~\ref{thm:profitability}) requires $\alpha_w > \alpha_v \cdot (N-1)/((1-\phi)N - 1)$, which reduces to $1 > (N-1)/((1-\phi)N - 1)$. Since $(1-\phi)N - 1 < N - 1$ for any $\phi > 0$, the right side exceeds 1---the condition can never be satisfied. The attacker always loses exactly the fee fraction $\phi$.
802
+ \end{proof}
803
+
804
+ This theorem establishes that \textbf{participation uniformity is the fundamental design variable} for game security. The closer a game's tier supplies are to uniform, the harder it is for any attacker to achieve the $\alpha_w > 1.08 \times \alpha_v$ threshold needed for profit.
805
+
806
+ \subsubsection{Design Principles}
807
+
808
+ \textbf{Principle 1: Choose events with balanced interest.} The single most important design decision is selecting an event where participants naturally spread their mints across tiers. Events with clear favorites and longshots concentrate supply, creating the imbalance attackers exploit.
809
+
810
+ \begin{itemize}[nosep]
811
+ \item \textbf{Ideal}: Tournament stages (World Cup groups, March Madness brackets) where multiple teams have genuine fanbases
812
+ \item \textbf{Good}: Multi-candidate elections, multi-outcome market predictions
813
+ \item \textbf{Risky}: ``Favorite vs.\ field'' structures where one tier attracts 90\%+ of supply
814
+ \end{itemize}
815
+
816
+ \textbf{Principle 2: More tiers, but only if they attract participation.} Additional tiers dilute the attacker's governance power across more dead tokens. However, adding tiers that attract zero organic participation creates cheap governance power for attackers. The optimal tier count $N^*$ maximizes tiers with meaningful supply:
817
+ \[
818
+ N^* = \max \{ N : \forall i, \; n_i \geq n_{\min} \}
819
+ \]
820
+ where $n_{\min}$ is the supply level below which a tier becomes a governance attack vector.
821
+
822
+ \textbf{Principle 3: Reserve tokens as supply smoothing.} Configuring a reserved rate $\rho_i$ on every tier ensures that even tiers with low organic demand have tokens held by the delegate. These reserve tokens count toward supply (diluting attacker ownership), are held by the delegate (used to attest truthfully), and push $\alpha_w$ and $\alpha_v$ closer together. A reserved rate of $\rho = 1$ effectively halves the attacker's ownership fraction in any tier they haven't bought into.
823
+
824
+ \textbf{Principle 4: Meaningful minimum participation.} Setting \texttt{minParticipation} ensures the pot is large enough that the attacker's token purchases represent a small fraction of total supply.
825
+
826
+ \textbf{Principle 5: Scorecard timeout as hard backstop.} Always set \texttt{scorecardTimeout} for permissionless games to ensure fund recovery if governance fails.
827
+
828
+ \subsubsection{Anti-Patterns}
829
+
830
+ \textbf{Anti-pattern 1: Extreme favorites.} A game where Tier~1 attracts 10,000 mints and Tiers 2--32 attract 10 each. The attacker buys 11 tokens in each of 16 sparse tiers (cost: 1.76~ETH), gaining majority control at full governance power, while the pot holds 103.1~ETH.
831
+
832
+ \textbf{Anti-pattern 2: Excess empty tiers.} Adding 128 tiers when only 8 attract organic interest. The remaining 120 tiers are free governance power---1 token each at minimum cost.
833
+
834
+ \textbf{Anti-pattern 3: No safety parameters.} Running a permissionless game with \texttt{scorecardTimeout = 0} and \texttt{minParticipation = 0}. If governance fails, funds are permanently locked.
835
+
836
+ \subsubsection{The World Cup as Near-Ideal Design}
837
+
838
+ The 32-team FIFA World Cup game exemplifies resilient design:
709
839
 
710
840
  \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.
841
+ \item \textbf{Balanced interest}: All 32 teams have genuine fanbases, ensuring organic minting across all tiers. Even ``longshot'' teams attract nationalist buying.
842
+ \item \textbf{High tier count}: $N = 32$ means the profitability threshold requires 8.4\% ownership advantage---and 96.9\% of governance tokens are dead money.
843
+ \item \textbf{Natural uniformity}: Group-stage structure ensures competitive teams in each group, providing diverse entry points.
844
+ \item \textbf{Cultural event alignment}: The World Cup attracts large, globally distributed participation---making any attacker's fraction small.
845
+ \item \textbf{Clear resolution}: Tournament brackets provide unambiguous outcomes, reducing scorecard disputes to mechanical verification.
715
846
  \end{enumerate}
716
847
 
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.
848
+ \textbf{Is there a proven ideal game design?} Yes, with qualification. The Uniform Participation Theorem proves that a game with perfectly uniform tier supply is impervious to profitable governance attacks regardless of attacker capital. The ``ideal'' is therefore any event structure that naturally produces uniform minting---and the World Cup is the canonical real-world example. The qualification: no mechanism can prevent a 51\% attacker, just as no proof-of-stake protocol can. The defense is making 51\% ownership prohibitively expensive through high, uniform participation.
849
+
850
+ \subsection{Governance Hardening}\label{sec:hardening}
851
+
852
+ The defense stack in Section~9.2---BWA, dead token economics, and resilient game design---provides strong structural guarantees. This section describes four implemented mechanisms that provide defense-in-depth against residual attack vectors. These are additive: each one independently strengthens the system, and they compose without interference.
718
853
 
719
- \subsection{Cheap Cross-Tier Attestation Capture}
854
+ \subsubsection{Post-Ratification Timelock}
720
855
 
721
- \textbf{Severity: Critical.}
856
+ \textbf{Problem.} Without a timelock, \texttt{ratifyScorecardFrom} executes the scorecard instantly---the moment quorum is met and the grace period expires. There is zero time for the community to react to fraud that slips through BWA.
722
857
 
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.
858
+ \textbf{Mechanism.} A mandatory delay $\tau_{\text{lock}}$ exists between a scorecard reaching quorum (after grace period) and its execution. During this window:
859
+ \begin{enumerate}[nosep]
860
+ \item The scorecard enters the \textsc{queued} state---visible but not yet executable.
861
+ \item Multiple scorecards can reach \textsc{queued} or \textsc{succeeded} simultaneously. The first to be ratified wins; others become \textsc{defeated}.
862
+ \item After $\tau_{\text{lock}}$ expires, the scorecard transitions to \textsc{succeeded} and can be ratified.
863
+ \end{enumerate}
864
+
865
+ Multiple scorecards can coexist in \textsc{queued}/\textsc{succeeded} simultaneously. The first \texttt{ratifyScorecardFrom} call wins. Under BWA + graduated quorum, marshaling enough attestation power for a fraudulent competing scorecard is extremely expensive.
724
866
 
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.
867
+ \textbf{Recommended:} $\tau_{\text{lock}} = 3$--$7$ days. Same pattern as Compound Governor, OpenZeppelin TimelockController, and Gnosis Safe.
726
868
 
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$.}
869
+ \textbf{Implementation.} A \textsc{queued} state exists between \textsc{active} and \textsc{succeeded}. \texttt{ratifyScorecardFrom} only executes when the state is \textsc{succeeded} (timelock expired). The \texttt{timelockDuration} is configurable per game (set to 0 to disable).
728
870
 
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.''
871
+ \subsubsection{Graduated Quorum by Scorecard Concentration}
730
872
 
731
- \textbf{Recommended fix.} Introduce a minimum supply threshold for quorum eligibility:
873
+ \textbf{Problem.} Base quorum is flat: $Q_{\text{base}} = N_{\text{eligible}} \times V_{\text{max}} / 2$ regardless of the scorecard's weight distribution. A ``steal everything'' scorecard faces the same quorum as a distributed one.
874
+
875
+ \textbf{Mechanism.} Apply a concentration penalty based on the largest tier weight's squared share, scaled by the \emph{headroom}---the gap between maximum achievable BWA attestation and the base quorum:
876
+ \begin{equation}
877
+ \text{headroom} = Q_{\text{base}} - V_{\text{max}} - N = \frac{(N-2) \times V_{\text{max}}}{2} - N
878
+ \end{equation}
732
879
  \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}}
880
+ Q(S) = Q_{\text{base}} + \text{headroom} \times \left(\frac{\max_i(w_i)}{W_{\text{total}}}\right)^2
734
881
  \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
882
 
737
- \subsection{Prize Pool Under-Allocation}
883
+ The $-N$ term accounts for per-tier integer rounding loss in the BWA computation (\texttt{mulDiv} truncation).
738
884
 
739
- \textbf{Severity: Significant.}
885
+ \textbf{Properties:}
886
+ \begin{itemize}[nosep]
887
+ \item \textbf{Self-capping.} The penalty can never exceed headroom, so the adjusted quorum is always reachable by non-beneficiary attestors.
888
+ \item \textbf{Nonlinear.} $\text{maxShare}^2$ is quadratic: gentle for moderate concentration (25\% max $\to$ 6.25\% of headroom), steep for extreme (100\% max $\to$ 100\% of headroom).
889
+ \item \textbf{No magic constants.} The formula derives entirely from game parameters.
890
+ \end{itemize}
891
+
892
+ \begin{table}[H]
893
+ \centering
894
+ \begin{tabular}{lll}
895
+ \toprule
896
+ \textbf{Distribution} & \textbf{maxShare} & \textbf{Penalty (fraction of headroom)} \\
897
+ \midrule
898
+ Equal across 32 tiers & 3.1\% & 0.1\% (essentially unchanged) \\
899
+ World Cup (40/20/10/10/\ldots) & 40\% & 16\% \\
900
+ Winner-take-all (100/0/\ldots) & 100\% & 100\% (quorum = max achievable BWA) \\
901
+ \bottomrule
902
+ \end{tabular}
903
+ \caption{Graduated quorum impact by scorecard concentration.}
904
+ \end{table}
740
905
 
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}}$).
906
+ Distributed scorecards are barely affected. Concentrated fraudulent scorecards face quadratically increasing quorum, up to the theoretical BWA maximum for winner-take-all.
742
907
 
743
- \textbf{Recommended fix.} Change to exact equality: \texttt{if (\_cumulativeCashOutWeight != TOTAL\_CASHOUT\_WEIGHT) revert}.
908
+ \subsubsection{Attestation Withdrawal}
744
909
 
745
- \subsection{Attestation Timing Misconfiguration}
910
+ \textbf{Problem.} Without withdrawal, attestation would be irreversible. Holders tricked into attesting to a fraudulent scorecard (phishing, social engineering) cannot correct their mistake.
746
911
 
747
- \textbf{Severity: Significant.}
912
+ \textbf{Mechanism.} Holders can revoke attestation during the \textsc{active} phase:
913
+ \begin{enumerate}[nosep]
914
+ \item Each attestor's BWA weight is stored: \texttt{attestedWeightOf[msg.sender]}.
915
+ \item \texttt{revokeAttestationFrom(gameId, scorecardId)} subtracts the stored weight from the scorecard's count.
916
+ \item Revocation is only available while the scorecard state is \textsc{active}. Once \textsc{queued} (grace period ended + quorum met), revocations are disabled to prevent attest/revoke griefing.
917
+ \end{enumerate}
748
918
 
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.
919
+ During \textsc{active}, the grace period is still running, giving honest holders time to correct mistakes. Combined with the timelock, the overall correction window spans the grace period plus timelock duration.
750
920
 
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}}$.
921
+ \subsubsection{Scorecard-Aware Attestation Power (BWA Implementation)}
752
922
 
753
- \subsection{Pre-Scoring Scorecard Submission}
923
+ \textbf{Problem.} The raw \texttt{getAttestationWeight} computes attestation power without regard to which scorecard is being attested to. For BWA to function, attestation power must be \emph{scorecard-dependent}: each tier's contribution reduced by $(1 - w_i / W_{\text{total}})$.
754
924
 
755
- \textbf{Severity: Moderate.}
925
+ \textbf{Mechanism.} Modify the attestation flow to be scorecard-aware:
926
+ \begin{enumerate}[nosep]
927
+ \item When \texttt{attestToScorecardFrom} is called, retrieve the scorecard's tier weights.
928
+ \item For each tier where the attestor has power, compute the BWA-reduced weight:
929
+ \[
930
+ \text{power}_i^{\text{eff}} = \text{power}_i^{\text{raw}} \times \left(1 - \frac{w_i}{W_{\text{total}}}\right)
931
+ \]
932
+ \item Sum the effective power across all tiers and record this as the attestation count.
933
+ \end{enumerate}
756
934
 
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.
935
+ \textbf{Storage approach.} The tier weights must be accessible during attestation. Storing weights in the scorecard struct is recommended: written once at submission ($O(N)$ storage, $\sim$400k gas for 128 tiers), read many times during attestation (zero additional calldata per attestation).
758
936
 
759
- \textbf{Recommended fix.} Add a phase check requiring SCORING phase for scorecard submission.
937
+ \textbf{Quorum adjustment.} Under BWA, maximum possible attestation for any scorecard is $(N-1) \times V_{\text{max}}$ (the constant-total invariant). Base quorum is $N_{\text{eligible}} \times V_{\text{max}} / 2$, representing 50\% of raw power. The graduated quorum mechanism (Section 9.4.2) further adjusts this per-scorecard based on concentration, storing the result in \texttt{quorumSnapshot}.
760
938
 
761
- \subsection{Fee Extraction Fragility}
939
+ \subsection{Governance Deadlock Analysis}
762
940
 
763
- \textbf{Severity: Moderate.}
941
+ The following table summarizes all governance deadlock scenarios and their resolution:
764
942
 
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.
943
+ \begin{table}[H]
944
+ \centering
945
+ \begin{tabular}{ll}
946
+ \toprule
947
+ \textbf{Scenario} & \textbf{Resolution} \\
948
+ \midrule
949
+ No scorecard submitted & \texttt{scorecardTimeout} $\to$ NO\_CONTEST \\
950
+ Quorum unreachable & \texttt{scorecardTimeout} $\to$ NO\_CONTEST \\
951
+ Dead delegate & \texttt{scorecardTimeout} $\to$ NO\_CONTEST \\
952
+ Dead attestation holders & \texttt{scorecardTimeout} $\to$ NO\_CONTEST \\
953
+ Split target reverts & try-catch $\to$ fee stays in pot $\to$ game continues \\
954
+ All minters refund & Treasury = 0, nothing to recover \\
955
+ Insufficient participation & \texttt{minParticipation} $\to$ NO\_CONTEST \\
956
+ \bottomrule
957
+ \end{tabular}
958
+ \caption{Governance deadlock scenarios and resolutions.}
959
+ \end{table}
766
960
 
767
- \textbf{Recommended fix.} Set \texttt{minTokensPaidOut} to~0 or to the expected fee amount.
961
+ Every deadlock scenario is resolved by either \texttt{scorecardTimeout} or \texttt{minParticipation}, provided these optional parameters are set. A game with both set to~0 relies on the delegate and community coordination.
768
962
 
769
963
  %==========================================================================
770
964
  \section{Conclusions and Practical Implications}
@@ -772,29 +966,32 @@ In \texttt{fulfillCommitmentsOf}, the function calls \texttt{sendPayoutsOf} with
772
966
 
773
967
  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
968
 
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).
969
+ \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. The on-chain exact-sum validation ($\sum w_i = W_{\text{total}}$) provides a hard guarantee that no prize pool value is trapped.
970
+
971
+ \textbf{Governance Security.} The attestation model achieves a balance between decentralization and efficiency. Section~9.2 introduces \textbf{benefit-weighted attestation} (BWA): the ``perfect proportion'' where a tier's governance power for a given scorecard equals $V_{\text{max}} \times (1 - w_i / W_{\text{total}})$. This structural mechanism makes self-serving scorecards unratifiable regardless of attacker capital. The dead token economics prove that even attacks overcoming BWA are unprofitable: tokens purchased for governance power in non-winning tiers return \$0 under the fraudulent scorecard, creating a guaranteed loss when combined with fee extraction. Section~9.3 formalizes the Uniform Participation Theorem, proving that games with equal tier supply are impervious to profitable governance attacks.
776
972
 
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.
973
+ \textbf{Safety Mechanisms.} The NO\_CONTEST system (Section~9.1) provides comprehensive fund-recovery guarantees through minimum participation thresholds, scorecard timeouts, and the default attestation delegate---layered safety where each mechanism covers the failure modes of the others.
778
974
 
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.
975
+ \textbf{Market Efficiency.} The equilibrium analysis demonstrates convergence to the classical parimutuel result: mint fractions equal consensus probabilities. The uniform pricing enforced by the protocol ensures clean dynamics. The three-round information structure (mint $\to$ refund $\to$ secondary) provides richer information aggregation than single-shot mechanisms.
780
976
 
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.
977
+ \textbf{Protocol Sustainability.} The 7.5\% default fee rate (5\% Defifa + 2.5\% base protocol) positions Defifa competitively with traditional parimutuel systems (15--25\%) while the protocol token rebate further reduces the effective rate.
782
978
 
783
979
  \textbf{Practical Recommendations.}
784
980
  \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.
981
+ \item \textbf{Participation uniformity is paramount}: The Uniform Participation Theorem (Section~9.3) proves games with equal tier supply are impervious to profitable governance attacks. Choose events where all tiers attract organic interest.
982
+ \item \textbf{Tier count}: 4--32 tiers. Only add tiers that will attract meaningful participation; empty tiers are cheap governance power for attackers.
983
+ \item \textbf{Reserve tokens}: Configure reserved rates on every tier to smooth supply and dilute attacker ownership in sparse tiers.
984
+ \item \textbf{Pricing}: 0.01--0.1~ETH per NFT for accessibility and attack resistance.
787
985
  \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).
986
+ \item \textbf{Attestation}: Trusted default delegate; 3--7 day grace period.
987
+ \item \textbf{Fees}: Default 7.5\% is competitive; organizer splits should not exceed 5\%.
988
+ \item \textbf{Safety}: Always set \texttt{scorecardTimeout} (90--180 days) and \texttt{minParticipation} for permissionless games.
792
989
  \end{enumerate}
793
990
 
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.
991
+ \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 V6 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
992
 
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.
993
+ 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 twelve parameters (Eq.~1), executed deterministically by immutable smart contracts with a single, time-bounded governance input. From a 4-team presidential election to a 32-team World Cup, the same protocol handles it all---and the safety mechanisms ensure that every game resolves, one way or another.
797
994
 
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.
995
+ The most significant finding is the Uniform Participation Theorem: \textbf{a game with uniform tier supply is provably impervious to profitable governance attacks regardless of attacker capital.} This transforms game design from an art into an engineering discipline---the designer's job is to choose events and tier structures that naturally produce uniform participation, and the cryptoeconomics handle the rest.
799
996
 
800
997
  \end{document}