{"componentChunkName":"component---src-pages-sips-sip-markdown-remark-frontmatter-sip-tsx","path":"/sips/sip-198/","result":{"data":{"markdownRemark":{"fileAbsolutePath":"/vercel/path0/content/sips/sip-198.md","frontmatter":{"sip":198,"sccp":null,"title":"Update To Atomic Exchange Function","network":"Ethereum","author":"Kaleb (@kaleb-keny)","type":"Governance","proposal":"https://snapshot.org/#/snxgov.eth/proposal/QmbgLuzsw1aRpoEogonJNoBqVv5wsisDZyRSyytgj4WoRT","implementor":"MEB (@barrasso)","release":"Mirach","created":"2022-01-01T00:00:00.000Z","updated":null,"status":"Implemented"},"html":"<h2 id=\"simple-summary\" style=\"position:relative;\"><a href=\"#simple-summary\" aria-label=\"simple summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Simple Summary</h2>\n<!--\"If you can't explain it simply, you don't understand it well enough.\" Simply describe the outcome the proposed changes intends to achieve. This should be non-technical and accessible to a casual community member.-->\n<p>Update the atomic exchange functionality, laid out in <a href=\"https://sips.synthetix.io/sips/sip-120/\">SIP-120</a>, to include the following changes:</p>\n<ul>\n<li>Allow trading at the pure the chainlink price for certain synths.</li>\n<li>Remove the restriction on the Source or Destination Currencies being sUSD.</li>\n</ul>\n<h2 id=\"abstract\" style=\"position:relative;\"><a href=\"#abstract\" aria-label=\"abstract permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Abstract</h2>\n<p>The SIP proposes to incorporate into the atomic exchanges the ablity to configure a pure chainlink price feed for certain synths. Furthermore, the SIP proposes to remove the restriction on the source or destination currencies being sUSD.</p>\n<h2 id=\"motivation\" style=\"position:relative;\"><a href=\"#motivation\" aria-label=\"motivation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Motivation</h2>\n<p>Currently in order to add a synth into Atomic Exchanges, we need the following:</p>\n<ul>\n<li>The synth that can be traded</li>\n<li>The equivalent uni-v3 token</li>\n<li>The atomic price buffer</li>\n<li>The atomic exchange fee</li>\n</ul>\n<p>However, it is impossible to configure some forex stable synths due to the lack of an equivalent dex token that has deep persistent liquidity. One example is the recent EUR addition where we configured sEUR to take on the EURT token price. But TVL had dried up on the <a href=\"https://info.uniswap.org/#/pools/0x1754b94a3e63be72efe44a1828cd81c4782a46c4\">EURT/USDC</a> pair, and liquidity flowed towards the <a href=\"https://info.uniswap.org/#/pools/0x07f3d316630719f4fc69c152f397c150f0831071\">EURT/USDT</a> pool. This resulted in atomic prices being quoted at uncompetitive prices with respect to the fill that can be obtained elsewhere.\nAn analysis run on both <a href=\"https://ibb.co/BZQVmtB\">EUR</a> and <a href=\"https://ibb.co/GMPnx6y\">GBP</a>, whereby we looked at the price differential between the pure chainlink price against the prices seen on centralized exchanges reveals that a fee of 20 bp would more than sufficient to cover the latency gap related to pushing prices on ETH by an oracle.\nIn fact, <a href=\"https://docs.chain.link/docs/ethereum-addresses/\">chainlink push threshold</a> on all forex synths is around 15 bp, which allows us to provide really competitive pricing without incurring the risk of oracle front-running.</p>\n<p>Regarding the use case, synth stables on ETH have gained significant market share, due to the integration with <a href=\"http://fixedforex.fi/\">FixedForex</a> project and demand for these synths on <a href=\"https://www.curve.fi/\">curve</a> for farming purposes. At the time of writing, the synth-forex market cap is around $220m and distributed as follows:</p>\n<ul>\n<li>sEUR $108m</li>\n<li>sJPY $21m</li>\n<li>sAUD $18m</li>\n<li>sGBP $29m</li>\n<li>sCHF $27m</li>\n<li>sKRW $19m</li>\n</ul>\n<p>Hence, we should expect some volume with atomic forex trading across different curve pools, for curve farming, as well as different integration with other partners.</p>\n<p>The restriction on the source currency or destination currency being in sUSD was incorporated in SIP-120 as a safety precaution. However, this can be relaxed as to accomodate for crypto to FX trades without exposing minters to additional risk.</p>\n<h2 id=\"specification\" style=\"position:relative;\"><a href=\"#specification\" aria-label=\"specification permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Specification</h2>\n<!--The specification should describe the syntax and semantics of any new feature, there are five sections\n1. Overview\n2. Rationale\n3. Technical Specification\n4. Test Cases\n5. Configurable Values\n-->\n<h3 id=\"overview\" style=\"position:relative;\"><a href=\"#overview\" aria-label=\"overview permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Overview</h3>\n<!--This is a high level overview of *how* the SIP will solve the problem. The overview should clearly describe how the new feature will be implemented.-->\n<p>The implementation includes the following major sections:</p>\n<ul>\n<li>Tagging assets to trade at pure chainlink price</li>\n<li>The computation methodology of the price of assets that trade atomicaly</li>\n<li>The fill amount of a trade that trades atomically</li>\n</ul>\n<h3 id=\"rationale\" style=\"position:relative;\"><a href=\"#rationale\" aria-label=\"rationale permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rationale</h3>\n<!--This is where you explain the reasoning behind how you propose to solve the problem. Why did you propose to implement the change in this way, what were the considerations and trade-offs. The rationale fleshes out what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.-->\n<p>With <a href=\"https://sips.synthetix.io/sips/sip-120/\">SIP-120</a> any asset can be configured to trade atomically, however, the the downside is that it requires that a uniswap v3 pool be available with enough liquidity to make arbitrages on the uniswap pools align with real world prices. The lack of liquidity on those forex pools, resulted in prices drifting away on the EUR pools from prices on exchanges by hundreds of basis points. Furthermore, the lack of relevant uniswap liquidity pool for exotic forex assets makes this solution untenable.\nThe alternative specified in this sip, is to tag assets to trade at the pure chainlink price and allow for these assets to utilize the chainlink price for the fill. Although this does expose the staking pool to the risk of latency arbitrage, since the oracle used might drift away with from real world prices for a short period of time, that said, raising fees to a certain level (since stables drift by only a few bp at a given time) and incorporating off chain circuit breakers <a href=\"https://sips.synthetix.io/sips/sip-231/\">SIP-231</a> allows us to cover both the tail and non-tail latency risks.</p>\n<h3 id=\"technical-specification\" style=\"position:relative;\"><a href=\"#technical-specification\" aria-label=\"technical specification permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Technical Specification</h3>\n<!--The technical specification should outline the public API of the changes proposed. That is, changes to any of the interfaces Synthetix currently exposes or the creations of new ones.-->\n<h4 id=\"pure-chainlink-price-tagging\" style=\"position:relative;\"><a href=\"#pure-chainlink-price-tagging\" aria-label=\"pure chainlink price tagging permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Pure Chainlink Price Tagging</h4>\n<ul>\n<li><code>setPureChainlinkPriceForAtomicSwapsEnabled</code> is a method in <code>SystemSettings</code> that allows assets to be tagged to trade at the pure chainlink price.</li>\n<li><code>getPureChainlinkPriceForAtomicSwapsEnabled</code> is an internal function in <code>MixinSystemSettings</code> that returns True if an asset has been tagged to trade at purely the chainlink price and False otherwise</li>\n</ul>\n<h4 id=\"atomic-price-computation-methodology\" style=\"position:relative;\"><a href=\"#atomic-price-computation-methodology\" aria-label=\"atomic price computation methodology permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Atomic Price Computation Methodology</h4>\n<h5 id=\"context-on-pricing-and-naming-conventions\" style=\"position:relative;\"><a href=\"#context-on-pricing-and-naming-conventions\" aria-label=\"context on pricing and naming conventions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Context on Pricing and Naming Conventions</h5>\n<p>The price of an exchange when a trade materializes from a source (<code>SRC</code>) currency to a destination (<code>DEST</code>) currency can be broken down into two price components:</p>\n<ul>\n<li>The price of the source currency in dollar terms is denoted <code>SRC/USD</code>, for example <code>BTC/USD</code> is at 38k$ per bitcoin.</li>\n<li>the price of the destination in dollar terms, denoted <code>DEST/USD</code></li>\n<li>A trader, trades an amount of <code>SRC</code> currency, called <code>SRC_Amount</code> and he receives <code>DEST_Amount</code>.</li>\n<li><code>SRC/DEST</code> is the <strong>trade price</strong>, being the amount of destination currency received per source currency. It is obtained by dividing <code>SRC/USD</code> by <code>DEST/USD</code>. For example trading 1 bitcoin into eur, with destination <code>EUR/USD</code> 1.05$ and source <code>BTC/USD</code> at 38k$. Applying the previous formula will lead to <code>38k/1.05</code> , resulting in 36,190 EUR received, assuming 0 fees.</li>\n<li>The computation of <code>DEST_Amount</code> is given by <code>SRC_Amount * SRC/DEST * (1- fee)</code>.</li>\n<li>In the case where <code>SRC</code> or <code>DEST</code> is the US Dollar, the same logic still applies, where one of the components is <code>USD/USD</code> or 1. An example of this is a trade of 1 USD into BTC, in such a situation the trade price <code>SRC/DEST</code> is obtained by dividing <code>USD/USD</code> 1 by <code>BTC/USD</code> (38k$) which leads to <code>0.0000263</code> btc received.</li>\n</ul>\n<h5 id=\"computation-methodology-in-atomic-pricing\" style=\"position:relative;\"><a href=\"#computation-methodology-in-atomic-pricing\" aria-label=\"computation methodology in atomic pricing permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Computation Methodology in Atomic Pricing</h5>\n<p>SIP-198, leads to combinations that involve the usage of chainlink in certain situations and the usage of uniswap in others or a combination of the two sources of prices.</p>\n<ol>\n<li>PureChainlink Vs Not Pure Chainlink:</li>\n</ol>\n<ul>\n<li>When a pure chainlink price is assigned to a currency, the chainlink price is used.</li>\n<li>Otherwise the <strong>worse</strong> price between chainlink and uniswap is used in the combination. Worse price, means the price that would result in the lowest <code>DEST_Amount</code>.</li>\n</ul>\n<ol start=\"2\">\n<li>Naming Convention:</li>\n</ol>\n<ul>\n<li>When <code>_Uni</code> is denoted on a currency, it means the price is from the uniswap V3 based <code>DexPriceAggregatorUniswapV3</code> contract</li>\n<li>When <code>_Chainlink</code> is denoted on a currency, the chainlink price is used</li>\n</ul>\n<ol start=\"3\">\n<li>Below are the different scenarios that could arise for trading currencies that have or don't have the Pure Chainlink tag:</li>\n</ol>\n<ul>\n<li><code>SRC</code> and <code>DEST</code> are both set to trade at the PureChainlinkPrice, in such a case, both <code>SRC/USD_Chainlink</code> and <code>DEST/USD_Chainlink</code> are used to compute <code>SRC/DEST</code> by dividing <code>SRC/USD_Chainlink</code> by <code>DEST/USD_Chainlink</code>.</li>\n<li><code>SRC</code> is <strong>NOT</strong> set to PureChainlinkPrice and <code>DEST</code> is set to PureChainlinkPrice. Therefore, <code>SRC/DEST</code> is obtained by dividing min(<code>SRC/USD_UNI</code>,<code>SRC/USD_Chainlink</code>) by <code>DEST/USD_Chainlink</code>.</li>\n<li><code>SRC</code> is set to PureChainlinkPrice and <code>DEST</code> is <strong>NOT</strong> set to PureChainlinkPrice. Therefore, <code>SRC/DEST</code> is obtained by dividing <code>SRC/USD_Chainlink</code> by max(<code>DEST/USD_Chainlink</code>,<code>DEST/USD_Uni</code>).</li>\n<li>Both <code>SRC</code> and <code>DEST</code> are <strong>NOT</strong> set to PureChainlinkPrice, in such a case, <code>SRC/DEST</code> is obtained by dividing min(<code>SRC/USD_UNI</code>,<code>SRC/USD_Chainlink</code>) by max(<code>DEST/USD_Chainlink</code>,<code>DEST/USD_Uni</code>) .</li>\n</ul>\n<h4 id=\"slippage-protection\" style=\"position:relative;\"><a href=\"#slippage-protection\" aria-label=\"slippage protection permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Slippage Protection</h4>\n<p>Because prices could move by the time a trade lands on chain, <code>minReturnAmount</code> is incorporated, whereby a trade that leads to an amount lower than <code>minReturnAmount</code> would revert.</p>\n<h4 id=\"atomicpricebuffer\" style=\"position:relative;\"><a href=\"#atomicpricebuffer\" aria-label=\"atomicpricebuffer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>AtomicPriceBuffer</h4>\n<p>The <code>CL_BUFFER</code> is the buffer to be applied against the current Chainlink price in the direction detrimental to the trade, specified in bps and per-synth. This parameter had always been set to zero, given that controlling fees in order to offset latency was easier to reason about. Therfore, this parameter will be dropped from with current implementation of atomic exchanges.</p>\n<h3 id=\"test-cases\" style=\"position:relative;\"><a href=\"#test-cases\" aria-label=\"test cases permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Test Cases</h3>\n<!--Test cases for an implementation are mandatory for SIPs but can be included with the implementation..-->\n<ul>\n<li>\n<p>Given that a trader intends to trade <code>10</code> <code>sBTC</code> to <code>sEUR</code>, with fees set to 0 bp</p>\n<ul>\n<li>Given that <code>EUR/USD_Chainlink</code> is at <code>1.1</code> while <code>EUR/USD_Uni</code> is at <code>1.2</code>.\n<ul>\n<li>Given that <code>BTC/USD_Uni</code> is <code>37,000</code> <code>BTC/USD_Chainlink</code> is at <code>38,000</code>.\n<ul>\n<li>Given that <code>sEUR</code>and <code>sBTC</code> are NOT set to trade at the pure chainlink price\n<ul>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>300,000</code>\n<ul>\n<li>✅ Then it succeeds and the following take place:\n<ul>\n<li><code>308,333</code> sEUR is sent to the user, and <code>10</code> <code>sBTC</code> is burned</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>310,000</code>\n<ul>\n<li>❌ Then it reverts, due to the retun amount being too low</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Given that <code>sBTC</code> and <code>sEUR</code> are both set to trade at the pure chainlink price\n<ul>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>300,000</code>\n<ul>\n<li>✅ Then it succeeds and the following take place:\n<ul>\n<li><code>345,455</code> sEUR is sent to the user, and <code>10</code> <code>sBTC</code> is burned</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>350,000</code>\n<ul>\n<li>❌ Then it reverts, due to the retun amount being too low</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Given that <code>sBTC</code> is set to trade at the pure chainlink price and <code>sEUR</code> is NOT set to trade at the pure chainlink price\n<ul>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>300,000</code>\n<ul>\n<li>✅ Then it succeeds and the following take place:\n<ul>\n<li><code>316,667</code> sEUR is sent to the user, and <code>10</code> <code>sBTC</code> is burned</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>320,000</code>\n<ul>\n<li>❌ Then it reverts, due to the retun amount being too low</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Given that <code>sEUR</code> is set to trade at the pure chainlink price and <code>sBTC</code> is NOT set to trade at the pure chainlink price\n<ul>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>330,000</code>\n<ul>\n<li>✅ Then it succeeds and the following take place:\n<ul>\n<li><code>336,364</code> sEUR is sent to the user, and <code>10</code> <code>sBTC</code> is burned</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>340,000</code>\n<ul>\n<li>❌ Then it reverts, due to the retun amount being too low</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p>Given that a trader intends to trade <code>10</code> <code>sBTC</code> to <code>sEUR</code>, with fees set to 50 bp</p>\n<ul>\n<li>Given that <code>EUR/USD_Chainlink</code> is at <code>1.1</code> while <code>EUR/USD_Uni</code> is at <code>1.2</code>.\n<ul>\n<li>Given that <code>BTC/USD_Uni</code> is <code>37,000</code> <code>BTC/USD_Chainlink</code> is at <code>38,000</code>.\n<ul>\n<li>Given that <code>sEUR</code>and <code>sBTC</code> are NOT set to trade at the pure chainlink price\n<ul>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>300,000</code>\n<ul>\n<li>✅ Then it succeeds and the following take place:\n<ul>\n<li><code>306,791</code> sEUR is sent to the user, sUSD <code>1,696</code> is sent to the fee pool and <code>10</code> <code>sBTC</code> is burned</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>When the user attempts to trade, setting the minReturnAmount to <code>307,000</code>\n<ul>\n<li>❌ Then it reverts, due to the retun amount being too low</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h3 id=\"configurable-values-via-sccp\" style=\"position:relative;\"><a href=\"#configurable-values-via-sccp\" aria-label=\"configurable values via sccp permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configurable Values (Via SCCP)</h3>\n<!--Please list all values configurable via SCCP under this implementation.-->\n<p>Aside from the SCCP configurable variables specified in <a href=\"https://sips.synthetix.io/sips/sip-120/\">SIP-120</a>, the Spartan Council can assign that an asset can be traded at the pure chainlink price via SIP with <code>setPureChainlinkPriceForAtomicSwapsEnabled</code>.</p>\n<h2 id=\"copyright\" style=\"position:relative;\"><a href=\"#copyright\" aria-label=\"copyright permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Copyright</h2>\n<p>Copyright and related rights waived via <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0</a>.</p>"}},"pageContext":{"id":"96ba2ddc-5a55-5db0-a731-5e136175c4bd","frontmatter__sip":198,"__params":{"frontmatter__sip":"198"}}},"staticQueryHashes":[]}