---
name: house-bsc
description: Pull, sell back, stake, seed float and redeem on HOUSE — the on-chain graded card gacha on BNB Smart Chain (chainId 56) — and open real Collector Crypt (Solana) packs through the HouseBridge shelf, from a Binance Agentic Wallet via the `baw` CLI.
---

# HOUSE skill

Use this skill when the user wants to open packs ("pull"), sell a pulled card back, stake a card
NFT, seed buyback float, link a browser wallet, or redeem HOUSE on BNB Smart Chain mainnet —
or open a Collector Crypt gacha pack ("shelf" / "order") paying USDT on BSC and manage the
resulting wrapped card (HVC): sell back, unwrap to Solana, redeem the physical slab.

Network: BSC mainnet, `--binanceChainId 56`. All amounts are 18-decimal integers.

## Addresses

| contract | address |
|---|---|
| BandMachine | `0x737C1A7Eb1511c2d658d1f8A22C0be9AFFfAf9A3` |
| HouseBridge (Collector Crypt shelf + HVC ERC-721) | `0x92ddC0451d30dD59eFf2AFCdA2cECEe5f272F15C` |
| HouseVault | `0x614D83ee542e8CAe74Aa964983C98e39191AFf60` |
| AgentLink | `0x49a5F168B536692caDe7B91A3f56c329231Aecf8` |
| Appraisal | `0xaCc486Cff02728052188E2e31a0C9cc4532Cd7Ad` |
| PriceOracle | `0x2FE203C7d58D62cC5C2228c3Fa7E3c7E892AdF5c` |
| HOUSE token | `0x0000000000000000000000000000000000000000` |
| USDT | `0x55d398326f99059fF775485246999027B3197955` |
| Agent ID (.ai) | `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F` |
| Renaiss cards | `0xF8646A3Ca093e97Bb404c3b25e675C0394DD5b30` |

Zero addresses mean the contracts are not deployed yet — stop and tell the user.

## Tooling

Every write is two steps:

```
baw contract-call preview --binanceChainId 56 --from <agentWallet> --to <contract> --value 0 --inputData <calldata> --json
baw contract-call execute --requestId <requestId-from-preview> --json
```

Reads can be done with any BSC JSON-RPC (`eth_call`) — e.g. `https://bsc-dataseed.bnbchain.org`.
Calldata = 4-byte selector + ABI-encoded args (addresses left-padded to 32 bytes, uints big-endian 32 bytes,
bools as 0/1 in 32 bytes).

## Procedure: pull a card

1. Eligibility: `eth_call` `AgentLink.isAgent(agentWallet)` (`0x1ffbb064`). Must return true.
2. Pick a band: 0 Bronze (genesis), 1 Silver, 2 Gold, 3 Grail. Read `price(band)` (`0xb7fafcd7`).
   If it is 0 the band is closed (fewer than `MIN_POOL()` = 20 cards) — use Bronze or tell the user.
3. Read `floatNeeded(band)` (`0xf1de243d`). If > 0 the pull would revert `InsufficientFloat`;
   either seed that much float (see below) or stop.
4. `total = price + price / 100`.
5. Approve USDT: to `USDT`, calldata `0x095ea7b3 + pad(BandMachine) + pad(total)`.
6. Boost (optional): read `boostCost(band)` (`0x9e24b5cf`). If 0, HOUSE is not live — do not boost.
   Otherwise approve HOUSE: to `HOUSE`, `0x095ea7b3 + pad(BandMachine) + pad(boostCost)`.
7. Pull: to `BandMachine`, calldata `0x5fe32b8e + pad(band) + pad(boost ? 1 : 0)`.
8. Read `requestId` from the `PullRequested` log in the receipt
   (topic0 `0x317b132d…df19`, requestId is topic1).
