Skip to content

v0.1.5

Latest

Choose a tag to compare

@starknetdev starknetdev released this 20 May 16:34
66ba245

Note: This tag was force-recreated to point at the post-#26 merge commit. The previous v0.1.5 content (extension self-validation refactor) is preserved in commit history but no longer addressable by tag; pin to the SHA `af14d8f` if you need it.

Breaking changes: extension trait simplification

Standardises both extension traits on (token_id: Option<felt252>, payout_params: Span<felt252>) as the sovereign dispatch surface. Extensions own recipient resolution, eligibility checks, and asset transfer. The host is a pure dispatcher.

New shapes

fn payout_prize(ctx_id, prize_id, token_id: Option<felt252>, payout_params)
fn payout_entry_fee(ctx_id, token_id: Option<felt252>, claim_params)

Conventions

  • token_id = Some(id) — claim path. Extension typically derives recipient via owner_of(id).
  • token_id = None — non-claim flow (sponsor refund, dao distribution, raffle). Extension extracts whatever it needs from payout_params.

Why

  • Position-based payout_* forced every extension into a leaderboard-winner-as-recipient frame. Non-leaderboard extensions had to shoehorn into positional semantics or stuff identity into payout_params.
  • Host-supplied recipient meant the host had to know what the extension would compute. For non-positional extensions the host has nothing to compute, so the parameter was dead weight.

Preset adaptations

Preset Claim path Refund path
NFTPrize ILeaderboard::get_position(token_id) → position; recipient = owner_of(token_id) payout_params[0] = slot_index; verifies slot > leaderboard_length; recipient = stored sponsor
NFTEntryFee Same pattern as NFTPrize claim_params[0] = slot_index; recipient = stored escrowed_payer
DynamicEntryFee Ignores token_id (single-pool); pays configured recipient n/a

externals

ILeaderboard stub gains get_position(context_id, token_id) -> Option<u32> — the reverse position lookup used by token-keyed extensions (NFTPrize, NFTEntryFee).

SRC5 IDs

Regenerated via src5_rs:

  • IPRIZE_EXTENSION_ID = 0x2601108a8735e986bb3fcf7f163f947c742c853768126b57f7d26ac26acfe7d
  • IENTRY_FEE_EXTENSION_ID = 0x127f41894efc483809bcb4854be559dc21fa0b2df7fe79bf59ccfbfa3719054

Per-method extended function selectors recorded in the docstrings above each constant.

See #26 for full implementation details.