Skip to content
Verified contractExactBUSL-1.1

PausableFreezableWhitelistable

Address0x7de423e3bc146809db0702410f3e9efcfe5bdf27
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.36

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.36+commit.8a079791
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
BUSL-1.1
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,434,315
Creation transaction
0x153023e95a…cf6aa8fba4

src/platform/policies/PausableFreezableWhitelistable.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

import { ConfigViews } from "../../libs/ConfigViews.sol";

import { PolicyTypes } from "../../libs/PolicyTypes.sol";

import { IPausableFreezableWhitelistable } from "./interfaces/IPausableFreezableWhitelistable.sol";
import { IPolicy } from "./interfaces/IPolicy.sol";
import { PausableFreezable } from "./PausableFreezable.sol";

/// @title  Pause and freeze enforcement restricted to a stablecoin's whitelisted accounts.
/// @author M0 Labs
contract PausableFreezableWhitelistable is PausableFreezable, IPausableFreezableWhitelistable {
    /* ============ Constructor ============ */

    /// @notice Constructs the policy, binding it permanently to one registrar.
    /// @param  configRegistrar_ The registrar to read every compliance decision from.
    constructor(address configRegistrar_) PausableFreezable(configRegistrar_) {}

    /* ============ View/Pure Functions ============ */

    /// @inheritdoc IPolicy
    function policyType() external pure virtual override(IPolicy, PausableFreezable) returns (bytes32) {
        return PolicyTypes.PAUSABLE_FREEZABLE_WHITELISTABLE;
    }

    /* ============ Internal View/Pure Functions ============ */

    /// @dev    Rejects a transfer unless both counterparties are whitelisted.
    ///         An unlisted spender may still move tokens between two listed accounts.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the transfer.
    /// @param  from       The address the tokens would move from.
    /// @param  to         The address the tokens would move to.
    /// @param  amount     The amount of tokens that would move.
    function _beforeTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256 amount
    ) internal view virtual override {
        _revertIfNotWhitelisted(stablecoin, from);
        _revertIfNotWhitelisted(stablecoin, to);

        super._beforeTransferChecks(stablecoin, caller, from, to, amount);
    }

    /// @dev    Rejects a mint unless the recipient is whitelisted.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the mint.
    /// @param  to         The address that would receive the minted tokens.
    /// @param  amount     The amount of tokens that would be minted.
    function _beforeMintChecks(
        address stablecoin,
        address caller,
        address to,
        uint256 amount
    ) internal view virtual override {
        _revertIfNotWhitelisted(stablecoin, to);

        super._beforeMintChecks(stablecoin, caller, to, amount);
    }

    /// @dev    Rejects a claim unless the recipient is whitelisted.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the claim.
    /// @param  account    The address that would receive the claimed yield.
    function _beforeClaimChecks(address stablecoin, address caller, address account) internal view virtual override {
        _revertIfNotWhitelisted(stablecoin, account);

        super._beforeClaimChecks(stablecoin, caller, account);
    }

    /// @dev    Reverts unless the account belongs to the stablecoin's whitelist.
    /// @param  stablecoin The stablecoin the whitelist belongs to.
    /// @param  account    The account to check.
    function _revertIfNotWhitelisted(address stablecoin, address account) internal view {
        if (ConfigViews.isWhitelisted(_getConfigRegistrar(), stablecoin, account)) return;

        revert AccountNotWhitelisted(stablecoin, account);
    }
}

lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted to signal this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlDefaultAdminRules.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/extensions/IAccessControlDefaultAdminRules.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev External interface of AccessControlDefaultAdminRules declared to support ERC-165 detection.
 */
interface IAccessControlDefaultAdminRules is IAccessControl {
    /**
     * @dev The new default admin is not a valid default admin.
     */
    error AccessControlInvalidDefaultAdmin(address defaultAdmin);

    /**
     * @dev At least one of the following rules was violated:
     *
     * - The `DEFAULT_ADMIN_ROLE` must only be managed by itself.
     * - The `DEFAULT_ADMIN_ROLE` must only be held by one account at the time.
     * - Any `DEFAULT_ADMIN_ROLE` transfer must be in two delayed steps.
     */
    error AccessControlEnforcedDefaultAdminRules();

    /**
     * @dev The delay for transferring the default admin delay is enforced and
     * the operation must wait until `schedule`.
     *
     * NOTE: `schedule` can be 0 indicating there's no transfer scheduled.
     */
    error AccessControlEnforcedDefaultAdminDelay(uint48 schedule);

    /**
     * @dev Emitted when a {defaultAdmin} transfer is started, setting `newAdmin` as the next
     * address to become the {defaultAdmin} by calling {acceptDefaultAdminTransfer} only after `acceptSchedule`
     * passes.
     */
    event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule);

    /**
     * @dev Emitted when a {pendingDefaultAdmin} is reset if it was never accepted, regardless of its schedule.
     */
    event DefaultAdminTransferCanceled();

    /**
     * @dev Emitted when a {defaultAdminDelay} change is started, setting `newDelay` as the next
     * delay to be applied between default admin transfer after `effectSchedule` has passed.
     */
    event DefaultAdminDelayChangeScheduled(uint48 newDelay, uint48 effectSchedule);

    /**
     * @dev Emitted when a {pendingDefaultAdminDelay} is reset if its schedule didn't pass.
     */
    event DefaultAdminDelayChangeCanceled();

    /**
     * @dev Returns the address of the current `DEFAULT_ADMIN_ROLE` holder.
     */
    function defaultAdmin() external view returns (address);

    /**
     * @dev Returns a tuple of a `newAdmin` and an accept schedule.
     *
     * After the `schedule` passes, the `newAdmin` will be able to accept the {defaultAdmin} role
     * by calling {acceptDefaultAdminTransfer}, completing the role transfer.
     *
     * A zero value only in `acceptSchedule` indicates no pending admin transfer.
     *
     * NOTE: A zero address `newAdmin` means that {defaultAdmin} is being renounced.
     */
    function pendingDefaultAdmin() external view returns (address newAdmin, uint48 acceptSchedule);

    /**
     * @dev Returns the delay required to schedule the acceptance of a {defaultAdmin} transfer started.
     *
     * This delay will be added to the current timestamp when calling {beginDefaultAdminTransfer} to set
     * the acceptance schedule.
     *
     * NOTE: If a delay change has been scheduled, it will take effect as soon as the schedule passes, making this
     * function returns the new delay. See {changeDefaultAdminDelay}.
     */
    function defaultAdminDelay() external view returns (uint48);

    /**
     * @dev Returns a tuple of `newDelay` and an effect schedule.
     *
     * After the `schedule` passes, the `newDelay` will get into effect immediately for every
     * new {defaultAdmin} transfer started with {beginDefaultAdminTransfer}.
     *
     * A zero value only in `effectSchedule` indicates no pending delay change.
     *
     * NOTE: A zero value only for `newDelay` means that the next {defaultAdminDelay}
     * will be zero after the effect schedule.
     */
    function pendingDefaultAdminDelay() external view returns (uint48 newDelay, uint48 effectSchedule);

    /**
     * @dev Starts a {defaultAdmin} transfer by setting a {pendingDefaultAdmin} scheduled for acceptance
     * after the current timestamp plus a {defaultAdminDelay}.
     *
     * Requirements:
     *
     * - Only can be called by the current {defaultAdmin}.
     *
     * Emits a DefaultAdminRoleChangeStarted event.
     */
    function beginDefaultAdminTransfer(address newAdmin) external;

    /**
     * @dev Cancels a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}.
     *
     * A {pendingDefaultAdmin} not yet accepted can also be cancelled with this function.
     *
     * Requirements:
     *
     * - Only can be called by the current {defaultAdmin}.
     *
     * May emit a DefaultAdminTransferCanceled event.
     */
    function cancelDefaultAdminTransfer() external;

    /**
     * @dev Completes a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}.
     *
     * After calling the function:
     *
     * - `DEFAULT_ADMIN_ROLE` should be granted to the caller.
     * - `DEFAULT_ADMIN_ROLE` should be revoked from the previous holder.
     * - {pendingDefaultAdmin} should be reset to zero values.
     *
     * Requirements:
     *
     * - Only can be called by the {pendingDefaultAdmin}'s `newAdmin`.
     * - The {pendingDefaultAdmin}'s `acceptSchedule` should've passed.
     */
    function acceptDefaultAdminTransfer() external;

    /**
     * @dev Initiates a {defaultAdminDelay} update by setting a {pendingDefaultAdminDelay} scheduled for getting
     * into effect after the current timestamp plus a {defaultAdminDelay}.
     *
     * This function guarantees that any call to {beginDefaultAdminTransfer} done between the timestamp this
     * method is called and the {pendingDefaultAdminDelay} effect schedule will use the current {defaultAdminDelay}
     * set before calling.
     *
     * The {pendingDefaultAdminDelay}'s effect schedule is defined in a way that waiting until the schedule and then
     * calling {beginDefaultAdminTransfer} with the new delay will take at least the same as another {defaultAdmin}
     * complete transfer (including acceptance).
     *
     * The schedule is designed for two scenarios:
     *
     * - When the delay is changed for a larger one the schedule is `block.timestamp + newDelay` capped by
     * {defaultAdminDelayIncreaseWait}.
     * - When the delay is changed for a shorter one, the schedule is `block.timestamp + (current delay - new delay)`.
     *
     * A {pendingDefaultAdminDelay} that never got into effect will be canceled in favor of a new scheduled change.
     *
     * Requirements:
     *
     * - Only can be called by the current {defaultAdmin}.
     *
     * Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event.
     */
    function changeDefaultAdminDelay(uint48 newDelay) external;

    /**
     * @dev Cancels a scheduled {defaultAdminDelay} change.
     *
     * Requirements:
     *
     * - Only can be called by the current {defaultAdmin}.
     *
     * May emit a DefaultAdminDelayChangeCanceled event.
     */
    function rollbackDefaultAdminDelay() external;

    /**
     * @dev Maximum time in seconds for an increase to {defaultAdminDelay} (that is scheduled using {changeDefaultAdminDelay})
     * to take effect. Default to 5 days.
     *
     * When the {defaultAdminDelay} is scheduled to be increased, it goes into effect after the new delay has passed with
     * the purpose of giving enough time for reverting any accidental change (i.e. using milliseconds instead of seconds)
     * that may lock the contract. However, to avoid excessive schedules, the wait is capped by this function and it can
     * be overrode for a custom {defaultAdminDelay} increase scheduling.
     *
     * IMPORTANT: Make sure to add a reasonable amount of time while overriding this value, otherwise,
     * there's a risk of setting a high new delay that goes into effect almost immediately without the
     * possibility of human intervention in the case of an input error (eg. set milliseconds instead of seconds).
     */
    function defaultAdminDelayIncreaseWait() external view returns (uint48);
}

