// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {CheckpointLeaf} from "../../contracts/mainnet-checkpoint/libraries/CheckpointLeaf.sol";
import {CheckpointPaymentsLib} from "../../contracts/mainnet-checkpoint/libraries/CheckpointPaymentsLib.sol";

contract PaymentLeafV2SubmitTest is Test {
    function test_assertPaymentsRootV2() public {
        CheckpointLeaf.PaymentLeafV2[] memory leaves = new CheckpointLeaf.PaymentLeafV2[](1);
        leaves[0] = CheckpointLeaf.PaymentLeafV2({
            txHash: keccak256("tx"),
            from: address(0x1),
            to: address(0x2),
            token: address(0x3),
            value: 100,
            blockNumber: 1,
            blockTimestamp: 2,
            gasUsed: 3,
            success: true,
            logIndex: 0
        });
        bytes32[] memory hashes = new bytes32[](1);
        hashes[0] = CheckpointLeaf.paymentLeafV2(138, leaves[0]);
        bytes32 root = CheckpointLeaf.buildMerkleRoot(hashes);
        CheckpointPaymentsLib.assertPaymentsRootV2(138, root, leaves);
    }
}
