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

OETH Dapp, curve swap support for stETH, WETH, rETH, and frxETH #1538

Merged
merged 7 commits into from
May 26, 2023

Conversation

smitch88
Copy link
Contributor

@smitch88 smitch88 commented May 23, 2023

Code changes to support #1429

Add support for curve swaps for mint/redeem of OETH

  • stETH, WETH, rETH, frxETH

This implementation is more of a hardcoded route approach with the structure of the routes defined in curveRoutes as a constant. This could be fetched dynamically but I believe it would be easier to do this if we integrate @curvefi/api rather than deriving this ourselves from contract calls.

  • Updates dapp-oeth/abis/CurveRegistryExchange.json to include get_exchange_multiple_amount for estimate support and exchange_multiple for actual swap support.
  • Updates useCurrencySwapper to integrate the new curve quotes
  • Updates allowances on the initial mount to retrieve token allowances from the curve router contract for each of stETH, WETH, rETH, and frxETH

@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-sbmitchell-cw5wsv May 23, 2023 23:26 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-sbmitchell-xxdu1t May 24, 2023 09:02 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-sbmitchell-m4hwzu May 25, 2023 07:40 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-sbmitchell-gtzwrx May 25, 2023 13:55 Inactive
@smitch88 smitch88 temporarily deployed to preview-oeth-sbmitchell-gtzwrx May 25, 2023 14:16 Inactive
Copy link
Contributor

@HrikB HrikB left a comment

Choose a reason for hiding this comment

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

For me, I am unable to make the swaps happen from OETH -> [Collateral of Choice]

When I click the approve button, I provide an approval to the OETH/ETH pool contract at 0x94B17476A93b3262d87B9a326965D1E91f9c13E7. However, the route requires calling transferFrom from the address 0x99a58482bd75cbab83b27ec03ca68ff489b5788f which is the registry exchange contract. So my transaction fails because that approval has not been provided.
image

@HrikB
Copy link
Contributor

HrikB commented May 26, 2023

Seems like 0x99a58482bd75cbab83b27ec03ca68ff489b5788f is the right one to approve. On a OETH -> stETH trade on curve.fi, that is the address needing to be approved.

@smitch88
Copy link
Contributor Author

Interesting, looking at this now

@smitch88
Copy link
Contributor Author

@HrikB should be good to go now

@smitch88 smitch88 temporarily deployed to preview-oeth-sbmitchell-gtzwrx May 26, 2023 14:23 Inactive
@smitch88 smitch88 requested a review from HrikB May 26, 2023 14:26
@smitch88 smitch88 temporarily deployed to preview-oeth-sbmitchell-gtzwrx May 26, 2023 18:37 Inactive
Copy link
Contributor

@HrikB HrikB left a comment

Choose a reason for hiding this comment

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

Ok I've got the approval working!

The only things that need work right now are as per our discussions on discord:

  • Fixing the loading state
  • Figuring out bug that is causing OETH -> rETH swap to fail

@smitch88 smitch88 temporarily deployed to preview-oeth-sbmitchell-gtzwrx May 26, 2023 19:26 Inactive
@HrikB HrikB self-requested a review May 26, 2023 20:41
@smitch88 smitch88 merged commit 066e740 into oeth-dapp May 26, 2023
@smitch88 smitch88 deleted the sbmitchell/1429 branch May 26, 2023 21:06
HrikB added a commit that referenced this pull request Jun 9, 2023
* Start of VaultTwo

* No vault Two

* Extract units conversion to method

* Exchange rate supporting Vault

* Remove unneeded memory array

* Change to using enums for exchange rate types

* Documentation on _toUnits

* OETH - Allow initialize time control of OUSD resolution (#1273)

* Allow initialize time control of OUSD resolution

* Remove debugging

* Correct mint / redeem with oracle

* add the main deploy file for OETH

* make it possible for the 5/8 multisig to be the governor of deployments

* prettier

* Gas efficiency

* add frax eth deployment

* basic sfraxETH strategy implementation

* add brownie env to git ignore

* prettier

* Remove unused code

* add the infrastructure for fork tests

* hardcode oracle price

* finish up the fraxETH strategy fork tests and fix a bug

* lint and some minor fixes

* deployment file fix

* Slither db update for false positives

* add a test that checks we can withdraw what the checkBalance returns

* minor fix

* Correct license for new contracts

* Deploy is ready

* Add redeem fee variable

* add slither exceptions

* fix tests (#1317)

* OETH - Oracle router changes (#1314)

* start oracle separation

* add slither ignores

* create a suggestion of how to check for prices in the Vault

* remove logs

* better name

* minor refactor

* minor refactor v2

* move unit pricing to a separate function

* refactor

* better comment

* refactor Vault contract and correct price calculation in priceUnit(Mint/Redeem) functions

* add range checks

* Prettier and address cleanup

* Small cleanup

* Add back in missing constant

---------

Co-authored-by: Daniel Von Fange <[email protected]>

* fix oracle tests

* fix tests

* more fixes

* fix slither

* ETH / sfrxeth zapper (#1316)

* Initial draft zapper

* Initial draft zapper

* Add deploy file for zapper

* Remove WETH partial support, out of scope in this PR

* Happy Slither

* WETH support

* move decimals cache to asset struct (#1319)

* WOETH deployment (#1320)

* add WOETH deployment

* deploy separate files

* Let’s just call them decimals

* add decimalsCache to existing Vault

* prettier

* deployment numbering

* fork test fix

* run decimals cache only in forked environment

* prettier

* Remove unused buyback trigger

* rETH support

* support oracles reporting feeds with different decimal format (#1321)

* support oracles reporting feeds with different decimal format

* lint

* gas optimisation

* Add support for stETH

* Use default strat for frxETH

* harvester & unit tests (#1331)

* Start of VaultTwo

* No vault Two

* Extract units conversion to method

* Exchange rate supporting Vault

* Remove unneeded memory array

* Change to using enums for exchange rate types

* Documentation on _toUnits

* OETH - Allow initialize time control of OUSD resolution (#1273)

* Allow initialize time control of OUSD resolution

* Remove debugging

* Correct mint / redeem with oracle

* add the main deploy file for OETH

* make it possible for the 5/8 multisig to be the governor of deployments

* prettier

* Gas efficiency

* add frax eth deployment

* basic sfraxETH strategy implementation

* add brownie env to git ignore

* prettier

* Remove unused code

* add the infrastructure for fork tests

* hardcode oracle price

* finish up the fraxETH strategy fork tests and fix a bug

* lint and some minor fixes

* deployment file fix

* Slither db update for false positives

* add a test that checks we can withdraw what the checkBalance returns

* minor fix

* Correct license for new contracts

* Deploy is ready

* Add redeem fee variable

* add slither exceptions

* fix tests (#1317)

* OETH - Oracle router changes (#1314)

* start oracle separation

* add slither ignores

* create a suggestion of how to check for prices in the Vault

* remove logs

* better name

* minor refactor

* minor refactor v2

* move unit pricing to a separate function

* refactor

* better comment

* refactor Vault contract and correct price calculation in priceUnit(Mint/Redeem) functions

* add range checks

* Prettier and address cleanup

* Small cleanup

* Add back in missing constant

---------

Co-authored-by: Daniel Von Fange <[email protected]>

* fix oracle tests

* fix tests

* more fixes

* fix slither

* ETH / sfrxeth zapper (#1316)

* Initial draft zapper

* Initial draft zapper

* Add deploy file for zapper

* Remove WETH partial support, out of scope in this PR

* Happy Slither

* WETH support

* move decimals cache to asset struct (#1319)

* WOETH deployment (#1320)

* add WOETH deployment

* deploy separate files

* Let’s just call them decimals

* add decimalsCache to existing Vault

* prettier

* deployment numbering

* fork test fix

* run decimals cache only in forked environment

* prettier

* Remove unused buyback trigger

* rETH support

* support oracles reporting feeds with different decimal format (#1321)

* support oracles reporting feeds with different decimal format

* lint

* gas optimisation

* harvester now considers different oracle decimals. Fixing unit tests

---------

Co-authored-by: Daniel Von Fange <[email protected]>

* add some addresses

* fix bug

* Deploy 53 OETH and 54 WOETH (#1334)

* deploy of OETH 053

* add remaining deployment files

* add guardian actions helper

* use updated ABI in brownie

---------

Co-authored-by: Daniel Von Fange <[email protected]>

* Prettier

* Merge cleanup

* Zapper cleanup

* remove console.log

* Zapper: Better event name

* Add slither excludes to triage file

* Remove inline slither comments and add docstrings

* cleaner wording

* Explicity access levels on vars

* Zapper redeploy

* Lint: cleanup extra variable

* Deploy 56 - OUSD Zapper Redeploy (#1364)

* Deploy 56 Zapper

* Remove forceDeploy

* Don't show zapper no return checks

* Direct clone

* Fix package.json

* Fix build for oeth

* Add build scripts

* Fix scripts

* Fix bash script

* Fix build scripts

* Update scripts

* Update scripts

* Try expression again

* Add hashbang

* Use bash instead

* Add ABI

* Fix deps

* Fix start script

* checkpoint

* Update more services

* checkpoint

* checkpoint

* Minting

* Add Zapper

* Cleanup balances

* Fix approval bug

* Fix animation balance

* Update Zapper address

* Update swap estimator

* Update gas for redeem

* Display OETH balance instead of OUSD

* Add wrap/unwrap

* Fix allowances on wrap/unwrap

* UI tweaks

* Fix circle graphics

* sfrxETH Zapper allowance

* Fix sfrxETH balance

* Switch to Analytics API v2

* Fix keys

* Fix lifetime earnings

* Add curve

* Fix broken code

* more precise inputs/outputs

* apy and oeth portfolio dapp reskin

* Cleanup tx history page

* In progress commit

* Fix path refs

* Fix menu

* Fix modal

* Fix rendering issue

* Adjust

* Add estimtes

* Fix estimate view

* Fix balances display

* Fix redeem

* Fix effective price

* Remove welcome

* Fix wrap view

* fix gfnosis safe

* Update the manifest

* Fix eth price with fallback, banner, add fonts

* Fix tx activity

* Fix swap routes pill styling

* Remove relative path

* Add activity

* Add activity count

* Fix font face inclusion

* Fix gas estimate

* wrap and history page

* Fix broken vault est

* Try fonts in images dir just for static files check

* header restyle

* Add swap routes styling

* Fix confirmation modal color

* Fix diff percentage visibility

* Fix arrow aplit

* Fix eth redeem

* Fix redeem

* Fix mix on pill

* responsive nav and data section

* Hide history nav item

* Fix IPFS DApp link

* Fix IPFS link

* Update meta description

* Fix wrap, curve redeem for eth

* Add in wrap/unwrap events

* Support multiple txs taking place

* Fix defaults, ordering, and mobile

* Fix effective price

* Cleanup GTM code. (#1428)

* Cleanup GTM code.

* Fix var.

* Make changes to correct folder.

* Fix various p2/p3 issues across the board. Sticky nav, decimals, images, and other various style fixes

* Fix first tx pending view

* Fix approvals when below max int provided

* Fix curve allowance issue

* Fix currency ordering

* Update contract name

* Hide irrelevant APY measures, change default to one week

* Gtm tracking updates (#1467)

* Start updating events.

* Tracking updates.

* Revert deployment file changes

* Swap Route (#1449)

* header-fix

* header fix

* heading padding fix

* remove double ipfs link on fleek

* swap responsiveness

* routes responsiveness

* merge fix

* btn fix

* swap route header on all browsers

* show links

* mobile responsiveness on wrap route

* Fix rate display wOETH -> OETH (#1473)

* Fix wOETH to oeth rate conversion

* Fix styling of wrap

* Fix sfrxeth -> oeth receive amount estimate (#1471)

* Add conversion rate

* Fix redeem and activity values

* Fix comment

* Fix address HEX and add in wrap events. (#1478)

* Fix address HEX and add in wrap events.

* Small fix for slice

* swap routes section in the swap route (#1489)

* swap routes section in the swap route

* padding

* desktop fixes

* add ledger live connector (#1454)

* add ledger live connector

* update manifest

* edit display name

* add csp header

* Oeth dapp UI style fixes (#1511)

* Many UI fixes

* Address background color discrepancy

* Revert contracts folder changes

* Fix padding on selectable pills, fix default swap mode to mint vs redeem

* Add inputMode to wrapped side

* Remove OETH from redeem

* Fix scrollbar styling

* Add drop shadow to apy, remove console log, remove value from redeem in modal

* Add drop shadow across menus and code cleanup

* fix: remove double IPFS and pull the logic to env variables (#1529)

* fix: remove double IPFS and pull the logic to env variables

* Revert "fix: remove double IPFS and pull the logic to env variables"

This reverts commit 81822e6.

* fix: remove IPFS link if deploy mode is IPFS

* refactor: clean up

* oeth dapp merge fix (#1530)

* Fix merge issue

* Remove yarn changes

* Fix url reference for learn more

* Fix icons and transition speed

* Revert dapp changes

* OETH Dapp, curve swap support for stETH, WETH, rETH, and frxETH (#1538)

* Add in curve routes

* Remove console log

* Set node engine to 16

* Run prettier on the fileset

* Add different approvals for oeth to LSD and oeth to eth pool

* Fix approval route

* Fix reth

* fix dapp crash from undefined (#1571)

* Undefined dapp crash (#1573)

* fix dapp crash from undefined

* fix get

* History route (#1567)

* bugs

* history route bug fixes and styling

* disconnected state

* history route style fixes

* disable export button

* Restore history nav link

* Add OETH DApp Linter to CI (#1616)

---------

Co-authored-by: Daniel Von Fange <[email protected]>
Co-authored-by: Domen Grabec <[email protected]>
Co-authored-by: Shahul Hameed <[email protected]>
Co-authored-by: Hrik Bhowal <[email protected]>
Co-authored-by: Micah Alcorn <[email protected]>
Co-authored-by: Jonathan Snow <[email protected]>
Co-authored-by: roland <[email protected]>
Co-authored-by: Rafael Ugolini <[email protected]>
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.

3 participants