Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch Strategy Creation #1560

Open
Costa769 opened this issue Oct 30, 2024 · 0 comments
Open

Batch Strategy Creation #1560

Costa769 opened this issue Oct 30, 2024 · 0 comments
Assignees
Milestone

Comments

@Costa769
Copy link
Collaborator

Costa769 commented Oct 30, 2024

Summary

We aim to simplify the process of creating multiple trading strategies. Users can batch strategies and create them all at once, eliminating the need for separate transactions for each individual strategy creation flow. This streamlined approach reduces the complexity of the multisig process by requiring approvals from multiple wallets only once, enabling the efficient execution of multiple actions in a single transaction.

Overview

The process of creating multiple strategies is designed to feel like an online shopping experience. Users can create strategies using the current flow and add them to a "cart" for later approval, along with other saved strategies. Pending strategies are stored in local storage, ensuring they remain accessible only to the wallet that added them.
In the first phase, users will be able to create strategies in batches, simplifying the approval process.

Pre-requisite

List of items that are required for this flow to work:

  • Smart contract
    -- New routing contract that knows to receive instructions to perform multiple “create strategy” transactions
    -- Receive execution details from caller
    -- According to the details, fetch the relevant budgets needed for the strategies (requires approval ahead of time)
    -- Approve carbonController to extract these tokens from the routing contract
    -- Execute the transaction details as instructed by the caller
    -- Receive NFT from carbonController
    -- Transfer NFT to caller (all relevant NFT received in the transaction from carbonController will be sent back to caller at the end of the transaction. No special instructions are needed
  • App
    -- Know how to include transfer NFT instructions as part of the transaction details

Designs

Mockups

Implementation

Given that we would like this option to be part of the existing create strategy flow, we would only expose it on the create strategy page.
At the end of the create strategy flow, a user would have the new option called “add to cart”. When clicking it, the strategy details as user indicated would be stored in the local storage and be available under the “cart” page to be signed at a later stage.

  • All strategy types can be added to the cart, except for spot trades.
    -- If spot trade option is selected, no “Add to Cart” CTA will be displayed
  • The "Add to Cart" button will initially be disabled upon page load and will become active once all required strategy fields are completed without error messages.
  • Users can still add a strategy to the cart even if there are warning messages displayed on the trade page.
    -- Unlike the "Create Strategy" button, the "Add to Cart" button will be enabled even if the approval checkbox is not checked.
  • On "Add to Cart" CTA click:
    -- Disable the "Add to Cart" button with a 2-second pending effect, similar to the effect when the user clicks the "Create Strategy" button.
    -- Show an indication that the strategy has been added to the cart. Animation examples:
    --- https://codepen.io/filipdanisko/pen/VadXXq (There's no need to capture a screenshot of the strategy data; Just the example of the animation for adding the strategy to the chart.)
    --- https://codepen.io/maysi/pen/mOebgz
    -- Keep the current pair , strategy selection and prices unchanged, but reset the input fields.
    -- The card icon will refresh to display the count of pending strategies on the cart page.
    --- The cart counter will represent the total number of pending strategies, rather than just those recently added.
    --- If there are no pending strategies in the cart, we will show the cart icon without the number indication

Cart Page

To approve the strategies added to the cart, the user will need to access the cart page by clicking on the cart icon.
Cart Page URL: /cart

  • The cart page can be accessed through the cart icon, even if there are no pending strategies.
    -- Empty cart screen mockup
    -- On “Create Strategy” CTA click open a Trade page with default settings
  • On the cart page, users will see strategy overview cards for all strategies added to the cart that haven't been approved yet. These strategy overview cards will be similar in appearance to the created strategy cards, but without a strategy ID.
  • At this stage, users must approve all the strategies in the cart at once; there is no option to approve only a subset.
  • Clicking the pencil icon on the strategy card allows the user to edit the strategy.
    -- Upon clicking, a trading page will open, displaying the strategy parameters available for editing.
  • Users can delete the strategy by clicking on the trash icon on the strategy overview cart
    -- On “Delete” icon click confirmation popup will be displayed. The confirmation popup is identical to the one shown when a user selects the delete option from the strategy menu, offering the user the option to edit their strategy instead of deleting it.

Warning messages and errors

  • If there are any warning or error messages, they will be displayed on the relevant strategy overview cards either when the cart page loads or when token prices or wallet balances are updated.
  • If any strategy displays an error message, the "Sign All Strategies" button will be disabled.
    -- If there isn't a strategy-specific error, but a general error occurs (e.g., insufficient funds in the user's wallet to deposit into all strategies), the error message will appear above the "Sign All Strategies" CTA. mockup
    -- In both strategy specific and general error the CTA text will be changed to "Fix Error(s) to Proceed"
  • The "Confirm Warning" checkbox on the cart page follows the same logic as on the trade page. If an error message is present, no warning checkbox will appear. If there are no errors but one or more strategies show a warning, a "Confirm Warning" checkbox will be displayed. The "Create" button will remain disabled until the checkbox is checked.

Examples:

  • Strategy card with warning message mockup
  • Strategy card with error message mockup
  • General error message, not specific to any strategy (e.g., insufficient funds to create multiple strategies) mockup.

Design Notes

  1. The following buttons in the design should have brand colors
  • "Create Strategy" CTA on both trade page and empty Cart page
  • "Sign All Strategies" CTA on the Cart page
  1. As we only support delete and edit actions, all strategy cards should display trash and pencil icons, without a gear icon.
    mockup

Open questions

Review the process for handling multisig strategy creation: once a user has approved the creation of the strategies, determine how the "pending" state is managed until all participants provide their approvals.

  • What occurs if other participants do not approve the strategy creation?
  • Is there a time limit for other multisig participants to approve the strategies?
@Costa769 Costa769 added this to the RC1 milestone Oct 30, 2024
@Costa769 Costa769 self-assigned this Oct 30, 2024
@Costa769 Costa769 changed the title Batch Strategy Approval Batch Strategy Creation Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant