> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/zh/can-kao/precompiles.md).

# 预编译合约参考

Rome 的 Solana 互操作预编译合约中的每个方法——地址、Solidity 签名、选择器，以及它是读取、调用还是构造一个 CPI。

Rome 的链上程序通过预编译分发的选择器。选择器 = `keccak256(signature)[:4]`；下方每一行都据此进行验证。Solidity 接口位于 [`rome-solidity/contracts/interface.sol`](https://github.com/rome-protocol/rome-solidity/blob/master/contracts/interface.sol).

**首先阅读 Dispatch 列。** 它说明一个方法对 Solana 状态的作用：

| 分发                  | 发生什么                                                                                             | 真实的 Solana CPI | 允许在迭代执行中               |
| ------------------- | ------------------------------------------------------------------------------------------------ | -------------- | ---------------------- |
| `调用` / `组合式`        | 一个或多个 CPI，在适用 seeds 时由调用方的 external-authority PDA 签名。对于 **legacy** 该轨道 **缓存** 上，它们会暂存，并在交易结束时提交。 | 是              | Legacy： **否**。Cached：是 |
| `EthCall`           | 纯计算或读取 Rome 自身状态                                                                                 | 否              | 是                      |
| `CrossStateEthCall` | 读取另一个 Solana 账户的字节，由仿真预加载。无 CPI，无副作用。                                                            | 否              | 是                      |
| `Precompiled`       | 确定性密码学（以太坊标准预编译）                                                                                 | 否              | 是                      |

合约使用 **一条轨道**：要么是 legacy 预编译（`0xff…07`, `0xff…08`, `0xff…09`, `0x42…16`），要么是缓存轨道的预编译（`0xff…04`, `0xff…05`, `0xff…06`, `0xff…0b`）。在同一交易中混用两条轨道的变更调用会在运行时被拒绝。读取仍然允许，但有一个例外：一旦触发了缓存轨道的 invoke，该交易剩余部分将拒绝 legacy 轨道读取。另见 [集成 Solana 程序](https://docs.rome.builders/zh/kai-fa-zhe-zhi-nan/integrate-solana-program.md).

**谁来付费。** Solana 费用支付者预先垫付 legacy 轨道 CPI 支出的每一 lamport（租金、转账、 `swap_gas_to_lamports`）；程序会在每次 CPI 前后测量支付者余额，并按 gas 价格将净支出计作用户的 gas，同时退回 CPI 返还的 lamports。

**谁来签名。** 调用预编译的合约以自身身份行事：签名者是该合约的 external-authority PDA（`["EXTERNAL_AUTHORITY", contract]`）。用户自己的 PDA 仅在用户直接向预编译地址发送的交易中签名。在 `DELEGATECALL` / `CALLCODE`下，变更选择器将被拒绝，除非 `create_ata*`, `create_pda*`, `swap_gas_to_lamports`, `init_spl_mint` 和 `create_and_init_mint` 在 HelperProgram 上， `create_ata*` 在 ASplCached 上，以及 `invoke` / `invoke_signed` 在 CpiProgram 上。它们之所以被豁免，是因为其目标绑定于调用方或由操作员出资，而不是因为它们不签名： `create_and_init_mint` 仍会使用外层调用方的 PDA 签名以支付铸币账户的租金，并且只能创建其权限方为该 PDA 的铸币账户，且 `invoke` / `invoke_signed` 拒绝裸权限（`DelegatecallOwnerAuthority`），并按运行中合约的地址为加盐 PDA 加入命名空间。

每个方法均为 non-payable（`msg.value > 0` 若 `TransferProhibited`则回退），除 `withdrawal(bytes32)`。标记为 *仅单状态* 的方法在 op-geth-stack 链上会被拒绝。CPI 不得指定 Solana 费用支付者（普通 System 转账指令内除外）或 Rome 程序，也不得调用 Rome 程序。

## SystemCached（`0xff00000000000000000000000000000000000004`)

PDA 创建 + system-program 操作（allocate、assign、lamport transfer），暂存到覆盖层中。是 legacy 的缓存对应项 `System @ 0xff..07`的变更选择器（legacy System 保留纯读取选择器）。

| Solidity 签名                          | 选择器          | 分发   | 描述                                 |
| ------------------------------------ | ------------ | ---- | ---------------------------------- |
| `create_pda()`                       | `0xe0402a8d` | `调用` | 创建调用方的 `external_auth` PDA，免租金，零数据 |
| `create_pda(uint64)`                 | `0x4ceab657` | `调用` | 相同，但由资助方指定高于租金的 lamports           |
| `create_pda(uint64,bytes32)`         | `0x48e2bb86` | `调用` | 带 lamports 的加盐 PDA                 |
| `create_pda(bytes32,uint64,bytes32)` | `0xcc258bbf` | `调用` | 所有者指定、大小为 N、由 salt 派生              |
| `allocate(uint64,bytes32)`           | `0x93225c9f` | `调用` | 在加盐派生的 PDA 上分配 N 字节                |
| `assign(bytes32,bytes32)`            | `0x8ac00bdc` | `调用` | 将加盐派生的 PDA 分配给新所有者                 |
| `transfer(address,uint64)`           | `0x5d359fbd` | `调用` | 向由 EVM 地址派生的 PDA 转移 lamport        |
| `transfer(bytes32,uint64)`           | `0xfd54d1ea` | `调用` | 向原始 Solana 公钥转移 lamport            |
| `transfer(bytes32,uint64,bytes32)`   | `0x875abfc0` | `调用` | 向原始公钥转移 lamport，来源为加盐派生            |

## SplCached（`0xff00000000000000000000000000000000000005`)

SPL Token / Token-2022 转账 + ATA 初始化 + 跨状态账户读取，暂存到覆盖层中。

| Solidity 签名                                     | 选择器          | 分发                  | 描述                                                                                                                                                                                                        |
| ----------------------------------------------- | ------------ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `transfer(address,uint256)`                     | `0xa9059cbb` | `调用`                | 以调用方为所有者的 SPL 转账至由 EVM 地址派生的 PDA 的 ATA，当前 rollup 铸币                                                                                                                                                       |
| `transfer(bytes32,uint256)`                     | `0x6a467394` | `调用`                | 相同，收款方以原始 Solana 公钥给出                                                                                                                                                                                     |
| `transfer(address,uint256,bytes32)`             | `0x57cfeeee` | `调用`                | 显式指定铸币版本，EVM 地址目标                                                                                                                                                                                         |
| `transfer(bytes32,uint256,bytes32)`             | `0x7db527f9` | `调用`                | 显式指定铸币版本，原始公钥目标                                                                                                                                                                                           |
| `transferFrom(address,address,uint256,bytes32)` | `0x401e3367` | `调用`                | 委托来源版本——权限 = `external_auth(caller)`，作为 ATA 所有者或足额委托人均可接受。用于 `SPL_ERC20_cached.transferFrom` 以及由路由器驱动的流程                                                                                                  |
| `approve(address,uint256,bytes32)`              | `0x8180f2fc` | `调用`                | EVM 支出方授权——所有者 = `external_auth(caller)`，委托人 = `external_auth(spender_addr)`。用于 `SPL_ERC20_cached.approve`                                                                                                |
| `mint(address,uint256,bytes32)`                 | `0x1e458bee` | `调用`                | 调用方 PDA 作为铸币权限签名。SPL 运行时强制 caller-PDA == 链上铸币权限。用于 `SPL_ERC20_cached.mint_to` 以及入站桥结算                                                                                                                     |
| `init(bytes32,bytes32,bytes32)`                 | `0x0b0ad508` | `调用`                | `InitializeAccount3` 指令（ata、mint、owner）                                                                                                                                                                   |
| `account(address)`                              | `0x73b9aa91` | `CrossStateEthCall` | 读取 EVM 地址的 PDA 派生 ATA 的 SPL 账户状态（当前 rollup 铸币）                                                                                                                                                            |
| `account(bytes32)`                              | `0x882358ae` | `CrossStateEthCall` | 读取原始 ATA 公钥的 SPL 账户状态                                                                                                                                                                                     |
| `account(address,bytes32)`                      | `0xf9827227` | `CrossStateEthCall` | 同上， `account(address)` 但显式指定铸币。                                                                                                                                                                           |
| `mint_info(bytes32)`                            | `0xe24bf5d4` | `CrossStateEthCall` | 铸币信息，感知覆盖层：token program、decimals、 **已启用** hook program（若不存在则为 0 *或* 、处于空闲状态）、当前 epoch 手续费 bps，以及扩展存在位图。与以下项使用相同选择器： `HelperProgram.mint_info` ——一项能力，两个分发归宿，因为一旦缓存轨道的 invoke 已触发，缓存轨道合约就不能再使用 legacy 读取。 |

## ASplCached（`0xff00000000000000000000000000000000000006`)

关联代币账户创建，幂等。

| Solidity 签名                   | 选择器          | 分发   | 描述                                 |
| ----------------------------- | ------------ | ---- | ---------------------------------- |
| `create_ata()`                | `0xb6d336ed` | `调用` | 针对调用方 PDA × 当前 rollup 铸币的幂等 ATA 创建 |
| `create_ata(bytes32)`         | `0x81972e35` | `调用` | 针对调用方 PDA × 显式铸币的幂等 ATA 创建         |
| `create_ata(address)`         | `0x5a7c3259` | `调用` | 针对由 EVM 地址派生的 PDA × 当前铸币的幂等 ATA 创建 |
| `create_ata(address,bytes32)` | `0x3de2251a` | `调用` | 针对 EVM 地址 × 显式铸币的幂等 ATA 创建         |

## WithdrawCached（`0xff0000000000000000000000000000000000000b`)

Gas 代币提现路径（原生 gas → SPL 包装代币，原生 gas → SOL，原生 gas → 调用方 PDA），暂存。是 legacy 的缓存对应项 `Withdraw @ 0x42..16`.

| Solidity 签名                   | 选择器          | 分发    | 描述                                                                                                                                                                                                                                                           |
| ----------------------------- | ------------ | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `withdrawal(bytes32) payable` | `0x4d8b0ea4` | `组合式` | 销毁 `msg.value` 销毁 Rome gas，转移至 Solana system 账户收款方                                                                                                                                                                                                           |
| `withdraw_to_pda(uint256)`    | `0x7f3124a0` | `组合式` | 销毁 wei，将 lamports 存入调用方的 `EXTERNAL_AUTHORITY` PDA。仅单状态。                                                                                                                                                                                                      |
| `withdraw_to_ata(uint256)`    | `0x8059abc0` | `组合式` | 销毁 wei，将 SPL 包装代币存入调用方 PDA 拥有的 ATA。仅单状态。gas-wrapper 桥的包裹路径。                                                                                                                                                                                                  |
| `deposit(uint256)`            | `0xb6b55f25` | `组合式` | 与以下相反： `withdrawal` ——在 Solana 侧，从调用方 PDA 拥有的 ATA 向链的 sol\_wallet ATA 进行 SPL 转账； **mint** `wei` 在 EVM 侧将原生 gas 发放给调用方。纯铸造（不会对以下项进行抵扣性扣账： `Withdraw::ADDRESS` ——链的 SPL 钱包是经济担保，而非预编译地址）。仅单状态。gas-wrapper 桥的解包路径。与以下语义一致： `HelperProgram.deposit_from_ata` 语义。 |

## System（`0xff00000000000000000000000000000000000007`)

PDA 派生 + base58 转换 + identity 风格工具。纯读取预编译——每个方法均为 `EthCall` （无 Solana 侧效应）。

| Solidity 签名                                       | 选择器          | 分发        | 描述                                                         |
| ------------------------------------------------- | ------------ | --------- | ---------------------------------------------------------- |
| `find_program_address(bytes32,(bytes)[])`         | `0x27e3edda` | `EthCall` | Solana `find_program_address` 通过 syscall——返回 `(pda, bump)` |
| `create_program_address(bytes32,(bytes)[],uint8)` | `0xb99f29e1` | `EthCall` | 使用已知 bump 进行常数时间 PDA 派生                                    |
| `rome_evm_program_id()`                           | `0xb76fd45b` | `EthCall` | 返回此 Rome EVM 程序的 Solana 程序 ID                              |
| `program_id()`                                    | `0x77764881` | `EthCall` | 返回 Rome 的 System Program ID（此预编译的标识）                       |
| `mint_id()`                                       | `0xe132a122` | `EthCall` | 返回链的 gas 代币 SPL 铸币公钥（`OwnerInfo.chain_mint_id`)            |
| `operator()`                                      | `0x570ca735` | `EthCall` | 返回外层 Rome 交易的 Solana 签名者                                   |
| `bytes32_to_base58(bytes32)`                      | `0xfa2b1a5f` | `EthCall` | 公钥字节 → base58 字符串                                          |
| `base58_to_bytes32(bytes)`                        | `0x5df01b72` | `EthCall` | base58 字符串 → 公钥字节                                          |

## CpiProgram（`0xff00000000000000000000000000000000000008`)

**双用途预编译。** 在下面 7 个选择器中， **2 个执行真实的 Solana CPI** (`invoke`, `invoke_signed` ——分发为 `调用`）以及 **5 个是纯跨状态读取** (`account_info`, `account_data_at`, `account_u64_at`, `account_lamports`, `pdas_batch_derive` ——分发为 `CrossStateEthCall`，无 syscall，无 `found_cpi` 标志已设置）。历史上的短语“CPI shortcut selectors”是指这些读取选择器作为早期基于 CPI 读取的节省 CU 替代方案——它们本身并不是 **CPI**。完整行为矩阵请参见本节顶部的消歧表。

| Solidity 签名                                                    | 选择器          | 分发                  | 描述                                                                                                                                   |
| -------------------------------------------------------------- | ------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `invoke(bytes32,(bytes32,bool,bool)[],bytes)`                  | `0x7480cb86` | `调用`                | CPI 作为以下身份签名： `EXTERNAL_AUTHORITY(caller)` 当该账户被列为签名者时（在 DELEGATECALL 下会被拒绝）；没有加盐子 PDA。调用方传入目标程序 + 账户元数据 + 指令数据                      |
| `invoke_signed(bytes32,(bytes32,bool,bool)[],bytes,bytes32[])` | `0xb94f3733` | `调用`                | CPI 作为以下身份签名： `EXTERNAL_AUTHORITY(caller)` 在直接 CALL 下；salt 按每个 PDA seed 追加。在 DELEGATECALL 下，裸调用方权限会被拒绝，且加盐 seed 会携带运行中合约的地址——见下方派生说明 |
| `account_info(bytes32)`                                        | `0xc13465d9` | `CrossStateEthCall` | 读取 Solana 账户的完整状态（lamports/owner/flags/data）                                                                                         |
| `account_data_at(bytes32,uint16,uint16)`                       | `0x593762e8` | `CrossStateEthCall` | 读取任意 Solana 账户数据缓冲区的一段切片                                                                                                             |
| `account_u64_at(bytes32,uint16)`                               | `0xb317d4c1` | `CrossStateEthCall` | 在已知偏移处进行带类型的 u64 小端读取——节省 ABI 往返                                                                                                     |
| `account_lamports(bytes32)`                                    | `0xde79ed54` | `CrossStateEthCall` | 仅 lamports 探测——跳过数据获取                                                                                                                |
| `pdas_batch_derive(bytes[][],bytes32)`                         | `0x944336f8` | `CrossStateEthCall` | 在一次分发中针对一个程序派生 N 个相互独立的 PDA                                                                                                          |

## HelperProgram（`0xff00000000000000000000000000000000000009`)

面向 Rome 用户的辅助工具，用于 ATA/PDA 创建、由调用方的 `EXTERNAL_AUTHORITY` PDA 签名的 SPL 转账/授权/铸造、gas↔lamports 转换、ATA 存款，以及面向 SPL\_ERC20 的读取（`user_balance` / `allowance_of`）。每个方法均为 `不可支付`；变更路径通过 `调用` （单个 CPI）完成，除 `deposit_from_ata` (`组合式`（仅单状态），以及三个只读 `pda`/`ata` 查询（`EthCall`），以及两个跨状态 SPL\_ERC20 读取（`CrossStateEthCall` ——一次 Solana 账户获取）。

| Solidity 签名                                                      | 选择器          | 分发                  | 描述                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------------------------------- | ------------ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `create_ata(address)`                                            | `0x5a7c3259` | `调用`                | 在链的 gas 铸币下为 EVM 用户创建 ATA                                                                                                                                                                                                                                                                                                        |
| `create_ata(address,bytes32)`                                    | `0x3de2251a` | `调用`                | 在任意铸币下为 EVM 用户创建 ATA                                                                                                                                                                                                                                                                                                             |
| `create_ata_for_key(bytes32,bytes32)`                            | `0xd258a69d` | `调用`                | 以任意原始 Solana 公钥作为所有者的幂等 ATA 创建（不是通过 `external_auth`）派生。由操作员支付租金。用于 `SPL_ERC20.bridgeOutToSolana` / `ensureRecipientAta` / `create_token_account` 原始公钥收款流程                                                                                                                                                                        |
| `create_pda(address)`                                            | `0xff3556ca` | `调用`                | 创建用户的 `EXTERNAL_AUTHORITY` PDA（免租）                                                                                                                                                                                                                                                                                               |
| `create_pda(address,uint64)`                                     | `0x58e88298` | `调用`                | 相同，但由……资助 `lamports` 超过租金最低阈值                                                                                                                                                                                                                                                                                                    |
| `swap_gas_to_lamports(uint64)`                                   | `0x6e3f24e0` | `调用`                | 向调用者的 PDA 记入 `n` 来自该交易 Solana 手续费支付者的 lamports；调用者以 Rome gas 支付这些费用（支付者在任何 legacy CPI 中消耗的 lamport 会计入交易手续费）                                                                                                                                                                                                                     |
| `transfer_lamports(address,uint64)`                              | `0x5fe71665` | `调用`                | 将 lamports 从调用者的 PDA 转移到另一位 EVM 用户的 PDA                                                                                                                                                                                                                                                                                          |
| `transfer_spl(address,uint64)`                                   | `0xb12be5ba` | `调用`                | 将链上 gas SPL 从调用者 PDA 的 ATA 发送到目标用户的 ATA                                                                                                                                                                                                                                                                                          |
| `transfer_spl(bytes32,uint64)`                                   | `0xba3a5eac` | `调用`                | 将链上 gas SPL 从调用者 PDA 的 ATA 发送到显式指定的 ATA                                                                                                                                                                                                                                                                                          |
| `transfer_spl(address,uint64,bytes32)`                           | `0x53b505e0` | `调用`                | 将任意 mint 的 SPL 从调用者 PDA 的 ATA 发送到目标用户的 ATA                                                                                                                                                                                                                                                                                       |
| `transfer_spl(bytes32,uint64,bytes32)`                           | `0xb6977879` | `调用`                | 将任意 mint 的 SPL 从调用者 PDA 的 ATA 发送到显式指定的 ATA                                                                                                                                                                                                                                                                                       |
| `transfer_spl(bytes32,bytes32,uint64,bytes32)`                   | `0x766b362a` | `调用`                | 委托版本——由调用者提供 `src_ata` （必须由 PDA 拥有，或者 PDA 必须是委托方且具有足够的 `delegated_amount`)                                                                                                                                                                                                                                                       |
| `transfer_spl(address,address,uint64,bytes32)`                   | `0xe479df56` | `调用`                | 按地址键控的委托版本——在内部根据 EVM 地址派生两个 ATA。以 `external_auth(caller)`；SPL Token 接受 PDA 作为所有者或委托方。用于 `SPL_ERC20.transferFrom`                                                                                                                                                                                                                |
| `transfer_spl_to_signer(uint64,bytes32)`                         | `0x46efa679` | `调用`                | Solana 原生退出路径。发送 `amount` 的 `mint` 从调用者 PDA 的 ATA 到 **外层 Solana 签名者的** 该 mint 的 ATA（仅在钱包签名的 Solana 通道中由用户自己的钱包持有；若通过 MetaMask 或中继，则签名者是 Rome 的代理支付者；无需 EVM 地址转换）。无需 approve——调用者 PDA 拥有源 ATA。应与 `ActivateAta` （槽位 18），用于端到端仅使用 Solana 密钥的 EVM 使用场景。它会在当前 v1 通道以及更早的 legacy `DoTxUnsigned` （槽位 17）通道中触达钱包，因为两者中钱包都会对 Solana 交易签名。 |
| `approve_spl(address,uint64,bytes32)`                            | `0xabf6f675` | `调用`                | 以调用者 PDA 作为所有者设置 `delegate_pda(spender)` 通过 SPL 在所有者 ATA 上 `approve_checked`。用于 `SPL_ERC20.approve`                                                                                                                                                                                                                              |
| `approve_spl_raw_delegate(bytes32,bytes32,uint64,bytes32,uint8)` | `0x7881d453` | `调用`                | SPL `approve_checked` 使用由调用者提供的原始公钥委托方（例如 Wormhole `authority_signer` PDA，没有对应的 EVM 地址）。调用者传入 `decimals` 以跳过链上 mint 读取（节省约 30–50K CU）。硬编码的 `spl_program = SPL Token`。用于 `RomeBridgeWithdraw.approveBurnETH`                                                                                                                      |
| `mint_spl(address,uint64,bytes32)`                               | `0xd795522b` | `调用`                | 以调用者 PDA 作为 mint 权限方，通过 SPL 铸造到目标用户的 ATA `mint_to_checked`。SPL 运行时会强制校验权限匹配。用于 `SPL_ERC20.mint_to`                                                                                                                                                                                                                               |
| `create_mint_account(bytes32)`                                   | `0xe97d3291` | `调用`                | System CreateAccount 分配一个由 salt 派生的 PDA（`external_auth_with_salt(caller, salt)`），空间为 82，归 SPL Token 所有。资助方 = 调用者的 external\_auth PDA。两个 PDA 签名者。用于 `ERC20SPLFactory.create_token_mint`                                                                                                                                           |
| `init_spl_mint(bytes32,uint8,bytes32,bool,bytes32)`              | `0x4f75e987` | `调用`                | SPL Token `InitializeMint2` 针对预分配的 mint。没有 PDA 签名者（mint\_authority/freeze\_authority 作为数据存储，而不是运行时签名者）。用于 `ERC20SPLFactory.init_token_mint`                                                                                                                                                                                      |
| `create_and_init_mint(uint8,bytes32,bool,bytes32,bytes32)`       | `0x20972d0f` | `组合式`               | 组合：在一次分发中同时执行 System CreateAccount + SPL InitializeMint2。相比单独的 `create_mint_account` + `init_spl_mint` 调用                                                                                                                                                                                                                        |
| `deposit_from_ata(uint256)`                                      | `0x4479b709` | `组合式`               | 将 SPL 从调用者的 ATA 提取到 Rome 原生 gas。 **仅支持单状态** ——在 op-geth 链上会被拒绝                                                                                                                                                                                                                                                                   |
| `pda(address)`                                                   | `0x8854a299` | `EthCall`           | 派生用户的 `EXTERNAL_AUTHORITY` PDA——只读                                                                                                                                                                                                                                                                                               |
| `pda_with_salt(address,bytes32)`                                 | `0x5c6d04b3` | `EthCall`           | 由 salt 派生的 `EXTERNAL_AUTHORITY` PDA，单次分发完成。将 Solidity 侧的 2 次调用 `rome_evm_program_id() + find_program_address()` 组合。用于 `RomeEVMAccount.pda_with_salt`, `RomeBridgeWithdraw.{burnUSDC,burnETH}`                                                                                                                                    |
| `ata(address)`                                                   | `0x31db4f82` | `EthCall`           | 派生 `getATA(user_pda, chain_mint_id)` ——组合 EXT\_AUTH + ATA——只读                                                                                                                                                                                                                                                                    |
| `ata(address,bytes32)`                                           | `0xfeb1c647` | `EthCall`           | 同样，但带显式 mint——只读                                                                                                                                                                                                                                                                                                                 |
| `user_balance(address,bytes32)`                                  | `0xdd0119c8` | `CrossStateEthCall` | 读取用户 ATA `amount` （SPL TokenAccount 偏移 64）。如果 ATA 不存在则返回 0（用于全新链探测）。合并了 3 个 v1 分发。用于 `SPL_ERC20.balanceOf`                                                                                                                                                                                                                       |
| `mint_info(bytes32)`                                             | `0xe24bf5d4` | `CrossStateEthCall` | 面向 legacy 路径调用者的 mint 信息：token program、decimals、 **已启用** hook program（若不存在则为 0 *或* 惰性）、当前 epoch 手续费 bps、扩展存在位图。镜像于 `SplCached` 在相同选择器上。 `feeBps` 是一个 **谓词** ——它表示手续费已启用；它不是一个操作数，因为真实手续费受 `maximum_fee` 所上限约束，而这里刻意不携带该字段。                                                                                                       |
| `allowance_of(address,address,bytes32)`                          | `0xed72dbc8` | `CrossStateEthCall` | 读取所有者 ATA 的 delegated\_amount，并进行 **委托方相等性检查** ——除非链上 delegate == `external_auth(spender)`。ERC-20 语义正确（硬性要求）。用于 `SPL_ERC20.allowance`                                                                                                                                                                                            |

## 提取（`0x4200000000000000000000000000000000000016`)

Rome → Solana 原生 gas 提取。

| Solidity 签名                | 选择器          | 分发             | 描述                                                                  |
| -------------------------- | ------------ | -------------- | ------------------------------------------------------------------- |
| `withdrawal(bytes32)`      | `0x4d8b0ea4` | `组合式` (`可支付的`) | 销毁 `msg.value` Rome gas；铸造并转移到一个 Solana system 账户 `到`。这是唯一可支付的预编译方法 |
| `withdraw_to_pda(uint256)` | `0x7f3124a0` | `组合式`          | 销毁 gas；存入调用者的 `EXTERNAL_AUTHORITY` PDA。 **仅支持单状态**                  |
| `withdraw_to_ata(uint256)` | `0x8059abc0` | `组合式`          | 销毁 gas；存入到 `getATA(caller_pda, chain_mint_id)`. **仅支持单状态**          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rome.builders/zh/can-kao/precompiles.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
