Milton - AMM
I think that nothing is so important for freedom as recognizing in the law each individual’s natural right to property and giving individuals a sense that they own something that they’re responsible for, that they have control over, and that they can dispose of.Milton Friedman
Milton is a central and most important contract for IPOR Interest Rate Swaps. It is in charge of issuing swaps, delegating funds, and managing the risk and state of the derivatives portfolio. Milton is divided into several parts responsible for aspects of this large set of functionalities. It has been built for modularity to evolve and improve as the market for interest rate derivatives evolves and matures.
The main part is a
Milton.sol
- it is responsible mainly for opening interest rate swaps. To fulfill that function, it keeps balances, tracks the performance of the derivative portfolio via S.O.A.P, and delegates things such as spread calculation and asset management. Milton, like many other contracts in IPOR Protocol, is issued per stablecoin. In other words, for each stablecoin, there is a version of Milton. It helps with gas optimisation as well as security.
For implementation refer to the deployed contract of Milton.
Function | Notes |
---|---|
calculateSpread | Calculates the spread for both pay fixed and receive fixed spread. The actual implementation of math is in a dedicated contract contracts/spread/MiltonSpreadModel.sol |
calculateSoap | |
openSwapPayFixed | Both types of swaps: pay fixed and receive fixed use separate methods. This is mainly due to efficiency, gas optimization, and code simplicity. |
openSwapReceiveFixed | see above |
closeSwapPayFixed | Closes the swap. This function will execute one or more ERC20 transfers to the user triggering the function. The first ERC20 transfer is a net payout from the swap; the second transfer is for the liquidation deposit. If the swap's owner closes his position, there will only be one ERC20 transfer for the combined amount. If the entity closing swap is different from the owner, then the owner will receive the first transfer with the net payout of the swap and the closing user the second one with the liquidation deposit. Some fees may be deducted from the final payout. For more information refer to the fees documentation |
closeSwapReceiveFixed | see above. Closes ReceiveFixed swap |
closeSwaps | Closes multiple swaps in one transaction. Allows up to 10 swaps of each type to be closed. As arguments, it takes to arrays of swap IDs. If the swap has already been closed, such swap would be skipped when closing. |
emergencyCloseSwapPayFixed | Emergency swap closing allows for closing a swap at maturity by admin even if the contract is paused. |
emergencyCloseSwapPayFixed | see above |
emergencyCloseSwapsPayFixed | Emergency swap closing allows for closing multiple swaps at maturity by admin even if the contract is paused. |
emergencyCloseSwapsReceiveFixed | see above |
Last modified 1yr ago