// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; /** * @custom:name IXRPPayment * @custom:id 0x08 * @custom:supported XRP, testXRP * @author Flare * @notice A relay of a transaction on an XRPL chain that is of type payment in a native (XRP) currency. * The provable transaction is identified by its `transactionId`. The transactions represents a transfer * / attempt of transfer of XRP currency from a source address to a receiving address, and it also includes relevant * details such as amount sent, amount received, memos, destination tags, and success status. * * @custom:verification The transaction with `transactionId` is fetched from the RPC of the blockchain node or relevant * indexer. * * If the transaction cannot be fetched or the transaction is in a block that does not have a sufficient * [number of confirmations](/specs/attestations/configs.md#finalityconfirmation), the attestation request is rejected. * * Once the transaction is received, * the [payment summary](/specs/attestations/external-chains/transactions.md#payment-summary) * is computed according to the rules for the source chain. * * If the summary is successfully calculated, the response is assembled from the summary. * `blockNumber` and `blockTimestamp` are retrieved from the block if they are not included in the transaction data. * `blockTimestamp` is close time of the ledger converted to UNIX time. * * If the summary is not successfully calculated, the attestation request is rejected. * @custom:lut `blockTimestamp` * @custom:lutlimit `0x127500` */ interface IXRPPayment { /** * @notice Top level request * @param attestationType ID of the attestation type. * @param sourceId ID of the data source. * @param messageIntegrityCode `MessageIntegrityCode` that is derived from the expected response. * @param requestBody Data defining the request. Type (struct) and interpretation is determined by * the `attestationType`. */ struct Request { bytes32 attestationType; bytes32 sourceId; bytes32 messageIntegrityCode; RequestBody requestBody; } /** * @notice Top level response * @param attestationType Extracted from the request. * @param sourceId Extracted from the request. * @param votingRound The ID of the State Connector round in which the request was considered. * @param lowestUsedTimestamp The lowest timestamp used to generate the response. * @param requestBody Extracted from the request. * @param responseBody Data defining the response. The verification rules for the construction of the * response body and the type are defined per specific `attestationType`. */ struct Response { bytes32 attestationType; bytes32 sourceId; uint64 votingRound; uint64 lowestUsedTimestamp; RequestBody requestBody; ResponseBody responseBody; } /** * @notice Top level proof * @param merkleProof Merkle proof corresponding to the attestation response. * @param data Attestation response. */ struct Proof { bytes32[] merkleProof; Response data; } /** * @notice Request body for Payment attestation type * @param transactionId ID of the payment transaction. * @param proofOwner Address authorized to use the proof, where applicable. */ struct RequestBody { bytes32 transactionId; address proofOwner; } /** * @notice Response body for Payment attestation type * @param blockNumber Number of the block in which the transaction is included. * @param blockTimestamp The timestamp of the block in which the transaction is included. * @param sourceAddress Address string of the source address (r address). * @param sourceAddressHash Standard address hash of the source address. * @param receivingAddressHash Standard address hash of the receiving address. * The zero 32-byte string if there is no receivingAddress (if `status` is not success). * @param intendedReceivingAddressHash Standard address hash of the intended receiving address. * Relevant if the transaction is unsuccessful. * @param spentAmount Amount in minimal units spent by the source address. * @param intendedSpentAmount Amount in minimal units to be spent by the source address. * Relevant if the transaction status is unsuccessful. * @param receivedAmount Amount in minimal units received by the receiving address. * @param intendedReceivedAmount Amount in minimal units intended to be received by the receiving address. * Relevant if the transaction is unsuccessful. * @param hasMemoData True if the transaction has a MemoData field, false otherwise. * @param firstMemoData Raw bytes of MemoData field of first Memo in the transaction, empty if no Memo is present. * @param hasDestinationTag True if the transaction has a destination tag, false otherwise. * @param destinationTag Destination tag of the transaction, 0 if no destination tag is present, * see hasDestinationTag for indication if transaction has destination tag. * Currently XRPL only supports destination tags that are uint32 values. * @param status Success status of the transaction: 0 - success, 1 - failed by sender's fault, * 2 - failed by receiver's fault. */ struct ResponseBody { uint64 blockNumber; uint64 blockTimestamp; string sourceAddress; bytes32 sourceAddressHash; bytes32 receivingAddressHash; bytes32 intendedReceivingAddressHash; int256 spentAmount; int256 intendedSpentAmount; int256 receivedAmount; int256 intendedReceivedAmount; bool hasMemoData; bytes firstMemoData; bool hasDestinationTag; uint256 destinationTag; uint8 status; } }