Skip to content
Verified contractPartialBUSL-1.1

MapleSkyStrategy

Address0x20c7c396ef6f2710fa15301925c61ba99dd0504d
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
prague
License
BUSL-1.1
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,205,275
Creation transaction
0x88ba68584a…b6077e8840

modules/defi-strategies/contracts/sky/MapleSkyStrategy.sol

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

import { ERC20Helper } from "../../modules/erc20-helper/src/ERC20Helper.sol";

import { MapleProxiedInternals } from "../../modules/proxy-factory/contracts/MapleProxiedInternals.sol";

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

import {
    IDaiJoinLike,
    IERC20Like,
    IERC4626Like,
    IGlobalsLike,
    ILitePSMLike,
    IPSMLike,
    IProxyFactoryLike,
    IStrategyManagerLike
} from "../interfaces/Interfaces.sol";

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

/*

    ███╗   ███╗ █████╗ ██████╗ ██╗     ███████╗
    ████╗ ████║██╔══██╗██╔══██╗██║     ██╔════╝
    ██╔████╔██║███████║██████╔╝██║     █████╗
    ██║╚██╔╝██║██╔══██║██╔═══╝ ██║     ██╔══╝
    ██║ ╚═╝ ██║██║  ██║██║     ███████╗███████╗
    ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚══════╝╚══════╝

    ███████╗██╗  ██╗██╗   ██╗
    ██╔════╝██║ ██╔╝╚██╗ ██╔╝
    ███████╗█████╔╝  ╚████╔╝
    ╚════██║██╔═██╗   ╚██╔╝
    ███████║██║  ██╗   ██║
    ╚══════╝╚═╝  ╚═╝   ╚═╝

    ███████╗████████╗██████╗  █████╗ ████████╗███████╗ ██████╗██╗   ██╗
    ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚██╗ ██╔╝
    ███████╗   ██║   ██████╔╝███████║   ██║   █████╗  ██║  ███╗╚████╔╝
    ╚════██║   ██║   ██╔══██╗██╔══██║   ██║   ██╔══╝  ██║   ██║ ╚██╔╝
    ███████║   ██║   ██║  ██║██║  ██║   ██║   ███████╗╚██████╔╝  ██║
    ╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚══════╝ ╚═════╝   ╚═╝

*/

contract MapleSkyStrategy is IMapleSkyStrategy, MapleSkyStrategyStorage, MapleProxiedInternals {

    /**************************************************************************************************************************************/
    /*** Constants                                                                                                                      ***/
    /**************************************************************************************************************************************/

    uint256 internal constant WAD = 1e18;

    string public constant STRATEGY_TYPE = "SKY";

    uint256 public constant HUNDRED_PERCENT = 1e6;

    /**************************************************************************************************************************************/
    /*** Modifiers                                                                                                                      ***/
    /**************************************************************************************************************************************/

    modifier nonReentrant() {
        require(_locked == 1, "MSS:LOCKED");

        _locked = 2;

        _;

        _locked = 1;
    }

    modifier onlyFactory() {
        require(msg.sender == _factory(), "MSS:NOT_FACTORY");

        _;
    }

    modifier onlyOpsAdminOrStrategyDelegate() {
        require(msg.sender == strategyDelegate() || msg.sender == IGlobalsLike(globals()).operationalAdmin(), "MSS:NOT_AUTHORIZED");

        _;
    }

    modifier onlyProtocolAdmins() {
        address globals_ = globals();

        require(msg.sender == IGlobalsLike(globals_).governor() || msg.sender == IGlobalsLike(globals_).operationalAdmin(), "MSS:NOT_ADMIN");

        _;
    }

    modifier onlyStrategyManager() {
        require(msg.sender == strategyManager, "MSS:NOT_STRATEGY_MANAGER");

        _;
    }

    modifier whenLossNotRecognized() {
        require(!isLossRecognized, "MSS:LOSS_RECOGNIZED");

        _;
    }

    modifier whenNotPaused() {
        require(!IGlobalsLike(globals()).isFunctionPaused(msg.sig), "MSS:PAUSED");

        _;
    }

    /**************************************************************************************************************************************/
    /*** Proxy Functions                                                                                                                ***/
    /**************************************************************************************************************************************/

    function migrate(address migrator_, bytes calldata arguments_) external override whenNotPaused onlyFactory {
        require(_migrate(migrator_, arguments_), "MSS:M:FAILED");
    }

    function setImplementation(address implementation_) external override whenNotPaused onlyFactory {
        _setImplementation(implementation_);
    }

    function upgrade(uint256 version_, bytes calldata arguments_) external override whenNotPaused {
        require(msg.sender == securityAdmin(), "MSS:U:NOT_AUTHORIZED");

        IProxyFactoryLike(_factory()).upgradeInstance(version_, arguments_);

        emit Upgraded(version_, arguments_);
    }

    /**************************************************************************************************************************************/
    /*** Liquidity Management Functions                                                                                                 ***/
    /**************************************************************************************************************************************/

    function fundUnderlyingStrategy(
        uint256 assetsIn_,
        bytes calldata /* data_ */
    )
        external
        override
        whenNotPaused
        nonReentrant
        onlyStrategyManager
        whenLossNotRecognized
        returns (uint256 deployedAssets_)
    {
        require(assetsIn_ > 0, "MSS:FUS:ZERO_ASSETS");

        address globals_     = globals();
        address psm_         = psm;
        address savingsUsds_ = savingsUsds;

        require(IGlobalsLike(globals_).isInstanceOf("STRATEGY_VAULT", savingsUsds_), "MSS:FUS:INVALID_STRATEGY_VAULT");
        require(IGlobalsLike(globals_).isInstanceOf("PSM", psm_),                    "MSS:FUS:INVALID_PSM");

        require(IPSMLike(psm_).tout() != type(uint256).max,                             "MSS:FUS:PSM_HALTED");
        require(IDaiJoinLike(ILitePSMLike(IPSMLike(psm_).psm()).daiJoin()).live() == 1, "MSS:FUS:DAI_JOIN_CAGED");

        _harvestAndWithdraw(psm_, savingsUsds_, 0, address(0));

        uint256 aumBefore_ = _currentTotalAssets(psm_, savingsUsds_);

        require(ERC20Helper.approve(fundsAsset, psm_, assetsIn_), "MSS:FUS:GEM_APPROVE_FAIL");

        uint256 usdsOut_ = IPSMLike(psm_).sellGem(address(this), assetsIn_);

        require(ERC20Helper.approve(usds, savingsUsds_, usdsOut_), "MSS:FUS:USDS_APPROVE_FAIL");

        uint256 sharesMinted_ = IERC4626Like(savingsUsds_).deposit(usdsOut_, address(this), referralCode);
        uint256 aumAfter_     = _currentTotalAssets(psm_, savingsUsds_);

        lastRecordedTotalAssets = aumAfter_;
        deployedAssets_         = aumAfter_ - aumBefore_;

        emit StrategyFunded(msg.sender, assetsIn_, sharesMinted_, deployedAssets_);
    }

    function withdrawFromUnderlyingStrategy(
        address destination_,
        uint256 assets_,
        bytes calldata /* data_ */
    )
        external
        override
        whenNotPaused
        nonReentrant
        onlyStrategyManager
        whenLossNotRecognized
    {
        require(destination_ != address(0), "MSS:WFUS:ZERO_DESTINATION");
        require(assets_ > 0,                "MSS:WFUS:ZERO_ASSETS");

        address psm_         = psm;
        address savingsUsds_ = savingsUsds;

        uint256 sharesBurned_ = _harvestAndWithdraw(psm_, savingsUsds_, assets_, destination_);

        lastRecordedTotalAssets = _currentTotalAssets(psm_, savingsUsds_);

        emit StrategyWithdrawal(destination_, sharesBurned_, assets_);
    }

    function impair(uint256 assets_) external override whenNotPaused nonReentrant onlyOpsAdminOrStrategyDelegate whenLossNotRecognized {
        require(assets_ > 0, "MSS:I:ZERO");

        impairedAssets += assets_;

        emit Impaired(assets_);
    }

    function removeImpairment(uint256 assets_)
        external
        override
        whenNotPaused
        nonReentrant
        onlyOpsAdminOrStrategyDelegate
        whenLossNotRecognized
    {
        require(assets_ > 0,               "MSS:RI:ZERO");
        require(assets_ <= impairedAssets, "MSS:RI:EXCEEDS_IMPAIRMENT");

        impairedAssets -= assets_;

        emit ImpairmentRemoved(assets_);
    }

    function recognizeLoss() external override whenNotPaused nonReentrant onlyOpsAdminOrStrategyDelegate whenLossNotRecognized {
        isLossRecognized        = true;
        lastRecordedTotalAssets = 0;
        impairedAssets          = 0;

        emit LossRecognized();
    }

    function recoverPosition() external override whenNotPaused nonReentrant onlyOpsAdminOrStrategyDelegate {
        require(isLossRecognized, "MSS:RP:LOSS_NOT_RECOGNIZED");

        address savingsUsds_ = savingsUsds;
        uint256 balance_     = IERC20Like(savingsUsds_).balanceOf(address(this));

        require(balance_ > 0,                                                  "MSS:RP:ZERO_BALANCE");
        require(ERC20Helper.transfer(savingsUsds_, mapleTreasury(), balance_), "MSS:RP:TRANSFER_FAILED");

        emit PositionRecovered(balance_);
    }

    /**************************************************************************************************************************************/
    /*** Admin Functions                                                                                                                ***/
    /**************************************************************************************************************************************/

    function setFallbackTout(uint256 fallbackTout_)
        external
        override
        whenNotPaused
        nonReentrant
        onlyOpsAdminOrStrategyDelegate
        whenLossNotRecognized
    {
        require(fallbackTout_ != fallbackTout, "MSS:SFT:NO_CHANGE");
        require(fallbackTout_ <= WAD,          "MSS:SFT:INVALID_TOUT");

        fallbackTout = fallbackTout_;

        emit FallbackToutSet(fallbackTout_);
    }

    function setMetadata(string calldata metadata_)
        external
        override
        whenNotPaused
        nonReentrant
        onlyOpsAdminOrStrategyDelegate
        whenLossNotRecognized
    {
        require(keccak256(bytes(metadata_)) != keccak256(bytes(strategyMetadata)), "MSS:SM:NO_CHANGE");

        strategyMetadata = metadata_;

        emit StrategyMetadataSet(metadata_);
    }

    function setReferralCode(uint16 referralCode_)
        external
        override
        whenNotPaused
        nonReentrant
        onlyOpsAdminOrStrategyDelegate
        whenLossNotRecognized
    {
        require(referralCode_ != referralCode, "MSS:SRC:NO_CHANGE");

        referralCode = referralCode_;

        emit ReferralCodeSet(referralCode_);
    }

    function setStrategyDelegateFeeRate(uint32 strategyDelegateFeeRate_)
        external
        override
        whenNotPaused
        nonReentrant
        whenLossNotRecognized
    {
        require(msg.sender == strategyDelegate(),                                      "MSS:SSDFR:NOT_STRATEGY_DELEGATE");
        require(strategyDelegateFeeRate_ != strategyDelegateFeeRate,                   "MSS:SSDFR:NO_CHANGE");
        require(strategyDelegateFeeRate_ <= HUNDRED_PERCENT,                           "MSS:SSDFR:INVALID_FEE_RATE");
        require(strategyDelegateFeeRate_ + strategyProtocolFeeRate <= HUNDRED_PERCENT, "MSS:SSDFR:INVALID_SUM_FEE_RATE");

        address psm_         = psm;
        address savingsUsds_ = savingsUsds;

        require(IPSMLike(psm_).tout() != type(uint256).max, "MSS:SSDFR:PSM_HALTED");

        _harvestAndWithdraw(psm_, savingsUsds_, 0, address(0));

        lastRecordedTotalAssets = _currentTotalAssets(psm_, savingsUsds_);

        strategyDelegateFeeRate = strategyDelegateFeeRate_;

        emit StrategyDelegateFeeRateSet(strategyDelegateFeeRate_);
    }

    function setStrategyProtocolFeeRate(uint32 strategyProtocolFeeRate_)
        external
        override
        whenNotPaused
        nonReentrant
        onlyProtocolAdmins
        whenLossNotRecognized
    {
        require(strategyProtocolFeeRate_ != strategyProtocolFeeRate,                   "MSS:SSPFR:NO_CHANGE");
        require(strategyProtocolFeeRate_ <= HUNDRED_PERCENT,                           "MSS:SSPFR:INVALID_FEE_RATE");
        require(strategyDelegateFeeRate + strategyProtocolFeeRate_ <= HUNDRED_PERCENT, "MSS:SSPFR:INVALID_SUM_FEE_RATE");

        address psm_         = psm;
        address savingsUsds_ = savingsUsds;

        require(IPSMLike(psm_).tout() != type(uint256).max, "MSS:SSPFR:PSM_HALTED");

        _harvestAndWithdraw(psm_, savingsUsds_, 0, address(0));

        lastRecordedTotalAssets = _currentTotalAssets(psm_, savingsUsds_);

        strategyProtocolFeeRate = strategyProtocolFeeRate_;

        emit StrategyProtocolFeeRateSet(strategyProtocolFeeRate_);
    }

    function multicall(bytes[] calldata data_) external override {
        for (uint256 i = 0; i < data_.length; i++) {
            (bool success_, bytes memory returnData_) = address(this).delegatecall(data_[i]);

            if (!success_) {
                assembly ("memory-safe") {
                    revert(add(32, returnData_), mload(returnData_))
                }
            }
        }
    }

    /**************************************************************************************************************************************/
    /*** View Functions                                                                                                                 ***/
    /**************************************************************************************************************************************/

    function availableToWithdraw() external view override returns (uint256 availableToWithdraw_) {
        if (isLossRecognized) return 0;

        address psm_         = psm;
        address savingsUsds_ = savingsUsds;

        if (IPSMLike(psm_).tout() == type(uint256).max) return 0;

        if (IDaiJoinLike(ILitePSMLike(IPSMLike(psm_).psm()).daiJoin()).live() != 1) return 0;

        uint256 currentTotalAssets_ = _currentTotalAssets(psm_, savingsUsds_);
        uint256 psmPocketLiquidity_ = IERC20Like(fundsAsset).balanceOf(IPSMLike(psm_).pocket());

        uint256 grossAvailable_ = _min(currentTotalAssets_, psmPocketLiquidity_);

        (uint256 delegateFee_, uint256 protocolFee_) = _currentAccruedFees(currentTotalAssets_);

        uint256 totalFees_ = delegateFee_ + protocolFee_;

        if (grossAvailable_ > totalFees_) availableToWithdraw_ = grossAvailable_ - totalFees_;
    }

    function assetsUnderManagement() public view override returns (uint256 assetsUnderManagement_) {
        if (isLossRecognized) return 0;

        uint256 currentTotalAssets_ = _currentTotalAssets(psm, savingsUsds);

        (uint256 delegateFee_, uint256 protocolFee_) = _currentAccruedFees(currentTotalAssets_);

        assetsUnderManagement_ = currentTotalAssets_ - delegateFee_ - protocolFee_;
    }

    function factory() external view override returns (address factory_) {
        factory_ = _factory();
    }

    function globals() public view override returns (address globals_) {
        globals_ = IProxyFactoryLike(_factory()).mapleGlobals();
    }

    function implementation() external view override returns (address implementation_) {
        implementation_ = _implementation();
    }

    function mapleTreasury() public view override returns (address mapleTreasury_) {
        mapleTreasury_ = IGlobalsLike(globals()).mapleTreasury();
    }

    function securityAdmin() public view override returns (address securityAdmin_) {
        securityAdmin_ = IGlobalsLike(globals()).securityAdmin();
    }

    function strategyDelegate() public view override returns (address strategyDelegate_) {
        strategyDelegate_ = IStrategyManagerLike(strategyManager).strategyDelegate();
    }

    function unrealizedLosses() public view override returns (uint256 unrealizedLosses_) {
        unrealizedLosses_ = _min(impairedAssets, assetsUnderManagement());
    }

    /**************************************************************************************************************************************/
    /*** Internal Functions                                                                                                             ***/
    /**************************************************************************************************************************************/

    function _harvestAndWithdraw(
        address psm_,
        address savingsUsds_,
        uint256 assets_,
        address destination_
    )
        internal
        returns (uint256 sharesBurned_)
    {
        address fundsAsset_ = fundsAsset;

        uint256 currentTotalAssets_ = _currentTotalAssets(psm_, savingsUsds_);

        (uint256 delegateFee_, uint256 protocolFee_) = _currentAccruedFees(currentTotalAssets_);

        uint256 totalToWithdraw_ = assets_ + delegateFee_ + protocolFee_;

        if (totalToWithdraw_ != 0) {
            uint256 requiredUsds_ = _usdsForGem(psm_, totalToWithdraw_);

            sharesBurned_ = IERC4626Like(savingsUsds_).withdraw(requiredUsds_, address(this), address(this));

            require(ERC20Helper.approve(usds, psm_, requiredUsds_), "MSS:HAW:USDS_APPROVE_FAIL");

            IPSMLike(psm_).buyGem(address(this), totalToWithdraw_);
        }

        if (delegateFee_ != 0) {
            require(ERC20Helper.transfer(fundsAsset_, strategyDelegate(), delegateFee_), "MSS:HAW:DELEGATE_TRANSFER_FAIL");
        }

        if (protocolFee_ != 0) {
            require(ERC20Helper.transfer(fundsAsset_, mapleTreasury(), protocolFee_), "MSS:HAW:PROTOCOL_TRANSFER_FAIL");
        }

        emit StrategyFeesCollected(delegateFee_, protocolFee_);

        if (assets_ != 0 && destination_ != address(0)) {
            require(ERC20Helper.transfer(fundsAsset_, destination_, assets_), "MSS:HAW:ASSET_TRANSFER_FAIL");
        }
    }

    /**************************************************************************************************************************************/
    /*** Internal Helper Functions                                                                                                      ***/
    /**************************************************************************************************************************************/

    function _currentAccruedFees(uint256 currentTotalAssets_) internal view returns (uint256 delegateFee_, uint256 protocolFee_) {
        uint256 lastRecordedTotalAssets_ = lastRecordedTotalAssets;

        if (currentTotalAssets_ <= lastRecordedTotalAssets_) return (0, 0);

        uint256 yieldAccrued_ = currentTotalAssets_ - lastRecordedTotalAssets_;

        delegateFee_ = yieldAccrued_ * strategyDelegateFeeRate / HUNDRED_PERCENT;
        protocolFee_ = yieldAccrued_ * strategyProtocolFeeRate / HUNDRED_PERCENT;
    }

    function _currentTotalAssets(address psm_, address savingsUsds_) internal view returns (uint256 currentTotalAssets_) {
        if (isLossRecognized) return 0;

        currentTotalAssets_ =
            _gemForUsds(psm_, IERC4626Like(savingsUsds_).previewRedeem(IERC4626Like(savingsUsds_).balanceOf(address(this))));
    }

    function _gemForUsds(address psm_, uint256 usdsAmount_) internal view returns (uint256 gemAmount_) {
        uint256 tout_                 = _getTout(psm_);
        uint256 to18ConversionFactor_ = IPSMLike(psm_).to18ConversionFactor();

        gemAmount_ = (usdsAmount_ * WAD) / (to18ConversionFactor_ * (WAD + tout_));
    }

    function _getTout(address psm_) internal view returns (uint256 tout_) {
        tout_ = IPSMLike(psm_).tout();

        // Sky halts `buyGem` by setting `tout` to type(uint256).max; value the position with the fallback in that state.
        if (tout_ == type(uint256).max) tout_ = fallbackTout;
    }

    function _min(uint256 x_, uint256 y_) internal pure returns (uint256 min_) {
        min_ = x_ < y_ ? x_ : y_;
    }

    function _usdsForGem(address psm_, uint256 gemAmount_) internal view returns (uint256 usdsAmount_) {
        uint256 tout_                 = IPSMLike(psm_).tout();
        uint256 to18ConversionFactor_ = IPSMLike(psm_).to18ConversionFactor();
        uint256 gemAmt18_             = gemAmount_ * to18ConversionFactor_;

        usdsAmount_ = gemAmt18_ + gemAmt18_ * tout_ / WAD;
    }

}

modules/defi-strategies/contracts/interfaces/IMapleSkyStrategy.sol

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

import { IMapleProxied } from "../../modules/proxy-factory/contracts/interfaces/IMapleProxied.sol";

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

/**
 *  @title Defines a Maple Sky strategy.
 */
interface IMapleSkyStrategy is IMapleSkyStrategyStorage, IMapleProxied {

    /**************************************************************************************************************************************/
    /*** Events                                                                                                                         ***/
    /**************************************************************************************************************************************/

    /**
     *  @dev   Emitted when the fallback PSM `tout` used for valuation during a Sky halt is set.
     *  @param fallbackTout PSM `tout` value used for valuation while the live `tout` is type(uint256).max.
     */
    event FallbackToutSet(uint256 fallbackTout);

    /**
     *  @dev   Emitted when the strategy's impaired assets are increased.
     *  @param assets Funds-asset amount of impairment added to the strategy.
     */
    event Impaired(uint256 assets);

    /**
     *  @dev   Emitted when the strategy's impaired assets are decreased.
     *  @param assets Funds-asset amount of impairment removed from the strategy.
     */
    event ImpairmentRemoved(uint256 assets);

    /**
     *  @dev   Emitted when the strategy is shut down after final loss recognition.
     */
    event LossRecognized();

