Protocol & Security·6 min read

Contracts, fees and owner permissions

How ERC-404R pools are built, where fees go, what each owner can change, and the addresses of the testnet deployment.

Protocol and pool

ERC-404R is the rule-agnostic layer: a factory, and for each pool a token, a mirror NFT, a vault, a receipt, an escrow, a swap tax hook and a swap router. A pool’s behaviour comes from one rule module. PACK is the first pool. Its rule module, PackGachaController, implements the random draw and is the only rule set that exists.

  • A pool is created in two transactions. createPool deploys the token, mirror NFT, vault, receipt and escrow. launchPool attaches the rule module, hook and router, distributes the supply and hands ownership to the curator.
  • A rule module must come from a deployer that protocol governance has enabled.
  • Each rule module reports ruleSetId() and, for every mirror NFT, tokenState(tokenId). PACK’s states are SEALED, PENDING_VRF, REVEALED, PENDING_GRAIL and DETACHED. My cards shows the state of each pack you hold.
  • The escrow reports custodyStateOf(assetId) for every asset: Pooled, Detached or Redeemed.

Where fees go

FeeRateSplit
Swap tax3% on buys and on sells, paid in BNB. The contract caps it at 5%.The protocol share comes first. The rest is split between the pool vault and the curator. The vault divides its part across the acquisition, reserve and buyback buckets (40 / 40 / 20 at deployment).
Opening and fusion feesSet by the pool owner in BNB, capped at 1 BNB. The app shows the current value.The protocol share comes first. Of the rest, 70% goes to the pool vault and 30% to the curator.
Protocol fee1.67% of the pool fees above. The contracts cap it at 10%.Paid to the protocol fee receiver set on the factory.

Swap tax accrues in the hook until someone calls distributeTax(). Anyone can call it.

How buybacks are funded

  • A buyback pays the pool’s buyback share of the slab’s current appraisal. PACK’s share is 85%, fixed when the pool was created.
  • The BNB comes from the vault’s buyback bucket. No BNB is reserved for a particular slab when it is won, so a buyback fails if the bucket holds less than the payout.
  • The vault operator cannot spend the buyback bucket, and can send acquisition and reserve funds only to destinations the owner has whitelisted. The vault owner is not restricted and can send BNB from any bucket, the buyback bucket included.
  • Appraisals are written on-chain by the pool owner or an updater the owner appoints. The BNB price comes from a Chainlink feed when one is configured, and otherwise from a price the owner sets. Stale values block buybacks.

What each owner can change

ContractOwner actionsLimits in the contract
ERC404RFactorySet the protocol fee and its receiver; enable or disable rule module deployersProtocol fee is capped at 10%
ERC404RTaxHookSet the buy and sell tax and the vault share; set receiversEach tax is capped at 5%
ERC404RVaultSend BNB from any bucket; move vault NFTs; whitelist collections and spending destinations; approve ERC-20 spending; set roles and the bucket splitNone on the owner. The operator cannot use the buyback bucket and is limited to whitelisted destinations
ERC404REscrowSet the BNB price or its feed; set the maximum appraisal age; change the vault that pays buybacksThe buyback share is fixed at creation and the rule module can be set only once. A manually set price expires after one day
PackGachaControllerRegister and remove slabs; update appraisals; set fees, odds and the holding period; set the daily budget; fund or defund the prize reserve; change VRF settingsGrail chance is capped at 20%, the holding period at 7 days and each fee at 1 BNB. A new VRF coordinator takes effect after a 2-day delay
PackGenesisMintCancel the sale; recover unsold tokens; open the pool after a failed saleAnyone can call finalize() once the sale sells out or ends above its softcap. Refunds open if the sale is cancelled, misses its softcap or is not finalized in time

Trust assumptions

The pool owner sets appraisals, fees and odds within the caps above, and can move NFTs out of the vault. On the testnet deployment, protocol governance and the fee receiver are the deployer’s address. The contract sources are not yet verified on BscScan.

Testnet contract addresses

BNB Chain Testnet (chain ID 97). The app uses the addresses in its own configuration, so compare them with this list before you sign.

ContractAddress
ERC404RFactory0x598cc8918AF48CF151B80e5f4B119Dca7A5CE74d
PackGachaDeployer0xdCeF80c1919E75E5f9F957d0a4b44ED660592679
ERC404RToken ($PACK, pool 1)0xde75b51C2ae14feaa541A6695D5a725F483Ca1FD
ERC404RMirror0x26289D96A80101bA47D3E204eb367C04eb6477b5
ERC404RTaxHook0xbC20b9Dc1efBC4CE91A6779344284F298dBA5834
ERC404RSwapRouter0xE390046a6a2245E2e4552f405Fdb9bE0eaf12cdC
ERC404RVault0x94aa1A414334F6cF00ADd121d693099B037937CA
ERC404RReceipt0x4EC649c220917130cf73f28f27EF531c4785e743
ERC404REscrow0xd6A02d70c62d9A96803fe2DEa4c03De22fD870af
PackGachaController0xDC4B188Abb524330d5A5c050B23Eb91cD0533c62
PackGenesisMint0x15aC393661d8943f202FF776Ba009c4F8B2BF18f
PackVesting0x0f4B6c6e37Ca1920652cCED05c195DeA1B721c85