Verified contractExactAGPL-3.0-or-later
NFATPrimeFacet
Address0x74d139d6e730f29d62f2acc6a3b59df2f2d6d9a8
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.34
- Same code
Only this contract
Details
- Compiler
- solc 0.8.34+commit.80d5c536
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- AGPL-3.0-or-later
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,442,692
- Creation transaction
- 0xe763ce11be…8f83eca9ae
14 files
- src/facets/nfat-prime/NFATPrimeFacet.solmain5.13 KB
- lib/openzeppelin-contracts/contracts/access/IAccessControl.sol3.26 KB
- lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol1.28 KB
- lib/oz-upgradeable/contracts/proxy/utils/Initializable.sol8.91 KB
- lib/oz-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol4.36 KB
- src/ControllerSharedStorage.sol1.11 KB
- src/facets/Facet.sol3.12 KB
- src/facets/IFacet.sol1.42 KB
- src/facets/nfat-prime/INFATPrimeFacet.sol4.98 KB
- src/interfaces/IALMProxy.sol3.2 KB
- src/interfaces/IAccessControls.sol2 KB
- src/interfaces/IRateLimits.sol8.23 KB
- src/libraries/ApproveLib.sol1.61 KB
- src/libraries/RateLimitHelpers.sol1.53 KB
src/facets/nfat-prime/NFATPrimeFacet.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import { ApproveLib } from "../../libraries/ApproveLib.sol";
import { makeAddressAddressKey, makeAddressKey } from "../../libraries/RateLimitHelpers.sol";
import { IALMProxy } from "../../interfaces/IALMProxy.sol";
import { IFacet } from "../IFacet.sol";
import { Facet } from "../Facet.sol";
import { INFATPrimeFacet } from "./INFATPrimeFacet.sol";
interface IERC20Like {
function balanceOf(address account) external view returns (uint256);
}
interface IFacilityLike {
function gem() external view returns (address);
function subscribe(uint256 amount, bytes calldata data) external;
function withdraw(uint256 amount) external;
function collect(uint256 tokenId, uint256 amount) external;
}
contract NFATPrimeFacet is INFATPrimeFacet, Facet {
/**********************************************************************************************/
/*** Constants ***/
/**********************************************************************************************/
bytes32 internal constant _LIMIT_SUBSCRIBE = keccak256("LIMIT_NFAT_PRIME_SUBSCRIBE");
bytes32 internal constant _LIMIT_WITHDRAW = keccak256("LIMIT_NFAT_PRIME_WITHDRAW");
bytes32 internal constant _LIMIT_COLLECT = keccak256("LIMIT_NFAT_PRIME_COLLECT");
/// @inheritdoc IFacet
string public constant override VERSION = "1.0.0";
/**********************************************************************************************/
/*** External Interactive Allocator Functions ***/
/**********************************************************************************************/
/// @inheritdoc INFATPrimeFacet
function subscribe(address facility, uint256 amount, bytes calldata data)
external
override
nonReentrant
onlyRole(ALLOCATOR_ROLE)
{
address proxy = _getSharedControllerStorage().proxy;
address gem = IFacilityLike(facility).gem();
ApproveLib.approve(gem, proxy, facility, amount);
uint256 startingBalance = IERC20Like(gem).balanceOf(proxy);
IALMProxy(proxy).doCall(facility, abi.encodeCall(IFacilityLike.subscribe, (amount, data)));
ApproveLib.approve(gem, proxy, facility, 0);
uint256 spent = startingBalance - IERC20Like(gem).balanceOf(proxy);
_decreaseRateLimit(getSubscribeRateLimitKey(facility, gem), spent);
emit NFATPrimeSubscribe(facility, spent, data);
}
/// @inheritdoc INFATPrimeFacet
function withdraw(address facility, uint256 amount)
external
override
nonReentrant
onlyRole(ALLOCATOR_ROLE)
{
require(amount != 0, "NFATPrimeFacet/zero-amount");
address proxy = _getSharedControllerStorage().proxy;
address gem = IFacilityLike(facility).gem();
uint256 startingBalance = IERC20Like(gem).balanceOf(proxy);
IALMProxy(proxy).doCall(facility, abi.encodeCall(IFacilityLike.withdraw, (amount)));
uint256 received = IERC20Like(gem).balanceOf(proxy) - startingBalance;
_decreaseRateLimit(getWithdrawRateLimitKey(facility), received);
emit NFATPrimeWithdraw(facility, received);
}
/// @inheritdoc INFATPrimeFacet
function collect(address facility, uint256 tokenId, uint256 amount)
external
override
nonReentrant
onlyRole(ALLOCATOR_ROLE)
{
require(amount != 0, "NFATPrimeFacet/zero-amount");
address proxy = _getSharedControllerStorage().proxy;
address gem = IFacilityLike(facility).gem();
uint256 startingBalance = IERC20Like(gem).balanceOf(proxy);
IALMProxy(proxy).doCall(facility, abi.encodeCall(IFacilityLike.collect, (tokenId, amount)));
uint256 received = IERC20Like(gem).balanceOf(proxy) - startingBalance;
_decreaseRateLimit(getCollectRateLimitKey(facility), received);
emit NFATPrimeCollect(facility, tokenId, received);
}
/**********************************************************************************************/
/*** External View/Pure Functions ***/
/**********************************************************************************************/
/// @inheritdoc INFATPrimeFacet
function getSubscribeRateLimitKey(address facility, address gem)
public
pure
override
returns (bytes32)
{
return makeAddressAddressKey(_LIMIT_SUBSCRIBE, gem, facility);
}
/// @inheritdoc INFATPrimeFacet
function getWithdrawRateLimitKey(address facility) public pure override returns (bytes32) {
return makeAddressKey(_LIMIT_WITHDRAW, facility);
}
/// @inheritdoc INFATPrimeFacet
function getCollectRateLimitKey(address facility) public pure override returns (bytes32) {
return makeAddressKey(_LIMIT_COLLECT, facility);
}
}
lib/openzeppelin-contracts/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
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/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "../IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
lib/oz-upgradeable/contracts/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}
lib/oz-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
struct ReentrancyGuardStorage {
uint256 _status;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
assembly {
$.slot := ReentrancyGuardStorageLocation
}
}
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
$._status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// On the first call to nonReentrant, _status will be NOT_ENTERED
if ($._status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
$._status = ENTERED;
}
function _nonReentrantAfter() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
$._status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
return $._status == ENTERED;
}
}
src/ControllerSharedStorage.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
abstract contract ControllerSharedStorage {
/**********************************************************************************************/
/*** Shared Controller Storage Domain ***/
/**********************************************************************************************/
/// @custom:storage-location erc7201:sky.pau.storage.SharedController
struct SharedControllerStorage {
address accessControls;
address proxy;
address rateLimits;
}
// keccak256(abi.encode(uint256(keccak256("sky.pau.storage.SharedController")) - 1)) & ~bytes32(uint256(0xff))
bytes32 internal constant SHARED_CONTROLLER_STORAGE_LOCATION =
0x77adf60bdbfedf206f8b8310f3d364080b7f61dcc0e46caac13c29bb1eb5cc00;
function _getSharedControllerStorage()
internal
pure
returns (SharedControllerStorage storage $)
{
assembly {
$.slot := SHARED_CONTROLLER_STORAGE_LOCATION
}
}
}
src/facets/Facet.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import {
ReentrancyGuardUpgradeable
} from "../../lib/oz-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol";
import { IAccessControls } from "../interfaces/IAccessControls.sol";
import { IRateLimits } from "../interfaces/IRateLimits.sol";
import { ControllerSharedStorage } from "../ControllerSharedStorage.sol";
import { IFacet } from "./IFacet.sol";
abstract contract Facet is IFacet, ControllerSharedStorage, ReentrancyGuardUpgradeable {
/**********************************************************************************************/
/*** Constants ***/
/**********************************************************************************************/
/// @inheritdoc IFacet
bytes32 public constant override DEFAULT_ADMIN_ROLE = 0x00;
/// @inheritdoc IFacet
bytes32 public constant override ALLOCATOR_ROLE = keccak256("ALLOCATOR_ROLE");
/**********************************************************************************************/
/*** Modifiers ***/
/**********************************************************************************************/
modifier onlyRole(bytes32 role) {
address accessControls = _getSharedControllerStorage().accessControls;
require(
IAccessControls(accessControls).hasRole(role, msg.sender),
AccessControlUnauthorizedAccount(msg.sender, role)
);
_;
}
/**********************************************************************************************/
/*** Internal Interactive Functions ***/
/**********************************************************************************************/
function _increaseRateLimit(bytes32 key, uint256 amount) internal {
IRateLimits(_getSharedControllerStorage().rateLimits).triggerRateLimitIncrease(key, amount);
}
function _decreaseRateLimit(bytes32 key, uint256 amount) internal {
IRateLimits(_getSharedControllerStorage().rateLimits).triggerRateLimitDecrease(key, amount);
}
function _sweepETH() internal {
_getSharedControllerStorage().proxy.call{value: address(this).balance}("");
}
function _tryIncreaseRateLimit(bytes32 key, uint256 amount) internal {
if (!_rateLimitExists(key)) return;
_increaseRateLimit(key, amount);
}
/**********************************************************************************************/
/*** Internal View/Pure Functions ***/
/**********************************************************************************************/
function _rateLimitExists(bytes32 key) internal view returns (bool) {
return IRateLimits(
_getSharedControllerStorage().rateLimits
).getRateLimitData(key).maxAmount > 0;
}
}
src/facets/IFacet.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
/**
* @title IFacet
* @notice Base interface inherited by all PAU facets. Defines shared roles, versioning,
* and access control errors.
*/
interface IFacet {
/**********************************************************************************************/
/*** Errors ***/
/**********************************************************************************************/
/// @notice Thrown when a caller lacks the required access control role.
error AccessControlUnauthorizedAccount(address caller, bytes32 role);
/**********************************************************************************************/
/*** Variables ***/
/**********************************************************************************************/
/// @notice Role identifier for the default admin (bytes32(0)).
function DEFAULT_ADMIN_ROLE() external pure returns (bytes32);
/// @notice Role identifier for allocator accounts authorized to execute facet operations.
function ALLOCATOR_ROLE() external pure returns (bytes32);
/// @notice Semantic version string of the facet.
function VERSION() external pure returns (string memory);
}
src/facets/nfat-prime/INFATPrimeFacet.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import { IFacet } from "../IFacet.sol";
/**
* @title INFATPrimeFacet
* @notice PAU facet for interacting with NFAT facilities on the originating (subscription) side.
* Exposes subscribe, withdraw, and collect flows with per-facility rate limiting on each
* interaction.
*/
interface INFATPrimeFacet is IFacet {
/**********************************************************************************************/
/*** Events ***/
/**********************************************************************************************/
/**
* @notice Emitted when repaid capital is collected from an issued NFAT position.
* @param facility Address of the NFAT facility.
* @param tokenId Identifier of the NFAT token being collected against.
* @param amount Amount of the facility's gem token collected (gem-native decimals).
*/
event NFATPrimeCollect(address indexed facility, uint256 indexed tokenId, uint256 amount);
/**
* @notice Emitted when capital is subscribed into an NFAT facility.
* @param facility Address of the NFAT facility.
* @param amount Amount of the facility's gem token subscribed (gem-native decimals).
* @param data Arbitrary subscribe payload forwarded to the facility.
*/
event NFATPrimeSubscribe(address indexed facility, uint256 amount, bytes data);
/**
* @notice Emitted when queued (unissued) subscribed capital is withdrawn from a facility.
* @param facility Address of the NFAT facility.
* @param amount Amount of the facility's gem token withdrawn (gem-native decimals).
*/
event NFATPrimeWithdraw(address indexed facility, uint256 amount);
/**********************************************************************************************/
/*** Interactive Functions ***/
/**********************************************************************************************/
/**
* @notice Collects repaid capital from an issued NFAT position, consuming the collect rate
* limit by the collected amount.
* @param facility Address of the NFAT facility.
* @param tokenId Identifier of the NFAT token to collect against.
* @param amount Amount of the facility's gem token to collect. Must be non-zero.
*/
function collect(address facility, uint256 tokenId, uint256 amount) external;
/**
* @notice Subscribes capital into an NFAT facility, consuming the subscribe rate limit.
* @dev `amount == 0` is supported. as the facet still forwards `data` to the facility.
* @param facility Address of the NFAT facility.
* @param amount Amount of the facility's gem token to subscribe.
* @param data Arbitrary subscribe payload forwarded to the facility.
*/
function subscribe(address facility, uint256 amount, bytes calldata data) external;
/**
* @notice Cancels queued (unissued) subscribed capital from an NFAT facility, consuming the
* withdraw rate limit by the returned amount.
* @param facility Address of the NFAT facility.
* @param amount Amount of the facility's gem token to withdraw. Must be non-zero.
*/
function withdraw(address facility, uint256 amount) external;
/**********************************************************************************************/
/*** View/Pure Functions ***/
/**********************************************************************************************/
/**
* @notice Returns the derived collect rate limit key for an NFAT facility.
* @param facility Address of the NFAT facility.
* @return key Derived rate limit key.
*/
function getCollectRateLimitKey(address facility) external pure returns (bytes32 key);
/**
* @notice Returns the derived subscribe rate limit key for an NFAT facility and gem token.
* @dev Keyed on `(facility, gem)` so a facility cannot change its gem under a configured
* rate limit; switching the gem invalidates the key.
* @param facility Address of the NFAT facility.
* @param gem Address of the facility's gem token at configuration time.
* @return key Derived rate limit key.
*/
function getSubscribeRateLimitKey(address facility, address gem)
external
pure
returns (bytes32 key);
/**
* @notice Returns the derived withdraw rate limit key for an NFAT facility.
* @param facility Address of the NFAT facility.
* @return key Derived rate limit key.
*/
function getWithdrawRateLimitKey(address facility) external pure returns (bytes32 key);
}
src/interfaces/IALMProxy.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import {
IAccessControl
} from "../../lib/openzeppelin-contracts/contracts/access/IAccessControl.sol";
/**
* @title IALMProxy
* @notice Proxy contract that executes calls, value calls, and delegate calls on behalf of the
* PAU system. Only accounts with the CONTROLLER role can invoke its functions.
*/
interface IALMProxy is IAccessControl {
/**********************************************************************************************/
/*** Custom Errors ***/
/**********************************************************************************************/
/// @notice Thrown when the admin is the zero address.
error ZeroAdmin();
/**********************************************************************************************/
/*** Interactive Functions ***/
/**********************************************************************************************/
/**
* @notice Performs a standard call to the specified `target` with the given `data`.
* Reverts if the call fails.
* @param target The address of the target contract to call.
* @param data The calldata that will be sent to the target contract.
* @return result The returned data from the call.
*/
function doCall(address target, bytes calldata data) external returns (bytes memory result);
/**
* @notice This function allows for transferring `value` (ether) along with the call to the
* target contract. Reverts if the call fails.
* @param target The address of the target contract to call.
* @param data The calldata that will be sent to the target contract.
* @param value The amount of Ether (in wei) to send with the call.
* @return result The returned data from the call.
*/
function doCallWithValue(address target, bytes calldata data, uint256 value)
external
payable
returns (bytes memory result);
/**
* @notice This function performs a delegate call to the specified `target` with the given
* `data`. Reverts if the call fails.
* @param target The address of the target contract to delegate call.
* @param data The calldata that will be sent to the target contract.
* @return result The returned data from the delegate call.
*/
function doDelegateCall(address target, bytes calldata data)
external
returns (bytes memory result);
/**********************************************************************************************/
/*** Variables ***/
/**********************************************************************************************/
/**
* @notice This function retrieves a constant `bytes32` value that represents the controller.
* @return The `bytes32` identifier of the controller.
*/
function CONTROLLER() external view returns (bytes32);
}
src/interfaces/IAccessControls.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import {
IAccessControlEnumerable
} from "../../lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol";
/**
* @title IAccessControls
* @notice Role-based access control interface for PAU system, extending OpenZeppelin's
* AccessControlEnumerable.
*/
interface IAccessControls is IAccessControlEnumerable {
/**********************************************************************************************/
/*** Custom Errors ***/
/**********************************************************************************************/
/// @notice Thrown when the admin is the zero address.
error ZeroAdmin();
/**********************************************************************************************/
/*** Interactive Admin Functions ***/
/**********************************************************************************************/
/**
* @notice Sets the admin role for a given role.
* @param role The role to set the admin for.
* @param adminRole The admin role for the given role.
*/
function setRoleAdmin(bytes32 role, bytes32 adminRole) external;
/**********************************************************************************************/
/*** View/Pure Functions ***/
/**********************************************************************************************/
/**
* @notice Returns true if the contract supports the given interface.
* @param interfaceId The 4-byte interface identifier (ERC-165).
* @return isSupported True if the interface is supported, false otherwise.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
src/interfaces/IRateLimits.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import {
IAccessControl
} from "../../lib/openzeppelin-contracts/contracts/access/IAccessControl.sol";
/**
* @title IRateLimits
* @notice Per-key rate limiting contract for the PAU system. Tracks time-based allowances
* that refill linearly and are consumed by controller operations.
*/
interface IRateLimits is IAccessControl {
/**********************************************************************************************/
/*** Structs ***/
/**********************************************************************************************/
/**
* @notice Struct representing a rate limit.
* The current rate limit is calculated using the formula:
* `currentRateLimit = min(slope * (block.timestamp - lastUpdated) + lastAmount, maxAmount)`.
* @param maxAmount Maximum allowed amount at any time.
* @param slope The slope of the rate limit, used to calculate the new limit based on
* time passed. [tokens / second]
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
struct RateLimitData {
uint256 maxAmount;
uint256 slope;
uint256 lastAmount;
uint256 lastUpdated;
}
/**********************************************************************************************/
/*** Events ***/
/**********************************************************************************************/
/**
* @notice Emitted when the rate limit data is set.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
event RateLimitDataSet(
bytes32 indexed key,
uint256 maxAmount,
uint256 slope,
uint256 lastAmount,
uint256 lastUpdated
);
/**
* @notice Emitted when a rate limit decrease is triggered.
* @param key The identifier for the rate limit.
* @param amountToDecrease The amount to decrease from the current rate limit.
* @param oldRateLimit The previous rate limit value before triggering.
* @param newRateLimit The new rate limit value after triggering.
*/
event RateLimitDecreaseTriggered(
bytes32 indexed key,
uint256 amountToDecrease,
uint256 oldRateLimit,
uint256 newRateLimit
);
/**
* @notice Emitted when a rate limit increase is triggered.
* @param key The identifier for the rate limit.
* @param amountToIncrease The amount to increase from the current rate limit.
* @param oldRateLimit The previous rate limit value before triggering.
* @param newRateLimit The new rate limit value after triggering.
*/
event RateLimitIncreaseTriggered(
bytes32 indexed key,
uint256 amountToIncrease,
uint256 oldRateLimit,
uint256 newRateLimit
);
/**********************************************************************************************/
/*** Custom Errors ***/
/**********************************************************************************************/
/// @notice Thrown when the admin is the zero address.
error ZeroAdmin();
/**********************************************************************************************/
/*** Interactive Admin Functions ***/
/**********************************************************************************************/
/**
* @notice Sets rate limit data for a specific key.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
function setRateLimitData(
bytes32 key,
uint256 maxAmount,
uint256 slope,
uint256 lastAmount,
uint256 lastUpdated
) external;
/**
* @notice Sets rate limit data for a specific key with
* `lastAmount == maxAmount` and `lastUpdated == block.timestamp`.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
*/
function setRateLimitData(bytes32 key, uint256 maxAmount, uint256 slope) external;
/**
* @notice Sets an unlimited rate limit.
* @param key The identifier for the rate limit.
*/
function setUnlimitedRateLimitData(bytes32 key) external;
/**********************************************************************************************/
/*** Interactive Controller Functions ***/
/**********************************************************************************************/
/**
* @notice Triggers the rate limit for a specific key and reduces the available amount by the
* provided value.
* @param key The identifier for the rate limit.
* @param amountToDecrease The amount to decrease from the current rate limit.
* @return newLimit The updated rate limit after the deduction.
*/
function triggerRateLimitDecrease(bytes32 key, uint256 amountToDecrease)
external
returns (uint256 newLimit);
/**
* @notice Increases the rate limit for a given key up to the maxAmount. Does not revert if the
* new rate limit exceeds the maxAmount.
* @param key The identifier for the rate limit.
* @param amountToIncrease The amount to increase from the current rate limit.
* @return newLimit The updated rate limit after the addition.
*/
function triggerRateLimitIncrease(bytes32 key, uint256 amountToIncrease)
external
returns (uint256 newLimit);
/**********************************************************************************************/
/*** Variables ***/
/**********************************************************************************************/
/// @notice Role identifier for controller accounts that can increase/decrease rate limits.
function CONTROLLER() external view returns (bytes32);
/**********************************************************************************************/
/*** View/Pure Functions ***/
/**********************************************************************************************/
/**
* @notice Retrieves the current rate limit for a specific key.
* @param key The identifier for the rate limit.
* @return rateLimit The current rate limit value for the given key.
*/
function getCurrentRateLimit(bytes32 key) external view returns (uint256 rateLimit);
/**
* @notice Retrieves the RateLimitData struct associated with a specific key.
* @param key The identifier for the rate limit.
* @return data The data associated with the rate limit.
*/
function getRateLimitData(bytes32 key) external view returns (RateLimitData memory data);
}
src/libraries/ApproveLib.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
import { IALMProxy } from "../interfaces/IALMProxy.sol";
interface IERC20Like {
function approve(address spender, uint256 amount) external returns (bool success);
}
library ApproveLib {
// NOTE: This logic was inspired by OpenZeppelin's forceApprove in SafeERC20 library.
function approve(address token, address proxy, address spender, uint256 amount) internal {
bytes memory approveData = abi.encodeCall(IERC20Like.approve, (spender, amount));
// Call doCall on proxy to approve the token.
( bool success, bytes memory data )
= proxy.call(abi.encodeCall(IALMProxy.doCall, (token, approveData)));
bytes memory returnData;
if (success) {
// Decode the ABI-encoding of the approve call bytes return data first.
returnData = abi.decode(data, (bytes));
// Approve was successful if 1) no return value or 2) true return value.
if (
returnData.length == 0 ||
(returnData.length == 32 && abi.decode(returnData, (bool)))
) return;
}
// If call was unsuccessful, set to zero and try again.
IALMProxy(proxy).doCall(token, abi.encodeCall(IERC20Like.approve, (spender, 0)));
returnData = IALMProxy(proxy).doCall(token, approveData);
// Revert if approve returns false.
require(
returnData.length == 0 || (returnData.length == 32 && abi.decode(returnData, (bool))),
"ApproveLib/approve-failed"
);
}
}
src/libraries/RateLimitHelpers.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.34;
function makeAddressKey(bytes32 key, address a) pure returns (bytes32) {
return keccak256(abi.encode(key, a));
}
function makeAddressAddressKey(bytes32 key, address a, address b) pure returns (bytes32) {
return keccak256(abi.encode(key, a, b));
}
function makeAddressAddressAddressKey(bytes32 key, address a, address b, address c)
pure
returns (bytes32)
{
return keccak256(abi.encode(key, a, b, c));
}
function makeAddressBytes32Key(bytes32 key, address a, bytes32 b) pure returns (bytes32) {
return keccak256(abi.encode(key, a, b));
}
function makeAddressUint16Key(bytes32 key, address a, uint16 b) pure returns (bytes32) {
return keccak256(abi.encode(key, a, b));
}
function makeAddressUint16AddressKey(bytes32 key, address a, uint16 b, address c)
pure
returns (bytes32)
{
return keccak256(abi.encode(key, a, b, c));
}
function makeAddressAddressUint32Key(bytes32 key, address a, address b, uint32 c)
pure
returns (bytes32)
{
return keccak256(abi.encode(key, a, b, c));
}
function makeAddressAddressBytes32Uint32Key(bytes32 key, address a, address b, bytes32 c, uint32 d)
pure
returns (bytes32)
{
return keccak256(abi.encode(key, a, b, c, d));
}
function makeBytes32Key(bytes32 key, bytes32 a) pure returns (bytes32) {
return keccak256(abi.encode(key, a));
}
function makeUint32Key(bytes32 key, uint32 a) pure returns (bytes32) {
return keccak256(abi.encode(key, a));
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@layerzerolabs/lz-evm-messagelib-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/messagelib/",
"@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"solidity-bytes-utils/=lib/solidity-bytes-utils/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/:ds-test/=lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/:erc4626-tests/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/:forge-std/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/murky/lib/forge-std/:ds-test/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/:ds-test/=lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/:erc4626-tests/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/:forge-std/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/:ds-test/=lib/uniswap-v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/lib/ds-test/src/",
"lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-v3-origin/lib/solidity-utils/lib/forge-std/:ds-test/=lib/aave-v3-origin/lib/solidity-utils/lib/forge-std/lib/ds-test/src/",
"lib/dss-allocator/lib/dss-test/lib/forge-std/:ds-test/=lib/dss-allocator/lib/dss-test/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/erc20-helpers/lib/forge-std/:ds-test/=lib/grove-basin/lib/erc20-helpers/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/grove-address-registry/lib/forge-std/:ds-test/=lib/grove-basin/lib/grove-address-registry/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/forge-std/:ds-test/=lib/grove-basin/lib/xchain-ssr-oracle/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/:erc4626-tests/=lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/:forge-std/=lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/:forge-std/=lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/:forge-std/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/forge-std/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/:openzeppelin-contracts/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/",
"lib/grove-xchain-helpers/lib/LayerZero-v2/lib/forge-std/:ds-test/=lib/grove-xchain-helpers/lib/LayerZero-v2/lib/forge-std/lib/ds-test/src/",
"lib/grove-xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/grove-xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/grove-xchain-helpers/lib/solidity-bytes-utils/lib/forge-std/:ds-test/=lib/grove-xchain-helpers/lib/solidity-bytes-utils/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/morpho-blue/lib/forge-std/:ds-test/=lib/metamorpho/lib/morpho-blue/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/metamorpho/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/forge-std/:ds-test/=lib/metamorpho/lib/universal-rewards-distributor/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/murky/:forge-std/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/lib/forge-std/src/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/murky/:openzeppelin-contracts/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/lib/openzeppelin-contracts/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/:erc4626-tests/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/:forge-std/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/oz-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/oz-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/erc20-helpers/lib/forge-std/:ds-test/=lib/spark-psm/lib/erc20-helpers/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/spark-psm/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/forge-std/:ds-test/=lib/spark-psm/lib/xchain-ssr-oracle/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/:erc4626-tests/=lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/:forge-std/=lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/:forge-std/=lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/lib/forge-std/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/:forge-std/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/forge-std/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/:openzeppelin-contracts/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/lib/openzeppelin-contracts/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:forge-std/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/spark-vaults-v2/lib/token-tests/lib/dss-test/:dss-interfaces/=lib/spark-vaults-v2/lib/token-tests/lib/dss-test/lib/dss-interfaces/src/",
"lib/spark-vaults-v2/lib/token-tests/lib/dss-test/:forge-std/=lib/spark-vaults-v2/lib/token-tests/lib/dss-test/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/permit2/lib/forge-gas-snapshot/:forge-std/=lib/uniswap-v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/permit2/lib/forge-std/:ds-test/=lib/uniswap-v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/src/",
"lib/uniswap-v4-periphery/lib/permit2/lib/solmate/:ds-test/=lib/uniswap-v4-periphery/lib/permit2/lib/solmate/lib/ds-test/src/",
"lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:forge-std/=lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/v4-core/lib/solmate/:ds-test/=lib/uniswap-v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/src/",
"lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-v3-origin/lib/solidity-utils/:forge-std/=lib/aave-v3-origin/lib/solidity-utils/lib/forge-std/src/",
"lib/dss-allocator/lib/dss-test/:dss-interfaces/=lib/dss-allocator/lib/dss-test/lib/dss-interfaces/src/",
"lib/dss-allocator/lib/dss-test/:forge-std/=lib/dss-allocator/lib/dss-test/lib/forge-std/src/",
"lib/grove-address-registry/lib/forge-std/:ds-test/=lib/grove-address-registry/lib/forge-std/lib/ds-test/src/",
"lib/grove-basin/lib/erc20-helpers/:forge-std/=lib/grove-basin/lib/erc20-helpers/lib/forge-std/src/",
"lib/grove-basin/lib/grove-address-registry/:forge-std/=lib/grove-basin/lib/grove-address-registry/lib/forge-std/src/",
"lib/grove-basin/lib/openzeppelin-contracts/:erc4626-tests/=lib/grove-basin/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/grove-basin/lib/openzeppelin-contracts/:forge-std/=lib/grove-basin/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/grove-basin/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/grove-basin/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/:forge-std/=lib/grove-basin/lib/xchain-ssr-oracle/lib/forge-std/src/",
"lib/grove-basin/lib/xchain-ssr-oracle/:openzeppelin-contracts/=lib/grove-basin/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/",
"lib/grove-basin/lib/xchain-ssr-oracle/:sparklend-address-registry/=lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/",
"lib/grove-basin/lib/xchain-ssr-oracle/:xchain-helpers/=lib/grove-basin/lib/xchain-ssr-oracle/lib/xchain-helpers/src/",
"lib/grove-xchain-helpers/lib/LayerZero-v2/:forge-std/=lib/grove-xchain-helpers/lib/LayerZero-v2/lib/forge-std/src/",
"lib/grove-xchain-helpers/lib/openzeppelin-contracts/:erc4626-tests/=lib/grove-xchain-helpers/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/grove-xchain-helpers/lib/openzeppelin-contracts/:forge-std/=lib/grove-xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/grove-xchain-helpers/lib/solidity-bytes-utils/:forge-std/=lib/grove-xchain-helpers/lib/solidity-bytes-utils/lib/forge-std/src/",
"lib/layerzero-v2/lib/forge-std/:ds-test/=lib/layerzero-v2/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/forge-std/:ds-test/=lib/metamorpho/lib/forge-std/lib/ds-test/src/",
"lib/metamorpho/lib/morpho-blue/:forge-std/=lib/metamorpho/lib/morpho-blue/lib/forge-std/src/",
"lib/metamorpho/lib/openzeppelin-contracts/:erc4626-tests/=lib/metamorpho/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/metamorpho/lib/openzeppelin-contracts/:forge-std/=lib/metamorpho/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/metamorpho/lib/universal-rewards-distributor/:forge-std/=lib/metamorpho/lib/universal-rewards-distributor/lib/forge-std/src/",
"lib/metamorpho/lib/universal-rewards-distributor/:openzeppelin-contracts/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/",
"lib/nfat/lib/dss-test/:dss-interfaces/=lib/nfat/lib/dss-test/lib/dss-interfaces/src/",
"lib/nfat/lib/dss-test/:forge-std/=lib/nfat/lib/dss-test/lib/forge-std/src/",
"lib/nfat/lib/openzeppelin-contracts/:erc4626-tests/=lib/nfat/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/nfat/lib/openzeppelin-contracts/:forge-std/=lib/nfat/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/nfat/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/nfat/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/oz-upgradeable/lib/forge-std/:ds-test/=lib/oz-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/oz-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/oz-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/oz-upgradeable/lib/openzeppelin-contracts/:forge-std/=lib/oz-upgradeable/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/spark-address-registry/lib/forge-std/:ds-test/=lib/spark-address-registry/lib/forge-std/lib/ds-test/src/",
"lib/spark-psm/lib/erc20-helpers/:forge-std/=lib/spark-psm/lib/erc20-helpers/lib/forge-std/src/",
"lib/spark-psm/lib/openzeppelin-contracts/:erc4626-tests/=lib/spark-psm/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/spark-psm/lib/openzeppelin-contracts/:forge-std/=lib/spark-psm/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/:forge-std/=lib/spark-psm/lib/xchain-ssr-oracle/lib/forge-std/src/",
"lib/spark-psm/lib/xchain-ssr-oracle/:openzeppelin-contracts/=lib/spark-psm/lib/xchain-ssr-oracle/lib/openzeppelin-contracts/",
"lib/spark-psm/lib/xchain-ssr-oracle/:sparklend-address-registry/=lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/",
"lib/spark-psm/lib/xchain-ssr-oracle/:xchain-helpers/=lib/spark-psm/lib/xchain-ssr-oracle/lib/xchain-helpers/src/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/:forge-std/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/forge-std/src/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/:openzeppelin-contracts/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts/:erc4626-tests/=lib/spark-vaults-v2/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts/:forge-std/=lib/spark-vaults-v2/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/spark-vaults-v2/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/spark-vaults-v2/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/spark-vaults-v2/lib/token-tests/:dss-test/=lib/spark-vaults-v2/lib/token-tests/lib/dss-test/src/",
"lib/uniswap-v4-periphery/lib/permit2/:solmate/=lib/uniswap-v4-periphery/lib/permit2/lib/solmate/",
"lib/uniswap-v4-periphery/lib/permit2/:forge-std/=lib/uniswap-v4-periphery/lib/permit2/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/permit2/:openzeppelin-contracts/=lib/uniswap-v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
"lib/uniswap-v4-periphery/lib/v4-core/:solmate/=lib/uniswap-v4-periphery/lib/v4-core/lib/solmate/",
"lib/uniswap-v4-periphery/lib/v4-core/:forge-std/=lib/uniswap-v4-periphery/lib/v4-core/lib/forge-std/src/",
"lib/uniswap-v4-periphery/lib/v4-core/:openzeppelin-contracts/=lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"lib/xchain-helpers/lib/openzeppelin-contracts/:erc4626-tests/=lib/xchain-helpers/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/xchain-helpers/lib/openzeppelin-contracts/:forge-std/=lib/xchain-helpers/lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/aave-v3-origin/:solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/src/",
"lib/aave-v3-origin/:forge-std/=lib/aave-v3-origin/lib/forge-std/src/",
"lib/dss-allocator/:dss-test/=lib/dss-allocator/lib/dss-test/src/",
"lib/dss-test/:dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
"lib/dss-test/:forge-std/=lib/dss-test/lib/forge-std/src/",
"lib/grove-address-registry/:forge-std/=lib/grove-address-registry/lib/forge-std/src/",
"lib/grove-basin/:erc20-helpers/=lib/grove-basin/lib/erc20-helpers/src/",
"lib/grove-basin/:forge-std/=lib/grove-basin/lib/forge-std/src/",
"lib/grove-basin/:grove-address-registry/=lib/grove-basin/lib/grove-address-registry/src/",
"lib/grove-basin/:openzeppelin-contracts/=lib/grove-basin/lib/openzeppelin-contracts/",
"lib/grove-basin/:xchain-ssr-oracle/=lib/grove-basin/lib/xchain-ssr-oracle/",
"lib/grove-xchain-helpers/:forge-std/=lib/grove-xchain-helpers/lib/forge-std/src/",
"lib/grove-xchain-helpers/:openzeppelin-contracts/=lib/grove-xchain-helpers/lib/openzeppelin-contracts/",
"lib/layerzero-v2/:forge-std/=lib/layerzero-v2/lib/forge-std/src/",
"lib/metamorpho/:erc4626-tests/=lib/metamorpho/lib/erc4626-tests/",
"lib/metamorpho/:forge-std/=lib/metamorpho/lib/forge-std/src/",
"lib/metamorpho/:openzeppelin-contracts/=lib/metamorpho/lib/openzeppelin-contracts/",
"lib/nfat/:dss-test/=lib/nfat/lib/dss-test/src/",
"lib/nfat/:openzeppelin-contracts/=lib/nfat/lib/openzeppelin-contracts/",
"lib/openzeppelin-contracts/:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts/:forge-std/=lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/oz-upgradeable/:erc4626-tests/=lib/oz-upgradeable/lib/erc4626-tests/",
"lib/oz-upgradeable/:forge-std/=lib/oz-upgradeable/lib/forge-std/src/",
"lib/oz-upgradeable/:openzeppelin-contracts/=lib/oz-upgradeable/lib/openzeppelin-contracts/",
"lib/spark-address-registry/:forge-std/=lib/spark-address-registry/lib/forge-std/src/",
"lib/spark-psm/:erc20-helpers/=lib/spark-psm/lib/erc20-helpers/src/",
"lib/spark-psm/:forge-std/=lib/spark-psm/lib/forge-std/src/",
"lib/spark-psm/:openzeppelin-contracts/=lib/spark-psm/lib/openzeppelin-contracts/",
"lib/spark-psm/:xchain-ssr-oracle/=lib/spark-psm/lib/xchain-ssr-oracle/",
"lib/spark-vaults-v2/:forge-std/=lib/spark-vaults-v2/lib/forge-std/src/",
"lib/spark-vaults-v2/:openzeppelin-contracts/=lib/spark-vaults-v2/lib/openzeppelin-contracts/",
"lib/xchain-helpers/:forge-std/=lib/xchain-helpers/lib/forge-std/src/",
"lib/xchain-helpers/:openzeppelin-contracts/=lib/xchain-helpers/lib/openzeppelin-contracts/",
"@ensdomains/=lib/uniswap-v4-periphery/lib/v4-core/node_modules/@ensdomains/",
"@layerzerolabs/oft-evm/=lib/grove-xchain-helpers/lib/devtools/packages/oft-evm/",
"@openzeppelin/=lib/uniswap-v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"@uniswap/v4-core/=lib/uniswap-v4-periphery/lib/v4-core/",
"LayerZero-v2/=lib/grove-xchain-helpers/lib/",
"aave-v3-core/=lib/aave-v3-origin/src/core/",
"aave-v3-origin/=lib/aave-v3-origin/",
"aave-v3-periphery/=lib/aave-v3-origin/src/periphery/",
"devtools/=lib/grove-xchain-helpers/lib/devtools/packages/toolbox-foundry/src/",
"ds-test/=lib/aave-v3-origin/lib/forge-std/lib/ds-test/src/",
"dss-allocator/=lib/dss-allocator/",
"dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
"dss-test/=lib/dss-test/src/",
"erc20-helpers/=lib/grove-basin/lib/erc20-helpers/src/",
"erc4626-tests/=lib/metamorpho/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/uniswap-v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
"forge-std/=lib/forge-std/src/",
"grove-address-registry/=lib/grove-address-registry/src/",
"grove-basin/=lib/grove-basin/",
"grove-xchain-helpers/=lib/grove-xchain-helpers/src/",
"halmos-cheatcodes/=lib/grove-basin/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"hardhat/=lib/uniswap-v4-periphery/lib/v4-core/node_modules/hardhat/",
"layerzero-v2/=lib/layerzero-v2/",
"layerzerolabs/oapp-evm/=lib/grove-xchain-helpers/lib/devtools/packages/oapp-evm/",
"metamorpho/=lib/metamorpho/src/",
"morpho-blue/=lib/metamorpho/lib/morpho-blue/",
"murky/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/src/",
"nfat/=lib/nfat/",
"openzeppelin-contracts-upgradeable/=lib/spark-vaults-v2/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/contracts/",
"oz-upgradeable/=lib/oz-upgradeable/",
"permit2/=lib/uniswap-v4-periphery/lib/permit2/",
"solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/",
"solmate/=lib/uniswap-v4-periphery/lib/permit2/lib/solmate/",
"spark-address-registry/=lib/spark-address-registry/src/",
"spark-psm/=lib/spark-psm/",
"spark-vaults-v2/=lib/spark-vaults-v2/",
"sparklend-address-registry/=lib/grove-basin/lib/xchain-ssr-oracle/lib/sparklend-address-registry/",
"token-tests/=lib/spark-vaults-v2/lib/token-tests/src/",
"uniswap-v4-periphery/=lib/uniswap-v4-periphery/",
"universal-rewards-distributor/=lib/metamorpho/lib/universal-rewards-distributor/src/",
"v4-core/=lib/uniswap-v4-periphery/lib/v4-core/src/",
"xchain-helpers/=lib/xchain-helpers/src/",
"xchain-ssr-oracle/=lib/grove-basin/lib/xchain-ssr-oracle/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.