Skip to content
Verified contractExactMIT

LuloHyBridgeAdapter

Address0xda198d975d253184863dfbe2115bb5516803304a
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.22

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.22+commit.4fc1097e
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
Via IR
yes
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,442,522
Creation transaction
0x34598e4f60…f7467a2223

contracts/LuloHyBridgeAdapter.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import {
    IHyVault, ILegacyVault, ILegacyMaplePool, ILegacyMapleManager,
    ILegacyMapleWithdrawalManager, ILegacyAdapter, IMessageTransmitterV2, ITokenMessengerV2
} from "./interfaces/IHyBridgeDependencies.sol";

/// @notice Replacement implementation for the two existing Ethereum Lulo proxies.
/// @dev All mutable state belongs to a new ERC-7201 namespace. No legacy adapter,
/// AccessControl, Initializable, or ReentrancyGuard storage is reused.
/// Migration requires an atomic Safe batch: assertLegacyReady(proxy), followed by
/// the OLD implementation's upgradeToAndCall(newImplementation, migrateToHy(config)).
/// This contract does not settle vault requests, fabricate NAV, or change Solana state.
contract LuloHyBridgeAdapter is UUPSUpgradeable {
    using SafeERC20 for IERC20;

    bytes32 public constant DEFAULT_ADMIN_ROLE = bytes32(0);
    bytes32 public constant AUTOMATION = keccak256("AUTOMATION");
    uint32 public constant solanaDomain = 5;
    uint256 public constant MAX_PENDING_REQUESTS = 1;
    uint256 public constant MAX_LEGACY_DUST_USDC = 1000;
    uint256 public constant MAX_MAPLE_DUST_SHARES = 1000;
    uint256 public constant MAX_CORE_DUST_SHARES = 1e15;

    address public constant EXPECTED_SAFE = 0x3E7b25304a7002E6EaF65B10717d0594Ed2247ED;
    address public constant EXPECTED_AUTOMATION = 0xB099426B5E80C5b2b66cC0d8Ac918F41962AF456;
    address public constant MAPLE_PROXY = 0x842Abc7c67Ea08AF53d79b41Dd32F00CBc96a921;
    address public constant GAMI_PROXY = 0x38ed57d7bf9AcA472787032ed4338926Cd651911;
    address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
    address public constant HY_VAULT = 0x9Ff1883ec71D6F6990Cb50575cCE8eE83f9B8FEd;
    address public constant CCTP_MESSAGE_TRANSMITTER = 0x81D40F21F12A8F0E3252Bccb954D722d4c464B64;
    address public constant CCTP_TOKEN_MESSENGER = 0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d;
    address public constant LEGACY_MAPLE_VAULT = 0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b;
    address public constant LEGACY_MAPLE_ROUTER = 0x134cCaaA4F1e4552eC8aEcb9E4A2360dDcF8df76;
    address public constant LEGACY_CORE_VAULT = 0xdAe854D0896ad2fEE335689A3F7B4a95fd1a3E46;

    bytes32 public constant MAPLE_SOLANA_RECIPIENT =
        0x1cc035503d5bc8ced1768ec1041252d5091f3ea655c4ab9fe065768134cf623c;
    bytes32 public constant GAMI_SOLANA_RECIPIENT =
        0x4900d910c9db703d8b9d05d034cfdbdc026c307fbcf9f8b8804ed8153261478c;
    bytes32 public constant SOLANA_DESTINATION_CALLER =
        0x096e3eee5cf1fcfe48ca4594a69452d1d416b709c813602a2c6f808008151e47;

    // keccak256(abi.encode(uint256(keccak256("lulo.storage.HyBridgeAdapterV1")) - 1))
    // & ~bytes32(uint256(0xff)).
    bytes32 private constant HY_STORAGE =
        0x5697fc6e3d96fc634c3529406500fad306e1adfd70608c455bfb2cb6db477700;

    struct MigrationConfig {
        address automation;
        uint256 expectedUsdcBalance;
    }

    struct Request {
        uint256 requestId;
        uint256 assets;
        uint256 shares;
    }

    /// @custom:storage-location erc7201:lulo.storage.HyBridgeAdapterV1
    struct HyStorage {
        bool initialized;
        uint256 guard;
        address token;
        address vault;
        address transmitter;
        address messenger;
        address legacyVault;
        bytes32 solanaRecipient;
        bytes32 solanaCaller;
        mapping(bytes32 => mapping(address => bool)) roles;
        uint256 adminCount;
        Request depositRequest;
        Request redeemRequest;
    }

    struct VaultPosition {
        uint256 heldShares;
        uint256 pendingDepositAssets;
        uint256 claimableDepositAssets;
        uint256 claimableDepositShares;
        uint256 pendingRedeemShares;
        uint256 claimableRedeemShares;
        uint256 claimableRedeemAssets;
    }

    error AlreadyMigrated();
    error UnauthorizedMigration(address caller);
    error UnsupportedChain(uint256 chainId);
    error UnsupportedProxy(address proxy);
    error InvalidConfiguration();
    error InvalidDependency(address dependency);
    error NotInitialized();
    error ReentrantCall();
    error InvalidAmount();
    error BalanceMismatch(uint256 expected, uint256 actual);
    error LegacyConfigurationMismatch();
    error LegacyPositionNotCleared(address vault, uint256 shares, uint256 assets);
    error LegacyRequestsOutstanding(address vault);
    error LegacyMapleQueueOutstanding(address manager);
    error ExistingHyPosition();
    error RequestNotClaimable(uint256 requestId);
    error InvalidRequestId(uint256 requestId);
    error RequestIndexOutOfBounds();
    error VaultPausedValuation();
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
    error AccessControlBadConfirmation();
    error LastAdministrator();
    error ReceiveFailed();

    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
    event HyMigrated(address indexed proxy, address indexed automation, uint256 usdcBalance, uint256 legacyDustAssets);
    event VaultDepositRequested(address indexed vault, uint256 assets, uint256 requestId);
    event VaultDepositClaimed(address indexed vault, uint256 assets, uint256 shares);
    event VaultRedeemRequested(address indexed vault, uint256 shares, uint256 requestId);
    event VaultRedeemClaimed(address indexed vault, uint256 assets, uint256 shares);
    event USDCReceived(address indexed vault, uint256 amount);
    event BridgeToSolana(address indexed from, bytes32 indexed solanaAddress, bytes32 indexed destinationCaller, uint256 amount);

    modifier onlyRole(bytes32 role) {
        _requireInitialized();
        if (!_state().roles[role][msg.sender]) revert AccessControlUnauthorizedAccount(msg.sender, role);
        _;
    }

    modifier nonReentrant() {
        HyStorage storage s = _state();
        if (s.guard == 2) revert ReentrantCall();
        s.guard = 2;
        _;
        s.guard = 1;
    }

    /// @notice Call on the new implementation BEFORE replacing the old proxy code.
    /// @dev Intended as the first CALL in the same atomic Safe batch as the upgrade.
    /// Checks old code's shadow ledgers and configuration while they remain readable.
    function assertLegacyReady(address proxy) external view returns (uint256 legacyDustAssets) {
        _checkContext(proxy);
        ILegacyAdapter old = ILegacyAdapter(proxy);
        (address legacy, bytes32 recipient) = _route(proxy);
        if (
            old.vaultContract() != legacy || old.tokenContract() != USDC
                || old.messageTransmitter() != CCTP_MESSAGE_TRANSMITTER
                || old.tokenMessenger() != CCTP_TOKEN_MESSENGER
                || old.solanaDomain() != solanaDomain
                || old.solanaSenderTokenAccount() != recipient
                || old.solanaDestinationCaller() != SOLANA_DESTINATION_CALLER
                || !old.hasRole(DEFAULT_ADMIN_ROLE, EXPECTED_SAFE)
                || !old.hasRole(AUTOMATION, EXPECTED_AUTOMATION)
        ) revert LegacyConfigurationMismatch();
        if (proxy == MAPLE_PROXY) {
            if (old.vaultSharesPendingWithdrawals() != 0) revert LegacyRequestsOutstanding(legacy);
        } else {
            if (old.getDepositRequests().length != 0 || old.getRedeemRequests().length != 0)
                revert LegacyRequestsOutstanding(legacy);
        }
        legacyDustAssets = _assertLegacyExternalReady(proxy);
        uint256 cash = IERC20(USDC).balanceOf(proxy);
        if (old.getUsdcBalance() != cash) revert BalanceMismatch(cash, old.getUsdcBalance());
        uint256 expectedTvl = cash + legacyDustAssets;
        uint256 oldTvl = old.getTotalValueLocked();
        if (oldTvl != expectedTvl) revert BalanceMismatch(expectedTvl, oldTvl);
    }

    /// @notice One-time initialization, called atomically through the authorized old UUPS upgrade.
    /// @dev It deliberately does not read old storage slots. The preceding atomic
    /// assertLegacyReady CALL is required to check old internal request counters.
    function migrateToHy(MigrationConfig calldata config) external onlyProxy {
        _checkContext(address(this));
        if (msg.sender != EXPECTED_SAFE) revert UnauthorizedMigration(msg.sender);
        HyStorage storage s = _state();
        if (s.initialized) revert AlreadyMigrated();
        if (config.automation != EXPECTED_AUTOMATION) revert InvalidConfiguration();
        s.initialized = true;
        s.guard = 2;

        uint256 cash = IERC20(USDC).balanceOf(address(this));
        if (cash != config.expectedUsdcBalance) revert BalanceMismatch(config.expectedUsdcBalance, cash);
        uint256 dust = _assertLegacyExternalReady(address(this));
        IHyVault vault = IHyVault(HY_VAULT);
        if (
            vault.asset() != USDC || vault.decimals() != 18 || IERC20Metadata(USDC).decimals() != 6
                || !vault.isAllowed(address(this)) || vault.paused()
                || CCTP_MESSAGE_TRANSMITTER.code.length == 0 || CCTP_TOKEN_MESSENGER.code.length == 0
        ) revert InvalidConfiguration();
        if (
            vault.balanceOf(address(this)) != 0 || vault.pendingDepositRequest(0, address(this)) != 0
                || vault.claimableDepositRequest(0, address(this)) != 0
                || vault.pendingRedeemRequest(0, address(this)) != 0
                || vault.claimableRedeemRequest(0, address(this)) != 0
        ) revert ExistingHyPosition();

        (s.legacyVault, s.solanaRecipient) = _route(address(this));
        s.token = USDC;
        s.vault = HY_VAULT;
        s.transmitter = CCTP_MESSAGE_TRANSMITTER;
        s.messenger = CCTP_TOKEN_MESSENGER;
        s.solanaCaller = SOLANA_DESTINATION_CALLER;

        // These allowances live in the token, so replacing implementation code
        // does not remove them. Approvals remain exact-and-temporary thereafter.
        IERC20 token = IERC20(USDC);
        token.forceApprove(LEGACY_MAPLE_VAULT, 0);
        token.forceApprove(LEGACY_MAPLE_ROUTER, 0);
        token.forceApprove(LEGACY_CORE_VAULT, 0);
        token.forceApprove(HY_VAULT, 0);
        token.forceApprove(CCTP_TOKEN_MESSENGER, 0);
        uint256 afterCash = token.balanceOf(address(this));
        if (afterCash != cash) revert BalanceMismatch(cash, afterCash);

        _grantRole(DEFAULT_ADMIN_ROLE, EXPECTED_SAFE);
        _grantRole(AUTOMATION, config.automation);
        s.guard = 1;
        emit HyMigrated(address(this), config.automation, cash, dust);
    }

    function requestDepositToVault(uint256 usdcAmount)
        external onlyRole(AUTOMATION) nonReentrant returns (uint256 requestId)
    {
        IHyVault vault = _vault();
        IERC20 token = IERC20(_state().token);
        uint256 beforeCash = token.balanceOf(address(this));
        if (usdcAmount == 0 || usdcAmount > beforeCash) revert InvalidAmount();
        if (vault.asset() != address(token)) revert InvalidConfiguration();
        uint256 pendingBefore = vault.pendingDepositRequest(0, address(this));
        token.forceApprove(address(vault), usdcAmount);
        requestId = vault.requestDeposit(usdcAmount, address(this), address(this));
        token.forceApprove(address(vault), 0);
        _checkRequestId(requestId);
        uint256 afterCash = token.balanceOf(address(this));
        if (afterCash != beforeCash - usdcAmount) revert BalanceMismatch(beforeCash - usdcAmount, afterCash);
        uint256 pending = vault.pendingDepositRequest(requestId, address(this));
        if (pending != pendingBefore + usdcAmount) revert BalanceMismatch(pendingBefore + usdcAmount, pending);
        // Lagoon merges same-epoch requests and auto-claims a previous settled
        // request. Only the current request ID is needed; vault state owns TVL.
        _state().depositRequest = Request(requestId, pending, vault.convertToShares(pending));
        emit VaultDepositRequested(address(vault), usdcAmount, requestId);
    }

    function claimDepositFromVault(uint256 requestId)
        external onlyRole(AUTOMATION) nonReentrant returns (uint256 shares)
    {
        _checkRequestId(requestId);
        IHyVault vault = _vault();
        uint256 assets = vault.claimableDepositRequest(requestId, address(this));
        if (assets == 0 || assets != vault.claimableDepositRequest(0, address(this)))
            revert RequestNotClaimable(requestId);
        uint256 expectedShares = vault.maxMint(address(this));
        if (expectedShares == 0) revert RequestNotClaimable(requestId);
        uint256 beforeShares = vault.balanceOf(address(this));
        uint256 beforeCash = IERC20(_state().token).balanceOf(address(this));
        shares = vault.deposit(assets, address(this), address(this));
        if (shares != expectedShares) revert BalanceMismatch(expectedShares, shares);
        uint256 afterShares = vault.balanceOf(address(this));
        if (afterShares != beforeShares + shares) revert BalanceMismatch(beforeShares + shares, afterShares);
        uint256 afterCash = IERC20(_state().token).balanceOf(address(this));
        if (afterCash != beforeCash) revert BalanceMismatch(beforeCash, afterCash);
        uint256 remainder = vault.claimableDepositRequest(requestId, address(this));
        if (remainder != 0) revert BalanceMismatch(0, remainder);
        delete _state().depositRequest;
        emit VaultDepositClaimed(address(vault), assets, shares);
    }

    /// @notice Requests shares corresponding to a gross USDC NAV amount, rounded up.
    /// @dev Settlement NAV and exit fees determine the eventual assets received.
    function requestRedeemFromVault(uint256 usdcAmount)
        external onlyRole(AUTOMATION) nonReentrant returns (uint256 shares, uint256 requestId)
    {
        if (usdcAmount == 0) revert InvalidAmount();
        IHyVault vault = _vault();
        shares = vault.convertToShares(usdcAmount);
        if (vault.convertToAssets(shares) < usdcAmount) shares += 1;
        uint256 beforeShares = vault.balanceOf(address(this));
        if (shares == 0 || shares > beforeShares) revert InvalidAmount();
        uint256 pendingBefore = vault.pendingRedeemRequest(0, address(this));
        requestId = vault.requestRedeem(shares, address(this), address(this));
        _checkRequestId(requestId);
        uint256 afterShares = vault.balanceOf(address(this));
        if (afterShares != beforeShares - shares) revert BalanceMismatch(beforeShares - shares, afterShares);
        uint256 pending = vault.pendingRedeemRequest(requestId, address(this));
        if (pending != pendingBefore + shares) revert BalanceMismatch(pendingBefore + shares, pending);
        _state().redeemRequest = Request(requestId, vault.convertToAssets(pending), pending);
        emit VaultRedeemRequested(address(vault), shares, requestId);
    }

    function claimRedeemFromVault(uint256 requestId)
        external onlyRole(AUTOMATION) nonReentrant returns (uint256 assets)
    {
        _checkRequestId(requestId);
        IHyVault vault = _vault();
        uint256 shares = vault.claimableRedeemRequest(requestId, address(this));
        if (shares == 0 || shares != vault.claimableRedeemRequest(0, address(this)))
            revert RequestNotClaimable(requestId);
        uint256 expectedAssets = vault.maxWithdraw(address(this));
        if (expectedAssets == 0) revert RequestNotClaimable(requestId);
        IERC20 token = IERC20(_state().token);
        uint256 beforeCash = token.balanceOf(address(this));
        uint256 beforeShares = vault.balanceOf(address(this));
        assets = vault.redeem(shares, address(this), address(this));
        if (assets != expectedAssets) revert BalanceMismatch(expectedAssets, assets);
        uint256 afterCash = token.balanceOf(address(this));
        if (afterCash != beforeCash + assets) revert BalanceMismatch(beforeCash + assets, afterCash);
        uint256 afterShares = vault.balanceOf(address(this));
        if (afterShares != beforeShares) revert BalanceMismatch(beforeShares, afterShares);
        uint256 remainder = vault.claimableRedeemRequest(requestId, address(this));
        if (remainder != 0) revert BalanceMismatch(0, remainder);
        delete _state().redeemRequest;
        emit VaultRedeemClaimed(address(vault), assets, shares);
    }

    function bridgeToSolana(uint256 usdcAmount) external onlyRole(AUTOMATION) nonReentrant {
        HyStorage storage s = _state();
        IERC20 token = IERC20(s.token);
        uint256 beforeCash = token.balanceOf(address(this));
        if (usdcAmount == 0 || usdcAmount > beforeCash) revert InvalidAmount();
        token.forceApprove(s.messenger, usdcAmount);
        ITokenMessengerV2(s.messenger).depositForBurn(
            usdcAmount, solanaDomain, s.solanaRecipient, s.token, s.solanaCaller, 0, 2000
        );
        token.forceApprove(s.messenger, 0);
        uint256 afterCash = token.balanceOf(address(this));
        if (afterCash != beforeCash - usdcAmount) revert BalanceMismatch(beforeCash - usdcAmount, afterCash);
        emit BridgeToSolana(address(this), s.solanaRecipient, s.solanaCaller, usdcAmount);
    }

    function receiveFromCCTP(bytes calldata message, bytes calldata attestation)
        external onlyRole(AUTOMATION) nonReentrant
    {
        HyStorage storage s = _state();
        IERC20 token = IERC20(s.token);
        uint256 beforeCash = token.balanceOf(address(this));
        if (!IMessageTransmitterV2(s.transmitter).receiveMessage(message, attestation)) revert ReceiveFailed();
        uint256 afterCash = token.balanceOf(address(this));
        if (afterCash <= beforeCash) revert ReceiveFailed();
        emit USDCReceived(s.vault, afterCash - beforeCash);
    }

    function getTotalValueLocked() external view returns (uint256) {
        VaultPosition memory p = _position();
        // Combining shares before conversion prevents artificial rounding losses
        // when held shares move into pending redemption or claims become held.
        uint256 shareValue = _vault().convertToAssets(p.heldShares + p.claimableDepositShares + p.pendingRedeemShares);
        return getUsdcBalance() + shareValue + p.pendingDepositAssets + p.claimableRedeemAssets + getLegacyDustBalance();
    }

    function getUsdcBalance() public view returns (uint256) {
        _requireInitialized();
        return IERC20(_state().token).balanceOf(address(this));
    }

    function getVaultShares() public view returns (uint256) { return _vault().balanceOf(address(this)); }
    function getVaultBalance() external view returns (uint256) { return _vault().convertToAssets(getVaultShares()); }

    function getPendingWithdrawals() external view returns (uint256) {
        VaultPosition memory p = _position();
        return _vault().convertToAssets(p.pendingRedeemShares) + p.claimableRedeemAssets;
    }

    function getPendingDepositAssets() external view returns (uint256) {
        VaultPosition memory p = _position();
        return p.pendingDepositAssets + _vault().convertToAssets(p.claimableDepositShares);
    }

    function getPendingRedeemShares() external view returns (uint256) {
        VaultPosition memory p = _position();
        return p.pendingRedeemShares + p.claimableRedeemShares;
    }

    /// @notice Allowed migration dust is retained and valued, not erased from TVL.
    /// @dev There is no legacy redemption/sweep entrypoint. Read failures revert.
    function getLegacyDustBalance() public view returns (uint256) {
        _requireInitialized();
        ILegacyVault legacy = ILegacyVault(_state().legacyVault);
        return legacy.convertToAssets(legacy.balanceOf(address(this)));
    }

    function getDepositRequests() public view returns (Request[] memory requests) {
        VaultPosition memory p = _position();
        uint256 assets = p.pendingDepositAssets + p.claimableDepositAssets;
        if (assets == 0) return new Request[](0);
        uint256 id = _state().depositRequest.requestId;
        IHyVault vault = _vault();
        if (vault.pendingDepositRequest(id, address(this)) + vault.claimableDepositRequest(id, address(this)) != assets) id = 0;
        requests = new Request[](1);
        requests[0] = Request(id, assets, vault.convertToShares(p.pendingDepositAssets) + p.claimableDepositShares);
    }

    function getRedeemRequests() public view returns (Request[] memory requests) {
        VaultPosition memory p = _position();
        uint256 shares = p.pendingRedeemShares + p.claimableRedeemShares;
        if (shares == 0) return new Request[](0);
        uint256 id = _state().redeemRequest.requestId;
        IHyVault vault = _vault();
        if (vault.pendingRedeemRequest(id, address(this)) + vault.claimableRedeemRequest(id, address(this)) != shares) id = 0;
        requests = new Request[](1);
        requests[0] = Request(id, vault.convertToAssets(p.pendingRedeemShares) + p.claimableRedeemAssets, shares);
    }

    function depositRequests(uint256 index) external view returns (uint256 requestId, uint256 assets, uint256 shares) {
        Request[] memory requests = getDepositRequests();
        if (index >= requests.length) revert RequestIndexOutOfBounds();
        Request memory r = requests[index];
        return (r.requestId, r.assets, r.shares);
    }

    function redeemRequests(uint256 index) external view returns (uint256 requestId, uint256 assets, uint256 shares) {
        Request[] memory requests = getRedeemRequests();
        if (index >= requests.length) revert RequestIndexOutOfBounds();
        Request memory r = requests[index];
        return (r.requestId, r.assets, r.shares);
    }

    function initialized() external view returns (bool) { return _state().initialized; }
    function tokenContract() external view returns (address) { return _state().token; }
    function vaultContract() external view returns (address) { return _state().vault; }
    function messageTransmitter() external view returns (address) { return _state().transmitter; }
    function tokenMessenger() external view returns (address) { return _state().messenger; }
    function solanaSenderTokenAccount() external view returns (bytes32) { return _state().solanaRecipient; }
    function getSolanaSenderTokenAccount() external view returns (bytes32) { return _state().solanaRecipient; }
    function solanaDestinationCaller() external view returns (bytes32) { return _state().solanaCaller; }

    function hasRole(bytes32 role, address account) public view returns (bool) { return _state().roles[role][account]; }
    function getRoleAdmin(bytes32) external pure returns (bytes32) { return DEFAULT_ADMIN_ROLE; }
    function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
        return interfaceId == 0x01ffc9a7 || interfaceId == 0x7965db0b;
    }

    function grantRole(bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (account == address(0)) revert InvalidConfiguration();
        _grantRole(role, account);
    }

    function revokeRole(bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) { _revokeRole(role, account); }

    function renounceRole(bytes32 role, address callerConfirmation) external {
        _requireInitialized();
        if (callerConfirmation != msg.sender) revert AccessControlBadConfirmation();
        _revokeRole(role, msg.sender);
    }

    function _authorizeUpgrade(address) internal view override onlyRole(DEFAULT_ADMIN_ROLE) {
        if (_state().guard == 2) revert ReentrantCall();
    }

    function _grantRole(bytes32 role, address account) internal {
        HyStorage storage s = _state();
        if (!s.roles[role][account]) {
            s.roles[role][account] = true;
            if (role == DEFAULT_ADMIN_ROLE) s.adminCount++;
            emit RoleGranted(role, account, msg.sender);
        }
    }

    function _revokeRole(bytes32 role, address account) internal {
        HyStorage storage s = _state();
        if (s.roles[role][account]) {
            if (role == DEFAULT_ADMIN_ROLE) {
                if (s.adminCount == 1) revert LastAdministrator();
                s.adminCount--;
            }
            s.roles[role][account] = false;
            emit RoleRevoked(role, account, msg.sender);
        }
    }

    function _position() internal view returns (VaultPosition memory p) {
        IHyVault vault = _vault();
        p.heldShares = vault.balanceOf(address(this));
        p.pendingDepositAssets = vault.pendingDepositRequest(0, address(this));
        p.claimableDepositAssets = vault.claimableDepositRequest(0, address(this));
        p.pendingRedeemShares = vault.pendingRedeemRequest(0, address(this));
        p.claimableRedeemShares = vault.claimableRedeemRequest(0, address(this));
        if ((p.claimableDepositAssets != 0 || p.claimableRedeemShares != 0) && vault.paused()) revert VaultPausedValuation();
        if (p.claimableDepositAssets != 0) p.claimableDepositShares = vault.maxMint(address(this));
        // When closed with no claimable redemption, maxWithdraw includes held
        // shares. It must not be added in that case or TVL would double count.
        if (p.claimableRedeemShares != 0) p.claimableRedeemAssets = vault.maxWithdraw(address(this));
    }

    function _assertLegacyExternalReady(address proxy) internal view returns (uint256 assets) {
        (address legacyAddress,) = _route(proxy);
        ILegacyVault legacy = ILegacyVault(legacyAddress);
        if (legacy.asset() != USDC) revert InvalidDependency(legacyAddress);
        uint256 shares = legacy.balanceOf(proxy);
        assets = legacy.convertToAssets(shares);
        uint256 maxShares = proxy == MAPLE_PROXY ? MAX_MAPLE_DUST_SHARES : MAX_CORE_DUST_SHARES;
        if (shares > maxShares || assets > MAX_LEGACY_DUST_USDC)
            revert LegacyPositionNotCleared(legacyAddress, shares, assets);
        if (proxy == MAPLE_PROXY) {
            address manager = ILegacyMaplePool(legacyAddress).manager();
            if (manager.code.length == 0) revert InvalidDependency(manager);
            address withdrawal = ILegacyMapleManager(manager).withdrawalManager();
            if (withdrawal.code.length == 0) revert InvalidDependency(withdrawal);
            ILegacyMapleWithdrawalManager queue = ILegacyMapleWithdrawalManager(withdrawal);
            if (queue.lockedShares(proxy) != 0 || queue.manualSharesAvailable(proxy) != 0 || queue.requestIds(proxy) != 0)
                revert LegacyMapleQueueOutstanding(withdrawal);
        } else {
            IHyVault core = IHyVault(legacyAddress);
            if (
                core.pendingDepositRequest(0, proxy) != 0 || core.claimableDepositRequest(0, proxy) != 0
                    || core.pendingRedeemRequest(0, proxy) != 0 || core.claimableRedeemRequest(0, proxy) != 0
            ) revert LegacyRequestsOutstanding(legacyAddress);
        }
    }

    function _checkContext(address proxy) internal view {
        if (block.chainid != 1) revert UnsupportedChain(block.chainid);
        if (proxy != MAPLE_PROXY && proxy != GAMI_PROXY) revert UnsupportedProxy(proxy);
    }

    function _route(address proxy) internal pure returns (address legacy, bytes32 recipient) {
        if (proxy == MAPLE_PROXY) return (LEGACY_MAPLE_VAULT, MAPLE_SOLANA_RECIPIENT);
        if (proxy == GAMI_PROXY) return (LEGACY_CORE_VAULT, GAMI_SOLANA_RECIPIENT);
        revert UnsupportedProxy(proxy);
    }

    function _checkRequestId(uint256 requestId) internal pure {
        if (requestId > type(uint40).max) revert InvalidRequestId(requestId);
    }

    function _requireInitialized() internal view { if (!_state().initialized) revert NotInitialized(); }

    function _vault() internal view returns (IHyVault) {
        _requireInitialized();
        return IHyVault(_state().vault);
    }

    function _state() internal pure returns (HyStorage storage s) {
        bytes32 slot = HY_STORAGE;
        assembly { s.slot := slot }
    }
}