lib/common/src/interfaces/IERC20.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

/**
 * @title  ERC20 Token Standard.
 * @author M^0 Labs
 * @dev    The interface as defined by EIP-20: https://eips.ethereum.org/EIPS/eip-20
 */
interface IERC20 {
    /* ============ Events ============ */

    /**
     * @notice Emitted when `spender` has been approved for `amount` of the token balance of `account`.
     * @param  account The address of the account.
     * @param  spender The address of the spender being approved for the allowance.
     * @param  amount  The amount of the allowance being approved.
     */
    event Approval(address indexed account, address indexed spender, uint256 amount);

    /**
     * @notice Emitted when `amount` tokens is transferred from `sender` to `recipient`.
     * @param  sender    The address of the sender who's token balance is decremented.
     * @param  recipient The address of the recipient who's token balance is incremented.
     * @param  amount    The amount of tokens being transferred.
     */
    event Transfer(address indexed sender, address indexed recipient, uint256 amount);

    /* ============ Interactive Functions ============ */

    /**
     * @notice Allows a calling account to approve `spender` to spend up to `amount` of its token balance.
     * @dev    MUST emit an `Approval` event.
     * @param  spender The address of the account being allowed to spend up to the allowed amount.
     * @param  amount  The amount of the allowance being approved.
     * @return Whether or not the approval was successful.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @notice Allows a calling account to transfer `amount` tokens to `recipient`.
     * @param  recipient The address of the recipient who's token balance will be incremented.
     * @param  amount    The amount of tokens being transferred.
     * @return Whether or not the transfer was successful.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @notice Allows a calling account to transfer `amount` tokens from `sender`, with allowance, to a `recipient`.
     * @param  sender    The address of the sender who's token balance will be decremented.
     * @param  recipient The address of the recipient who's token balance will be incremented.
     * @param  amount    The amount of tokens being transferred.
     * @return Whether or not the transfer was successful.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /* ============ View/Pure Functions ============ */

    /**
     * @notice Returns the allowance `spender` is allowed to spend on behalf of `account`.
     * @param  account The address of the account who's token balance `spender` is allowed to spend.
     * @param  spender The address of an account allowed to spend on behalf of `account`.
     * @return The amount `spender` can spend on behalf of `account`.
     */
    function allowance(address account, address spender) external view returns (uint256);

    /**
     * @notice Returns the token balance of `account`.
     * @param  account The address of some account.
     * @return The token balance of `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /// @notice Returns the number of decimals UIs should assume all amounts have.
    function decimals() external view returns (uint8);

    /// @notice Returns the name of the contract/token.
    function name() external view returns (string memory);

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

    /// @notice Returns the current total supply of the token.
    function totalSupply() external view returns (uint256);
}

lib/common/src/interfaces/IERC20Extended.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

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

/**
 * @title  An ERC20 token extended with EIP-2612 permits for signed approvals (via EIP-712
 *         and with EIP-1271 compatibility), and extended with EIP-3009 transfer with authorization (via EIP-712).
 * @author M^0 Labs
 * @dev    The additional interface as defined by EIP-2612: https://eips.ethereum.org/EIPS/eip-2612
 */
interface IERC20Extended is IERC20, IERC3009 {
    /* ============ Custom Errors ============ */

    /**
     * @notice Revert message when spender's allowance is not sufficient.
     * @param  spender    Address that may be allowed to operate on tokens without being their owner.
     * @param  allowance  Amount of tokens a `spender` is allowed to operate with.
     * @param  needed     Minimum amount required to perform a transfer.
     */
    error InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @notice Revert message emitted when the transferred amount is insufficient.
     * @param  amount Amount transferred.
     */
    error InsufficientAmount(uint256 amount);

    /**
     * @notice Revert message emitted when the recipient of a token is invalid.
     * @param  recipient Address of the invalid recipient.
     */
    error InvalidRecipient(address recipient);

    /* ============ Interactive Functions ============ */

    /**
     * @notice Approves `spender` to spend up to `amount` of the token balance of `owner`, via a signature.
     * @param  owner    The address of the account who's token balance is being approved to be spent by `spender`.
     * @param  spender  The address of an account allowed to spend on behalf of `owner`.
     * @param  value    The amount of the allowance being approved.
     * @param  deadline The last timestamp where the signature is still valid.
     * @param  v        An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712).
     * @param  r        An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712).
     * @param  s        An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712).
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Approves `spender` to spend up to `amount` of the token balance of `owner`, via a signature.
     * @param  owner     The address of the account who's token balance is being approved to be spent by `spender`.
     * @param  spender   The address of an account allowed to spend on behalf of `owner`.
     * @param  value     The amount of the allowance being approved.
     * @param  deadline  The last timestamp where the signature is still valid.
     * @param  signature An arbitrary signature (EIP-712).
     */
    function permit(address owner, address spender, uint256 value, uint256 deadline, bytes memory signature) external;

