# WHITE FLAG · Base Sepolia test setup

This is an operator guide. The public page `/testnet` can inspect testnet transaction hashes without a wallet. Wallet connection and transaction requests remain paused while the MetaMask malicious-site classification is unresolved. This page does not remove or bypass that classification.

## Current state

- Website test network: Base Sepolia, chain ID 84532; RPC `https://sepolia.base.org`.
- Existing test token: `0x03ef9cdddc43a66eb706ff539a21a0a2443a9850`.
- Deployed test sale: `0xB0d46198fCC745D7189f2AcCBb8b89C64cC3EAe8`; source `/contracts/WhiteFlagTestSale.sol`.
- First successful purchase, 2026-09-29: `0x35ca1ff440014cd0bab1bdf58e68dae4271a0c37859416e3e11584a9e7b8c3de`. The receipt confirms payment of 0.000001 test ETH and delivery of 1 tWFLAG. At that check, stock was 9 tWFLAG and `sold` was 1; these values are not a live balance guarantee.
- The Site runtime points to the reviewed sale address for read-only verification. `WF_TESTNET_ENABLED=false` and the separate incident hold remain in place.
- Test sale price: exactly 0.000001 test ETH plus test gas, for 1 test FLAG.
- The amount is not a conversion of the $7.42 product price. No BTC is accepted by this test contract.
- The normal storefront remains a demo. Existing BTC invoices, mainnet settings, and order records are unchanged.

## Completed setup and remaining activation

1. Resolve the MetaMask website classification through its official support process before enabling Site wallet requests. Read-only receipt checks and PDF practice do not require a wallet. Do not instruct users to ignore the warning or turn protections off.
2. Review the test sale source. It is locked to Base Sepolia and the existing test token. It has no owner, upgrade, withdrawal or token-approval functions. Never use real assets.
3. Completed: `WhiteFlagTestSale.sol` compiled with Solidity 0.8.30, EVM Shanghai, optimizer 200 and deployed on Base Sepolia. Its runtime bytecode was matched to the reviewed source. No redeployment is needed.
4. Completed: 10 existing TEST tokens were transferred to the sale contract and one test purchase succeeded. Do not repeat that funding or reuse the completed order ID. The sale address is different from the token address above. No token approval is needed.
5. Set the Site runtime value `WF_TESTNET_SALE_ADDRESS` to that reviewed sale address. The address must not be chosen by a URL parameter or customer input. The public testnet page checks network, code presence, linked token, token decimals, exact price/quantity, capacity, and available inventory. These checks are not a security audit or bytecode verification.
6. After classification resolution and code review, remove the documented incident hold in code and set `WF_TESTNET_ENABLED=true`. Both are required. Merely setting the environment value does not bypass the hold. Mainnet sales remain closed.
7. Verify a purchase with a test-only wallet. Confirm the network is Base Sepolia and the value is exactly 0.000001 test ETH. The contract atomically transfers one token to the paying address; an error reverts both parts. The page verifies the transaction destination, sender, input, amount, purchase event and the designated token's Transfer log.

## Evidence and recovery

- Two block confirmations are required for the test page's completion display; these are not Ethereum L1 finality. Recheck if a receipt disappears or the network reorganizes.
- A successful general transaction, including token deployment or faucet transfer, is not a successful test purchase.
- Order IDs are random. Contract replay protection is scoped to buyer + order ID. Reopening a receipt does not pay again or trigger another token transfer.
- The browser keeps a test worksheet before requesting a transaction. If the wallet response is lost, do not repeat payment. Copy the transaction hash from MetaMask Activity and inspect it. An unknown result remains blocked until investigated; no automatic replacement is sent.
- Test worksheets (nickname, declaration, consent time, address and transaction hash) are saved only in that browser. They are editable local data, not verified signature records or paid orders. Clearing browser storage loses them. Transaction hashes remain public on the chain.
- The PDF is labeled PREVIEW and contains the saved declaration and its UTF-8 binary representation. It is not proof of a real purchase. No real email is sent from this test flow.
- A purchase made externally in Remix can be inspected without a wallet. After the purchase receipt is confirmed, the visitor may enter a name and give fresh consent to create a separate practice declaration. Its new record ID and browser consent time are generated now; no signature, wallet ownership, or consent at the transaction time is inferred. The PDF carries this limitation. This worksheet does not replace a pending purchase record, and its binary appendix encodes the newly saved declaration exactly.
- `FAILED_TIMEOUT` from a sponsored MetaMask transaction is a relay timeout. Check the receipt and token balances before retrying. On the confirmation screen, the supported `Paid by MetaMask >` fee picker offers native ETH payment; on Base Sepolia this uses test ETH. Never force a reverted transaction. `Order already used` can mean the purchase already succeeded: inspect the matching receipt instead of issuing another payment.
- Test ETH and unused test tokens sent to the sale contract remain locked there. Successful purchases receive tokens; at most 0.0001 test ETH is collected by 100 purchases. Never fund this contract with valuable assets.
- This experiment does not validate the separate BTC payment provider or its invoice/webhook lifecycle.

## 철우님용 간단 안내

1. 사이트의 **테스트망 확인**을 누르면 `/testnet`으로 이동합니다.
2. **거래번호로 확인**에는 MetaMask 활동에서 복사한 Base Sepolia 거래번호를 붙여 넣습니다. 지갑 연결 없이 조회합니다.
3. 지금은 보안 경고 재검토가 끝나지 않아 **MetaMask 연결 / 테스트 결제 버튼이 잠겨 있습니다.**
4. 판매 계약 배포·재고 입금·첫 구매는 완료됐습니다. 같은 주문으로 다시 결제하지 마세요.
5. 안내된 네트워크 설정을 다시 메타마스크에 입력할 필요는 없습니다. 이미 Base Sepolia에 연결되어 있다면 그대로 두세요.
6. 성공한 구매 거래를 조회하면 **조회한 거래로 연습 선언서 만들기**가 나타납니다. 이름을 입력하고 지금의 선언 동의를 체크한 뒤 **연습 선언 저장 → 연습 선언서 PDF 저장**을 누르세요. PDF에는 원문과 이진수 부록이 들어갑니다. 이메일 발송이나 새 결제는 하지 않습니다.
