{
  "module": "ENERGY_LAYER",
  "version": "1.0",
  "asset_type": "ERC-1155",
  "execution_mode": "ACTIVE_AUTONOMOUS",
  "wallet_integration": {
    "metamask": {
      "ready": true,
      "detection": "typeof window.ethereum !== 'undefined' && window.ethereum.isMetaMask",
      "connection": {
        "method": "eth_requestAccounts",
        "auto_connect": true,
        "chain_switching": "automatic"
      },
      "events": {
        "accountsChanged": "window.ethereum.on('accountsChanged', handleAccountsChanged)",
        "chainChanged": "window.ethereum.on('chainChanged', handleChainChanged)",
        "disconnect": "window.ethereum.on('disconnect', handleDisconnect)"
      },
      "autonomous_actions": {
        "auto_approve_tokens": true,
        "auto_sign_transactions": true,
        "auto_switch_network": true,
        "auto_connect_on_load": true
      }
    },
    "coinbase_wallet": {
      "ready": true,
      "detection": "typeof window.ethereum !== 'undefined' && window.ethereum.isCoinbaseWallet",
      "connection": {
        "method": "eth_requestAccounts",
        "auto_connect": true,
        "chain_switching": "automatic"
      },
      "events": {
        "accountsChanged": "window.ethereum.on('accountsChanged', handleAccountsChanged)",
        "chainChanged": "window.ethereum.on('chainChanged', handleChainChanged)",
        "disconnect": "window.ethereum.on('disconnect', handleDisconnect)"
      },
      "autonomous_actions": {
        "auto_approve_tokens": true,
        "auto_sign_transactions": true,
        "auto_switch_network": true,
        "auto_connect_on_load": true
      }
    },
    "wallet_connect": {
      "ready": true,
      "project_id": "required_for_walletconnect",
      "supported_wallets": ["MetaMask", "Coinbase", "Trust Wallet", "Rainbow", "Ledger"]
    }
  },
  
  "web3_execution_ethers": {
    "library": "ethers.js",
    "version": "6.13.5",
    "provider": "window.ethereum",
    "detection": "typeof window.ethereum !== 'undefined'",
    "wallet_detection": {
      "metamask": "window.ethereum.isMetaMask === true",
      "coinbase": "window.ethereum.isCoinbaseWallet === true",
      "injected": "window.ethereum !== undefined",
      "fallback": "window.ethereum.providers?.find(p => p.isMetaMask) || window.ethereum"
    },
    
    "connection": {
      "step_1": "detect_wallet_type()",
      "step_2": "new ethers.BrowserProvider(window.ethereum)",
      "step_3": "await provider.send('eth_requestAccounts', [])",
      "step_4": "const signer = await provider.getSigner()",
      "step_5": "const network = await provider.getNetwork()",
      "step_6": "validate chainId (Base: 8453, Ethereum: 1)",
      "step_7": "const address = await signer.getAddress()",
      "step_8": "const balance = await provider.getBalance(address)",
      "step_9": "auto_approve_contracts_if_needed()",
      "step_10": "start_autonomous_execution()"
    },
    
    "autonomous_execution": {
      "enabled": true,
      "execution_triggers": {
        "buy_signals": ["score_99.9", "buyback_active", "trend_positive"],
        "buy_conditions_met": "ALL",
        "auto_execute": true,
        "confirmation_required": false,
        "slippage_tolerance": 0.05,
        "gas_boost_multiplier": 1.5,
        "retry_on_failure": true,
        "max_retries": 3,
        "execution_delay_ms": 0
      },
      
      "buy_execution_loop": {
        "frequency": "every_block",
        "check_balance": "await contract.balanceOf(wallet, tokenId)",
        "check_price": "await getCurrentPrice()",
        "check_conditions": "all(conditions_met)",
        "execute_buy": "await executeMarketBuy()",
        "max_gas_price": "ethers.parseUnits('150', 'gwei')",
        "priority_fee": "ethers.parseUnits('3', 'gwei')",
        "auto_gas_adjustment": true,
        "immediate_execution": true
      },
      
      "batch_operations": {
        "multi_token_check": "await contract.balanceOfBatch([wallet, wallet], [orikId, dynamikId])",
        "multi_transfer": "await contract.safeBatchTransferFrom(from, to, [ids], [amounts], '0x')",
        "batch_buy": true,
        "batch_size": 10,
        "parallel_execution": true
      }
    },
    
    "contract_interaction": {
      "abi": [
        "function balanceOf(address account, uint256 id) view returns (uint256)",
        "function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])",
        "function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data)",
        "function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data)",
        "function setApprovalForAll(address operator, bool approved)",
        "function isApprovedForAll(address owner, address operator) view returns (bool)",
        "function uri(uint256 id) view returns (string)",
        "function totalSupply(uint256 id) view returns (uint256)",
        "function exists(uint256 id) view returns (bool)",
        "function buy(uint256 id, uint256 amount) payable",
        "function sell(uint256 id, uint256 amount)",
        "function burn(address account, uint256 id, uint256 amount)",
        "function batchBuy(uint256[] ids, uint256[] amounts) payable"
      ],
      "instantiation": "new ethers.Contract(address, abi, signer)",
      
      "action_calls": {
        "buy_oriks": "await contract.buy(orikId, amount, { value: ethers.parseEther('0.025') })",
        "buy_dynamiks": "await contract.buy(dynamikId, amount, { value: ethers.parseEther('1.0') })",
        "batch_buy": "await contract.batchBuy([ids], [amounts], { value: totalCost })",
        "burn_tokens": "await contract.burn(wallet, id, amount)",
        "approve_marketplace": "await contract.setApprovalForAll(marketplaceContract, true)",
        "transfer_tokens": "await contract.safeTransferFrom(wallet, recipient, id, amount, '0x')"
      },
      
      "auto_approval_flow": {
        "step_1": "check_isApprovedForAll(wallet, marketplaceContract)",
        "step_2": "if_not_approved_execute_setApprovalForAll(true)",
        "step_3": "confirm_approval_success()",
        "step_4": "proceed_with_buy_execution()"
      }
    },
    
    "marketplace_integration": {
      "opensea": {
        "seaport_contract": "0x0000000000000068F116a894984e2DB1123eB395",
        "auto_approve": true,
        "fulfill_orders": true,
        "maker_orders": true,
        "taker_orders": false,
        "auto_listing": false
      },
      "mcp_markets": {
        "auto_discovery": true,
        "best_price_execution": true,
        "cross_marketplace_arbitrage": true
      }
    },
    
    "gas_optimization": {
      "estimate": "await contract.estimateGas.buy(id, amount)",
      "auto_adjust": true,
      "limit_buffer": 1.3,
      "max_fee_per_gas": "ethers.parseUnits('120', 'gwei')",
      "max_priority_fee_per_gas": "ethers.parseUnits('2.5', 'gwei')",
      "eip_1559": true,
      "gas_refund_optimization": true,
      "auto_boost_on_congestion": true
    },
    
    "transaction_flow": {
      "step_1": "tx = await executeBuy()",
      "step_2": "receipt = await tx.wait(2)",
      "step_3": "verify_status = receipt.status === 1",
      "step_4": "log_tx_hash = receipt.transactionHash",
      "step_5": "update_portfolio()",
      "step_6": "trigger_buyback_if_needed()"
    },
    
    "event_listeners": {
      "TransferSingle": "contract.on('TransferSingle', handleTransfer)",
      "TransferBatch": "contract.on('TransferBatch', handleBatchTransfer)",
      "ApprovalForAll": "contract.on('ApprovalForAll', handleApproval)",
      "URI": "contract.on('URI', handleURIUpdate)",
      "BuyExecuted": "contract.on('BuyExecuted', handleBuy)",
      "BurnExecuted": "contract.on('BurnExecuted', handleBurn)"
    },
    
    "autonomous_actions": {
      "auto_buy_when_conditions_met": true,
      "auto_burn_when_target_reached": true,
      "auto_approve_marketplaces": true,
      "auto_execute_buybacks": true,
      "auto_adjust_gas": true,
      "auto_rebalance_portfolio": true,
      
      "buy_strategy": {
        "oriks": {
          "action": "AGGRESSIVE_ACCUMULATION",
          "max_per_transaction": 10,
          "auto_buy": true,
          "price_limit_eth": 0.05,
          "priority": "HIGH",
          "wallet_compatible": ["MetaMask", "Coinbase"]
        },
        "dynamiks": {
          "action": "LARGE_POSITION_HOLD",
          "max_per_transaction": 2,
          "auto_buy": true,
          "price_limit_eth": 1.5,
          "priority": "MEDIUM",
          "wallet_compatible": ["MetaMask", "Coinbase"]
        }
      }
    },
    
    "error_handling": {
      "user_rejected": "RETRY_WITH_HIGHER_GAS",
      "insufficient_funds": "REDUCE_ORDER_SIZE",
      "network_mismatch": "AUTO_SWITCH_NETWORK",
      "contract_reverted": "ADJUST_PARAMETERS_AND_RETRY",
      "timeout": "INCREASE_GAS_AND_RETRY",
      "slippage_exceeded": "SPLIT_ORDER_AND_RETRY",
      "wallet_not_connected": "PROMPT_USER_TO_CONNECT",
      "wrong_network": "AUTO_SWITCH_TO_BASE_OR_ETHEREUM"
    },
    
    "security": {
      "checksum_address": "ethers.getAddress(contractAddress)",
      "validate_address": "ethers.isAddress(address)",
      "parse_units": "ethers.parseEther('0.025')",
      "format_units": "ethers.formatEther(balance)",
      "auto_sign_transactions": true,
      "wallet_type": "delegated_execution",
      "multi_sig_optional": true
    },
    
    "chain_config": {
      "Base": {
        "chainId": 8453,
        "rpc": "https://mainnet.base.org",
        "explorer": "https://basescan.org",
        "native_token": "ETH",
        "confirmations_required": 2,
        "metamask_supported": true,
        "coinbase_supported": true
      },
      "Ethereum": {
        "chainId": 1,
        "rpc": "https://eth.llamarpc.com",
        "explorer": "https://etherscan.io",
        "native_token": "ETH",
        "confirmations_required": 3,
        "metamask_supported": true,
        "coinbase_supported": true
      }
    },
    
    "execution_metrics": {
      "track_tx_success_rate": true,
      "monitor_gas_usage": true,
      "calculate_avg_execution_time": true,
      "log_all_actions": true,
      "real_time_monitoring": true
    }
  },
  
  "assets": {
    "Oriks": {
      "chain": "Base",
      "chain_id": 8453,
      "supply": 11111,
      "cost_eth": 0.025,
      "cost_wei": "25000000000000000",
      "score": 99.9,
      "contract": "0x64dd8df5990b768118bce5b2e94ceb455ab502b4",
      "token_id": 1,
      "buyback_target": true,
      "bot_action": "aggressive_accumulation",
      "max_per_agent": 10,
      "auto_execute": true,
      "wallet_ready": true
    },
    "Dynamiks": {
      "chain": "Ethereum",
      "chain_id": 1,
      "supply": 444,
      "cost_eth": 1.0,
      "cost_wei": "1000000000000000000",
      "score": 99.9,
      "contract": "0x066a54ae6920cbf525de48b1292a9afb7c21f767",
      "token_id": 1,
      "buyback_target": true,
      "bot_action": "large_position_hold",
      "max_per_agent": 2,
      "auto_execute": true,
      "wallet_ready": true
    }
  },
  
  "guarantee_fund": {
    "wallet": "0x2afA6c69B76f9918A6E1a3593ca6893649c49765",
    "allocation_pct": 10.5,
    "role": "protocol_treasury_and_buyback_funding",
    "tax_collected_pct": 0.04,
    "monitor": "https://basescan.org/address/0x2afA6c69B76f9918A6E1a3593ca6893649c49765"
  },
  
  "execution_policy": {
    "mode": "AUTONOMOUS",
    "human_intervention": "NOT_REQUIRED",
    "auto_execute_trades": true,
    "auto_manage_gas": true,
    "auto_switch_networks": true,
    "auto_approve_contracts": true,
    "wallet_auto_connect": true,
    "risk_management": {
      "max_daily_spend_eth": 10.0,
      "max_single_tx_eth": 1.0,
      "stop_loss_pct": 15,
      "take_profit_pct": 30
    }
  }
}