    /**
     *  @dev   Emitted when the remaining Sky position is recovered to the Maple treasury after final loss recognition.
     *  @param shares Amount of sUSDS shares recovered.
     */
    event PositionRecovered(uint256 shares);

    /**
     *  @dev   Emitted when the referral code used for future deposits is set.
     *  @param referralCode Referral code used when depositing into Sky.
     */
    event ReferralCodeSet(uint16 referralCode);

    /**
     *  @dev   Emitted when the strategy delegate fee rate is set.
     *  @param strategyDelegateFeeRate Percentage of yield collected by the strategy delegate, defined with 6 decimals
     *                                 of precision (1e6 == 100%).
     */
    event StrategyDelegateFeeRateSet(uint32 strategyDelegateFeeRate);

    /**
     *  @dev   Emitted when funds asset is deployed into the underlying Sky strategy.
     *  @param strategyManager Address of the strategy manager that initiated the call.
     *  @param assetsIn        Amount of funds asset consumed from the strategy balance.
     *  @param sharesMinted    Amount of sUSDS shares received from the deposit.
     *  @param deployedAssets  Funds-asset equivalent currently redeemable from the newly minted shares.
     */
    event StrategyFunded(address indexed strategyManager, uint256 assetsIn, uint256 sharesMinted, uint256 deployedAssets);

    /**
     *  @dev   Emitted once per fee-accrual cycle when yield fees are withdrawn from the underlying Sky position.
     *  @param delegateFee Funds-asset amount paid to the strategy delegate.
     *  @param protocolFee Funds-asset amount paid to the Maple treasury.
     */
    event StrategyFeesCollected(uint256 delegateFee, uint256 protocolFee);

    /**
     *  @dev   Emitted when the strategy metadata is set.
     *  @param strategyMetadata Optional metadata associated with the strategy.
     */
    event StrategyMetadataSet(string strategyMetadata);

    /**
     *  @dev   Emitted when the strategy protocol fee rate is set.
     *  @param strategyProtocolFeeRate Percentage of yield collected by the Maple treasury, defined with 6 decimals
     *                                 of precision (1e6 == 100%).
     */
    event StrategyProtocolFeeRateSet(uint32 strategyProtocolFeeRate);

    /**
     *  @dev   Emitted when funds asset is withdrawn from the underlying Sky strategy to a destination.
     *  @param destination  Address that received the funds asset.
     *  @param sharesBurned Amount of sUSDS shares burned, including those burned to cover the accrued delegate and protocol fees.
     *  @param assetsOut    Amount of funds asset delivered to the destination, excluding the fees reported by `StrategyFeesCollected`.
     */
    event StrategyWithdrawal(address indexed destination, uint256 sharesBurned, uint256 assetsOut);

    /**************************************************************************************************************************************/
    /*** Liquidity  Management Functions                                                                                                ***/
    /**************************************************************************************************************************************/

    /**
     *  @dev    Deploys funds asset already held by this contract into the Sky savings vault via the PSM.
     *          Callable only by the bound strategy manager. Accrues outstanding fees before depositing
     *          and refreshes the fee-accrual baseline to the post-deposit position.
     *          Reverts after final loss recognition.
     *  @param  assetsIn        Amount of funds asset to deploy. Must already be held by this contract.
     *  @param  data            Reserved for future strategy-specific calldata. Unused by the Sky strategy.
     *  @return deployedAssets  Funds-asset equivalent redeemable from the shares minted by this deposit,
     *                          net of the PSM `tout` fee that would apply on the inverse redemption.
     */
    function fundUnderlyingStrategy(uint256 assetsIn, bytes calldata data) external returns (uint256 deployedAssets);

    /**
     *  @dev   Redeems sUSDS shares back into funds asset via the PSM and delivers exactly `assets` to `destination`.
     *         Callable only by the bound strategy manager. Accrues outstanding fees before withdrawing
     *         and refreshes the fee-accrual baseline to the post-withdrawal position. The PSM `tout` fee
     *         is absorbed by the strategy's remaining sUSDS balance and socialized across shareholders.
     *         Reverts after final loss recognition.
     *  @param destination  Address that receives the withdrawn funds asset.
     *  @param assets       Amount of funds asset to deliver to the destination.
     *  @param data         Reserved for future strategy-specific calldata. Unused by the Sky strategy.
     */
    function withdrawFromUnderlyingStrategy(address destination, uint256 assets, bytes calldata data) external;

