> 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-2.md).

# PI-2: Remove Anti Lambda to Lambda Convert

Executed on November 27, 2024 at 21:11 UTC.

## Summary <a href="#id-2b5e4019-aad5-82ad-a702-01f3b741faf3" id="id-2b5e4019-aad5-82ad-a702-01f3b741faf3"></a>

Remove the Anti Lambda to Lambda (AL2L) [Convert](https://docs.pinto.money/resources/glossary#convert) functionality from the [Silo](https://docs.pinto.money/resources/glossary#silo) to prevent users from removing each other's [Rain Stalk](https://docs.pinto.money/responding-to-state/flood).

## Links <a href="#f63e4019-aad5-82e5-9fbd-81967111f69f" id="f63e4019-aad5-82e5-9fbd-81967111f69f"></a>

* [Implementation PR](https://github.com/pinto-org/protocol/pull/3)
* Implementation Commit: [c2077d53a84646f1fa2f09099547a628b6c2f590](https://github.com/pinto-org/protocol/commit/c2077d53a84646f1fa2f09099547a628b6c2f590)
* [Safe Transaction](https://app.safe.global/transactions/tx?id=multisig_0x2cf82605402912C6a79078a9BBfcCf061CbfD507_0x30f277db1b5031458c29c956098640f619ef294e97b5c1a88677527a8fcac6ea\&safe=base:0x2cf82605402912C6a79078a9BBfcCf061CbfD507)
* [Diamond Cut Transaction](https://basescan.org/tx/0xe7c0c6056e73e12ba8a55d67492887132d9ba2589f7d8d07e1b0f0c9f97896dc)

## Background <a href="#id-971e4019-aad5-8351-bf69-01fe8ff8f765" id="id-971e4019-aad5-8351-bf69-01fe8ff8f765"></a>

Before this upgrade, AL2L Converts allowed any [Farmer](https://docs.pinto.money/resources/glossary#farmers) to Convert another Farmer's [Deposit](https://docs.pinto.money/resources/glossary#deposit) in order to decrease its [Pinto-Denominated Value (PDV)](https://docs.pinto.money/resources/glossary#pinto-denominated-value-pdv) if the current PDV of the Deposit (i.e., the PDV per token \* the number of tokens) is less than the recorded PDV (i.e., the PDV stored onchain, which is used by the protocol to determine how many [Stalk](https://docs.pinto.money/resources/glossary#stalk) and [Seeds](https://docs.pinto.money/resources/glossary#seeds) to award the Deposit).

The ability to decrease a Deposit's PDV is necessary because as the value in liquidity pools changes due to changes in the price of the non-[Pinto](https://docs.pinto.money/resources/glossary#pinto) asset in the liquidity pool and/or the ratio of the assets in the liquidity pool changes, it is possible for the PDV of the Deposit to decrease substantially. By enabling anyone to decrease the PDV associated with a Deposit that is recorded by the protocol, the instances where the protocol is awarding excess Stalk and Seeds to a Deposit beyond the current value the Deposit is contributing to the protocol can be drastically reduced without requiring the protocol to regularly check the PDV of each Deposit, which would be expensive. Of course, there is no incentive for a Farmer to decrease their own PDV. Thus, the AL2L Convert is callable by any user on eligible Deposits that had completed [Germination](https://docs.pinto.money/resources/glossary#germination).

## Problem <a href="#id-018e4019-aad5-83ec-b188-818ab40c84c6" id="id-018e4019-aad5-83ec-b188-818ab40c84c6"></a>

AL2L Converts had a bug in their implementation that would result in a loss of the Rain Stalk associated with the Deposit while it's [Raining](https://docs.pinto.money/resources/glossary#rain) and/or [Flooding](https://docs.pinto.money/resources/glossary#flood). Rain Stalk is the snapshot of Stalk holdings taken each time it begins to Rain, which determines pro rata ownership of the proceeds from the Flood sale. While an AL2L Convert should decrease the Rain Stalk associated with a Deposit in the instance where its PDV is decreased, the AL2L Convert erroneously removed Rain Stalk during withdrawal without restoring the Farmer's Rain Stalk snapshot when the Deposit was recreated.

## Solution <a href="#a7ae4019-aad5-839f-ae43-014f326c3e73" id="a7ae4019-aad5-839f-ae43-014f326c3e73"></a>

Remove AL2L Converts until a fix can be implemented to allow Farmers to retain the appropriate number of Rain Stalk during Converts.

## Rationale <a href="#id-3e2e4019-aad5-8380-8add-8166025c2ce5" id="id-3e2e4019-aad5-8380-8add-8166025c2ce5"></a>

Temporarily removing AL2L Converts prevents another Farmer from triggering the erroneous Rain Stalk removal while a fix is developed. The tradeoff is that AL2L Converts cannot reduce overstated Deposit PDV during this period.

## Contract Changes <a href="#id-729e4019-aad5-8291-91e9-010d236a6bf3" id="id-729e4019-aad5-8291-91e9-010d236a6bf3"></a>

### Initialization <a href="#id-02ee4019-aad5-830c-965f-01855a602542" id="id-02ee4019-aad5-830c-965f-01855a602542"></a>

No initializer was called. The Diamond Cut used the zero address for its initializer and empty initialization calldata.

### Facet Changes <a href="#id-5f3e4019-aad5-82ab-8926-81c984a9b996" id="id-5f3e4019-aad5-82ab-8926-81c984a9b996"></a>

| **Facet**             | **Action** | **Previous Implementation**                                                                                                  | **New Implementation**                                                                                                       |
| --------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `ConvertFacet`        | Replace    | [`0x379D2d7FF9907F127f1226a9024BCF0789619734`](https://basescan.org/address/0x379D2d7FF9907F127f1226a9024BCF0789619734#code) | [`0xF07C34E81D56fF02c01869bf1F833C07BB52BF2b`](https://basescan.org/address/0xF07C34E81D56fF02c01869bf1F833C07BB52BF2b#code) |
| `ConvertGettersFacet` | Replace    | [`0xfE55E1e7f3FdAef6b1E6E3d6D53f84a374151817`](https://basescan.org/address/0xfE55E1e7f3FdAef6b1E6E3d6D53f84a374151817#code) | [`0x518F109e57c872F8aceC3b3e9a6Ce5f5e8E80097`](https://basescan.org/address/0x518F109e57c872F8aceC3b3e9a6Ce5f5e8E80097#code) |

### Other Contract / Parameter Changes <a href="#id-9ace4019-aad5-8305-b64f-81d6b06b030e" id="id-9ace4019-aad5-8305-b64f-81d6b06b030e"></a>

No protocol parameters changed. The replacement `ConvertFacet` links to the following libraries (previous → new addresses):

| Library              | Previous Implementation                                                                                                      | New Implementation                                                                                                           | Used By        |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `LibConvert`         | [`0x3dedd64cfbf6db642cf6a22ce747fdfb9f17b570`](https://basescan.org/address/0x3dedd64cfbf6db642cf6a22ce747fdfb9f17b570#code) | [`0x67e19ab71b645b8b42062b2a5c8e49ef900fee9e`](https://basescan.org/address/0x67e19ab71b645b8b42062b2a5c8e49ef900fee9e#code) | `ConvertFacet` |
| `LibPipelineConvert` | [`0x4917dcbafc47b57b9ec004424a44ccdc5834d054`](https://basescan.org/address/0x4917dcbafc47b57b9ec004424a44ccdc5834d054#code) | [`0x2fc411d1ed590416ec2bc398f624bf462b60ff49`](https://basescan.org/address/0x2fc411d1ed590416ec2bc398f624bf462b60ff49#code) | `ConvertFacet` |
| `LibSilo`            | [`0x351ca256f86c10b01f2640f22ca379cf1e74d8e2`](https://basescan.org/address/0x351ca256f86c10b01f2640f22ca379cf1e74d8e2#code) | [`0x453c79a1c29d81b67b3be4e2b8810674f63606d8`](https://basescan.org/address/0x453c79a1c29d81b67b3be4e2b8810674f63606d8#code) | `ConvertFacet` |
| `LibTokenSilo`       | [`0xbbe1d3e7bb0b50d1999f631674efd5446881612a`](https://basescan.org/address/0xbbe1d3e7bb0b50d1999f631674efd5446881612a#code) | [`0x1915dcd16475dd25e2f5588888421cf80fc8d116`](https://basescan.org/address/0x1915dcd16475dd25e2f5588888421cf80fc8d116#code) | `ConvertFacet` |

### Function Changes <a href="#e7ee4019-aad5-8238-b008-01944441b723" id="e7ee4019-aad5-8238-b008-01944441b723"></a>

* Updated `LibConvert.convert` to reject AL2L conversions instead of calling `LibLambdaConvert.antiConvert`. `ConvertFacet.convert` keeps its existing selector (`0xb362a6e8`) but now reverts for `ANTI_LAMBDA_LAMBDA` with `"Convert: Anti-lambda-lambda not supported"`. No public functions or events were added or removed. A rejected AL2L call returns no values and commits no state changes or event logs.
* `ConvertGettersFacet` was redeployed alongside `ConvertFacet` as part of the `LibConvert` update. Its getter functionality is unchanged. The old and new deployed implementations have identical executable code after excluding compiler metadata. `ConvertGettersFacet` has no externally linked libraries.
