// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @title IPermissionedMintingManager * @dev Interface for a permissioned minting manager that controls minting, cross-chain transfers, and contract upgrades. */ interface IPermissionedMintingManager { /** * @notice Sets a new contract to be managed by the PermissionedManager. * @dev This function is typically called when assigning a new contract to be managed under the permissioned minting rules. * @param contractAddress The address of the new contract to be managed. */ function setManagedContract(address contractAddress) external; /** * @notice Checks if a transfer request is allowed. * @dev This function verifies if a transfer is permitted based on certain conditions. * If permission is denied, the transaction will be reverted. As this function may update * internal state, the transfer should occur immediately after this check to ensure consistency. * @param from The address of the sender initiating the transfer. * @param to The address of the recipient of the transfer. * @param amount The amount of tokens being transferred. */ function checkTransferPermission( address from, address to, uint256 amount ) external; /** * @notice Checks if a minting request is allowed and may update the state accordingly. * @dev This function verifies if minting is permitted based on certain conditions. * If permission is denied, the transaction will be reverted. As this function may update * internal state, the minting should occur immediately after this check to ensure consistency. * @param account The address of the account requesting the minting. * @param amount The amount of tokens requested to be minted. * @param sender The address of the sender making the request. */ function checkMintingPermission( address account, uint256 amount, address sender ) external; /** * @notice Sends a redemption message to the vault contract via the bridge. * @dev This function triggers a redemption process for a given account and amount. * @param account The account whose tokens are being redeemed. * @param amount The amount of tokens to redeem. */ function triggerRedemption(address account, uint256 amount) external; /** * @notice Transfers tokens cross-chain through the bridge. * @dev This function is responsible for handling cross-chain token transfers. * @param chainId The ID of the destination chain. * @param account The address of the recipient on the destination chain. * @param amount The amount of tokens to transfer. */ function transferToChain( uint16 chainId, address account, uint256 amount ) external; /** * @notice Proposes an upgrade and waits for a predetermined time before allowing the upgrade. * @dev Returns true if the time has passed and the contract can migrate to a new version. * @param newContractAddress The address of the new contract. * @param sender The address initiating the upgrade proposal. * @return bool True if the upgrade is allowed after the waiting period, false otherwise. */ function isUpdateAllowed( address newContractAddress, address sender ) external returns (bool); /** * @notice Migrates the state to the new contract from the old contract. * @dev This function handles the migration of state when upgrading to a new contract version. * @param oldContract The address of the previous contract from which state is migrated. */ function migrateStateFromContract(address oldContract) external; }