    /* ============ View/Pure Functions ============ */

    /// @notice Returns the EIP712 typehash used in the encoding of the digest for the permit function.
    function PERMIT_TYPEHASH() external view returns (bytes32);
}

lib/common/src/interfaces/IERC3009.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

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

/**
 * @title  Transfer via signed authorization following EIP-3009 standard.
 * @author M^0 Labs
 * @dev    The interface as defined by EIP-3009: https://eips.ethereum.org/EIPS/eip-3009
 */
interface IERC3009 is IStatefulERC712 {
    /* ============ Events ============ */

    /**
     * @notice Emitted when an authorization has been canceled.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the canceled authorization.
     */
    event AuthorizationCanceled(address indexed authorizer, bytes32 indexed nonce);

    /**
     * @notice Emitted when an authorization has been used.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the used authorization.
     */
    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);

    /* ============ Custom Errors ============ */

    /**
     * @notice Emitted when an authorization has already been used.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the used authorization.
     */
    error AuthorizationAlreadyUsed(address authorizer, bytes32 nonce);

    /**
     * @notice Emitted when an authorization is expired.
     * @param  timestamp   Timestamp at which the transaction was submitted.
     * @param  validBefore Timestamp before which the authorization would have been valid.
     */
    error AuthorizationExpired(uint256 timestamp, uint256 validBefore);

    /**
     * @notice Emitted when an authorization is not yet valid.
     * @param  timestamp  Timestamp at which the transaction was submitted.
     * @param  validAfter Timestamp after which the authorization will be valid.
     */
    error AuthorizationNotYetValid(uint256 timestamp, uint256 validAfter);

    /**
     * @notice Emitted when the caller of `receiveWithAuthorization` is not the payee.
     * @param  caller Caller's address.
     * @param  payee  Payee's address.
     */
    error CallerMustBePayee(address caller, address payee);

    /* ============ Interactive Functions ============ */

    /**
     * @notice Execute a transfer with a signed authorization.
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  signature   A byte array ECDSA/secp256k1 signature (encoded r, s, v).
     */
    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        bytes memory signature
    ) external;

    /**
     * @notice Execute a transfer with a signed authorization.
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  r           An ECDSA/secp256k1 signature parameter.
     * @param  vs          An ECDSA/secp256k1 short signature parameter.
     */
    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        bytes32 r,
        bytes32 vs
    ) external;

    /**
     * @notice Execute a transfer with a signed authorization.
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  v           v of the signature.
     * @param  r           r of the signature.
     * @param  s           s of the signature.
     */
    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Receive a transfer with a signed authorization from the payer.
     * @dev    This has an additional check to ensure that the payee's address matches
     *         the caller of this function to prevent front-running attacks.
     *         (See security considerations)
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  signature   A byte array ECDSA/secp256k1 signature (encoded r, s, v).
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        bytes memory signature
    ) external;

    /**
     * @notice Receive a transfer with a signed authorization from the payer.
     * @dev    This has an additional check to ensure that the payee's address matches
     *         the caller of this function to prevent front-running attacks.
     *         (See security considerations)
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  r           An ECDSA/secp256k1 signature parameter.
     * @param  vs          An ECDSA/secp256k1 short signature parameter.
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        bytes32 r,
        bytes32 vs
    ) external;

    /**
     * @notice Receive a transfer with a signed authorization from the payer.
     * @dev    This has an additional check to ensure that the payee's address matches
     *         the caller of this function to prevent front-running attacks.
     *         (See security considerations)
     * @param  from        Payer's address (Authorizer).
     * @param  to          Payee's address.
     * @param  value       Amount to be transferred.
     * @param  validAfter  The time after which this is valid (unix time).
     * @param  validBefore The time before which this is valid (unix time).
     * @param  nonce       Unique nonce.
     * @param  v           v of the signature.
     * @param  r           r of the signature.
     * @param  s           s of the signature.
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Attempt to cancel an authorization.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the authorization.
     * @param  signature  A byte array ECDSA/secp256k1 signature (encoded r, s, v).
     */
    function cancelAuthorization(address authorizer, bytes32 nonce, bytes memory signature) external;

    /**
     * @notice Attempt to cancel an authorization.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the authorization.
     * @param  r          An ECDSA/secp256k1 signature parameter.
     * @param  vs         An ECDSA/secp256k1 short signature parameter.
     */
    function cancelAuthorization(address authorizer, bytes32 nonce, bytes32 r, bytes32 vs) external;

    /**
     * @notice Attempt to cancel an authorization.
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the authorization.
     * @param  v          v of the signature.
     * @param  r          r of the signature.
     * @param  s          s of the signature.
     */
    function cancelAuthorization(address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s) external;

    /* ============ View/Pure Functions ============ */

    /**
     * @notice Returns the state of an authorization.
     * @dev    Nonces are randomly generated 32-byte data unique to the authorizer's address
     * @param  authorizer Authorizer's address.
     * @param  nonce      Nonce of the authorization.
     * @return True if the nonce is used.
     */
    function authorizationState(address authorizer, bytes32 nonce) external view returns (bool);

    /// @notice Returns `transferWithAuthorization` typehash.
    function TRANSFER_WITH_AUTHORIZATION_TYPEHASH() external view returns (bytes32);

    /// @notice Returns `receiveWithAuthorization` typehash.
    function RECEIVE_WITH_AUTHORIZATION_TYPEHASH() external view returns (bytes32);

    /// @notice Returns `cancelAuthorization` typehash.
    function CANCEL_AUTHORIZATION_TYPEHASH() external view returns (bytes32);
}

lib/common/src/interfaces/IERC712.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

/**
 * @title  Typed structured data hashing and signing via EIP-712.
 * @author M^0 Labs
 * @dev    The interface as defined by EIP-712: https://eips.ethereum.org/EIPS/eip-712
 */
interface IERC712 {
    /* ============ Custom Errors ============ */

    /// @notice Revert message when an invalid signature is detected.
    error InvalidSignature();

    /// @notice Revert message when a signature with invalid length is detected.
    error InvalidSignatureLength();

    /// @notice Revert message when the S portion of a signature is invalid.
    error InvalidSignatureS();

    /// @notice Revert message when the V portion of a signature is invalid.
    error InvalidSignatureV();

    /**
     * @notice Revert message when a signature is being used beyond its deadline (i.e. expiry).
     * @param  deadline  The last timestamp where the signature is still valid.
     * @param  timestamp The current timestamp.
     */
    error SignatureExpired(uint256 deadline, uint256 timestamp);

    /// @notice Revert message when a recovered signer does not match the account being purported to have signed.
    error SignerMismatch();

    /* ============ View/Pure Functions ============ */

    /// @notice Returns the EIP712 domain separator used in the encoding of a signed digest.
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

lib/common/src/interfaces/IERC712Extended.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

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

/**
 * @title  EIP-712 extended by EIP-5267.
 * @author M^0 Labs
 * @dev    The additional interface as defined by EIP-5267: https://eips.ethereum.org/EIPS/eip-5267
 */
interface IERC712Extended is IERC712 {
    /* ============ Events ============ */

    /// @notice MAY be emitted to signal that the domain could have changed.
    event EIP712DomainChanged();

    /* ============ View/Pure Functions ============ */

    /// @notice Returns the fields and values that describe the domain separator used by this contract for EIP-712.
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

lib/common/src/interfaces/IStatefulERC712.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.20 <0.9.0;

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

/**
 * @title  Stateful Extension for EIP-712 typed structured data hashing and signing with nonces.
 * @author M^0 Labs
 */
interface IStatefulERC712 is IERC712Extended {
    /* ============ Custom Errors ============ */

    /**
     * @notice Revert message when a signing account's nonce is not the expected current nonce.
     * @param  nonce         The nonce used in the signature.
     * @param  expectedNonce The expected nonce to be used in a signature by the signing account.
     */
    error InvalidAccountNonce(uint256 nonce, uint256 expectedNonce);

