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

import {Test} from "forge-std/Test.sol";
import {DepositToken} from "../../contracts/vault/tokens/DepositToken.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contract DepositTokenDecimalsTest is Test {
    DepositToken public token;
    address public vault = address(0x1);
    address public collateralAsset = address(0x2);
    address public admin = address(this);

    function testInitializeWithDecimalsSix() public {
        DepositToken impl = new DepositToken();
        bytes memory initData = abi.encodeWithSelector(
            DepositToken.initializeWithDecimals.selector,
            "Deposit cUSDC",
            "acUSDC",
            vault,
            collateralAsset,
            admin,
            uint8(6)
        );
        ERC1967Proxy proxy = new ERC1967Proxy(address(impl), initData);
        token = DepositToken(address(proxy));
        token.grantRole(keccak256("MINTER_ROLE"), vault);

        assertEq(token.decimals(), 6);
        assertEq(token.vault(), vault);
        assertEq(token.collateralAsset(), collateralAsset);
    }

    function testFiveArgInitializeUses18Decimals() public {
        DepositToken impl = new DepositToken();
        bytes memory initData = abi.encodeWithSelector(
            DepositToken.initialize.selector,
            "Deposit",
            "dASSET",
            vault,
            collateralAsset,
            admin
        );
        ERC1967Proxy proxy = new ERC1967Proxy(address(impl), initData);
        token = DepositToken(address(proxy));

        assertEq(token.decimals(), 18);
    }
}
