> For the complete documentation index, see [llms.txt](https://docs.pinto.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinto.money/pinto-improvements/pi-6.md).

# PI-6: Introduce Cultivation System and Crop Ratio Changes

Executed on March 12, 2025 at 22:23 UTC.

## Summary <a href="#id-03de4019-aad5-83bf-8f7e-01ebfa92142c" id="id-03de4019-aad5-83bf-8f7e-01ebfa92142c"></a>

1. [**Cultivation System**](https://docs.pinto.money/pinto-mechanics/field-the-most-innovative-lending-facility-in-crypto/the-cultivation-system-optimal-soil-issuance)**:** Introduce the Cultivation System to dynamically issue [Soil](https://docs.pinto.money/resources/glossary#soil) in line with demand for it.
2. **Minimum Soil Issuance:** Create a parameter for the minimum number of Soil that can be issued when the time-weighted average and instantaneous Pinto supply deltas are nonpositive and their minimum absolute value is nonzero and set it to 50 Soil. Each delta measures the Pinto shortage or surplus relative to the $1 peg, using time-weighted average or instantaneous pool reserves. A negative value indicates a surplus.
3. **Generalized Gauge System:** Create a generalized gauge system such that any future state variable can be updated via a gauge upon the [`gm`](https://docs.pinto.money/resources/glossary#gm) call with minimal development effort.
4. **Maximum** [**Crop Ratio**](https://docs.pinto.money/resources/glossary#crop-ratio) **Increase:** Increase the Maximum Crop Ratio from 100% to 150%.
5. **Crop Scalar Adjustments:** Properly increase the magnitude of the Crop Scalar decreases from 1 to 2 percentage points per [Season](https://docs.pinto.money/resources/glossary#season) when price is Reasonably High, the [Pod Rate](https://docs.pinto.money/resources/glossary#pod-rate) is Reasonably or Excessively High and the [L2SR](https://docs.pinto.money/resources/glossary#liquidity-to-supply-ratio-l2sr) is Reasonably Low as intended in PI-5 (detailed below).

## Links <a href="#id-476e4019-aad5-8374-9541-01084364efa5" id="id-476e4019-aad5-8374-9541-01084364efa5"></a>

* [Implementation PR](https://github.com/pinto-org/protocol/pull/8)
* Implementation Commit: [`74fdaffaecac5d3c915c19e1542095eace3e6889`](https://github.com/pinto-org/protocol/commit/74fdaffaecac5d3c915c19e1542095eace3e6889)
* [Safe Transaction](https://app.safe.global/transactions/tx?id=multisig_0x2cf82605402912C6a79078a9BBfcCf061CbfD507_0x47edf70799fc82fae247c42b82a8e76f4b357546f8ceb27a28583af79ee2972c\&safe=base:0x2cf82605402912C6a79078a9BBfcCf061CbfD507)
* [Diamond Cut Transaction](https://basescan.org/tx/0xa7473e796229e91e36ba7fa270853937d9d61da3a42a1f975fc01ff15f79cb30)

## Problems <a href="#d21e4019-aad5-835e-bd56-81e3513a5835" id="d21e4019-aad5-835e-bd56-81e3513a5835"></a>

### 1. Cultivation System <a href="#befe4019-aad5-837b-b5fa-81bb112dbd6f" id="befe4019-aad5-837b-b5fa-81bb112dbd6f"></a>

When the protocol issues significant numbers of Soil that are not [Sown](https://docs.pinto.money/resources/glossary#sow) into, it signals to the market that the protocol is not creditworthy. When the protocol issues less Soil than there is demand for, it is not borrowing efficiently. The protocol lacked a method to discover the optimal number of Soil to issue.

### 2. Minimum Soil Issuance <a href="#id-921e4019-aad5-8337-a820-81701cd070e0" id="id-921e4019-aad5-8337-a820-81701cd070e0"></a>

At particularly low numbers of Soil, demand for Soil cannot be accurately measured. With the introduction of the Cultivation System, which starts the number of Soil available at a very low number and then ramps it up to meet demand, the protocol may issue too little Soil to accurately measure demand.

### 3. Generalized Gauge System <a href="#id-800e4019-aad5-828b-915c-818c5cf7d24b" id="id-800e4019-aad5-828b-915c-818c5cf7d24b"></a>

There are potentially several state variables that could be adjusted at the beginning of each Season, but without a generalized mechanism to do so each variable required a bespoke implementation.

### 4. Maximum Crop Ratio Increase <a href="#ed8e4019-aad5-83f5-a6a8-015b88ba774f" id="ed8e4019-aad5-83f5-a6a8-015b88ba774f"></a>

The Maximum Crop Ratio of 100% limited the ability of the protocol to create a sufficiently strong incentive to counter the preference demonstrated by the market to hold [Deposited LP](https://docs.pinto.money/resources/glossary#deposit) over [Deposited Pinto](https://docs.pinto.money/resources/glossary#pinto) when it is trying to incentivize LP -> Pinto [Converts](https://docs.pinto.money/resources/glossary#convert).

### 5. Crop Scalar Adjustments <a href="#b99e4019-aad5-827c-9642-811a7e6c20f9" id="b99e4019-aad5-827c-9642-811a7e6c20f9"></a>

When price is Reasonably High, the Pod Rate is Reasonably or Excessively High and the L2SR is Reasonably Low, the Crop Scalar did not decrease quickly enough. PI-5 intended to increase the magnitude of the Crop Scalar adjustments in these instances, but an encoding error left the decreases at 1 percentage point per Season instead of the intended 2.

## Solutions <a href="#id-36ce4019-aad5-83b0-b9fb-8173bdb3e403" id="id-36ce4019-aad5-83b0-b9fb-8173bdb3e403"></a>

### 1. Cultivation System <a href="#id-7fce4019-aad5-8325-84f2-010b48f77c91" id="id-7fce4019-aad5-8325-84f2-010b48f77c91"></a>

Introduce the Cultivation System, which uses a gauge to adjust the [Cultivation Factor](https://pinto.money/pinto.pdf#subsubsection.12.3.1), which acts as a scalar on Soil issuance relative to the maximum number of Soil the protocol would be willing to issue if there was infinite demand for Soil.

The Cultivation Factor p is updated as follows:

p={min(1,p+ΔpPt−1​​)max(0.01,p−ΔpPt−1​​0.0001​)​if Soil sold out last Seasonotherwise​

Where:

* p is the Cultivation Factor, initialized to 0.5 and bounded between 0.01 and 1.
* The adjustment coefficient is calculated below.
* P is the previous Season’s time-weighted average Pinto price in the [Well](https://docs.basin.exchange/components/well) with the largest USD liquidity, capped at 1. A zero price skips the update.

Δp=2%−RDupper−RDlowermax(min(RD,RDupper)−RDlower,0)​×1.5%

The adjustment coefficient decreases linearly from 2% to 0.5% as the Pod Rate rises from 3% to 25%, and is clamped outside those bounds. Rᴰ denotes the Pod Rate. Its lower and upper bounds are 3% and 25%, respectively.

### 2. Minimum Soil Issuance <a href="#id-731e4019-aad5-82bf-949d-817bb5cd5a98" id="id-731e4019-aad5-82bf-949d-817bb5cd5a98"></a>

The Cultivation System includes a 50-Soil floor when the time-weighted average and instantaneous Pinto supply deltas are nonpositive and their minimum absolute value is nonzero to prevent instances where the protocol issues too little Soil to be able to accurately measure demand.

Therefore, we define the Soil issued when the time-weighted average and instantaneous Pinto supply deltas are nonpositive to be:

**Soil =**

* 0, if D = 0
* max(D × ((1 − min(R<sup>W</sup>, 0.99)) / 24) × *p*, 50), if D > 0

Where:

* *D* is the smaller absolute value of the time-weighted average and instantaneous Pinto supply deltas.
* *RD* is the Pod Rate.
* *RW* is the L2SR.
* *p* is the Cultivation Factor, initialized to 0.5. When the time-weighted average Pinto supply delta is nonpositive but the instantaneous Pinto supply delta is positive, Soil instead equals 1% of the absolute time-weighted average Pinto supply delta times the Pod Rate coefficient, without the 50-Soil floor.
* The divisor 24 represents the configured 86,400-second Soil distribution period in one-hour Seasons. These normalized equations omit sequential integer rounding. A Sow records sellout when remaining Soil is at most 1 Soil. The Cultivation Factor uses that recorded sellout from the previous Season.

### 3. Generalized Gauge System <a href="#f64e4019-aad5-821a-99b4-01ee0f2931c9" id="f64e4019-aad5-821a-99b4-01ee0f2931c9"></a>

Add the following to `AppStorage`:

```
struct GaugeData {
    GaugeId[] gaugeIds;
    mapping(GaugeId => Gauge) gauges;
}

enum GaugeId {
    CULTIVATION_FACTOR
}
```

Introduce a Gauge Implementation as:

```
struct Gauge {
    bytes value;
    address target;
    bytes4 selector;
    bytes data;
}
```

A gauge selector must adhere to the following function definition:

```
foo(
    bytes memory value,
    bytes memory systemData,
    bytes memory gaugeData
) external view returns
(
    bytes memory,
    bytes memory
)
```

The function must return the updated encoded value first and encoded gauge data second.

Gauges have a `GaugeId` that is set upon adding a new Gauge. Gauges are called during the `gm` call, upon which each Gauge’s returned value and/or data are stored.

The following new events are associated with the generalized gauge system:

```
    event Engaged(GaugeId gaugeId, bytes value);
    event AddedGauge(GaugeId gaugeId, Gauge gauge);
    event RemovedGauge(GaugeId gaugeId);
    event UpdatedGauge(GaugeId gaugeId, Gauge gauge);
```

### 4. Maximum Crop Ratio Increase <a href="#e33e4019-aad5-8259-91e4-81a9a1a78b67" id="e33e4019-aad5-8259-91e4-81a9a1a78b67"></a>

Update `s.sys.evaluationParameters.maxBeanMaxLpGpPerBdvRatio` from `100e18` to `150e18`. These 18-decimal fixed-point values represent 100% and 150%. In the code name, `Bean` denotes Pinto, `Bdv` denotes PDV, and `MaxLpGp` denotes maximum LP gauge points.

### 5. Crop Scalar Adjustments <a href="#id-22fe4019-aad5-8220-894e-01a7a3b43985" id="id-22fe4019-aad5-8220-894e-01a7a3b43985"></a>

Update s.sys.casesV2 to reflect the Crop Scalar decreases from 1 to 2 percentage points per Season for case IDs 57–59 and 66–68. These six cases cover Reasonably High price, Reasonably Low L2SR, and Reasonably or Excessively High Pod Rate across decreasing, steady, and increasing Soil demand. Their encoded adjustment changed from `−1e18` to `−2e18`.

![](https://pinto.money/pi/6/pi6-cases.png)

PI-6 as executed. Highlighted cells show the six Crop Scalar decreases from −0.01 to −0.02. Maximum Temperature adjustments were unchanged.

## Rationale <a href="#bdce4019-aad5-82e0-a5c4-81779b3dcf99" id="bdce4019-aad5-82e0-a5c4-81779b3dcf99"></a>

### 1. Cultivation System <a href="#dfde4019-aad5-824f-8d7e-01f85c0807d0" id="dfde4019-aad5-824f-8d7e-01f85c0807d0"></a>

Starting with a very low number of Soil minimizes the instances where the protocol fails to find demand for Soil by a wide margin while the protocol is raising the [Maximum Temperature](https://docs.pinto.money/resources/glossary#maximum-temperature) to discover the interest rate at which it can attract demand. Instead, the Cultivation System enables the protocol to ramp up available Soil once demand for Soil has been discovered. This should result in lower overall Maximum Temperatures necessary to reduce supply.

### 2. Minimum Soil Issuance <a href="#id-8f1e4019-aad5-829a-9d50-01f699ec56e9" id="id-8f1e4019-aad5-829a-9d50-01f699ec56e9"></a>

Setting a minimum Soil of 50 when the time-weighted average and instantaneous Pinto supply deltas are nonpositive and their minimum absolute value is nonzero helps ensure that the protocol can accurately measure demand for Soil even in instances where the Cultivation System would otherwise result in there being a de minimis number of Soil.

### 3. Generalized Gauge System <a href="#id-3eae4019-aad5-82a0-b5e0-0103dd8edc43" id="id-3eae4019-aad5-82a0-b5e0-0103dd8edc43"></a>

Previously, adding 1) State that updates on a `gm` call and 2) Logic that executes during the `gm` call required 1) significant technical understanding of the entire `gm` call, 2) an implicit understanding of the current ordering of actions within the `gm`, and 3) appending or manipulating the state stored on the Pinto Diamond Contract. The Generalized Gauge System introduces a framework in which new features can be appended to the gm call that 1) isolates state and logic on a Gauge basis, and 2) Introduces explicit execution ordering (i.e., the order in which the Diamond State changes within a `gm` call), in a modular and composable fashion, such that iterating on Gauges requires minimal onboarding and minimal background knowledge of other Gauges, in a way that minimizes additional security risk per additional Gauge.

### 4. Maximum Crop Ratio Increase <a href="#id-67be4019-aad5-82fe-bdd5-0152487c2b84" id="id-67be4019-aad5-82fe-bdd5-0152487c2b84"></a>

Prior to this change, the Maximum Crop Ratio of 100% imposed an upper bound on the ratio of [Seeds](https://docs.pinto.money/resources/glossary#seeds) per [PDV](https://docs.pinto.money/resources/glossary#pinto-denominated-value-pdv) of Deposited Pinto and the maximum Seeds per 1 PDV of LP Deposited of 1:1. The idea behind this limit was that at all times, the protocol should not express a preference to have Depositors hold Deposited Pinto over Deposited LP because it would mean that the protocol is not looking to preserve liquidity.

However, this failed to capture the fact that the market prefers to hold Deposited LP over Deposited Pinto, such that even if the protocol offers Deposited Pinto as many Seeds per PDV as the highest-rewarded Deposited LP token, the market may still prefer to hold LP. By setting the Maximum Crop Ratio too low, the protocol has therefore been unable to sufficiently incentivize Converts and return the price to its value target consistently when the price is too low.

### 5. Crop Scalar Adjustments <a href="#id-476e4019-aad5-83ee-973c-81d2d2658585" id="id-476e4019-aad5-83ee-973c-81d2d2658585"></a>

When price is Reasonably High, the Pod Rate is Reasonably or Excessively High and the L2SR is Reasonably Low, the Crop Scalar should decrease more quickly to more aggressively encourage Converts from Pinto to LP tokens to preserve liquidity. In similar instances but where the L2SR is Excessively Low, the protocol already acts incredibly aggressively to preserve liquidity, but in instances where the L2SR is Reasonably Low, it does not act any more aggressively than when the L2SR is Reasonably or Excessively High. This change refines the Crop Scalar change to better factor in the fact that the L2SR is lower than optimal.

## Contract Changes <a href="#id-3ace4019-aad5-8280-9a4b-8103f77cec7d" id="id-3ace4019-aad5-8280-9a4b-8103f77cec7d"></a>

### Initialization <a href="#d59e4019-aad5-83b2-a172-0179bca2c326" id="d59e4019-aad5-83b2-a172-0179bca2c326"></a>

Executed `InitPI6.init()` at [`0x43474d1dabd2213ff6c18b5ba69f8c847808c2c4`](https://basescan.org/address/0x43474d1dabd2213ff6c18b5ba69f8c847808c2c4#code). It registered the Cultivation Factor gauge at 0.5, set the Soil distribution period to 86,400 seconds (24 hours) and minimum Soil issuance to 50 Soil, installed the corrected Crop Scalar cases, increased the maximum Crop Ratio from 100% to 150%, and reset the Crop Scalar to 67%.

### Facet Changes <a href="#id-424e4019-aad5-8342-a379-01012babafd0" id="id-424e4019-aad5-8342-a379-01012babafd0"></a>

| **Facet**              | **Action** | **Previous Implementation**                                                                                                  | **New Implementation**                                                                                                       |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `SeasonFacet`          | Replace    | [`0xfc52fc3c8a29f74603006ff03915770014d9f049`](https://basescan.org/address/0xfc52fc3c8a29f74603006ff03915770014d9f049#code) | [`0xa932cab249fc9ddd073cdb5d40bf304a50025cd6`](https://basescan.org/address/0xa932cab249fc9ddd073cdb5d40bf304a50025cd6#code) |
| `SeasonGettersFacet`   | Replace    | [`0xfa0093b9ca5d00c9e6623767eb09489d90abf150`](https://basescan.org/address/0xfa0093b9ca5d00c9e6623767eb09489d90abf150#code) | [`0xf3d017981d0818274210661ba3cc85d143afa78e`](https://basescan.org/address/0xf3d017981d0818274210661ba3cc85d143afa78e#code) |
| `GaugeFacet`           | Replace    | [`0x2a8827a73de0703b3f6e24895818a3e6d9f8eeba`](https://basescan.org/address/0x2a8827a73de0703b3f6e24895818a3e6d9f8eeba#code) | [`0x25ce5e07e26b4140086f28834dea1c092fc10f90`](https://basescan.org/address/0x25ce5e07e26b4140086f28834dea1c092fc10f90#code) |
| `GaugeFacet`           | Add        | N/A                                                                                                                          | [`0x25ce5e07e26b4140086f28834dea1c092fc10f90`](https://basescan.org/address/0x25ce5e07e26b4140086f28834dea1c092fc10f90#code) |
| `GaugeGettersFacet`    | Replace    | [`0x04912d77f69bd03f8846a432b0abacfc028bea33`](https://basescan.org/address/0x04912d77f69bd03f8846a432b0abacfc028bea33#code) | [`0xb1cb5aa3c2e91268aae9c97d59ad90d8df979da3`](https://basescan.org/address/0xb1cb5aa3c2e91268aae9c97d59ad90d8df979da3#code) |
| `ClaimFacet`           | Replace    | [`0x28bcfb5ad84dd460f2fd080dfd706105b8fc21c6`](https://basescan.org/address/0x28bcfb5ad84dd460f2fd080dfd706105b8fc21c6#code) | [`0xcbb67c0dadf1c2774215d8afd4fef34c7741474b`](https://basescan.org/address/0xcbb67c0dadf1c2774215d8afd4fef34c7741474b#code) |
| `PipelineConvertFacet` | Replace    | [`0x508320dcc2b4e9f79555bcae1478e6ce736b22ab`](https://basescan.org/address/0x508320dcc2b4e9f79555bcae1478e6ce736b22ab#code) | [`0x1c3ecf2ae6bd491d112f5a2cea5927a231437437`](https://basescan.org/address/0x1c3ecf2ae6bd491d112f5a2cea5927a231437437#code) |
| `SiloGettersFacet`     | Replace    | [`0x6c1dc649e93be43fff670a2407fa4edc4996bb95`](https://basescan.org/address/0x6c1dc649e93be43fff670a2407fa4edc4996bb95#code) | [`0x48f040332c3ccccf620e3ed6bbab3d117c9238ca`](https://basescan.org/address/0x48f040332c3ccccf620e3ed6bbab3d117c9238ca#code) |
| `OracleFacet`          | Replace    | [`0x755b6b8844faa8361d54cdee16b418770a412cb4`](https://basescan.org/address/0x755b6b8844faa8361d54cdee16b418770a412cb4#code) | [`0x72827f9a9c3f4a0e36c7de20bb7b830abf385d2e`](https://basescan.org/address/0x72827f9a9c3f4a0e36c7de20bb7b830abf385d2e#code) |

### Other Contract / Parameter Changes <a href="#id-714e4019-aad5-82e7-bb52-01b7edc52d6b" id="id-714e4019-aad5-82e7-bb52-01b7edc52d6b"></a>

Added `soilDistributionPeriod = 86400` seconds and `minSoilIssuance = 50e6` (50 Soil) to the evaluation parameters, replacing two reserved buffer slots. Initialized the Cultivation Factor to `50e6` (0.5), bounded by `1e6` (0.01) and `100e6` (1). Increased `maxBeanMaxLpGpPerBdvRatio` from `100e18` to `150e18` and reset `beanToMaxLpGpPerBdvRatio` to `67e18` (67%). Corrected the selected Crop Scalar decreases from 1 to 2 percentage points per Season.

The replacement facets linked the following library implementations:

All ten listed library addresses changed. `ClaimFacet`, `PipelineConvertFacet`, `SiloGettersFacet`, and `OracleFacet` retained their own source files and interfaces despite their replacement. Shared-library behavior may still change.

| Library              | Previous Implementation                                                                                                      | New Implementation                                                                                                           | Used By                            |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `LibEvaluate`        | [`0x69c7d1feb4b963ff9b8338a765c13bb5c3b19792`](https://basescan.org/address/0x69c7d1feb4b963ff9b8338a765c13bb5c3b19792#code) | [`0xfad4e8659830d22ce9e4d87eaef52674bf805fdb`](https://basescan.org/address/0xfad4e8659830d22ce9e4d87eaef52674bf805fdb#code) | `SeasonFacet`                      |
| `LibGauge`           | [`0x07b75f35e90eb114035d3c67ac7738f11fb70a26`](https://basescan.org/address/0x07b75f35e90eb114035d3c67ac7738f11fb70a26#code) | [`0x573c652702091e7265688902ef63c82e21917b4f`](https://basescan.org/address/0x573c652702091e7265688902ef63c82e21917b4f#code) | `SeasonFacet`                      |
| `LibIncentive`       | [`0x4e5dae995c2e8eef23b44a95034064262326e703`](https://basescan.org/address/0x4e5dae995c2e8eef23b44a95034064262326e703#code) | [`0x6fac8752c40475c83720acbad2f0c32476243350`](https://basescan.org/address/0x6fac8752c40475c83720acbad2f0c32476243350#code) | `SeasonFacet`                      |
| `LibShipping`        | [`0x6ccdfc6fd7885a07e5d4ee5e998a66afe6a65705`](https://basescan.org/address/0x6ccdfc6fd7885a07e5d4ee5e998a66afe6a65705#code) | [`0xab1d90c08dfa6d4c520dad967e97c5eee1d61af2`](https://basescan.org/address/0xab1d90c08dfa6d4c520dad967e97c5eee1d61af2#code) | `SeasonFacet`                      |
| `LibWellMinting`     | [`0xd972df7cfd286778951aa829a40e9ab7f7db1d5a`](https://basescan.org/address/0xd972df7cfd286778951aa829a40e9ab7f7db1d5a#code) | [`0xa31576ac3be233a845e665b98bc384b51e1f4b78`](https://basescan.org/address/0xa31576ac3be233a845e665b98bc384b51e1f4b78#code) | `SeasonFacet, SeasonGettersFacet`  |
| `LibFlood`           | [`0x0b316cb760a677ed1c581041c7d2118bc66aa87c`](https://basescan.org/address/0x0b316cb760a677ed1c581041c7d2118bc66aa87c#code) | [`0x8595c632071edec9ab2cd84350d8eef46f181577`](https://basescan.org/address/0x8595c632071edec9ab2cd84350d8eef46f181577#code) | `SeasonFacet`                      |
| `LibGerminate`       | [`0x636234f909174c764d216ef9bd22175f01a107b2`](https://basescan.org/address/0x636234f909174c764d216ef9bd22175f01a107b2#code) | [`0x30f89cd09b92938864b819a552471f2c8771c83d`](https://basescan.org/address/0x30f89cd09b92938864b819a552471f2c8771c83d#code) | `SeasonFacet`                      |
| `LibSilo`            | [`0x5a686e6024d1d40994ae99979ceb63bf67724b04`](https://basescan.org/address/0x5a686e6024d1d40994ae99979ceb63bf67724b04#code) | [`0x85e7554e3af2cfb5ec7a90b53b15b6730055905c`](https://basescan.org/address/0x85e7554e3af2cfb5ec7a90b53b15b6730055905c#code) | `ClaimFacet, PipelineConvertFacet` |
| `LibTokenSilo`       | [`0x0da233676f46427c31928f5f85678d6737f4ec7e`](https://basescan.org/address/0x0da233676f46427c31928f5f85678d6737f4ec7e#code) | [`0x31b1b337778948f2d5a1f70722cef7cca1b72e06`](https://basescan.org/address/0x31b1b337778948f2d5a1f70722cef7cca1b72e06#code) | `ClaimFacet, PipelineConvertFacet` |
| `LibPipelineConvert` | [`0xb387ad744cc1a80ab629eea5ca15459076719a7a`](https://basescan.org/address/0xb387ad744cc1a80ab629eea5ca15459076719a7a#code) | [`0xc7ed19335fcfc73552394dd911cdd56db1ac5e56`](https://basescan.org/address/0xc7ed19335fcfc73552394dd911cdd56db1ac5e56#code) | `PipelineConvertFacet`             |

### Function Changes <a href="#id-0cfe4019-aad5-8250-967b-01bb440ed4fd" id="id-0cfe4019-aad5-8250-967b-01bb440ed4fd"></a>

* Added `cultivationFactor(bytes,bytes,bytes)`, a view function that returns the encoded adjusted Cultivation Factor and unchanged gauge data. It does not store the factor itself. The adjustment uses the previous Season’s recorded Soil sellout, Pod Rate, and largest-USD-liquidity Well price.
* Added internal `LibWell.getBeanUsdPriceForWell()` and reused the calculated USD TWAP in `LibEvaluate` for price classification and Cultivation Factor evaluation. Extended `BeanstalkState` with `largestLiquidWellTwapBeanPrice` and `twaDeltaB`. Updated the shared `LibWell.getTokenBeanPriceFromTwaReserves()` helper to return zero when either time-weighted reserve is at most 1, rather than only when it is zero.
* Updated internal `scaleSoilBelowPeg()` to apply the 24-hour distribution period, Cultivation Factor, and qualified 50-Soil floor. `setSoil()` stores the resulting issuance. Updated `getExtEvaluationParameters()` to return `soilDistributionPeriod` and `minSoilIssuance` in two former buffer slots, reducing the remaining buffer from 63 to 61 entries without changing the selector.
* Updated the `gm` path through `stepGauges()` to run the existing Seed Gauge, engage the generalized gauges, and then calculate Soil. `LibGaugeHelpers` stores each returned value and gauge data. A failed `staticcall` or zero selector preserves the previous fields. A successful call with malformed return data can still revert during decoding.
* Added `getGauge(GaugeId)`, which returns the Gauge configuration including value, target, selector, and data. Added `getGaugeValue(GaugeId)`, which returns only the encoded gauge value. PI-6 did not enable public owner functions to add, remove, or update gauges.
* Corrected the encoded `LibCases` values installed by `InitPI6` for Reasonably High price, Reasonably Low L2SR, and Reasonably or Excessively High Pod Rate, across all Soil-demand states. The existing `getChangeFromCaseId()` reads the corrected cases.

### Event Changes <a href="#id-3cde4019-aad5-82a8-8a0e-819b585f1924" id="id-3cde4019-aad5-82a8-8a0e-819b585f1924"></a>

* Updated the Soil issuance calculation reported by the existing `Soil(uint32,uint256)` event. Its signature remained unchanged.
* Added `AddedGauge(GaugeId,Gauge)`, emitted by initialization with the registered Cultivation Factor configuration, and `Engaged(GaugeId,bytes)`, emitted after engagement with the stored encoded value, including the retained value after a failed call.
* The existing `BeanToMaxLpGpPerBdvRatioChange` event kept its signature. Its emitted adjustment reflects the corrected 2-percentage-point decreases, subject to the existing Crop Scalar bounds. `RemovedGauge` and `UpdatedGauge` were helper declarations, not newly enabled public mutation operations.
