UniCrop is about growing crypto assets, whether it is ERC20 or NFTs, through interchanging and cross-exchanging assets among themseleves. The asset can grow in many ways: staking/yield Farming, using Flashswap and leveraging Arbitrage opportunity, etc. For this project, we have implemented a Flashswap example with DAI/USDC using Uniswap V3 protocol.We initially tried to create a staking Yield Farming app using a scaffolding we already had. We wanted to stake WBTC and deposit in Compound Pool in Python based Brownie framework. We wanted to use Uniswap V3 Oracle for Price limit for harvesting and deploy to Optimism. But, due to lack of time, we ran into some roadblocks with the Brownie framework and pivoted to FlashSwap implementation.
It lets your contract borrow 1,500 DAI from DAI/USDC pool with 0.05 % fee.
The contract execute uniswapV3FlashCallback function. First, it swaps 1500 DAI for UNI on Kyber protocol (1500 DAI - 55.66 UNI )
The contract swaps 55.66 UNI and swap them for DAI on Uniswap DAI/ETH 0.05% pool and UNI/ETH 0.05% pool.
The contract pays back the amount with the pool fee ( 1500 DAI * (1 + 0.05%) = 1,500.75 DAI).
If the transaction does not have enough amount tp pay back the borrowed amount, the whole transaction will be reverted.