Playbook

BareToken: NFT (Non-Fungible Token)-Gated Emissions and Abuse (Baretoken Nft Gated Emissions And Abuse)

Hashmasks-style NFT-gated claims: ~10e18/day, INITIAL_ALLOTMENT, 10-year emissionEnd — plus open mint surface and abuse scenarios.

Bare Crypto Solidity Marketplace Protocol

Part 5 of 5

BareNFT, reserve escrow, English auction, and NFT-gated BareToken emissions built in Remix IDE with OpenZeppelin v4.1 GitHub imports — no Hardhat/Foundry — covering ADRs, weak RNG, and emergency-power trade-offs.

Bare Crypto Solidity marketplace protocol diagram

Hold the NFT (Non-Fungible Token), claim daily emissions — but are the doors locked?

BareToken is a Hashmasks-like ERC20 emission engine: emissionPerDay about 10 * 10^18, INITIAL_ALLOTMENT 1830e18, emissionEnd = start + 10 years. claim(tokenIndices) mints accumulated balances only to BareNFT owners; _lastClaim tracks each tokenId. Yet a public mint(address, value), confused spender/burner roles, and a burn that targets address(this) open the economy to abuse.

BareNFT ownerOf(tokenId) == msg.sender
        |
   accumulated(tokenId)
     lastClaim → now * emissionPerDay / day
     + INITIAL_ALLOTMENT (first claim)
        |
   claim([ids]) → _mint ERC20
        |
   abuse doors: public mint(), role confusion, burn quirk

This part locks the NFT-gated emission ADR, the 10-year horizon, and abuse scenarios.

Concepts, defined where they first appear

📦 NFT-gated emission
Tying ERC20 claim rights to ERC721 ownership.

📦 INITIAL_ALLOTMENT
Fixed bonus on first claim (1830e18), optionally scaled by pre-reveal.

📦 emissionEnd
start + 86400*365*10 — a ten-year emission horizon.

📦 Per-token lastClaim
Each NFT index carries its own emission clock.

A Hashmasks-style model attaches cashflow to the NFT; a public mint or wrong role breaks the economy in one transaction.

ADR: Hashmasks-style 10-year emissions

Decision: BareToken accrues about 10e18 per day for NFT holders, mints on claim, adds INITIAL_ALLOTMENT on first claim, and ends emissions after 10 years. Rationale: holding incentive and a long supply curve. Cost: the contract binds tightly to the BareNFT address (setBareAddress once) and to ownership checks; IBareToken.isMintedBeforeReveal is expected on the collection side.

Claim accounting and diagram

accumulated multiplies seconds between lastClaim (or emissionStart) and now by emissionPerDay / SECONDS_IN_A_DAY; after emissionEnd it returns zero. First claim adds INITIAL_ALLOTMENT (+ PRE_REVEAL_MULTIPLIER). claim checks duplicates and ownerOf in the index array, updates _lastClaim, and mints the sum.

emissionStart ──10y──> emissionEnd
per NFT:
  lastClaim[i]
     |
     v
  qty = dt * 10e18 / 86400
     + (first ? 1830e18 : 0)
claim(ids) → mint to holder

Abuse and performance scenarios

Public mint(to, value) can inflate supply with no role check — instantly breaking the emission model. isSpender reads MINTER_ROLE while _addSpender writes BURNER_ROLE — confused role semantics. burn rewrites the account to address(this) — it does not burn the caller's balance as users expect. Abuse: flash-style acquire-claim-sell in one block can skim accrued value or break UI assumptions around lastClaim. Performance: large tokenIndices arrays plus O(n^2) duplicate checks bloat claim gas; whale batch claims can approach block limits.

The mappings that get confused most often

❌ NFT-gated claim means supply is safe
✓ If public mint or wrong roles exist, gated claim cannot save the economy

❌ INITIAL_ALLOTMENT is added on every claim
✓ It is added only once when lastClaim equals emissionStart

❌ burn always burns msg.sender balance
✓ In this implementation burn redirects the account to address(this) — quirky and dangerous

A checklist for auditing your own system

  1. Who can call mint(address, value), and is there a role gate?
  2. Is setBareAddress one-shot locked or mutable?
  3. How does the UI show INITIAL_ALLOTMENT on first claim?
  4. How does same-block buy-claim-sell affect lastClaim?
  5. What is the gas cost of duplicate checks on large tokenIndices claims?

What to take away from this part

  1. BareToken is a Hashmasks-style NFT-gated daily emission ADR with a 10-year horizon.
  2. Public mint and role/burn quirks mean gating alone does not secure the economy.
  3. Claim gas and flash-ownership abuse belong in the emission design tests.

Gated emissions are a story; an open mint door ends that story in one transaction.

FAQ

Frequently asked questions

What is NFT-gated emission?

Tying ERC20 claim rights to ERC721 ownership.

What is INITIAL_ALLOTMENT?

Fixed bonus on first claim (1830e18), optionally scaled by pre-reveal.

Is it true that "NFT-gated claim means supply is safe"?

If public mint or wrong roles exist, gated claim cannot save the economy

What does this part lock in?

This part locks the NFT-gated emission ADR, the 10-year horizon, and abuse scenarios. BareToken is a Hashmasks-like ERC20 emission engine: emissionPerDay about 10 * 10^18, INITIAL_ALLOTMENT 1830e18, emissionEnd = start + 10 years. claim(tokenIndices) mints accumulated balances only to BareNFT owners; _lastClaim tracks each tokenId. Yet a public mint(address, value), confused spender/burner roles, and a burn that targets address(this) open the economy to abuse.

Engineering Principles Learned

  • An NFT-gated emission ADR must cover mint/burn/role surfaces in the same threat model.
  • Initial allotment and daily rate must match between UI and on-chain accounting.
  • Claim batch size and ownership-flash scenarios must be written as performance and abuse tests.

Continue reading

Continue reading

Next in series

Same series

Same series

Paylaş