Play for NFTs

Abierto
#196 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
blockchain, typescript

Línea de trabajo

The repository is described as front-end TypeScript code for tables and lobbies, but no files, tests, or entry points are named. Trace table creation for tournament and SNG flows, then examine how the vault contract and Cosmos wallet plus MetaMask signing would fit. Done means an owner can deposit an NFT as the prize and the winner can redeem it.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement epic feature idea fairy sit-and-go

Epic: Play for NFTs — ETH escrow keyed by gameId, validator-signed release

Design doc: ui/docs/designs/play-for-nft.md (committed on the Play-for-NFT design branch).

A Sit & Go creator escrows an ERC-721 NFT on Ethereum as the prize. The poker-chain runs the SNG as normal. When it resolves, the winner pulls the NFT out of escrow by presenting a validator-signed unlock — the same single-validator ECDSA scheme the USDC withdrawal bridge already uses. If the SNG is cancelled before a winner exists, the chain issues a validator-signed refund to the depositor.

Locked decisions
  • Scope: SNG only, winner-takes-all (one prize NFT → 1st place; no place tiers).
  • Prize source: creator escrows the NFT at table creation.
  • Escrow deposit: one transaction via onERC721Received (NFT's own safeTransferFrom(creator, escrow, tokenId, abi.encode(gameId)) — no approve, no separate entrypoint).
  • Unlock auth: reuse the bridge's single-validator signing — EIP-191 keccak256, verified against Vault.isValidator.
  • Release: winner pulls and pays ETH gas; no relayer / gasless path.
  • Refund: chain-signed REFUND to the depositor on cancellation.
  • Winner ETH address: provided at claim; the chain signs only for the recorded winner's cosmos identity.
Why it's mostly reuse

SngWinNFT.claim(...) is already a validator-signed, double-claim-guarded ERC-721 grant verified by IValidator(vault).isValidator(). The escrow is the same pattern with the asset held and released instead of minted. Signing reuses WithdrawalSigningHash / BuildWithdrawalSignature; the whitelist reuses Vault.isValidator. The genuinely new pieces are one contract and a few x/poker messages.

Signed unlock message

EIP-191( keccak256( abi.encodePacked(gameId, recipient, kind, nonce) ) ), kind ∈ {1 WIN, 2 REFUND}. Structurally identical to the withdrawal hash (receiver, amount, nonce).

Work breakdown (child issues)
  • #755 — NFTPrizeEscrow.sol contract + tests
  • #756 — x/poker chain messages + signing helper
  • #757 — Gateway indexer: observe PrizeDeposited / PrizeReleased
  • #758 — UI: escrow-at-creation flow + winner claim flow
End-to-end flow
CREATE   creator → MsgCreateGame → gameId
         creator → ERC721.safeTransferFrom(creator, escrow, tokenId, abi.encode(gameId))  [1 tx]
         gateway observes PrizeDeposited → MsgConfirmNFTPrizeDeposit(gameId)  (SNG start gated on confirmed)
PLAY     normal SNG; engine records winner in GameState.Results
WIN      winner → MsgRequestNFTUnlock(gameId, recipientEth)  (chain verifies caller == winner)
         validators sign → winner → NFTPrizeEscrow.release(gameId, recipientEth, WIN, nonce, sig)  [winner pays gas]
CANCEL   chain marks cancelled → depositor → MsgRequestNFTUnlock(gameId, depositorEth)
         validators sign → depositor → release(gameId, depositorEth, REFUND, nonce, sig)

See the design doc for the full contract sketch, chain state/messages, edge cases, and reuse map.

Lenguaje dominante
TypeScript
Estrellas
2
Forks
5
Merge medio
22 h 35 min
PR fusionados (30 d)
91

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de block52/ui

Todos los issues de block52/ui

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.