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

feat(swap-deadline): higher swap deadline #5002

Merged
merged 9 commits into from
Oct 23, 2024

Conversation

alfetopito
Copy link
Collaborator

@alfetopito alfetopito commented Oct 17, 2024

Update 2024-10-22

  • Split max deadline for EOA and SC wallets:
    • EOA is back at 3h
    • SC set to 12h

Testing

  1. With EOA, edit SWAP deadline
  • Should not allow more than 180 min
  1. With SC wallets, edit SWAP deadline
  • Should allow up to 720 min

Summary

Part of #4321
#208

Increase SWAP deadline

  • Currently set to 12h (up from 30min)
  • Currently for all wallets, not sure whether should limit it to only SC wallets
  • Moving all quote requests to using the relative validFor instead of the absolute validTo

And since all times will now be relative, we might get rid of this warning:
This still works, will keep it
image

To Test

  1. On SWAP, pick an expiration > 30 and < 12h (720 min)
  • Should place order as usual
  1. Alter your system clock and perform the tests from fix(trade): take time offset into account for quote and order validTo #4236
  • Should work as described

@alfetopito alfetopito self-assigned this Oct 17, 2024
Copy link

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview Oct 23, 2024 10:03am
cowfi ✅ Ready (Inspect) Visit Preview Oct 23, 2024 10:03am
explorer-dev ✅ Ready (Inspect) Visit Preview Oct 23, 2024 10:03am
swap-dev ✅ Ready (Inspect) Visit Preview Oct 23, 2024 10:03am
widget-configurator ✅ Ready (Inspect) Visit Preview Oct 23, 2024 10:03am

if (order.class === 'limit') {
legacyFeeQuoteParams.validFor = Math.round(PRICE_QUOTE_VALID_TO_TIME / 1000)
} else {
legacyFeeQuoteParams.validTo = timestamp(order.validTo)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

validTo has been removed completely for quote requests. Always use validFor for everything now.
Quote responses still have it, as we use that as source of truth for current time.

@@ -48,7 +48,7 @@ import useNativeCurrency from 'lib/hooks/useNativeCurrency'

import * as styledEl from './styled'

const MAX_DEADLINE_MINUTES = 180 // 3h
const MAX_DEADLINE_MINUTES = 60 * 12 // 12h
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Max SWAP order deadline!!

@elena-zh
Copy link

Hey @alfetopito , works great!
However, the main issue I've noticed that all market orders have 'partially fillable' type now that is resulting in 99.99% order filling, including eth-flow orders
it is filled
tx completed
image
image

One more limitation that may cause difficulties with signing orders: when connected using WC, I got this error message in 5 minutes. So even if we set a quote validity longer than 5-10 minutes, users still face some limitations from other places.
5 minutes expired request


As for #4236 , it works as expected: orders can be placed, however, on the UI they won't be displayed correctly. Actually, that is why we show the warning at the top:

  • limit order that is placed rn, but shows creation date 4 hours ago
    ago
  • placed swap order with duration < than a time difference:
    expired on placement
  • open order is labeled ad expired:
    filled

@alfetopito
Copy link
Collaborator Author

Hey @alfetopito , works great! However, the main issue I've noticed that all market orders have 'partially fillable' type now that is resulting in 99.99% order filling, including eth-flow orders it is filled tx completed image image

As mentioned on slack, unrelated issue, fixed on #5016

One more limitation that may cause difficulties with signing orders: when connected using WC, I got this error message in 5 minutes. So even if we set a quote validity longer than 5-10 minutes, users still face some limitations from other places. 5 minutes expired request

That's unrelated to this change. Quote validity changes were purely backend. This (WC disconnection) is a different issue, which we do have a GH issue for already.

As for #4236 , it works as expected: orders can be placed, however, on the UI they won't be displayed correctly. Actually, that is why we show the warning at the top:

Then, both parts are working as expected \o/

* limit order that is placed rn, but shows creation date 4 hours ago
  ![ago](https://private-user-images.githubusercontent.com/70885163/378386430-0c6ee4a8-2d56-4219-a47b-35a7a66fc297.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk1OTQ4OTEsIm5iZiI6MTcyOTU5NDU5MSwicGF0aCI6Ii83MDg4NTE2My8zNzgzODY0MzAtMGM2ZWU0YTgtMmQ1Ni00MjE5LWE0N2ItMzVhN2E2NmZjMjk3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEwMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMDIyVDEwNTYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdlMTMzYjdkYzMxNDVmNjA2NjI0ZWVhMWUyYTE0MGI2OWRjZmY0MjVjODg0YmJiZmIzMmU1MzVkYzNmNzMzMTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.U17MDKTCNFZQjpl0kW0yuF_Ya5Z4uerf-m5R3MaK7l8)

* placed swap order with duration < than a time difference:
  ![expired on placement](https://private-user-images.githubusercontent.com/70885163/378386609-538903aa-fc71-4a83-b87c-729d9da86099.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk1OTQ4OTEsIm5iZiI6MTcyOTU5NDU5MSwicGF0aCI6Ii83MDg4NTE2My8zNzgzODY2MDktNTM4OTAzYWEtZmM3MS00YTgzLWI4N2MtNzI5ZDlkYTg2MDk5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEwMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMDIyVDEwNTYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFiYjQ3OGFlYTMzMmIzNzJlYTM4MWMzZGZiODg2OWJlOTVlMzg2YWQyZmEwYTM4MTg0NzJhYTk1M2ExOTZlMWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-PCAXR4JCjgildvDrF0E_ooITAtNIo4-opf1jYlm2q4)

* open order is labeled ad expired:
  ![filled](https://private-user-images.githubusercontent.com/70885163/378386724-fed67711-4e11-4537-93ba-c1531e0c6c24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk1OTQ4OTEsIm5iZiI6MTcyOTU5NDU5MSwicGF0aCI6Ii83MDg4NTE2My8zNzgzODY3MjQtZmVkNjc3MTEtNGUxMS00NTM3LTkzYmEtYzE1MzFlMGM2YzI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEwMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMDIyVDEwNTYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYxNjYxNjFjYzFiMDgyZjE5NTk4MGVhNThlYzUyNTE0MGM2ZDg5Zjc2MTZjNWU2ZjU2NTNlNzY2Mjc2M2M4NDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.DVxQZYmXCN6LH2ef3Ie7XO6qGCQtWi8KHXqqrespF3Y)

@alfetopito
Copy link
Collaborator Author

I'll make sure the extended time only works for SC wallets and let you know

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Great, @alfetopito , than k you!

Btw, should we mentioned somewhere in the docs about this change?

@alfetopito
Copy link
Collaborator Author

Great, @alfetopito , than k you!

Btw, should we mentioned somewhere in the docs about this change?

I don't know. Do we have anything about that in the docs already?

Doesn't seem like it https://docs.cow.fi/search?q=deadline

In that case, I wouldn't mention it.
It would make more sense IMO to show that in the UI via tooltips/error messages, but it's out of the scope of the current change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants