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

Add multi-callee support to the frontend #498

Merged
merged 19 commits into from
Nov 7, 2022
Merged

Conversation

aomafarag
Copy link
Contributor

@aomafarag aomafarag commented Oct 13, 2022

Closes #496.

Screenshot from 2022-10-13 16-29-53

Checklist:

  • issue number linked above after pound (#)
    • replace "Closes " with "Contributes to" or other if this PR does not close the issue
  • issue checkboxes are all addressed
  • manually checked my feature / not applicable
  • wrote tests / not applicable
  • attached screenshots / not applicable

Copy link
Contributor

@LukSteib LukSteib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Storybook lgtm ✔️
  • Checks are failing

LukSteib
LukSteib previously approved these changes Oct 17, 2022
Copy link
Contributor

@LukSteib LukSteib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component approved

@valiafetisov
Copy link
Contributor

valiafetisov commented Oct 17, 2022

Looking at the screenshot:

  • Please make sure that prices shown in the table are ordered from the best (on top) to the worst (on the bottom) to the Unknown (on the very bottom) on the frontend
  • (It might be just storybook, and might not need to be fixed) Unknown callee can never be selected (as it seems to be now, since Market Difference is Unknown, and both other prices have Select in front of them)
  • (It might be just storybook, and might not need to be fixed) In case Market Difference is Unknown, profits and and Estimated Profitability Time will be unknown too

Why issue checkboxes are all addressed is not checked? Is there something outstanding?

@aomafarag
Copy link
Contributor Author

  • Please make sure that prices shown in the table are ordered from the best (on top) to the worst (on the bottom) to the Unknown (on the very bottom) on the frontend

Done.

  • (It might be just storybook, and might not need to be fixed) Unknown callee can never be selected (as it seems to be now, since Market Difference is Unknown, and both other prices have Select in front of them)
  • (It might be just storybook, and might not need to be fixed) In case Market Difference is Unknown, profits and and Estimated Profitability Time will be unknown too

I think it's related to storybook and the pending refactoring of the core, because these values are assigned directly and randomly through helper functions.

Why issue checkboxes are all addressed is not checked? Is there something outstanding?

Nope. Just checked them all.

core/src/types.ts Outdated Show resolved Hide resolved
<span v-else class="opacity-50">Unknown</span>
</div>
</div>
<MarketPriceSelection :auction-transaction="auctionTransaction" :market-id.sync="marketId" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you raised in the issue and I answered: the values underneath this row is dependent on the selected marketId. They all now taken from the marketData[marketId] object: so that switching marketId displays new values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. But the calculation of the market difference, profitability, etc. happens in the core. So, shouldn't that be implemented there by using the marketId that is sent to the store?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, nvm. For some reason, I've just noticed the comment you made last week 😅.

Copy link
Contributor

@LukSteib LukSteib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe storybook related but to re-iterate on point @valiafetisov mentioned in prev comment

  • when expanding component for the first time both selectable callees have "Select" and the uni v3 which is actually selected is not marked accordingly ("Selected")
  • Why is the uni v3 callee the default selection (see screenshot below) if the 1inch callee has a better marketUnitPrice?

image

@aomafarag
Copy link
Contributor Author

aomafarag commented Oct 21, 2022

  • when expanding component for the first time both selectable callees have "Select" and the uni v3 which is actually selected is not marked accordingly ("Selected")

It's not marked because as long as the user hasn't selected any specific callee the suggestedMarketId is displayed, which can also change, as long as the user hasn't made a selection. Once the user makes a selection, it'll be fixed throughout.

For reference:

  • Expect that suggestedMarketId might change after the component render –> meaning that
    • in case no selection was made by the user, selected market might change by itself
    • in case a selection was made by the user, it should stay fixed even if suggestedMarketId changes

— from issue description

  • Why is the uni v3 callee the default selection (see screenshot below) if the 1inch callee has a better marketUnitPrice?

I picked an arbitrary value for storybook, but I can implement a function that picks the best unit price there as well.

@LukSteib
Copy link
Contributor

Thanks for clarification! Makes sense and no need to write a dedicated function for storybook.

LukSteib
LukSteib previously approved these changes Oct 21, 2022
@aomafarag
Copy link
Contributor Author

aomafarag commented Nov 4, 2022

Currently, I get this error in the browser console whenever I select a callee, which is self-explanatory and reflects the issue we are having:

[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "marketId"

found in

---> <CollateralAuctionSwapTransactionTable> at components/auction/collateral/CollateralAuctionSwapTransactionTable.vue
       <SwapTransaction> at components/auction/collateral/CollateralAuctionSwapTransaction.vue
         <SplitLayout> at components/layout/SplitLayout.vue
           <CollateralAuctionFlow> at components/auction/collateral/CollateralAuctionFlow.vue
             <AuctionsContainer> at containers/AuctionsContainer.vue
               <Pages/collateral.vue> at pages/collateral.vue
                 <Nuxt>
                   <Layouts/default.vue> at layouts/default.vue
                     <Root> [vue.runtime.esm.js:619](webpack:///node_modules/vue/dist/vue.runtime.esm.js?2b0e)

@valiafetisov, I can't seem to figure out how to avoid mutating the prop directly and syncing it at the same time.


@LukSteib, regarding the problem you mentioned with the route. The collateral configuration of wstETH on Curve V3 has an empty route array, i.e. it gets swapped directly into DAI without passing by ETH.

@LukSteib
Copy link
Contributor

LukSteib commented Nov 4, 2022

@LukSteib, regarding the problem you mentioned with the route. The collateral configuration of wstETH on Curve V3 has an empty route array, i.e. it gets swapped directly into DAI without passing by ETH.

I think the problem is not related to WSTETH since same problem occurs for a normal ETH auction. However, this is details that we might fix in a follow up issue.

Currently, I get this error in the browser console whenever I select a callee, which is self-explanatory and reflects the issue we are having:

Get the same error which prevents switching the callee via the UI. This problem however is blocking and I won't approve this PR as I don't want to merge and release a broken component.

@aomafarag
Copy link
Contributor Author

Currently, I get this error in the browser console whenever I select a callee, which is self-explanatory and reflects the issue we are having:

[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "marketId"

found in

---> <CollateralAuctionSwapTransactionTable> at components/auction/collateral/CollateralAuctionSwapTransactionTable.vue
       <SwapTransaction> at components/auction/collateral/CollateralAuctionSwapTransaction.vue
         <SplitLayout> at components/layout/SplitLayout.vue
           <CollateralAuctionFlow> at components/auction/collateral/CollateralAuctionFlow.vue
             <AuctionsContainer> at containers/AuctionsContainer.vue
               <Pages/collateral.vue> at pages/collateral.vue
                 <Nuxt>
                   <Layouts/default.vue> at layouts/default.vue
                     <Root> [vue.runtime.esm.js:619](webpack:///node_modules/vue/dist/vue.runtime.esm.js?2b0e)

@valiafetisov, I can't seem to figure out how to avoid mutating the prop directly and syncing it at the same time.

Figured it out!

Copy link
Contributor

@LukSteib LukSteib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • (note that it should not block if we cannot figure out easily): On initial load of the transaction page none of the callees is indicated as "Selected". Only after first selecting one of them the indicator holds (see s1 below)
  • One more thing that makes me wonder: In the example below (ETH-A simulation). We preselect univ2 but a higher price is more favorable in this case. Similar: comparing gross and net profit we indicate that uniswapv3 would yield overall better outcome for the user. Just trying to understand how this is possible. (see comparison in s2 below)

s1
image

s2
image

@aomafarag aomafarag self-assigned this Nov 7, 2022
@aomafarag
Copy link
Contributor Author

  • (note that it should not block if we cannot figure out easily): On initial load of the transaction page none of the callees is indicated as "Selected". Only after first selecting one of them the indicator holds (see s1 below)

This was answered above

@valiafetisov
Copy link
Contributor

This was answered above

Issue description doesn't imply that no price should be set as selected in the UI. I think we still need to indicate which one is currently "best" or "selected"

aomafarag and others added 2 commits November 7, 2022 13:12
@valiafetisov valiafetisov merged commit cbf5727 into main Nov 7, 2022
@valiafetisov valiafetisov deleted the market-price-selection branch November 7, 2022 14:49
@valiafetisov valiafetisov changed the title Add MarketPriceSelection component and stories Add multi-callee support to the frontend Nov 7, 2022
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

Successfully merging this pull request may close these issues.

Create MarketPriceSelection component
3 participants