Arbitrum
General framework
The whole system in L2 is a slightly modified version of the Diamond Proxy pattern (aka EIP 2535) with multiple facets (aka implementations) that control the logic and accounting of the funds received and/or invested.
The general overview of the Diamond can be found here.
Optimistic scenario
ETH is sent out, along the Account's config, from ozPayMe in L1, using Arbitrum's retryable ticket technique, to the OZLFacet in L2, where the protocol fee is charged and then deposited in DeFi (Curve and Yearn at the moment) for generating yield. This yield plus the deposited fees belong to the users of the protocol in direct proportion (to 100 using the OZL token which has a totalSupply of 100) to the amount of payments (aka ETH transfers) that they've routed through the system.
Before routing to the OZLFacet, and depending on the selector of the call, the deposited fees in DeFi are queried in order to tell if a tier of the owner's future revenue is met which would start the proper allocation.
Pessimistic scenario
Problem: The L2 gas price submitted when creating the retryable ticket in L1 is not enough, so the transaction is not auto-redeemed. Funds (user's ETH) don't arrive to the OZLFacet.
Solution: One of the Akash deployments manually redeems the transaction.
Problem: Once user's funds are in L2, the slippage they selected is too small and is not enough to produce a successful swap to their chosen stablecoin.
Solution: A try/catch technique has been implemented on each section where a swap is necessary to amplify the Account's slippage.
Solution backup: In case the "Solution" still doesn't produce a successful swap, an ERC20 token, which will vary depending on the swap that's failing, will be sent back to the user for the amount of ETH beign swapped.
Problem: For X reason, a retryable ticket can't be submitted in L1 so the ETH funds never leave to L2. The original transaction's flow fails and the ETH would be stuck in the user's Account.
Solution: The maxSubmissionCost of the retryable ticket is diminished using the try/catch technique, and the briding is re-tried. If it fails again, WETH is sent back to the user.
Solution backup: As as last resort, the user is always able to manually withdraw their ETH from the Account using withdrawETH_lastResort() from ozPayMe , in case of catastrophic failure.
Last updated