Get the best price on Mimatic (MAI) / DAI swaps by auto-anchoring via one swap contract interface which also improves pool liquidity
This project is a dapp/contract that allows consumers to always get the best price when swapping from a stablecoin (DAI) to another stablecoin with an anchoring mechanism (MAI). The contract connects to one or more Uniswap pools and the miStableDai contract (Anchor) to determine if the most efficient price is from the liquidity pool(s) or by minting or redeeming and putting new tokens into the pool.
How it's made
We use hardhat with Alchemy to fork the Polygon mainnet network and run a hardhat bootstrap script to steal tokens from a DAI whale. This lets us test with real pools with liquidity and real tokens (MAI and PoS DAI) and access the anchor contract. We are using Uniswap V2 pool contracts to compare prices/liquidity. Scaffold-eth provides the UI to all the contracts. The UI was a quick proof of concept to demonstrate calling our contract.