# 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:** 4

<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:** [15 August 2022 18:19 UTC](https://gov.yearn.fi/t/discussion-amm-functionality/12638/4 "2022-08-15T18:19:35Z")

</div>

> [@SeaSaltyFunk](#):
>
> **Suggestion;**  
> Enable swaps between;
> 
> - ibXXX to _any other_ ibXXX asset
> - sXXX to _any other_ (fiat) sXXX asset
> - ibXXX to _any other_ (fiat) sXXX asset

If this was enabled then the current method where [the AMM is borrowing funds from Iron Bank based on USD stable exchanges-in can be ceased](http://gov.yearn.fi/t/explainer-fixed-forex-swap-function/12576) this would be far more efficient for users and the protocol.

> [@SeaSaltyFunk](#):
>
> **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

Most of these opportunities can actually be disguarded if instead the AMM is adjusted to route any inbound USD stable swaps through the sUSD curve pools at;

- [DAI/USDC/USDT](https://curve.fi/susdv2) @ [0xA5407eAE9Ba41422680e2e00537571bcC53efBfD](https://etherscan.io/address/0xA5407eAE9Ba41422680e2e00537571bcC53efBfD)
- [FRAX/USDC](https://curve.fi/factory/136) @ [0xe3c190c57b5959Ae62EfE3B6797058B76bA2f5eF](https://etherscan.io/address/0xA5407eAE9Ba41422680e2e00537571bcC53efBfD)

Since the USD stables would just pass through the contract via the curve pool then enable the atomic exchange between sUSD & the sXXX (& onto ibXXX if user desired) then there is no need for any funds to be held by the treasury

Relevant Synthetix Contracts;

- [ReadProxyAddressResolver](https://etherscan.io/address/0x4E3b31eB0E5CB73641EE1E65E7dCEFe520bA3ef2)
- [Exchanger](https://etherscan.io/address/0xD64D83829D92B5bdA881f6f61A4e4E27Fc185387#writeContract)

**End Result - Options available in UI**

_Fully dependent on Curve pool slippage;_

- Exchange DAI/USDC/USDT/FRAX for sUSD
- Exchange sUSD for DAI/USDC/USDT/FRAX

_Dependent on availability & pricing of AtomicExchange;_

- Exchange sUSD for ANY sXXX fiat/stable
- Exchange ANY sXXX fiat/stable for ANY other sXXX fiat/stable
- Exchange ANY sXXX fiat/stable for sUSD

_Dependant on Curve pool slippage;_

- Exchange ANY ibXXX for ANY sXXX fiat/stable
- Exchange ANY sXXX for ANY ibXXX fiat/stable

Bonus if routing can be added to the contract to simplify inputs & output exchange offerings (i.e. with hops between Curve & AtomicExchange)

---

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