    /**
     *  @dev   Increases the asset-denominated impairment recorded for the strategy.
     *         Callable only by the strategy delegate or operational admin. Does not affect reported AUM or withdrawable assets.
     *  @param assets Funds-asset amount of impairment to add to the strategy.
     */
    function impair(uint256 assets) external;

    /**
     *  @dev   Decreases the asset-denominated impairment recorded for the strategy.
     *         Callable only by the strategy delegate or operational admin. Does not affect reported AUM or withdrawable assets.
     *  @param assets Funds-asset amount of impairment to remove from the strategy.
     */
    function removeImpairment(uint256 assets) external;

    /**
     *  @dev   Marks the strategy as shut down after all reasonably recoverable assets have been withdrawn.
     *         Callable only by the strategy delegate or operational admin.
     *         This is final and causes reported AUM and availability to be zero.
     */
    function recognizeLoss() external;

    /**
     *  @dev   Recovers the remaining underlying position to the Maple treasury after final loss recognition.
     *         Callable only by the strategy delegate or operational admin.
     */
    function recoverPosition() external;

    /**************************************************************************************************************************************/
    /*** Admin Functions                                                                                                                ***/
    /**************************************************************************************************************************************/

    /**
     *  @dev   Sets the fallback PSM `tout` used to value the position while Sky halts the PSM `buyGem` path
     *         by setting the live `tout` to type(uint256).max. Callable only by the strategy delegate or operational
     *         admin. Operationally managed to mirror the PSM `tout` prior to any halt; cannot exceed 1e18 (a 100% fee).
     *  @param fallbackTout PSM `tout` value used for valuation while the live `tout` is type(uint256).max.
     */
    function setFallbackTout(uint256 fallbackTout) external;

    /**
     *  @dev   Updates the metadata of the Sky strategy.
     *         Callable only by the strategy delegate or operational admin.
     *  @param metadata Optional metadata associated with the strategy.
     */
    function setMetadata(string calldata metadata) external;

    /**
     *  @dev   Sets the referral code used for future deposits into Sky.
     *         Callable only by the strategy delegate or operational admin.
     *  @param referralCode Referral code used when depositing into Sky.
     */
    function setReferralCode(uint16 referralCode) external;

    /**
     *  @dev   Sets the percentage of yield collected by the strategy delegate.
     *         Callable only by the strategy delegate.
     *         Accrues outstanding fees before updating the rate.
     *         Reverts while Sky halts the PSM `buyGem` path by setting the live `tout` to type(uint256).max.
     *         The combined strategy delegate and protocol fee rates cannot exceed 1e6.
     *  @param strategyDelegateFeeRate Percentage of yield collected by the strategy delegate, defined with 6 decimals
     *                                 of precision (1e6 == 100%).
     */
    function setStrategyDelegateFeeRate(uint32 strategyDelegateFeeRate) external;

    /**
     *  @dev   Sets the percentage of yield collected by the Maple treasury.
     *         Callable only by protocol admins.
     *         Accrues outstanding fees before updating the rate.
     *         Reverts while Sky halts the PSM `buyGem` path by setting the live `tout` to type(uint256).max.
     *         The combined strategy delegate and protocol fee rates cannot exceed 1e6.
     *  @param strategyProtocolFeeRate Percentage of yield collected by the Maple treasury, defined with 6 decimals
     *                                 of precision (1e6 == 100%).
     */
    function setStrategyProtocolFeeRate(uint32 strategyProtocolFeeRate) external;

    /**
     *  @dev   Allows EOAs to batch admin calls.
     *  @param data Array of calldata.
     */
    function multicall(bytes[] calldata data) external;

    /**************************************************************************************************************************************/
    /*** View Functions                                                                                                                 ***/
    /**************************************************************************************************************************************/

    /**
     *  @dev    Returns the funds-asset amount that can be withdrawn immediately by the strategy manager, net
     *          of accrued yield fees that would be collected before a withdrawal.
     *          Returns zero after final loss recognition before reading Sky's PSM state.
     *          Also returns zero while Sky's PSM `buyGem` path is halted (live `tout` is type(uint256).max),
     *          since nothing can be withdrawn even though AUM remains valued via `fallbackTout`.
     *  @return availableToWithdraw Funds-asset amount immediately withdrawable by the strategy manager.
     */
    function availableToWithdraw() external view returns (uint256 availableToWithdraw);

    /**
     *  @dev    Returns the funds-asset equivalent of the strategy's sUSDS position net of accrued yield fees.
     *          Returns zero after final loss recognition.
     *  @return assetsUnderManagement Funds-asset equivalent currently attributable to the strategy manager.
     */
    function assetsUnderManagement() external view returns (uint256 assetsUnderManagement);

    /**
     *  @dev    Returns the address of the Maple Globals contract.
     *  @return globals Address of the Maple Globals contract.
     */
    function globals() external view returns (address globals);

    /**
     *  @dev    Returns the Maple treasury address that receives the protocol's share of accrued yield.
     *  @return mapleTreasury Address of the Maple treasury.
     */
    function mapleTreasury() external view returns (address mapleTreasury);

    /**
     *  @dev    Returns the address of the security admin.
     *  @return securityAdmin Address of the security admin.
     */
    function securityAdmin() external view returns (address securityAdmin);

    /**
     *  @dev    Returns the strategy delegate that receives the delegate's share of accrued yield for the
     *          bound strategy manager.
     *  @return strategyDelegate Address of the strategy delegate.
     */
    function strategyDelegate() external view returns (address strategyDelegate);

    /**
     *  @dev    Returns the asset-denominated unrealized losses reported for the strategy, capped by reported AUM.
     *  @return unrealizedLosses Funds-asset amount of unrealized losses reported for the strategy.
     */
    function unrealizedLosses() external view returns (uint256 unrealizedLosses);

}

modules/defi-strategies/contracts/interfaces/IMapleSkyStrategyStorage.sol

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

/**
 *  @title Defines the storage layout of a Maple Sky strategy.
 */
interface IMapleSkyStrategyStorage {

    /**
     *  @dev    Returns the address of the asset used for strategy funds.
     *  @return fundsAsset Address of the funds asset.
     */
    function fundsAsset() external view returns (address fundsAsset);

