Battlechain safe harbor

From cyotee/indexedex · View interactive version

Battlechain safe harbor is an AI agent skill from the GitHub repository cyotee/indexedex. Use this skill when evaluating attack legality, agreement scope, bounty eligibility, or Binding Agreement resolution on BattleChain.

How to use this skill

Skill file

BattleChain Safe Harbor and Binding Agreement

This skill prevents the most dangerous mistake: reading terms from the wrong agreement.

What Safe Harbor Covers

Protected only when both are true:

  1. Target is attackable (UNDER_ATTACK or PROMOTION_REQUESTED).
  2. Target is in scope under the Binding Agreement.

Safe Harbor does not cover attacks on PRODUCTION, out-of-scope contracts, or violations of bounty and identity terms.

Binding Agreement Resolution (Critical)

Do not trust BattleChainSafeHarborRegistry.getAgreement(adopter) for exploit terms.

Use Binding Agreement resolution:

Prefer API or BCQuery instead of manual resolution.

Preferred Verification Paths

Option 1: Explorer API (recommended)

GET https://block-explorer-api.testnet.battlechain.com/battlechain/agreement/by-contract/{contractAddress}

Option 2: BCQuery helper

bool attackable = isAttackable(contractAddress); // requires --ffi

Option 3: On-chain only (top-level only)

address binding = attackRegistry.getAgreementForContract(contractAddress);
require(binding != address(0), "not registered top-level");
require(attackRegistry.isTopLevelContractUnderAttack(contractAddress), "not attackable");
BountyTerms memory terms = IAgreement(binding).getBountyTerms();

Commitment Window Rules

During commitment window (getCantChangeUntil()), protocol cannot make whitehat-unfavorable changes:

Agreement URI Rule

Legal source of truth is agreementURI from the Binding Agreement itself.

string memory uri = IAgreement(bindingAgreement).getAgreementURI();

Pre-Attack Checklist

Bounty Terms Essentials

struct BountyTerms {
    uint256 bountyPercentage;
    uint256 bountyCapUsd;
    bool retainable;
    IdentityRequirements identity;
    string diligenceRequirements;
    uint256 aggregateBountyCapUsd;
}

Bounty formula:

bounty = min(recoveredValue * bountyPercentage, bountyCapUsd)

Aggregate cap constraints apply when set. aggregateBountyCapUsd is incompatible with retainable = true.

Mainnet Safety Rule

If exploit likely affects mainnet deployments:

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.