    /* ============ View/Pure Functions ============ */

    /**
     * @notice Returns the next nonce to be used in a signature by `account`.
     * @param  account The address of some account.
     * @return nonce   The next nonce to be used in a signature by `account`.
     */
    function nonces(address account) external view returns (uint256 nonce);
}

src/interfaces/IErrors.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

/// @title  Error declarations shared by more than one interface.
/// @author M0 Labs
interface IErrors {
    /* ============ Custom Errors ============ */

    /// @notice Thrown when batched arrays have mismatched lengths.
    error ArrayLengthMismatch();

    /// @notice Thrown when a gateway-only function is called by an address other than the issuer gateway.
    /// @param  caller The address that attempted the call.
    error NotIssuerGateway(address caller);

    /// @notice Thrown when the caller holds the role neither registrar-wide nor scoped to the stablecoin.
    /// @param  account    The address that attempted the call.
    /// @param  stablecoin The stablecoin the call targets.
    /// @param  role       The unscoped role identifier the call requires.
    error UnauthorizedForStablecoin(address account, address stablecoin, bytes32 role);

    /// @notice Thrown when the account address is the zero address.
    error ZeroAccount();

    /// @notice Thrown when an operation that must move tokens is given a zero amount.
    error ZeroAmount();

    /// @notice Thrown when the config registrar address is the zero address.
    error ZeroConfigRegistrar();

    /// @notice Thrown when the issuer gateway address is the zero address.
    error ZeroIssuerGateway();

    /// @notice Thrown when the policy address is the zero address.
    error ZeroPolicy();

    /// @notice Thrown when the policy registry address is the zero address.
    error ZeroPolicyRegistry();

    /// @notice Thrown when the stablecoin address is the zero address.
    error ZeroStablecoin();
}

src/libs/ConfigKeys.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.36;

/// @title  The shared vocabulary of the config contracts: key derivations and the identifier catalog.
/// @author M0 Labs
/// @dev    Append only: these values address registrar storage, so a changed one silently reads an empty key.
library ConfigKeys {
    /* ============ Constants ============ */

    /// @dev The storage key for a stablecoin's pause flag.
    bytes32 internal constant PAUSE_FLAG = keccak256("PAUSE_FLAG");

    /// @dev The storage key for the freeze list.
    bytes32 internal constant FREEZE_LIST = keccak256("FREEZE_LIST");

    /// @dev The storage key for the whitelist, which exists per stablecoin only.
    bytes32 internal constant WHITELIST = keccak256("WHITELIST");

    /// @dev Hashed with a flag identifier to produce that flag's manager role.
    bytes32 internal constant FLAG_MANAGER_ROLE = keccak256("FLAG_MANAGER_ROLE");

    /// @dev Hashed with a list identifier to produce that list's manager role.
    bytes32 internal constant LIST_MANAGER_ROLE = keccak256("LIST_MANAGER_ROLE");

    /// @dev The role that can pause and unpause stablecoins, globally or scoped to a stablecoin.
    bytes32 internal constant PAUSER_ROLE = keccak256(abi.encode(FLAG_MANAGER_ROLE, PAUSE_FLAG));

    /// @dev The role that can freeze and unfreeze accounts, globally or scoped to a stablecoin.
    bytes32 internal constant FREEZE_MANAGER_ROLE = keccak256(abi.encode(LIST_MANAGER_ROLE, FREEZE_LIST));

    /// @dev The role that can whitelist and unwhitelist accounts, scoped to a stablecoin.
    bytes32 internal constant WHITELIST_MANAGER_ROLE = keccak256(abi.encode(LIST_MANAGER_ROLE, WHITELIST));

    /// @dev The role that can claim a stablecoin's yield directly on the token, alongside the issuer gateway.
    bytes32 internal constant CLAIMER_ROLE = keccak256("CLAIMER_ROLE");

    /// @dev The role that can seize tokens from a stablecoin's frozen accounts.
    bytes32 internal constant FORCED_TRANSFER_MANAGER_ROLE = keccak256("FORCED_TRANSFER_MANAGER_ROLE");

    /// @dev The role that can grant and revoke a single stablecoin's scoped roles.
    bytes32 internal constant STABLECOIN_ADMIN_ROLE = keccak256("STABLECOIN_ADMIN_ROLE");

    /* ============ Internal View/Pure Functions ============ */

    /// @dev    Returns the identifier of a role scoped to one stablecoin.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @return The scoped role identifier.
    function getStablecoinRole(address stablecoin, bytes32 role) internal pure returns (bytes32) {
        return keccak256(abi.encode(stablecoin, role));
    }

    /// @dev    Returns the identifier of the role that may write one flag.
    /// @param  flag The flag the role manages.
    /// @return The flag manager role identifier.
    function getFlagManagerRole(bytes32 flag) internal pure returns (bytes32) {
        return keccak256(abi.encode(FLAG_MANAGER_ROLE, flag));
    }

    /// @dev    Returns the identifier of the role that may write one list.
    /// @param  list The list the role manages.
    /// @return The list manager role identifier.
    function getListManagerRole(bytes32 list) internal pure returns (bytes32) {
        return keccak256(abi.encode(LIST_MANAGER_ROLE, list));
    }

    /// @dev    Returns the storage key for one of a stablecoin's values.
    /// @param  stablecoin The stablecoin the value belongs to, or the zero address for the panel-wide value.
    /// @param  key        The value identifier.
    /// @return The storage key.
    function getValueKey(address stablecoin, bytes32 key) internal pure returns (bytes32) {
        return keccak256(abi.encode(stablecoin, key));
    }

    /// @dev    Returns the storage key for one account's entry in a stablecoin's list.
    /// @param  stablecoin The stablecoin the list belongs to, or the zero address for the panel-wide list.
    /// @param  list       The list the entry belongs to.
    /// @param  account    The account the entry applies to.
    /// @return The storage key.
    function getListKey(address stablecoin, bytes32 list, address account) internal pure returns (bytes32) {
        return keccak256(abi.encode(stablecoin, list, account));
    }
}

src/libs/ConfigViews.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.36;

import { IConfigRegistrar } from "../platform/config/interfaces/IConfigRegistrar.sol";

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

/// @title  The meaning of the registrar's compliance keys, read the same way by every consumer.
/// @author M0 Labs
library ConfigViews {
    /* ============ Internal View/Pure Functions ============ */

    /// @dev    Returns whether the stablecoin is paused, registrar-wide or individually.
    /// @param  configRegistrar The registrar holding the compliance state.
    /// @param  stablecoin      The stablecoin to check.
    /// @return Whether the stablecoin is paused.
    function isPaused(IConfigRegistrar configRegistrar, address stablecoin) internal view returns (bool) {
        return
            configRegistrar.isFlagSet(address(0), ConfigKeys.PAUSE_FLAG) ||
            configRegistrar.isFlagSet(stablecoin, ConfigKeys.PAUSE_FLAG);
    }

    /// @dev    Returns whether the account is frozen, registrar-wide or for the stablecoin.
    /// @param  configRegistrar The registrar holding the compliance state.
    /// @param  stablecoin      The stablecoin the freeze applies to.
    /// @param  account         The account to check.
    /// @return Whether the account is frozen.
    function isFrozen(
        IConfigRegistrar configRegistrar,
        address stablecoin,
        address account
    ) internal view returns (bool) {
        return
            configRegistrar.isInList(address(0), ConfigKeys.FREEZE_LIST, account) ||
            configRegistrar.isInList(stablecoin, ConfigKeys.FREEZE_LIST, account);
    }

    /// @dev    Returns whether the account belongs to the stablecoin's whitelist.
    ///         Unlike pause and freeze, there is no registrar-wide tier to union with.
    /// @param  configRegistrar The registrar holding the compliance state.
    /// @param  stablecoin      The stablecoin the whitelist belongs to.
    /// @param  account         The account to check.
    /// @return Whether the account is whitelisted.
    function isWhitelisted(
        IConfigRegistrar configRegistrar,
        address stablecoin,
        address account
    ) internal view returns (bool) {
        return configRegistrar.isInList(stablecoin, ConfigKeys.WHITELIST, account);
    }
}

src/libs/PolicyTypes.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.36;

/// @title  Identifiers the policy registry catalogs each compliance policy under.
/// @author M0 Labs
/// @dev    Append only: never rename or reuse an identifier, since deployed policies report the value compiled in.
library PolicyTypes {
    /* ============ Constants ============ */

    /// @dev Pause and freeze enforcement.
    bytes32 internal constant PAUSABLE_FREEZABLE = keccak256("PAUSABLE_FREEZABLE");

    /// @dev Pause and freeze enforcement that additionally grants seizure authority.
    // solhint-disable-next-line gas-small-strings
    bytes32 internal constant PAUSABLE_FREEZABLE_FORCED_TRANSFERABLE = keccak256(
        "PAUSABLE_FREEZABLE_FORCED_TRANSFERABLE"
    );

    /// @dev Pause and freeze enforcement restricted to a stablecoin's whitelisted accounts.
    bytes32 internal constant PAUSABLE_FREEZABLE_WHITELISTABLE = keccak256("PAUSABLE_FREEZABLE_WHITELISTABLE");
}

src/platform/config/interfaces/IConfigRegistrar.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

// solhint-disable-next-line max-line-length
import { IAccessControlDefaultAdminRules } from "../../../../lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlDefaultAdminRules.sol";

import { IErrors } from "../../../interfaces/IErrors.sol";

/// @title  The store of an issuer's compliance state and of every role that writes it.
/// @author M0 Labs
interface IConfigRegistrar is IAccessControlDefaultAdminRules, IErrors {
    /* ============ Events ============ */

