Amount of Murabaha Token Required (AMTR)
Unlike a generic swap, in a Murabaha transaction the user does not have the currency token (ie, USDT) to facilitate a swap that would result in them receiving some token (ie, ARB). The currency token is being provided by the AZKA liquidity providers. These LP's are willing to purchase the token on behalf of the Murabaha taker and sell it to them at a markup profit, generating a debt that must be repaid by some date. Hence, it is logical to assume that the Murabaha taker has some idea as to the amount of token they require (This is essentially the AMTR or 'Amount of Murabaha Token Required'). The LP's need to provide the correct amount of currency token that would result in a swap which satisfies the Murabaha takers request. What the Murabaha Order book needs to do is the following:
Conduct a reverse DEX aggregator query that identifies the amount (A) of the currency token (ie USDT) that is needed to facilitate a swap that would result in the 'AMTR'. The amount (A) obtained is essentially the DEX aggregator Quote (Q) and represents the base debt (ex additional protocol fees) in the currency token that the user would would owe the pool. The DEX aggregator quote/base debt is what will be taken from the pool to facilitate the takers request.
The price impact and swap fees are contained in the DEX Aggregator quote. Price impact will be displayed on the UI for the user to asses the real cost of the swap with regards to the global market price.
In order to ensure that the ‘Amount received’ by the Murabaha Taker is equal ‘Amount of Murabaha token required (AMTR)’ that was requested, the Murabaha Order Book would add the slippage onto this AMTR as follows:
The Murabaha Aggregator/Order Book then adds on any additional Fees to the DEX quote/Base Debt as follows:
The Murabaha and protocol fees are a compensation for the providing this financing up front for the specified duration. It is possible; that due to the pool already having a high utilisation and/or the impact of the DEX Quote/Base debt on the pools utilisation; the Murabaha fee and Protocol fee is quite high. This coupled with price impact and gas fees might make the Murabaha transaction unfeasible for the taker.
Last updated