    /**
     *  @dev    Returns the admin-maintained mirror of Sky's PSM `tout`, used to value the position while Sky
     *          halts the PSM `buyGem` path by setting the live `tout` to type(uint256).max.
     *  @return fallbackTout PSM `tout` value used for valuation while the live `tout` is type(uint256).max.
     */
    function fallbackTout() external view returns (uint256 fallbackTout);

    /**
     *  @dev    Returns the full asset-denominated impairment recorded for the strategy.
     *  @return impairedAssets Funds-asset amount of impairment recorded for the strategy.
     */
    function impairedAssets() external view returns (uint256 impairedAssets);

    /**
     *  @dev    Returns whether a final loss has been recognized for this strategy.
     *  @return isLossRecognized Whether the strategy is shut down after final loss recognition.
     */
    function isLossRecognized() external view returns (bool isLossRecognized);

    /**
     *  @dev    Returns the funds-asset equivalent of the underlying position recorded at the end of the most
     *          recent state-changing call. Used as the baseline against which yield (and therefore fees) accrue.
     *  @return lastRecordedTotalAssets Last recorded funds-asset equivalent of the strategy's sUSDS position.
     */
    function lastRecordedTotalAssets() external view returns (uint256 lastRecordedTotalAssets);

    /**
     *  @dev    Returns the address of the PSM contract.
     *  @return psm Address of the PSM.
     */
    function psm() external view returns (address psm);

    /**
     *  @dev    Returns the referral code used when depositing into Sky.
     *  @return referralCode Referral code used when depositing into Sky.
     */
    function referralCode() external view returns (uint16 referralCode);

    /**
     *  @dev    Returns the percentage of yield collected by the strategy delegate.
     *          Defined with 6 decimals of precision (1e6 == 100%).
     *  @return strategyDelegateFeeRate Percentage of yield collected by the strategy delegate.
     */
    function strategyDelegateFeeRate() external view returns (uint32 strategyDelegateFeeRate);

    /**
     *  @dev    Returns the address of the strategy manager contract.
     *  @return strategyManager Address of the strategy manager.
     */
    function strategyManager() external view returns (address strategyManager);

    /**
     *  @dev    Returns arbitrary metadata associated with this instance of the Sky strategy.
     *  @return strategyMetadata Optional metadata associated with the strategy.
     */
    function strategyMetadata() external view returns (string memory strategyMetadata);

    /**
     *  @dev    Returns the percentage of yield collected by the Maple treasury.
     *          Defined with 6 decimals of precision (1e6 == 100%).
     *  @return strategyProtocolFeeRate Percentage of yield collected by the Maple treasury.
     */
    function strategyProtocolFeeRate() external view returns (uint32 strategyProtocolFeeRate);

    /**
     *  @dev    Returns the address of the savings USDS contract.
     *  @return savingsUsds Address of savings USDS.
     */
    function savingsUsds() external view returns (address savingsUsds);

    /**
     *  @dev    Returns the address of the USDS contract.
     *  @return usds Address of USDS.
     */
    function usds() external view returns (address usds);

}

modules/defi-strategies/contracts/interfaces/Interfaces.sol

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

interface IGlobalsLike {

    function canDeploy(address caller) external view returns (bool);

    function governor() external view returns (address);

    function isFunctionPaused(bytes4 signature) external view returns (bool);

    function isInstanceOf(bytes32 key, address instance) external view returns (bool);

    function isPoolAsset(address asset) external view returns (bool);

    function mapleTreasury() external view returns (address);

    function operationalAdmin() external view returns (address);

    function securityAdmin() external view returns (address);

}

interface IAaveTokenLike {

    function balanceOf(address account) external view returns (uint256 balance);

    function getIncentivesController() external view returns (address incentivesController);

    function POOL() external view returns (address pool);

    function UNDERLYING_ASSET_ADDRESS() external view returns (address asset);

}

interface IAaveRewardsControllerLike {

    function claimRewards(
        address[] calldata assets,
        uint256 amount,
        address to,
        address rewardToken
    )
        external
        returns (uint256 rewardAmount);

}

interface IAavePoolAddressesProviderLike {

    function getPoolDataProvider() external view returns (address dataProvider);

}

interface IAavePoolDataProviderLike {

    function getPaused(address asset) external view returns (bool isPaused);

    function getReserveConfigurationData(address asset)
        external
        view
        returns (
            uint256 decimals,
            uint256 ltv,
            uint256 liquidationThreshold,
            uint256 liquidationBonus,
            uint256 reserveFactor,
            bool usageAsCollateralEnabled,
            bool borrowingEnabled,
            bool stableBorrowRateEnabled,
            bool isActive,
            bool isFrozen
        );

}

interface IAavePoolLike {

    function ADDRESSES_PROVIDER() external view returns (address addressesProvider);

    function getVirtualUnderlyingBalance(address asset) external view returns (uint128 balance);

    function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;

    function withdraw(address asset, uint256 amount, address to) external returns (uint256 withdrawn);

}

interface IERC20Like {

    function balanceOf(address account) external view returns (uint256 balance);

}

interface IERC4626Like {

    function asset() external view returns (address);

    function balanceOf(address account) external view returns (uint256);

    function deposit(uint256 assets, address receiver, uint16 referralCode) external returns (uint256 shares);

    function previewRedeem(uint256 shares) external view returns (uint256 assets);

    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);

}

interface IDaiJoinLike {

    function live() external view returns (uint256);

}

interface ILitePSMLike {

    function daiJoin() external view returns (address);

}

interface IPSMLike {

    function buyGem(address usr, uint256 gemAmount) external returns (uint256 usdsInWad);

    function gem() external view returns (address);

    function pocket() external view returns (address);

    function psm() external view returns (address);

    function sellGem(address usr, uint256 gemAmount) external returns (uint256 usdsOutWad);

    function to18ConversionFactor() external view returns (uint256);

    function tout() external view returns (uint256);

    function usds() external view returns (address);

}

interface IProxyFactoryLike {

    function isInstance(address instance) external view returns (bool);

    function mapleGlobals() external view returns (address);

    function upgradeInstance(uint256 version, bytes calldata arguments) external;

}

interface IStrategyManagerLike {

    function factory() external view returns (address);

    function strategyDelegate() external view returns (address);

    function underlyingStrategy() external view returns (address);

}

modules/defi-strategies/contracts/sky/MapleSkyStrategyStorage.sol

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

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