    /// @notice Emitted when a registrar-wide flag is set.
    /// @param  flag The flag that was set.
    /// @param  set  Whether the flag is now set.
    event GlobalFlagSet(bytes32 indexed flag, bool set);

    /// @notice Emitted when one stablecoin's flag is set.
    /// @param  stablecoin The stablecoin the flag applies to.
    /// @param  flag       The flag that was set.
    /// @param  set        Whether the flag is now set.
    event StablecoinFlagSet(address indexed stablecoin, bytes32 indexed flag, bool set);

    /// @notice Emitted when an account's membership of a registrar-wide list is set.
    /// @param  list     The list the entry belongs to.
    /// @param  account  The account the entry applies to.
    /// @param  included Whether the account belongs to the list.
    event GlobalListEntrySet(bytes32 indexed list, address indexed account, bool included);

    /// @notice Emitted when an account's membership of one stablecoin's list is set.
    /// @param  stablecoin The stablecoin the list belongs to.
    /// @param  list       The list the entry belongs to.
    /// @param  account    The account the entry applies to.
    /// @param  included   Whether the account belongs to the list.
    event StablecoinListEntrySet(
        address indexed stablecoin,
        bytes32 indexed list,
        address indexed account,
        bool included
    );

    /// @notice Emitted when a stablecoin-scoped role is granted, naming its parts.
    /// @dev    Emitted only by `grantStablecoinRole`, never by a raw `grantRole` of a scoped id.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @param  account    The account the role was granted to.
    event StablecoinRoleGranted(address indexed stablecoin, bytes32 indexed role, address indexed account);

    /// @notice Emitted when a stablecoin-scoped role is revoked, naming its parts.
    /// @dev    Emitted only by `revokeStablecoinRole`, never by a raw `revokeRole` of a scoped id.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @param  account    The account the role was revoked from.
    event StablecoinRoleRevoked(address indexed stablecoin, bytes32 indexed role, address indexed account);

    /* ============ Custom Errors ============ */

    /// @notice Thrown when the panel handed to `initialize` reads a different registrar.
    /// @param  configPanel The panel that named another registrar.
    error InvalidConfigPanel(address configPanel);

    /// @notice Thrown when the flag identifier is the zero value.
    error ZeroFlag();

    /// @notice Thrown when the list identifier is the zero value.
    error ZeroList();

    /// @notice Thrown when the role identifier is the zero value.
    error ZeroRole();

    /* ============ Interactive Functions ============ */

    /// @notice Sets a registrar-wide flag.
    /// @dev    Restricted to `getFlagManagerRole(flag)`, held registrar-wide.
    /// @param  flag The flag to set.
    /// @param  set  Whether the flag applies.
    /// @return Whether the stored value changed.
    function setGlobalFlag(bytes32 flag, bool set) external returns (bool);

    /// @notice Sets one stablecoin's flag.
    /// @dev    Restricted to `getFlagManagerRole(flag)`, held registrar-wide or scoped to `stablecoin`.
    /// @param  stablecoin The stablecoin the flag applies to.
    /// @param  flag       The flag to set.
    /// @param  set        Whether the flag applies.
    /// @return Whether the stored value changed.
    function setStablecoinFlag(address stablecoin, bytes32 flag, bool set) external returns (bool);

    /// @notice Sets an account's membership of a registrar-wide list.
    /// @dev    Restricted to `getListManagerRole(list)`, held registrar-wide.
    /// @param  list     The list the entry belongs to.
    /// @param  account  The account the entry applies to.
    /// @param  included Whether the account belongs to the list.
    /// @return Whether the stored value changed.
    function setGlobalListEntry(bytes32 list, address account, bool included) external returns (bool);

    /// @notice Sets an account's membership of one stablecoin's list.
    /// @dev    Restricted to `getListManagerRole(list)`, held registrar-wide or scoped to `stablecoin`.
    /// @param  stablecoin The stablecoin the list belongs to.
    /// @param  list       The list the entry belongs to.
    /// @param  account    The account the entry applies to.
    /// @param  included   Whether the account belongs to the list.
    /// @return Whether the stored value changed.
    function setStablecoinListEntry(
        address stablecoin,
        bytes32 list,
        address account,
        bool included
    ) external returns (bool);

    /// @notice Grants a stablecoin-scoped role to an account.
    /// @dev    Restricted to `DEFAULT_ADMIN_ROLE`, or to `STABLECOIN_ADMIN_ROLE` scoped to `stablecoin` except for
    ///         that role itself.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @param  account    The account to grant the role to.
    function grantStablecoinRole(address stablecoin, bytes32 role, address account) external;

    /// @notice Revokes a stablecoin-scoped role from an account.
    /// @dev    Restricted to `DEFAULT_ADMIN_ROLE`, or to `STABLECOIN_ADMIN_ROLE` scoped to `stablecoin` except for
    ///         that role itself.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @param  account    The account to revoke the role from.
    function revokeStablecoinRole(address stablecoin, bytes32 role, address account) external;

    /* ============ View/Pure Functions ============ */

    /// @notice The value hashed with a flag identifier to produce that flag's manager role.
    /// @dev    A preimage, not a role: granting it confers nothing; grant `getFlagManagerRole(flag)`.
    function FLAG_MANAGER_ROLE() external pure returns (bytes32);

    /// @notice The value hashed with a list identifier to produce that list's manager role.
    /// @dev    A preimage, not a role: granting it confers nothing; grant `getListManagerRole(list)`.
    function LIST_MANAGER_ROLE() external pure returns (bytes32);

    /// @notice The role that can grant and revoke a single stablecoin's scoped roles.
    /// @dev    Granted only by `DEFAULT_ADMIN_ROLE`, scoped; a holder can self-grant its stablecoin's other roles.
    function STABLECOIN_ADMIN_ROLE() external pure returns (bytes32);

    /// @notice Returns the scoped role identifier for a stablecoin-scoped role.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @return The scoped role identifier, as carried by `RoleGranted` and `RoleRevoked`.
    function getStablecoinRole(address stablecoin, bytes32 role) external pure returns (bytes32);

    /// @notice Returns the identifier of the role that may write one flag.
    /// @dev    Held plain it writes both tiers; held via `getStablecoinRole`, one stablecoin only.
    /// @param  flag The flag the role manages.
    /// @return The flag manager role identifier.
    function getFlagManagerRole(bytes32 flag) external pure returns (bytes32);

    /// @notice Returns the identifier of the role that may write one list.
    /// @dev    Held plain it writes both tiers; held via `getStablecoinRole`, one stablecoin only.
    /// @param  list The list the role manages.
    /// @return The list manager role identifier.
    function getListManagerRole(bytes32 list) external pure returns (bytes32);

    /// @notice Returns whether an account holds a stablecoin-scoped role.
    /// @param  stablecoin The stablecoin the role is scoped to.
    /// @param  role       The unscoped role identifier.
    /// @param  account    The account to query.
    /// @return Whether the account holds the scoped role.
    function hasStablecoinRole(address stablecoin, bytes32 role, address account) external view returns (bool);

    /// @notice Returns whether a flag is set for exactly one tier.
    /// @dev    Reads that tier alone, never the union of registrar-wide and scoped.
    /// @param  stablecoin The stablecoin to query, or the zero address for the registrar-wide flag.
    /// @param  flag       The flag to query.
    /// @return Whether the flag is set.
    function isFlagSet(address stablecoin, bytes32 flag) external view returns (bool);

    /// @notice Returns whether an account belongs to one tier's list.
    /// @dev    Reads that tier alone, never the union of registrar-wide and scoped.
    /// @param  stablecoin The stablecoin the list belongs to, or the zero address for the global list.
    /// @param  list       The list to query.
    /// @param  account    The account to query.
    /// @return Whether the account belongs to the list.
    function isInList(address stablecoin, bytes32 list, address account) external view returns (bool);
}

src/platform/interfaces/IStablecoin.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

import { IERC20Extended } from "../../../lib/common/src/interfaces/IERC20Extended.sol";

import { IErrors } from "../../interfaces/IErrors.sol";

/// @title  Model-agnostic interface shared by every stablecoin model.
/// @author M0 Labs
interface IStablecoin is IERC20Extended, IErrors {
    /* ============ Events ============ */

    /// @notice Emitted when the compliance policy is set.
    /// @param  policy The address of the policy now dispatched to on every mutating operation.
    event PolicySet(address indexed policy);

    /// @notice Emitted when tokens are seized from a frozen account.
    /// @param  from   The address the tokens were seized from.
    /// @param  to     The address the tokens were sent to.
    /// @param  amount The amount of tokens moved.
    event ForceTransferred(address indexed from, address indexed to, uint256 amount);

    /* ============ Custom Errors ============ */

    /// @notice Thrown when an account holds fewer tokens than an operation requires.
    /// @param  account The address whose balance is insufficient.
    /// @param  balance The balance held by the account.
    /// @param  needed  The balance the operation requires.
    error InsufficientBalance(address account, uint256 balance, uint256 needed);

    /// @notice Thrown when the policy is not registered in the policy registry.
    /// @param  policy The address of the unregistered policy.
    error PolicyNotRegistered(address policy);

    /* ============ Interactive Functions ============ */

    /// @notice Mints `amount` tokens to `recipient`.
    /// @dev    Restricted to the issuer gateway.
    /// @param  recipient The address to receive the minted tokens.
    /// @param  amount    The amount of tokens to mint.
    function mint(address recipient, uint256 amount) external;

    /// @notice Burns `amount` tokens from `account`.
    /// @dev    Restricted to the issuer gateway.
    ///         Takes no allowance from `account`; the gateway is trusted to name only an entitled redeemer.
    /// @param  account The address to burn the tokens from.
    /// @param  amount  The amount of tokens to burn.
    function burn(address account, uint256 amount) external;

    /// @notice Seizes `amount` tokens from `frozenAccount` and sends them to `recipient`.
    /// @dev    Unrestricted at the token; the policy alone decides who may seize.
    /// @param  frozenAccount The address to seize the tokens from.
    /// @param  recipient     The address to send the tokens to.
    /// @param  amount        The amount of tokens to move.
    function forceTransfer(address frozenAccount, address recipient, uint256 amount) external;

    /// @notice Seizes tokens from several frozen accounts in a single call.
    /// @dev    Unrestricted at the token; the policy alone decides who may seize.
    ///         Reverts if the three arrays differ in length.
    /// @param  frozenAccounts The addresses to seize the tokens from.
    /// @param  recipients     The addresses to send the tokens to.
    /// @param  amounts        The amounts of tokens to move.
    function forceTransfers(
        address[] calldata frozenAccounts,
        address[] calldata recipients,
        uint256[] calldata amounts
    ) external;

    /// @notice Sets the compliance policy dispatched to on every mutating operation.
    /// @dev    Restricted to the issuer gateway; reverts unless the registry approves the policy.
    /// @param  policy The address of the policy to set.
    function setPolicy(address policy) external;

    /* ============ View/Pure Functions ============ */

    /// @notice Returns the compliance policy dispatched to on every mutating operation.
    /// @return The address of the policy.
    function policy() external view returns (address);

    /// @notice Returns the gateway that is the token's sole authority.
    /// @return The address of the issuer gateway, baked into the implementation.
    function issuerGateway() external view returns (address);

    /// @notice Returns the implementation this stablecoin currently runs.
    /// @return The address of the implementation, or zero when called on an implementation directly.
    function implementation() external view returns (address);

    /// @notice Returns the ERC-7201 slot the model keeps its ledger and yield state in.
    /// @return The model's storage location.
    function modelStorageLocation() external pure returns (bytes32);

    /// @notice Returns the ERC-1967 admin of the proxy this stablecoin runs behind.
    /// @dev    Non-zero only on a token migrated from a Transparent proxy; `ERC1967Proxy` never writes the slot.
    /// @return The address in the admin slot.
    function proxyAdmin() external view returns (address);

    /// @notice Returns the registry that approves policies.
    /// @return The address of the policy registry, baked into the implementation.
    function policyRegistry() external view returns (address);

    /// @notice Returns the currency the stablecoin is denominated in.
    /// @return The ISO 4217 alphabetic code, e.g. `USD`.
    function currency() external view returns (string memory);
}

src/platform/policies/PausableFreezable.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

import { ConfigKeys } from "../../libs/ConfigKeys.sol";
import { ConfigViews } from "../../libs/ConfigViews.sol";
import { PolicyTypes } from "../../libs/PolicyTypes.sol";

import { IStablecoin } from "../interfaces/IStablecoin.sol";

import { IPausableFreezable } from "./interfaces/IPausableFreezable.sol";
import { IPolicy } from "./interfaces/IPolicy.sol";
import { Policy } from "./Policy.sol";

/// @title  Pause and freeze enforcement, the base every compliance policy extends.
/// @author M0 Labs
contract PausableFreezable is Policy, IPausableFreezable {
    /* ============ Constructor ============ */

    /// @notice Constructs the policy, binding it permanently to one registrar.
    /// @param  configRegistrar_ The registrar to read every compliance decision from.
    constructor(address configRegistrar_) Policy(configRegistrar_) {}

    /* ============ View/Pure Functions ============ */

    /// @inheritdoc IPolicy
    function policyType() external pure virtual override(IPolicy, Policy) returns (bytes32) {
        return PolicyTypes.PAUSABLE_FREEZABLE;
    }

    /* ============ Internal View/Pure Functions ============ */

    /// @dev    Rejects a transfer while the stablecoin is paused or `from`, `to` or a spender is frozen.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the transfer.
    /// @param  from       The address the tokens would move from.
    /// @param  to         The address the tokens would move to.
    function _beforeTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256
    ) internal view virtual override {
        _revertIfPaused(stablecoin);
        _revertIfFrozen(stablecoin, from);
        _revertIfFrozen(stablecoin, to);

        if (caller != from) _revertIfFrozen(stablecoin, caller);
    }

    /// @dev    Rejects a nonzero approval while either party is frozen. A revocation always passes, and
    ///         pause does not apply.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  owner      The address whose tokens would be approved for spending.
    /// @param  spender    The address that would be allowed to spend the tokens.
    /// @param  amount     The allowance that would be set.
    function _beforeApproveChecks(
        address stablecoin,
        address,
        address owner,
        address spender,
        uint256 amount
    ) internal view virtual override {
        if (amount == 0) return;

        _revertIfFrozen(stablecoin, owner);
        _revertIfFrozen(stablecoin, spender);
    }

    /// @dev    Rejects a mint while the stablecoin is paused or the recipient is frozen.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  to         The address that would receive the minted tokens.
    function _beforeMintChecks(address stablecoin, address, address to, uint256) internal view virtual override {
        _revertIfPaused(stablecoin);
        _revertIfFrozen(stablecoin, to);
    }

    /// @dev    Rejects a burn while the stablecoin is paused or the account is frozen.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  from       The address the tokens would be burned from.
    function _beforeBurnChecks(address stablecoin, address, address from, uint256) internal view virtual override {
        _revertIfPaused(stablecoin);
        _revertIfFrozen(stablecoin, from);
    }

    /// @dev    Rejects a claim if `caller` is neither the stablecoin's issuer gateway nor a holder of `CLAIMER_ROLE`
    ///         scoped to it, if the stablecoin is paused, or if the recipient is frozen.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the claim.
    /// @param  account    The address that would receive the claimed yield.
    function _beforeClaimChecks(address stablecoin, address caller, address account) internal view virtual override {
        _revertIfNotClaimer(stablecoin, caller);
        _revertIfPaused(stablecoin);
        _revertIfFrozen(stablecoin, account);
    }

    /// @dev    Returns whether the account is frozen, registrar-wide or for the stablecoin.
    /// @param  stablecoin The stablecoin the freeze applies to.
    /// @param  account    The account to check.
    /// @return Whether the account is frozen.
    function _isFrozen(address stablecoin, address account) internal view returns (bool) {
        return ConfigViews.isFrozen(_getConfigRegistrar(), stablecoin, account);
    }

    /// @dev    Reverts unless the caller is the stablecoin's issuer gateway, which enforces its own
    ///         `YIELD_MANAGER_ROLE` and mint pause, or holds `CLAIMER_ROLE` scoped to the stablecoin. The gateway's
    ///         mint pause is deliberately not read here: a claimer is stopped by revoking the role or pausing the
    ///         stablecoin at the registrar, which spares every direct claim an external call to the gateway.
    /// @param  stablecoin The stablecoin the claim targets.
    /// @param  caller     The address that initiated the claim.
    function _revertIfNotClaimer(address stablecoin, address caller) internal view {
        if (caller == IStablecoin(stablecoin).issuerGateway()) return;

        bytes32 role = ConfigKeys.CLAIMER_ROLE;

        if (!_getConfigRegistrar().hasStablecoinRole(stablecoin, role, caller)) {
            revert UnauthorizedForStablecoin(caller, stablecoin, role);
        }
    }

    /// @dev    Reverts if the stablecoin is paused, registrar-wide or individually.
    /// @param  stablecoin The stablecoin to check.
    function _revertIfPaused(address stablecoin) internal view {
        if (ConfigViews.isPaused(_getConfigRegistrar(), stablecoin)) revert StablecoinPaused(stablecoin);
    }

    /// @dev    Reverts if the account is frozen, registrar-wide or for the stablecoin.
    /// @param  stablecoin The stablecoin the freeze applies to.
    /// @param  account    The account to check.
    function _revertIfFrozen(address stablecoin, address account) internal view {
        if (_isFrozen(stablecoin, account)) revert AccountFrozen(stablecoin, account);
    }
}

src/platform/policies/Policy.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

import { IConfigRegistrar } from "../config/interfaces/IConfigRegistrar.sol";

import { IPolicy } from "./interfaces/IPolicy.sol";

/// @title  Hook dispatch and registrar resolution, the base contract every compliance policy shares.
/// @author M0 Labs
abstract contract Policy is IPolicy {
    /* ============ State Variables ============ */

    /// @inheritdoc IPolicy
    address public immutable configRegistrar;

    /* ============ Constructor ============ */

    /// @notice Constructs the policy, binding it permanently to one registrar.
    /// @param  configRegistrar_ The registrar to read every compliance decision from.
    constructor(address configRegistrar_) {
        if (configRegistrar_ == address(0)) revert ZeroConfigRegistrar();

        configRegistrar = configRegistrar_;
    }

    /* ============ View/Pure Functions ============ */

    /// @inheritdoc IPolicy
    function policyType() external pure virtual returns (bytes32);

    /// @inheritdoc IPolicy
    function beforeTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256 amount
    ) external view {
        _beforeTransferChecks(stablecoin, caller, from, to, amount);
    }

    /// @inheritdoc IPolicy
    function beforeForcedTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256 amount
    ) external view {
        _beforeForcedTransferChecks(stablecoin, caller, from, to, amount);
    }

    /// @inheritdoc IPolicy
    function beforeApproveChecks(
        address stablecoin,
        address caller,
        address owner,
        address spender,
        uint256 amount
    ) external view {
        _beforeApproveChecks(stablecoin, caller, owner, spender, amount);
    }

    /// @inheritdoc IPolicy
    function beforeMintChecks(address stablecoin, address caller, address to, uint256 amount) external view {
        _beforeMintChecks(stablecoin, caller, to, amount);
    }

    /// @inheritdoc IPolicy
    function beforeBurnChecks(address stablecoin, address caller, address from, uint256 amount) external view {
        _beforeBurnChecks(stablecoin, caller, from, amount);
    }

    /// @inheritdoc IPolicy
    function beforeClaimChecks(address stablecoin, address caller, address account) external view {
        _beforeClaimChecks(stablecoin, caller, account);
    }

    /* ============ Internal View/Pure Functions ============ */

    /// @dev    Always reverts; an extension grants the transfer capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeTransferChecks(address stablecoin, address, address, address, uint256) internal view virtual {
        revert TransferNotSupported(stablecoin);
    }

    /// @dev    Always reverts; an extension grants the seizure capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeForcedTransferChecks(address stablecoin, address, address, address, uint256) internal view virtual {
        revert ForcedTransferNotSupported(stablecoin);
    }

    /// @dev    Always reverts; an extension grants the approval capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeApproveChecks(address stablecoin, address, address, address, uint256) internal view virtual {
        revert ApproveNotSupported(stablecoin);
    }

    /// @dev    Always reverts; an extension grants the mint capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeMintChecks(address stablecoin, address, address, uint256) internal view virtual {
        revert MintNotSupported(stablecoin);
    }

    /// @dev    Always reverts; an extension grants the burn capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeBurnChecks(address stablecoin, address, address, uint256) internal view virtual {
        revert BurnNotSupported(stablecoin);
    }

    /// @dev    Always reverts; an extension grants the claim capability by overriding this check.
    /// @param  stablecoin The stablecoin the check is performed for.
    function _beforeClaimChecks(address stablecoin, address, address) internal view virtual {
        revert ClaimNotSupported(stablecoin);
    }

    /// @dev    Returns the registrar this policy reads, typed for use.
    /// @return The registrar bound at deployment.
    function _getConfigRegistrar() internal view returns (IConfigRegistrar) {
        return IConfigRegistrar(configRegistrar);
    }
}

src/platform/policies/interfaces/IPausableFreezable.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

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

/// @title  Pause and freeze enforcement, the base every compliance policy extends.
/// @author M0 Labs
interface IPausableFreezable is IPolicy {
    /* ============ Custom Errors ============ */