@openzeppelin/contracts/interfaces/IERC1363.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

@openzeppelin/contracts/interfaces/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

@openzeppelin/contracts/interfaces/IERC1967.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

@openzeppelin/contracts/interfaces/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

@openzeppelin/contracts/interfaces/draft-IERC1822.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.22;

import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This library provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
 */
library ERC1967Utils {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit IERC1967.Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit IERC1967.AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the ERC-1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit IERC1967.BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

@openzeppelin/contracts/proxy/beacon/IBeacon.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.22;

import {IERC1822Proxiable} from "../../interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    /**
     * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC-1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

@openzeppelin/contracts/utils/Errors.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

@openzeppelin/contracts/utils/StorageSlot.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Int256Slot` with member `value` located at `slot`.
     */
    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns a `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }
}

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

contracts/interfaces/IHyBridgeDependencies.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @dev Minimal interface checked against the deployed Lagoon v0.6.0 ABI.
interface IHyVault is IERC20 {
    function asset() external view returns (address);
    function decimals() external view returns (uint8);
    function paused() external view returns (bool);
    function isAllowed(address account) external view returns (bool);
    function convertToAssets(uint256 shares) external view returns (uint256);
    function convertToShares(uint256 assets) external view returns (uint256);
    function pendingDepositRequest(uint256 requestId, address controller) external view returns (uint256);
    function claimableDepositRequest(uint256 requestId, address controller) external view returns (uint256);
    function pendingRedeemRequest(uint256 requestId, address controller) external view returns (uint256);
    function claimableRedeemRequest(uint256 requestId, address controller) external view returns (uint256);
    function maxMint(address controller) external view returns (uint256);
    function maxWithdraw(address controller) external view returns (uint256);
    function requestDeposit(uint256 assets, address controller, address owner) external payable returns (uint256);
    function deposit(uint256 assets, address receiver, address controller) external returns (uint256);
    function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256);
    function redeem(uint256 shares, address receiver, address controller) external returns (uint256);
}