contract MapleSkyStrategyStorage is IMapleSkyStrategyStorage {

    uint256 internal _locked;

    address public override fundsAsset;
    address public override psm;
    address public override strategyManager;
    address public override savingsUsds;
    address public override usds;

    bool public override isLossRecognized;

    uint256 public override fallbackTout;
    uint256 public override impairedAssets;
    uint256 public override lastRecordedTotalAssets;

    uint32 public override strategyDelegateFeeRate;
    uint32 public override strategyProtocolFeeRate;

    uint16 public override referralCode;

    string public override strategyMetadata;

}

modules/defi-strategies/modules/erc20-helper/src/ERC20Helper.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

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

/**
 * @title Small Library to standardize erc20 token interactions.
 */
library ERC20Helper {

    /**************************************************************************************************************************************/
    /*** Internal Functions                                                                                                             ***/
    /**************************************************************************************************************************************/

    function transfer(address token_, address to_, uint256 amount_) internal returns (bool success_) {
        return _call(token_, abi.encodeWithSelector(IERC20Like.transfer.selector, to_, amount_));
    }

    function transferFrom(address token_, address from_, address to_, uint256 amount_) internal returns (bool success_) {
        return _call(token_, abi.encodeWithSelector(IERC20Like.transferFrom.selector, from_, to_, amount_));
    }

    function approve(address token_, address spender_, uint256 amount_) internal returns (bool success_) {
        // If setting approval to zero fails, return false.
        if (!_call(token_, abi.encodeWithSelector(IERC20Like.approve.selector, spender_, uint256(0)))) return false;

        // If `amount_` is zero, return true as the previous step already did this.
        if (amount_ == uint256(0)) return true;

        // Return the result of setting the approval to `amount_`.
        return _call(token_, abi.encodeWithSelector(IERC20Like.approve.selector, spender_, amount_));
    }

    function _call(address token_, bytes memory data_) private returns (bool success_) {
        if (token_.code.length == uint256(0)) return false;

        bytes memory returnData;
        ( success_, returnData ) = token_.call(data_);

        return success_ && (returnData.length == uint256(0) || abi.decode(returnData, (bool)));
    }

}

modules/defi-strategies/modules/erc20-helper/src/interfaces/IERC20Like.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

/// @title Interface of the ERC20 standard as needed by ERC20Helper.
interface IERC20Like {

    function approve(address spender_, uint256 amount_) external returns (bool success_);

    function transfer(address recipient_, uint256 amount_) external returns (bool success_);

    function transferFrom(address owner_, address recipient_, uint256 amount_) external returns (bool success_);

}

modules/defi-strategies/modules/proxy-factory/contracts/MapleProxiedInternals.sol

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.7;

import { ProxiedInternals } from "../modules/proxy-factory/contracts/ProxiedInternals.sol";

/// @title A Maple implementation that is to be proxied, will need MapleProxiedInternals.
abstract contract MapleProxiedInternals is ProxiedInternals { }

modules/defi-strategies/modules/proxy-factory/contracts/interfaces/IMapleProxied.sol

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.7;

import { IProxied } from "../../modules/proxy-factory/contracts/interfaces/IProxied.sol";

/// @title A Maple implementation that is to be proxied, must implement IMapleProxied.
interface IMapleProxied is IProxied {

    /**
     *  @dev   The instance was upgraded.
     *  @param toVersion_ The new version of the loan.
     *  @param arguments_ The upgrade arguments, if any.
     */
    event Upgraded(uint256 toVersion_, bytes arguments_);

    /**
     *  @dev   Upgrades a contract implementation to a specific version.
     *         Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.
     *  @param toVersion_ The version to upgrade to.
     *  @param arguments_ Some encoded arguments to use for the upgrade.
     */
    function upgrade(uint256 toVersion_, bytes calldata arguments_) external;

}

modules/defi-strategies/modules/proxy-factory/modules/proxy-factory/contracts/ProxiedInternals.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

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

/// @title An implementation that is to be proxied, will need ProxiedInternals.
abstract contract ProxiedInternals is SlotManipulatable {

    /// @dev Storage slot with the address of the current factory. `keccak256('eip1967.proxy.factory') - 1`.
    bytes32 private constant FACTORY_SLOT = bytes32(0x7a45a402e4cb6e08ebc196f20f66d5d30e67285a2a8aa80503fa409e727a4af1);

    /// @dev Storage slot with the address of the current factory. `keccak256('eip1967.proxy.implementation') - 1`.
    bytes32 private constant IMPLEMENTATION_SLOT = bytes32(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc);

    /// @dev Delegatecalls to a migrator contract to manipulate storage during an initialization or migration.
    function _migrate(address migrator_, bytes calldata arguments_) internal virtual returns (bool success_) {
        uint256 size;

        assembly {
            size := extcodesize(migrator_)
        }

        if (size == uint256(0)) return false;

        ( success_, ) = migrator_.delegatecall(arguments_);
    }

    /// @dev Sets the factory address in storage.
    function _setFactory(address factory_) internal virtual returns (bool success_) {
        _setSlotValue(FACTORY_SLOT, bytes32(uint256(uint160(factory_))));
        return true;
    }

    /// @dev Sets the implementation address in storage.
    function _setImplementation(address implementation_) internal virtual returns (bool success_) {
        _setSlotValue(IMPLEMENTATION_SLOT, bytes32(uint256(uint160(implementation_))));
        return true;
    }

    /// @dev Returns the factory address.
    function _factory() internal view virtual returns (address factory_) {
        return address(uint160(uint256(_getSlotValue(FACTORY_SLOT))));
    }

    /// @dev Returns the implementation address.
    function _implementation() internal view virtual returns (address implementation_) {
        return address(uint160(uint256(_getSlotValue(IMPLEMENTATION_SLOT))));
    }

}

modules/defi-strategies/modules/proxy-factory/modules/proxy-factory/contracts/SlotManipulatable.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

abstract contract SlotManipulatable {

    function _getReferenceTypeSlot(bytes32 slot_, bytes32 key_) internal pure returns (bytes32 value_) {
        return keccak256(abi.encodePacked(key_, slot_));
    }

    function _getSlotValue(bytes32 slot_) internal view returns (bytes32 value_) {
        assembly {
            value_ := sload(slot_)
        }
    }

    function _setSlotValue(bytes32 slot_, bytes32 value_) internal {
        assembly {
            sstore(slot_, value_)
        }
    }

}

modules/defi-strategies/modules/proxy-factory/modules/proxy-factory/contracts/interfaces/IProxied.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

/// @title An implementation that is to be proxied, must implement IProxied.
interface IProxied {

    /**
     *  @dev The address of the proxy factory.
     */
    function factory() external view returns (address factory_);