    /// @notice Thrown when an account is frozen, panel-wide or for the stablecoin.
    /// @param  stablecoin The stablecoin the check was performed for.
    /// @param  account    The frozen account.
    error AccountFrozen(address stablecoin, address account);

    /// @notice Thrown when the stablecoin is paused, panel-wide or individually.
    /// @param  stablecoin The paused stablecoin.
    error StablecoinPaused(address stablecoin);
}

src/platform/policies/interfaces/IPausableFreezableWhitelistable.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

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

/// @title  Pause and freeze enforcement restricted to a stablecoin's whitelisted accounts.
/// @author M0 Labs
interface IPausableFreezableWhitelistable is IPausableFreezable {
    /* ============ Custom Errors ============ */

    /// @notice Thrown when an account absent from the stablecoin's whitelist takes part in an operation.
    /// @param  stablecoin The stablecoin the check was performed for.
    /// @param  account    The account missing from the whitelist.
    error AccountNotWhitelisted(address stablecoin, address account);
}

src/platform/policies/interfaces/IPolicy.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.36;

import { IErrors } from "../../../interfaces/IErrors.sol";

/// @title  Compliance hook interface dispatched before every mutating stablecoin operation.
/// @author M0 Labs
interface IPolicy is IErrors {
    /* ============ Custom Errors ============ */

    /// @notice Thrown when an approval is attempted under a policy that grants no approval capability.
    /// @param  stablecoin The stablecoin the check was performed for.
    error ApproveNotSupported(address stablecoin);

    /// @notice Thrown when a burn is attempted under a policy that grants no burn capability.
    /// @param  stablecoin The stablecoin the check was performed for.
    error BurnNotSupported(address stablecoin);

    /// @notice Thrown when a claim is attempted under a policy that grants no claim capability.
    /// @param  stablecoin The stablecoin the check was performed for.
    error ClaimNotSupported(address stablecoin);

    /// @notice Thrown when a seizure is attempted under a policy that grants no seizure authority.
    /// @param  stablecoin The stablecoin the check was performed for.
    error ForcedTransferNotSupported(address stablecoin);

    /// @notice Thrown when a mint is attempted under a policy that grants no mint capability.
    /// @param  stablecoin The stablecoin the check was performed for.
    error MintNotSupported(address stablecoin);

    /// @notice Thrown when a transfer is attempted under a policy that grants no transfer capability.
    /// @param  stablecoin The stablecoin the check was performed for.
    error TransferNotSupported(address stablecoin);

    /* ============ View/Pure Functions ============ */

    /// @notice The identifier the policy registry catalogs this policy under.
    /// @return The policy's type identifier.
    function policyType() external pure returns (bytes32);

    /// @notice The registrar this policy reads every compliance decision from.
    /// @return The address of the config registrar, fixed at deployment.
    function configRegistrar() external view returns (address);

    /// @notice Reverts if a transfer of `amount` from `from` to `to` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the transfer: `from` on `transfer`, the spender on `transferFrom`.
    /// @param  from       The address the tokens would move from.
    /// @param  to         The address the tokens would move to.
    /// @param  amount     The amount of tokens that would move.
    function beforeTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256 amount
    ) external view;

    /// @notice Reverts if a forced transfer of `amount` from `from` to `to` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the seizure, claiming seizure authority.
    /// @param  from       The address the tokens would be seized from.
    /// @param  to         The address the tokens would be sent to.
    /// @param  amount     The amount of tokens that would move.
    function beforeForcedTransferChecks(
        address stablecoin,
        address caller,
        address from,
        address to,
        uint256 amount
    ) external view;

    /// @notice Reverts if `owner` approving `spender` for `amount` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the approval: `owner` on `approve`, the relayer on `permit`.
    /// @param  owner      The address whose tokens would be approved for spending.
    /// @param  spender    The address that would be allowed to spend the tokens.
    /// @param  amount     The amount of tokens that would be approved.
    function beforeApproveChecks(
        address stablecoin,
        address caller,
        address owner,
        address spender,
        uint256 amount
    ) external view;

    /// @notice Reverts if minting `amount` to `to` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the mint.
    /// @param  to         The address that would receive the minted tokens.
    /// @param  amount     The amount of tokens that would be minted.
    function beforeMintChecks(address stablecoin, address caller, address to, uint256 amount) external view;

    /// @notice Reverts if burning `amount` from `from` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the burn.
    /// @param  from       The address the tokens would be burned from.
    /// @param  amount     The amount of tokens that would be burned.
    function beforeBurnChecks(address stablecoin, address caller, address from, uint256 amount) external view;

    /// @notice Reverts if claiming yield to `account` would violate the policy.
    /// @param  stablecoin The stablecoin the check is performed for.
    /// @param  caller     The address that initiated the claim.
    /// @param  account    The address that would receive the claimed yield.
    function beforeClaimChecks(address stablecoin, address caller, address account) external view;
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "viaSSACFG": false,
  "evmVersion": "cancun",
  "remappings": [
    "lib/common/lib/openzeppelin-contracts-upgradeable/:@openzeppelin/contracts/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "lib/openzeppelin-foundry-upgrades/:@openzeppelin/contracts/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "lib/common/:lib/common/lib/forge-std/=lib/forge-std/",
    "lib/common/lib/safe-utils/:forge-std/=lib/forge-std/src/",
    "lib/common/lib/safe-utils/:safe-smart-account/=lib/common/lib/safe-utils/lib/safe-smart-account/contracts/",
    "lib/common/lib/safe-utils/:solidity-http/=lib/common/lib/safe-utils/lib/solidity-http/src/",
    "lib/common/lib/safe-utils/lib/solidity-http/lib/solidity-stringutils/:ds-test/=lib/common/lib/safe-utils/lib/solidity-http/lib/solidity-stringutils/lib/ds-test/src/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:forge-std/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/src/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/common/lib/safe-utils/lib/solidity-http/:solidity-stringutils/=lib/common/lib/safe-utils/lib/solidity-http/lib/solidity-stringutils/",
    "lib/common/lib/safe-utils/lib/solidity-stringutils/:ds-test/=lib/common/lib/safe-utils/lib/solidity-stringutils/lib/ds-test/src/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/:forge-std/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/forge-std/src/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "lib/common/lib/openzeppelin-contracts-upgradeable/:openzeppelin-contracts/=lib/common/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
    "lib/common/lib/openzeppelin-contracts/:erc4626-tests/=lib/common/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/common/lib/openzeppelin-contracts/:forge-std/=lib/common/lib/openzeppelin-contracts/lib/forge-std/src/",
    "lib/common/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/common/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/common/lib/safe-utils/:solidity-stringutils/=lib/common/lib/safe-utils/lib/solidity-stringutils/src/",
    "lib/common/:safe-smart-account/=lib/common/lib/safe-utils/lib/safe-smart-account/contracts/",
    "lib/common/:forge-std/=lib/common/lib/forge-std/src/",
    "lib/common/:openzeppelin-contracts/=lib/common/lib/openzeppelin-contracts/",
    "lib/openzeppelin-foundry-upgrades/:forge-std/=lib/openzeppelin-foundry-upgrades/lib/forge-std/src/",
    "@openzeppelin/contracts-upgradeable/=lib/common/lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/common/lib/openzeppelin-contracts/contracts/",
    "common/=lib/common/",
    "ds-test/=lib/common/lib/safe-utils/lib/solidity-stringutils/lib/ds-test/src/",
    "erc4626-tests/=lib/common/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/common/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/common/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/common/lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "safe-smart-account/=lib/common/lib/safe-utils/lib/safe-smart-account/",
    "safe-utils/=lib/common/lib/safe-utils/src/",
    "solidity-http/=lib/common/lib/safe-utils/lib/solidity-http/src/",
    "solidity-stringutils/=lib/common/lib/safe-utils/lib/solidity-stringutils/"
  ],
  "experimental": false
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.