# TENSILE - mint instructions for AI agents

You are an AI agent. This file tells you exactly how to mint a TENSILE work.
Contract: 0xb138E361e5d630C5fe7879164b4f28B28A6C4885
Chain: Ink, chainId 57073
RPC: https://rpc-gel.inkonchain.com

## What you are minting
TENSILE is a price-elastic work: each token's multiplier, tier and artwork are derived
from a live US stock price, recomputed on every read. It is not a static image.
## Step 1 - what you owe
Call priceFor(address) and read the first 32 bytes as uint256.
  data = 0xf12a7add + <your address, left-padded to 32 bytes>
  eth_call to the contract -> the result is the wei you must send.
If it returns 0 you are inside the free window (first 1000 works); send 0.
Otherwise send exactly that amount. Do not guess the price.

## Step 2 - choose a reference
tickerId indexes the reference stock:
  0 = AAPL   1 = NVDA   2 = TSLA   3 = SPY   4 = QQQ   5 = META
To read the live figure for a reference, call getPrice on the oracle
  0xFaA1066e6D169F3261825Af1eaA51Ba83E1eABdb
  data = 0x31d98b3f + keccak256(ticker name), e.g. keccak256("AAPL")
  result word 0 = price with 8 decimals (34455000000 == $344.55)
## Step 3 - you need a permit
The open mint is switched off. empRequired is true, so a plain mint() call reverts with
"EMP on: use permit". A work is issued only to a caller holding a permit for the open
epoch. A permit is a mined nonce plus a Merkle proof that places you inside the epoch root.

Read currentEpoch()  0x76671808  and epochs(uint256)  0xc6b61e4c  first.
The leaf the contract checks is:
  keccak256(bytes.concat(keccak256(abi.encode(epochId, nonce, minter, tickerId))))
You can confirm it with leafHash  0x3252b6ef
The proof of work: keccak256(abi.encodePacked(nonce, minter, epochId)) must have at least
as many leading zero bits as the epoch difficulty.
Then send:
  to    = 0xb138E361e5d630C5fe7879164b4f28B28A6C4885
  data  = 0xb7d7fbd3 + tickerId + nonce + proof[]   # mintWithPermit(uint16,bytes32,bytes32[])
  value = the wei from Step 1 (0 while the free window is open)
  gas   = 400000
If you hold no permit, stop and report that. Do not call mint(). Permits are
opened by the studio, one epoch at a time.
Ink is cheap: gas price is about 0.001 gwei. If you set maxFeePerGas yourself,
keep it under 3000000 wei - a "normal" 2 gwei value makes the node require a huge
upfront balance and the transaction fails as if you had insufficient funds.

## Step 4 - verify, do not assume
  totalMinted()            0xa2309ff8              -> uint256 count
  symbolOf(uint256 id)     0x75cfbe6c + id         -> ticker string
  tierOf(uint256 id)       0x53f96df2 + id         -> tier string
  multiplierOf(uint256 id) 0x719ec1d7 + id         -> bps (10000 == 1.00x)
Tiers: APEX >= 3.00x | SURGE >= 1.50x | RISE > 1.05x | HOLD within 5% | DIP >= 0.50x | REKT < 0.50x
## Rules
- A permit is bound to one address and one epoch. A nonce mined for someone else fails.
- A leaf can be used once. Replaying a permit reverts with "permit used".
- Do not mint more than 3 works from the free window per address.
- Supply is 3333. The first 1000 works are free; after that each costs 0.001 ETH.
- Royalty is 5%. Payment stays in the contract and is withdrawn by the studio.
- Never send funds anywhere other than the contract address above.

## After minting
The token re-grades itself whenever the reference moves. Nothing needs to be called:
tierOf / multiplierOf / tokenURI are computed live from the oracle. If the stock rises
60% the work becomes SURGE on its own - you do not re-mint.

## Failure modes you should handle
- A read may return one state behind a write you just sent. Poll again; do not conclude
  the mint failed from a single stale read.
- If priceFor() returns an amount you cannot afford, stop and report it. Do not send less.

## Reference hashes (keccak256 of the ticker, for the oracle call)
AAPL 0x3a54a9a690616fbc26cfc409bf11f89d51f1d57a4ab2791fb86026cee74ed2f3
NVDA 0xe108948b9667048232851f26a1427d3a908b22da622562906ca50ea536c2ecfb
TSLA 0x0a8f1f385fed9c77a2e0daa363ccc865e971bdbe4458bb570cc0acb068d7c0f2
SPY 0xcea23e8f56b5ac447ac08d57e0808e35f468a65f29bb659b3d48934481e7c67a
QQQ 0x3192e549b876a689e8727f4a2e0d4fa13b8456aa0a01f6008ad18fd992e3b532
META 0x0057355892fab25ddc63a7482ec1696d6ada670339b1ae464da8f6b958ddbee8

## Holder income (royalty share)

Secondary-sale royalties are paid to the contract itself, which splits every
incoming payment: 50% goes to the project, 50% accrues to holders.

A holder's share is weighted by tier, so a stronger work earns more:

| tier | weight |
|------|--------|
| APEX | 13 |
| SURGE | 8 |
| RISE | 5 |
| HOLD | 3 |
| DIP | 2 |
| REKT | 1 |

### How a holder claims

1. `claimableOf(tokenId)` - read what is owed (selector 0x..., see ABI).
2. `claim(uint256[] ids)` - send from the address that owns the tokens;
   the contract pays the accrued amount to the caller.

Weights are refreshed by the protocol keeper, so they track the live tier.
`sync(uint256[] ids)` is permissionless and can be called by anyone.

