feat: Add cross-chain payments when user has no funds on OP #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds cross-chain payments to Jellybeans using ETH on Base (only when they don't have funds on OP).
Problem
Since the Jellybeans contract is deployed on OP, it requires users to have funds on OP to submit a guess. However, if a user does not have ETH readily available on OP, they will have to bridge funds first.
Solution
We can use cross-chain calls here to let users pay with ETH on other chains (ex. Base) even if the guess is submitted on OP. In this case, we use Glide to do so.
UX Behavior
When a user tries to submit a guess, we check if they have enough ETH on OP to complete the transaction. If so, we continue with the transaction normally.
Otherwise, we use Glide to submit a cross-chain call and let users pay with ETH on Base.
Future improvements
[ ] We can add support for more chains. See a list of supported chains here.
[ ] We can let users pay with other tokens as well such as USDC, Degen, Moxie, etc. This will require UX changes with a token picker.