interface ILegacyVault is IERC20 {
    function asset() external view returns (address);
    function convertToAssets(uint256 shares) external view returns (uint256);
}

interface ILegacyMaplePool is ILegacyVault {
    function manager() external view returns (address);
}

interface ILegacyMapleManager {
    function withdrawalManager() external view returns (address);
}

interface ILegacyMapleWithdrawalManager {
    function lockedShares(address owner) external view returns (uint256);
    function manualSharesAvailable(address owner) external view returns (uint256);
    function requestIds(address owner) external view returns (uint256);
}

interface ILegacyAdapter {
    struct Request {
        uint256 requestId;
        uint256 assets;
        uint256 shares;
    }
    function vaultContract() external view returns (address);
    function tokenContract() external view returns (address);
    function messageTransmitter() external view returns (address);
    function tokenMessenger() external view returns (address);
    function solanaDomain() external view returns (uint32);
    function solanaSenderTokenAccount() external view returns (bytes32);
    function solanaDestinationCaller() external view returns (bytes32);
    function hasRole(bytes32 role, address account) external view returns (bool);
    function getTotalValueLocked() external view returns (uint256);
    function getUsdcBalance() external view returns (uint256);
    function vaultSharesPendingWithdrawals() external view returns (uint256);
    function getDepositRequests() external view returns (Request[] memory);
    function getRedeemRequests() external view returns (Request[] memory);
}

interface IMessageTransmitterV2 {
    function receiveMessage(bytes calldata message, bytes calldata attestation) external returns (bool);
}

interface ITokenMessengerV2 {
    function depositForBurn(
        uint256 amount,
        uint32 destinationDomain,
        bytes32 mintRecipient,
        address burnToken,
        bytes32 destinationCaller,
        uint256 maxFee,
        uint32 minFinalityThreshold
    ) external;
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.