Skip to content

feat(blockchain): crypto ticket settlement on-chain via mintTicket - #98

Merged
manoahLinks merged 1 commit into
mainfrom
feat/crypto-settlement
Jul 17, 2026
Merged

feat(blockchain): crypto ticket settlement on-chain via mintTicket#98
manoahLinks merged 1 commit into
mainfrom
feat/crypto-settlement

Conversation

@manoahLinks

Copy link
Copy Markdown
Contributor

Route crypto purchases through the paid mintTicket instead of the free mintFiatTicket: the buyer's own (gas-sponsored) wallet approves USDC and calls the Diamond, which splits revenue on-chain by isRefundable — instant to the organizer for non-refundable events, escrow for refundable — and mints the NFT to the buyer. Fiat purchases keep the free mint.

  • onchain-fees.ts: shared FeeType codes + organizer-bears fee helper (ticketFee = price * 10000/(10000+bps)) so the buyer pays the face price on both rails, mirroring the contract's integer fee math.
  • events publish + crypto-checkout consume the helper — single source of truth for the on-chain ticketFee and the deposit amount.
  • crypto-checkout: deposit = totalFee * quantity (exactly what mintTicket pulls per mint) instead of the raw NGN->USDC conversion.
  • CircleContractService: approveErc20 for the USDC allowance leg + a non-persisting pollUntilTerminal for the untracked approve tx.
  • mint worker: read the authoritative on-chain totalFee, approve, then mintTicket signed by the buyer wallet; fiat path unchanged (treasury).

Refs #96

Route crypto purchases through the paid `mintTicket` instead of the free
`mintFiatTicket`: the buyer's own (gas-sponsored) wallet approves USDC and
calls the Diamond, which splits revenue on-chain by `isRefundable` —
instant to the organizer for non-refundable events, escrow for refundable
— and mints the NFT to the buyer. Fiat purchases keep the free mint.

- onchain-fees.ts: shared FeeType codes + organizer-bears fee helper
  (ticketFee = price * 10000/(10000+bps)) so the buyer pays the face price
  on both rails, mirroring the contract's integer fee math.
- events publish + crypto-checkout consume the helper — single source of
  truth for the on-chain ticketFee and the deposit amount.
- crypto-checkout: deposit = totalFee * quantity (exactly what mintTicket
  pulls per mint) instead of the raw NGN->USDC conversion.
- CircleContractService: `approveErc20` for the USDC allowance leg + a
  non-persisting `pollUntilTerminal` for the untracked approve tx.
- mint worker: read the authoritative on-chain totalFee, approve, then
  mintTicket signed by the buyer wallet; fiat path unchanged (treasury).

Refs #96
@manoahLinks
manoahLinks merged commit 54beb2b into main Jul 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant