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

Feature/gelato integration #1481

Closed
wants to merge 1 commit into from
Closed

Feature/gelato integration #1481

wants to merge 1 commit into from

Conversation

kassandraoftroy
Copy link

@kassandraoftroy kassandraoftroy commented Dec 24, 2020

Hello Omen!

This pr is the last piece of Gelato's integration with Omen, allowing for Omen users to schedule an auto-withdraw of liquidity provided to a prediction market. Gelato handles transaction execution at the user specified auto-withdraw date, and the executor recoups the transaction fees by taking a portion of the liquidity withdrawn (the rate is calculated on chain using oracles for token and gas prices). As such we impose a minimum threshold on liquidity deposited before Gelato can be activated, since it doesn't make sense to use Gelato if the entire deposit amount being withdrawn automatically won't even cover the transaction fee (and we can only guess what the transaction fee will be at the future date of execution)

Also note that this PR works with an omen-subgraph that includes Gelato data. We have made a PR that is ready to be merged for that here

Finally, there is a helpful constant for Omen devs GELATO_ACTIVATED that easily hides the Gelato features completely from the UI, which should be useful for e.g. xDai sidechain development (as Gelato services can only be used on main chain transactions)

Happy holidays!

@hilmarx
Copy link

hilmarx commented Dec 24, 2020

This PR implements #1028 @pimato

@hilmarx
Copy link

hilmarx commented Dec 24, 2020

Sneak Peak!

2020-12-24 15 30 23

Copy link
Contributor

@kadenzipfel kadenzipfel left a comment

Choose a reason for hiding this comment

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

Overall looks really good!

app/src/components/common/icons/IconCheckmark.tsx Outdated Show resolved Hide resolved
app/src/components/common/icons/IconCheckmarkFilled.tsx Outdated Show resolved Hide resolved
app/src/services/cpk.ts Show resolved Hide resolved
app/src/services/gelato.ts Outdated Show resolved Hide resolved
app/src/services/gelato.ts Outdated Show resolved Hide resolved
@Mi-Lan Mi-Lan linked an issue Dec 29, 2020 that may be closed by this pull request
Copy link
Contributor

@Mi-Lan Mi-Lan left a comment

Choose a reason for hiding this comment

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

Very cool feature! Definitely needed, overall works great! Just found couple of small things that will be easy fix:

  • As you can see in this screenshot seems that fields are not vertically aligned Screenshot 2020-12-29 at 11 48 34
  • Is it accounted for if market has duration that is shorter than 3 days?
  • Also i don't know if it's scope of this issue but seems that "Your liquidity" in pool section stops working
  • Some parts of this text should be bolded like in desings
    Screenshot 2020-12-29 at 12 02 25
  • This market is in test http://localhost:3000/#/0x915883aa30752c374527655192c2d9161d54e268 i created it with 12 dai via gelato and deposited 100 dai via gelato (this is just for future reference so i can test it)

@kassandraoftroy
Copy link
Author

kassandraoftroy commented Dec 30, 2020

  • As you can see in this screenshot seems that fields are not vertically aligned

Fixed. Also FYI your screenshot has an icon that's a bit fishy (next to the word 'time' that icon should be hidden and is for me) maybe you are behind a few commits somehow?

  • Is it accounted for if market has duration that is shorter than 3 days?

We added that, thanks!

  • Also i don't know if it's scope of this issue but seems that "Your liquidity" in pool section stops working

Hmm... not sure either might also be related to the first point. Is it that the amount of liquidity displayed in "Your Liquidity" wont update or is it that a button won't activate on click?

  • Some parts of this text should be bolded like in desings

Done thanks.

Let me know if anything else is needed or if there are any issues with the changes. Thanks!

@Mi-Lan
Copy link
Contributor

Mi-Lan commented Jan 4, 2021

  • As you can see in this screenshot seems that fields are not vertically aligned

Fixed. Also FYI your screenshot has an icon that's a bit fishy (next to the word 'time' that icon should be hidden and is for me) maybe you are behind a few commits somehow?

  • Is it accounted for if market has duration that is shorter than 3 days?

We added that, thanks!

  • Also i don't know if it's scope of this issue but seems that "Your liquidity" in pool section stops working

Hmm... not sure either might also be related to the first point. Is it that the amount of liquidity displayed in "Your Liquidity" wont update or is it that a button won't activate on click?

  • Some parts of this text should be bolded like in desings

Done thanks.

Let me know if anything else is needed or if there are any issues with the changes. Thanks!

Copy link
Contributor

@Mi-Lan Mi-Lan left a comment

Choose a reason for hiding this comment

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

Also seems that this failed part is not 100% according to design..
-here is the desgn
Screenshot 2021-01-04 at 14 48 27
-here it is in production
Screenshot 2021-01-04 at 14 48 34

Copy link
Contributor

@Mi-Lan Mi-Lan left a comment

Choose a reason for hiding this comment

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

I found two things regarding gelato withdrawing and when market is resolved and auto-withdraw feature activates

  • When i deposit liquidity with auto-withdraw and then withdraw before the period ends
    nothing changes in the ui below is ui after i withdraw
    Screenshot 2021-01-08 at 18 14 10
    after i refresh the page correct data is shown
    Screenshot 2021-01-08 at 18 14 33
  • When i stay in market view when liquidity is to be auto-withdrawn timer goes into negative and doesn't show correct data only on refresh does it change
    Screenshot 2021-01-08 at 12 51 17

@kassandraoftroy kassandraoftroy mentioned this pull request Jan 8, 2021
@kassandraoftroy
Copy link
Author