9. Poll `pullInfo(requestId)` (`0xcf0ee1b8`) every ~5 s until `state != 0`.
   Decode the returned Pull struct: (player, band, boost, price, collection, tokenId, book, windowEnd, state, provisional).
   - state 1 InWindow: report collection, tokenId, book, windowEnd.
   - state 4 Refunded: the pool emptied before the VRF callback; `price` USDT was returned. Report and stop.

## Procedure: sell back (within 72 h)

1. `ERC721(collection).approve(BandMachine, tokenId)` → `0x095ea7b3 + pad(BandMachine) + pad(tokenId)` sent to `collection`.
2. `BandMachine.sellBack(requestId)` → `0xad5d4bc5 + pad(requestId)`.
   Pays `0.9 * book` USDT. Must happen while `state == 1` and before `windowEnd`.

To keep the card do nothing. After `windowEnd` anyone may call `settleKept(requestId)` (`0x734a6057`).

## Procedure: seed float

Float guarantees the 90% buyback for every possible outcome. `floatNeeded(band)` says how much is missing.

1. Approve USDT to BandMachine for the amount.
2. `seedFloat(band, amount)` → `0x356f1624 + pad(band) + pad(amount)`.
3. Later `withdrawFloat(band, amount)` (`0xd9dd793e`) up to `floatOf(band, you)` (`0x1cb4bf8d`), only when
   the band has no open windows or owed book (else reverts `FloatLocked`).

## Procedure: link a browser wallet

From the Agent ID holder: `AgentLink.link(operator)` → `0x91a89712 + pad(operator)` sent to `AgentLink`.
The operator can then pull from the website. `unlink()` = `0x565a8a3e`.

## Procedure: stake

1. `Appraisal.bookOf(collection, tokenId)` (`0x52af443f`) must be ≥ 5e18. `bandOfBook(book)` (`0xeecc72c2`) gives the band.
2. `setApprovalForAll(BandMachine, true)` → `0xa22cb465 + pad(BandMachine) + pad(1)` to `collection`.
3. `BandMachine.stake(collection, tokenId)` → `0xadc9772e + pad(collection) + pad(tokenId)`.
4. Later: `claimRewards()` `0x372500ab`, `claimOwed()` `0xf2652d9c`,
   `requestUnstake` `0x710ba631` (not while the card is in a buyback window), after 7 days `unstake` `0xc2a672e0`.
   `stakesOf(staker)` (`0x33b69c4c`) returns 6 arrays: collections, tokenIds, bands, states, books, unstakeAt.

## Procedure: open a Collector Crypt pack (shelf)

HouseBridge escrows USDT; a relayer buys + opens the real pack on Solana and mints you a wrapped
card ERC-721 (HOUSE Vault Card, HVC — the HouseBridge contract itself). Fee is 3% (`FEE_BPS` = 300).

1. Eligibility: `AgentLink.isAgent(agentWallet)` (`0x1ffbb064`) must be true — same gate as pull.
2. Pick a machine. Codes are slugs like `pokemon_50`, `pokemon_100`, `onepiece_50`, `sports_100`,
   `lorcana_50`, `riftbound_100`, `dragonball_250`, `ewatch_250` … Fetch the list with
   `GET https://house-bsc.fly.dev/api/cc/machines` (name, price USD, ev, odds, tierRanges, stock, images).
   Encode: `bytes32 code = right-padded ASCII` (viem `stringToHex(code, { size: 32 })`), e.g.
   `pokemon_50` → `0x706f6b656d6f6e5f353000000000000000000000000000000000000000000000`.
   `machines(code)` (`0x33bf4285`) must return `active == true`, else `order` reverts `MachineInactive`.
