Every time USDL deviates from its 1 USD peg, an almost riskless arbitrage opportunity arises. The only potential downside is having to pay gas costs for a transaction that doesn't go through. See here for the high level details explaining the concepts behind the price stability mechanism.
Contract: LemmaUniswapV3ArbBot
This contract is a reference implementation for an arbitrage bot that profits off of the price deviations of USDL. The high level steps in this implementation are:
Check if USDL has deviated from its 1 USD price on the Uniswap v3 WETH<>USDL pool
If USDL is worth more than 1 USD, then in a single transaction, the following happens:
A flashloan is used to borrow WETH
The WETH is used to mint USDL
The USDL is swapped for WETH in the Uniswap pool
The loan is repaid using the the profits in WETH
If USDL is worth less than 1 USD, then in a single transaction, the following happens:
Function purpose: initializes the bot contract & points it to the chosen Uniswap v3 pair to arbitrage (in the example above that would be the USDL/WETH pair) and to the USDLemma contracts.
Parameters
Description
Attribute
_collateral
Address for the collateral type to be used in the arbitrage.
eg. for a USDL<>WETH arbitrage, the _collateral address would be the WETH address.