# Discussion: AMM Functionality

**URL:** <https://gov.yearn.fi/t/discussion-amm-functionality/12638>\
**Category:** Fixed Forex\
**Created:** [11 July 2022 20:05 UTC](https://gov.yearn.fi/t/discussion-amm-functionality/12638 "2022-07-11T20:05:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SeaSaltyFunk](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/seasaltyfunk/32/3959_2.png) [@SeaSaltyFunk](https://gov.yearn.fi/u/SeaSaltyFunk)\
**Post date:** [16 July 2022 11:54 UTC](https://gov.yearn.fi/t/discussion-amm-functionality/12638/3 "2022-07-16T11:54:05Z")

</div>

In addition to the above, an early version of cross-stable forex swaps _could_ be implemented, which is detailed below.

**Note;** there are some additional considerations with regards to optimal conditions or further optimization that should be considered when weighing up benefits & timing of implementation that are further highlighted below.

**Suggestion;**  
Enable swaps between;

- ibXXX to _any other_ ibXXX asset
- sXXX to _any other_ (fiat) sXXX asset
- ibXXX to _any other_ (fiat) sXXX asset

**Motivation;**  
This will enable liquidity miners farming the Fixed Forex stable pools on curve automatic routing to move capital between liquidity pools via the Fixed Forex AMM, with the flexibility to move between pools to deploy assets on either side of the LP.

This could be particularly appealing/useful where a bonus is available to enter onto one side of the LP pair during off-peg situations.

Depending on liquidity pools being in balance, this could allow for exchange between non-USD stables at fiat FX rates (minus any slippage caused by pool imbalance)

**Execution;**  
Requires AMM contracts to be further updated/modified to allow for the following routings scenarios;

**Note;** all routes must transit swap through USD stables due to lack of availability for any Oracles that track valuations of non-USD fiat to fiat exchange

_ibXXX any other ibXXX asset;_

- Routing as follows;
  - Route originating ibXXX asset via curve pool where paired with sXXX (i.e. exchange ibXXX for sXXX asset via curve pool)
  - Atomically Exchange sXXX asset for user desired fiat sXXX asset (via Synthetix)
  - Route sXXX via relevant curve pool where paired with ibXXX to swap for ibXXX asset

- Fees incurred via Curve & Atomic Exchange should be passed onto user, therefore requires functionality to quote swap costs to user;
  - Note, incurs fees from Curve & fees from Atomic Exchange

- Note; limited by liquidity available in curve pools at time of swap, possibly incurring slippage where pools off-balance

_sXXX any other sXXX asset;_

- Routing as follows;
  - Route originating sXXX asset via Atomically Exchange, swapping asset for ANY other fiat sXXX asset
  - Atomically Exchange originating sXXX for any other sXXX stable asset

- Fees incurred via Atomic Exchange should be passed onto user, therefore requires functionality to quote swap costs to user;
  - Note; incurs fees associated with Atomic Exchange

_ibXXX any other sXXX asset;_

- Routing as follows;
  - Route originating ibXXX asset via curve pool where paired with sXXX (i.e. exchange ibXXX for sXXX asset via curve pool)
  - Route originating sXXX asset via Atomically Exchange, swapping asset for user desired fiat asset version of sXXX

- Fees incurred via Curve & Atomic Exchange should be passed onto user, therefore requires functionality to quote swap costs to user;
  - Note; incurs fees associated with Atomic Exchange & Curve fees

- Note; limited by liquidity available in curve pools at time of swap, possibly incurring slippage where pools off-balance

**Considerations;**  
Due to risk of curve pool balance being directly impacted by implementation would recommend the following are considered as mandatory prerequisites that must be in place prior to implementation;

- A consistent pool incentivization strategy (i.e. one that regularly ensures predictable incentivisation for LPers) inclusive of;
  - Directed CRV emissions to gauges via gauge controlling assets (i.e. veCRV or vlCVX)
  - Dynamic utilization of OLM rewards to flexibly incentivize pools [Option 2 or 4 from this post](http://gov.yearn.fi/t/discussion-rkp3r-allocation-to-curve-gauges/12642))

- Availability of paired stable assets on chain (i.e. via lending markets etc.)
- AMO, PSM, or other pegging mechanisms/functions for Fixed Forex being enabled & actively in place prior to launch

A further consideration is that should technical changes or innovations at Chainlink or the Synthetix team enable the possibility of;

- Exchange availability outside of limitation of circuit breaker on Oracle availability

Then routing methods should be reviewed and modified accordingly.

**Additional Opportunities;**  
The lack of availability for swaps outside of oracle availability & circuit breaker could be somewhat mitigated if the following steps were undertaken;

- Any USD funds received in AMM used for directly acquiring ibXXX stables continue to be deposited in the sUSD+3CRV curve pool, earning rewards on total position
- The Keep3r team periodically withdraw some sUSD funds and proactively swap via Atomic Exchange based on anticipated demand prior to periods where the fiat oracles stop reporting & Atomic Exchange circuit breaker comes into effect
- Keep3r treasury then deposits available sXXX assets into the AMM contract to be used for swaps between ibXXX \< \> ibXXX through the routing highlighted above, but instead of using the Atomic Exchange leg utilizing sXXX treasury held funds
- A fee can be applied to account for risk of fiat exchange movements over the period FX markets are closed & oracles are not reporting
- Profits on fees can be reutilized by the Keep3r treasury to repay outstanding Iron Bank loans & where loans & potentially split with vKP3R holders
- Fees could be set at a level consistent with Atomic Exchange so from a UX experience there is little difference during these periods

---

_[View the full topic](https://gov.yearn.fi/t/discussion-amm-functionality/12638)._