I found two things regarding gelato withdrawing and when market is resolved and auto-withdraw feature activates

  • When i deposit liquidity with auto-withdraw and then withdraw before the period ends
    nothing changes in the ui below is ui after i withdraw
    Screenshot 2021-01-08 at 18 14 10
    after i refresh the page correct data is shown
    Screenshot 2021-01-08 at 18 14 33

Hi we've pushed changes recently that should be fixing this (just tested and verified that after a cancel, it updated itself without refresh, it worked). It's possible that we were criss crossed a bit and you were still a commit or two behind, when you got that. The 'need to refresh' error should have been fixed by this commit. There is a chance that A) you were a commit or two behind (no worries since we pushed very recently) or B) subgraph was just being very slow to update?

@Mi-Lan
Copy link
Contributor

Mi-Lan commented Jan 8, 2021

I found two things regarding gelato withdrawing and when market is resolved and auto-withdraw feature activates

  • When i deposit liquidity with auto-withdraw and then withdraw before the period ends
    nothing changes in the ui below is ui after i withdraw
    Screenshot 2021-01-08 at 18 14 10
    after i refresh the page correct data is shown
    Screenshot 2021-01-08 at 18 14 33

Hi we've pushed changes recently that should be fixing this (just tested and verified that after a cancel, it updated itself without refresh, it worked). It's possible that we were criss crossed a bit and you were still a commit or two behind, when you got that. The 'need to refresh' error should have been fixed by this commit. There is a chance that A) you were a commit or two behind (no worries since we pushed very recently) or B) subgraph was just being very slow to update?

Yeah it is that i was testing it this afternoon!

@Mi-Lan
Copy link
Contributor

Mi-Lan commented Jan 8, 2021

I found two things regarding gelato withdrawing and when market is resolved and auto-withdraw feature activates

  • When i deposit liquidity with auto-withdraw and then withdraw before the period ends
    nothing changes in the ui below is ui after i withdraw
    Screenshot 2021-01-08 at 18 14 10
    after i refresh the page correct data is shown
    Screenshot 2021-01-08 at 18 14 33

Hi we've pushed changes recently that should be fixing this (just tested and verified that after a cancel, it updated itself without refresh, it worked). It's possible that we were criss crossed a bit and you were still a commit or two behind, when you got that. The 'need to refresh' error should have been fixed by this commit. There is a chance that A) you were a commit or two behind (no worries since we pushed very recently) or B) subgraph was just being very slow to update?

Yeah it is that i was testing it this afternoon!

I found two things regarding gelato withdrawing and when market is resolved and auto-withdraw feature activates

  • When i deposit liquidity with auto-withdraw and then withdraw before the period ends
    nothing changes in the ui below is ui after i withdraw
    Screenshot 2021-01-08 at 18 14 10
    after i refresh the page correct data is shown
    Screenshot 2021-01-08 at 18 14 33

Hi we've pushed changes recently that should be fixing this (just tested and verified that after a cancel, it updated itself without refresh, it worked). It's possible that we were criss crossed a bit and you were still a commit or two behind, when you got that. The 'need to refresh' error should have been fixed by this commit. There is a chance that A) you were a commit or two behind (no worries since we pushed very recently) or B) subgraph was just being very slow to update?

Yeah it is that i was testing it this afternoon!
I seem to be getting this error when it comes to time to autho-withdraw....
Screenshot 2021-01-08 at 19 22 34

@hilmarx
Copy link

hilmarx commented Jan 8, 2021

Yeah it is that i was testing it this afternoon!
I seem to be getting this error when it comes to time to autho-withdraw....

That seems to be general issue with Apollo, I have encountered that one before on other dApps, dont think it has smth to do with Gelato.

apollographql/react-apollo#2813
or
apollographql/react-apollo#763

@Mi-Lan
Copy link
Contributor

Mi-Lan commented Jan 8, 2021

Yeah it is that i was testing it this afternoon!
I seem to be getting this error when it comes to time to autho-withdraw....

That seems to be general issue with Apollo, I have encountered that one before on other dApps, dont think it has smth to do with Gelato.

apollographql/react-apollo#2813
or
apollographql/react-apollo#763

Yeah it seems to be the case!

@kassandraoftroy
Copy link
Author

This repository is now up to date after rebase and commit to fix small new issues now that scalar markets have been integrated.

Note that currently, Gelato auto-withdrawls will only be available for categorical markets. In my opinion, integrating Gelato for scalar markets is outside the scope of this pr and can be handled separately but let me know what y'all think.

Lastly, we're doing the last minor styling corrections in this pr so these changes are easier to find and discuss.

@kassandraoftroy
Copy link
Author

kassandraoftroy commented Jan 18, 2021

Pushed another rebase, and updated some ethereum addresses and config urls for production. Just a note that if you want to test gelato on Mainnet, we have reinstated the graphql urls to point to the protofire subgraph, but it seems only rinkeby subgraph has been deployed and synced to include gelato. Either sync the new mainnet subgraph (that includes gelato) before testing, or just reset these two variables in the constants.ts to test right away:

export const GRAPH_MAINNET_HTTP = 'https://api.thegraph.com/subgraphs/name/hilmarx/gelato-omen-mainnet'
export const GRAPH_MAINNET_WS = 'wss://api.thegraph.com/subgraphs/name/hilmarx/gelato-omen-mainnet'

@kassandraoftroy
Copy link
Author

closing in favor of #1691

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.

Add Gelato Service to Fund Market/Deposit Liquidity Process
4 participants