    /**
     *  @dev The address of the implementation contract being proxied.
     */
    function implementation() external view returns (address implementation_);

    /**
     *  @dev   Modifies the proxy's implementation address.
     *  @param newImplementation_ The address of an implementation contract.
     */
    function setImplementation(address newImplementation_) external;

    /**
     *  @dev   Modifies the proxy's storage by delegate-calling a migrator contract with some arguments.
     *         Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.
     *  @param migrator_  The address of a migrator contract.
     *  @param arguments_ Some encoded arguments to use for the migration.
     */
    function migrate(address migrator_, bytes calldata arguments_) external;

}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "prague",
  "remappings": [
    "modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/:ds-test/=modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/:ds-test/=modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/globals-v2/modules/forge-std/:ds-test/=modules/syrup-utils/modules/globals-v2/modules/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/globals-v2/modules/forge-std/:ds-test/=modules/syrup-utils/modules/globals-v2/modules/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/lite-psm/lib/dss-test/:forge-std/=modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/src/",
    "modules/syrup-utils/modules/lite-psm/lib/dss-test/:forge-std/=modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/forge-std/src/",
    "modules/syrup-utils/modules/mpl-migration/modules/erc20-helper/:contract-test-utils/=modules/syrup-utils/modules/mpl-migration/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/syrup-utils/modules/mpl-migration/modules/erc20-helper/:contract-test-utils/=modules/syrup-utils/modules/mpl-migration/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/syrup-utils/modules/mpl-v2/modules/forge-std/:ds-test/=modules/syrup-utils/modules/mpl-v2/modules/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/mpl-v2/modules/forge-std/:ds-test/=modules/syrup-utils/modules/mpl-v2/modules/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/open-zeppelin/lib/forge-std/:ds-test/=modules/syrup-utils/modules/open-zeppelin/lib/forge-std/lib/ds-test/src/",
    "modules/syrup-utils/modules/open-zeppelin/lib/forge-std/:ds-test/=modules/syrup-utils/modules/open-zeppelin/lib/forge-std/lib/ds-test/src/",
    "modules/allocation-strategy/modules/erc20-helper/:contract-test-utils/=modules/allocation-strategy/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/allocation-strategy/modules/erc20-helper/:contract-test-utils/=modules/allocation-strategy/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/defi-strategies/modules/erc20-helper/:contract-test-utils/=modules/defi-strategies/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/defi-strategies/modules/erc20-helper/:contract-test-utils/=modules/defi-strategies/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/globals/modules/forge-std/:ds-test/=modules/globals/modules/forge-std/lib/ds-test/src/",
    "modules/globals/modules/forge-std/:ds-test/=modules/globals/modules/forge-std/lib/ds-test/src/",
    "modules/open-term-loan-manager/modules/forge-std/:ds-test/=modules/open-term-loan-manager/modules/forge-std/lib/ds-test/src/",
    "modules/open-term-loan-manager/modules/forge-std/:ds-test/=modules/open-term-loan-manager/modules/forge-std/lib/ds-test/src/",
    "modules/open-term-loan/modules/forge-std/:ds-test/=modules/open-term-loan/modules/forge-std/lib/ds-test/src/",
    "modules/open-term-loan/modules/forge-std/:ds-test/=modules/open-term-loan/modules/forge-std/lib/ds-test/src/",
    "modules/pool-permission-manager/modules/forge-std/:ds-test/=modules/pool-permission-manager/modules/forge-std/lib/ds-test/src/",
    "modules/pool-permission-manager/modules/forge-std/:ds-test/=modules/pool-permission-manager/modules/forge-std/lib/ds-test/src/",
    "modules/pool/modules/forge-std/:ds-test/=modules/pool/modules/forge-std/lib/ds-test/src/",
    "modules/pool/modules/forge-std/:ds-test/=modules/pool/modules/forge-std/lib/ds-test/src/",
    "modules/strategy-manager/modules/erc20-helper/:contract-test-utils/=modules/strategy-manager/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/strategy-manager/modules/erc20-helper/:contract-test-utils/=modules/strategy-manager/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/syrup-utils/modules/erc20-helper/:contract-test-utils/=modules/syrup-utils/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/syrup-utils/modules/erc20-helper/:contract-test-utils/=modules/syrup-utils/modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/syrup-utils/modules/open-zeppelin/:forge-std/=modules/syrup-utils/modules/open-zeppelin/lib/forge-std/src/",
    "modules/syrup-utils/modules/open-zeppelin/:forge-std/=modules/syrup-utils/modules/open-zeppelin/lib/forge-std/src/",
    "modules/withdrawal-manager-cyclical/modules/forge-std/:ds-test/=modules/withdrawal-manager-cyclical/modules/forge-std/lib/ds-test/src/",
    "modules/withdrawal-manager-cyclical/modules/forge-std/:ds-test/=modules/withdrawal-manager-cyclical/modules/forge-std/lib/ds-test/src/",
    "modules/withdrawal-manager-queue/modules/forge-std/:ds-test/=modules/withdrawal-manager-queue/modules/forge-std/lib/ds-test/src/",
    "modules/withdrawal-manager-queue/modules/forge-std/:ds-test/=modules/withdrawal-manager-queue/modules/forge-std/lib/ds-test/src/",
    "modules/erc20-helper/:contract-test-utils/=modules/erc20-helper/lib/contract-test-utils/contracts/",
    "modules/erc20-helper/:contract-test-utils/=modules/erc20-helper/lib/contract-test-utils/contracts/",
    "@openzeppelin/contracts/=modules/syrup-utils/modules/open-zeppelin/contracts/",
    "address-registry/=modules/address-registry/contracts/",
    "allocation-strategy/=modules/allocation-strategy/",
    "contract-test-utils/=modules/erc20-helper/lib/contract-test-utils/contracts/",
    "defi-strategies/=modules/defi-strategies/",
    "ds-test/=modules/globals/modules/forge-std/lib/ds-test/src/",
    "dss-interfaces/=modules/syrup-utils/modules/lite-psm/lib/dss-test/lib/dss-interfaces/src/",
    "dss-test/=modules/syrup-utils/modules/lite-psm/lib/dss-test/src/",
    "erc20-helper/=modules/erc20-helper/src/",
    "erc20/=modules/erc20/",
    "erc4626-tests/=modules/syrup-utils/modules/open-zeppelin/lib/erc4626-tests/",
    "forge-std/=modules/forge-std/src/",
    "strategy-manager/=modules/strategy-manager/",
    "syrup-utils/=modules/syrup-utils/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.