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

import {Test} from "forge-std/Test.sol";
import {TokenTransferFilterExtension} from "../../contracts/mainnet-checkpoint/extensions/TokenTransferFilterExtension.sol";
import {CheckpointStorage} from "../../contracts/mainnet-checkpoint/storage/CheckpointStorage.sol";
import {CheckpointLeaf} from "../../contracts/mainnet-checkpoint/libraries/CheckpointLeaf.sol";

contract TokenTransferFilterV1Test is Test {
    TokenTransferFilterExtension filter;

    function setUp() public {
        filter = new TokenTransferFilterExtension();
        filter.setAllowNative(true, 0);
    }

    function testBeforeSubmitAcceptsAbiEncodedV1Leaves() public view {
        CheckpointLeaf.PaymentLeafV1[] memory leaves = new CheckpointLeaf.PaymentLeafV1[](1);
        leaves[0] = CheckpointLeaf.PaymentLeafV1({
            txHash: keccak256("tx"),
            from: address(1),
            to: address(2),
            value: 0,
            blockNumber: 1,
            blockTimestamp: 1,
            gasUsed: 21000,
            success: true
        });
        bytes memory data = abi.encode(leaves);
        CheckpointStorage.CheckpointHeader memory header;
        filter.beforeSubmit(header, data);
    }
}