3. `quote(code)` (`0x15f05b05`) → `(price, fee, total)`. Show the user `total` (USDT, 18 dec).
4. Approve USDT: to `USDT`, calldata `0x095ea7b3 + pad(HouseBridge) + pad(total)`.
5. Order: to `HouseBridge`, calldata `0xe80160ab + code` (code is already 32 bytes).
6. Read `orderId` from the `OrderPlaced` log in the receipt (topic0 `0x7f49c3ab…1fb8`, orderId = topic1).
7. Poll `orderInfo(orderId)` (`0x6ab34a4a`) every ~4 s. Decode
   `(player, machine, price, fee, createdAt, state, tokenId)`; state 0 None, 1 Placed, 2 Fulfilled, 3 Refunded.
   - state 2: the HVC `tokenId` is in the wallet. Read `cardInfo(tokenId)` (`0xf77843dd`) →
     `(orderId, player, payee, ccMint, name, memo, solTx, tier, insuredValueCents, buybackBps, windowEnd, state, target)`.
     tier 1 Epic / 2 Rare / 3 Uncommon / 4 Common. Report name, tier, insured value (cents / 100 USD),
     and links `https://collectorcrypt.com/assets/solana/<ccMint>`, `https://solscan.io/tx/<solTx>`,
     VRF proof `https://gacha.collectorcrypt.com/api/vrf/verify?memo=<memo>`. Image: `GET /api/cc/cards/<tokenId>`.
   - state 1 for longer than `REFUND_AFTER()` (`0x19f2ed4d`, 3600 s) after `createdAt`: the player may call
     `refund(orderId)` → `0x278ecde1 + pad(orderId)` and get price + fee back. Ask the user first.
   - state 3: refunded; report and stop.

## Procedure: manage a wrapped card (HVC)

Card states: 0 None, 1 Held, 2 SellRequested, 3 SoldBack, 4 UnwrapRequested, 5 Unwrapped, 6 RedeemRequested, 7 Redeemed.
All three requests need card state 1 and `msg.sender == ownerOf(tokenId)`.

- Sell back (before `windowEnd`, 72 h after fulfilment): `requestSellBack(tokenId)` → `0x5cf3c06d + pad(tokenId)`.
  Payout ≈ `insuredValueCents / 100 × buybackBps / 10000` USDT, paid by the relayer (`SellBackSettled`).
  If the bridge treasury is short the relayer reverts the request to Held (`SellBackReverted`) — tell the user.
- Unwrap to Solana: `requestUnwrap(tokenId, solanaAddress)` → `0x44d28bb6 + pad(tokenId) + abi.encode(string)`
  (offset 0x40, length, UTF-8 bytes padded). The relayer transfers the Collector Crypt NFT to that address and burns the HVC. Irreversible — confirm the address with the user.
- Redeem physical: `requestRedeem(tokenId, reference)` → `0x38f73a37 + pad(tokenId) + abi.encode(string)`.
  `reference` = shipping reference or contact email.
- Keep / stake: the HVC is a normal ERC-721 and is whitelisted in BandMachine (collection = HouseBridge);
  follow "Procedure: stake" with `collection = HouseBridge`.
- Reads: `cardsOf(owner)` (`0xc7e93f2c`), `ordersOf(player)` (`0xfaae3a6c`).

## Procedure: redeem HOUSE

1. `HOUSE.approve(HouseVault, amount)`.
2. `HouseVault.redeem(amount)` → `0xdb006a75 + pad(amount)`. Pays `amount * nav() * 0.97`.

## Procedure: buyback (anyone)

When `housePriceUsdt() < 0.97 * nav()`: `buybackBelowNAV(usdtIn, minHouseOut)` → `0x6223ea03 + pad(usdtIn) + pad(minHouseOut)`,
with `usdtIn ≤ buybackRemainingToday()` (`0xe3498366`). Compute `minHouseOut` from spot with a slippage margin.

## Safety

- Never send BNB value; all calls are `--value 0`.
- Always run `preview` and show the user the decoded action before `execute`.
- Approvals should be exact amounts, not unlimited.
- Prices change as cards enter/leave a pool; re-read `price(band)` and `floatNeeded(band)` right before approving.
- Shelf: re-read `quote(code)` right before approving; never call `refund` before `createdAt + REFUND_AFTER`
  (reverts `TooEarly`); `requestUnwrap` is irreversible — confirm the Solana address.

See `/llms.txt` for the full selector and event list.
