yearn / yearn-sdk

🦧 SDK for the yearn.finance platform. WIP
https://npm.im/@yfi/sdk
MIT License
53 stars 56 forks source link

Enable zaps on Fantom vaults #297

Open mazurroman opened 2 years ago

mazurroman commented 2 years ago

Description

Whenever a deposit/withdraw happens and the vault underlying !== token, it will make an API call to https://api.joinwido.com/swaproute, get the swap route, and call the executeOrder function on 0x7Bbd6348db83C2fb3633Eebb70367E1AEc258764.

Related Issue

https://github.com/yearn/yearn-finance-v3/pull/710

Motivation and Context

Remove friction for deposits into Yearn vaults. This is Step 1 of the Yearn <> Wido Router integration proposal to enable frictionless deposits into all Yearn vaults, regardless of the chain the user is depositing from.

This is just a draft PR to kick off the discussion.

Zaps have been pretty successful on Ethereum, contributing to almost 50% of all deposits (see chart below).

image

Note on the chart: It's filtered down to curve vaults with at least one zapIn function call each month to skip vaults with no support for zaps. Source.

How Has This Been Tested?

It was tested locally with the frontend running the yalc'ed SDK.

Left ToDo

Example txs:

https://ftmscan.com/tx/0x4bcd9791a24307bc7760f543ce2d3f15201d578aff5460976d759288f80b834a https://ftmscan.com/tx/0xc8d1c86e90dda1a1487672cda5dba0005646ba0ad6b4057408526586aae963c6

Screenshots:

The following 4 screenshots show how zapIn into a Fantom vault looks