Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ apps/app/
apps/landing/
apps/automation-marketing/
apps/dashboard/
apps/automation-wallet/

apps/docs/
packages/contracts/
1 change: 1 addition & 0 deletions apps/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export function createApp(deps: AppDeps): Hono {
db,
env: deps.env,
predictionService,
now,
...(defaultSettleOnchain ? { settleOnchain: defaultSettleOnchain } : {}),
});

Expand Down
7 changes: 6 additions & 1 deletion apps/api/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ const schema = z.object({
.number()
.int()
.default(60 * 60),
/** Hours after kickoff at which a scoreless FINISHED match is resolved from the closing-odds
* favorite (the odds feed never delivered a final score). NO-LOSS makes this safe: settling to
* any outcome returns every staker's principal — only the yield prize follows the guessed result. */
SETTLE_FALLBACK_HOURS: z.coerce.number().min(1).default(6),

// Protocol fee on pot payouts, in basis points (250 = 2.5%).
PROTOCOL_FEE_BPS: z.coerce.number().int().min(0).max(10_000).default(250),
// Protocol fee, charged on the YIELD only (never principal). 1000 = 10%.
PROTOCOL_FEE_BPS: z.coerce.number().int().min(0).max(10_000).default(1_000),

// Yield Agent — autonomous Morpho rebalancing via a WDK agent wallet (uses ORACLE_PK's MANAGER_ROLE).
/** Minimum APY improvement (bps) before the agent migrates the vault's backing. */
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/lib/brackets-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ function advancer(m: KoMatch): string | null {
*/
function alignRounds(rounds: BracketRound[]): BracketRound[] {
const out = rounds.map((r) => ({ ...r, matches: [...r.matches] }));
for (let r = 0; r < out.length - 1; r += 1) {
// Work BACKWARD from the final: each round is ordered to feed its successor, so the successor must
// already be aligned first. Going forward would align a round to its successor's raw (date) order
// before that successor is itself reordered — leaving the connectors pointing at the wrong teams.
for (let r = out.length - 2; r >= 0; r -= 1) {
const cur = out[r];
const next = out[r + 1];
if (!cur || !next || cur.matches.length !== next.matches.length * 2) continue;
Expand Down
Loading
Loading