Inspiration

Since publishing educational guides about popular DeFi tools (DeFiTutorials.com) and observing early-users’ simulations on DeFi Strategies, we were inspired to create an easy way for anyone (no matter how much they know about using each DeFi tool) to get instant access to multiple DeFi protocols.

Right now, DeFi is just a buzzword to most people. We even noticed someone taking advantage of the DeFi community's current traction. They set up "DeFi" tokens to make gains through the unawareness of other people who believe 'DeFi' is an asset they can invest in through these tokens. People see ETH locked in DeFi going up and think, “How can I get exposure to that growth?!” We are putting education at the core of our approach to make sure this doesn't happen to anyone.

What it does

Zap is a smart contract that auto-spreads incoming deposits across Compound, Fulcrum, TokenSets and others, in a single transaction and based on pre-set allocations - bypassing many manual steps. You can send ETH to a Zap contract of your choosing and receive allocated tokens. For example, Lender Zap allocates incoming deposits 90% to cDai and 10% to dLETH2x. Therefore, if you send 1 ETH to this Zap, you will receive 0.9 ETH's worth of cDai and place a 2X margin trade with 0.1 ETH on Fulcrum (giving you exposure to 0.2 ETH). Lender's Zap is interesting because, within a year, the interest generated from cDai could completely cover your margin trade purchase.Think of it as trading with your future interest earned.

We have also created a 'Zap Generator' to help end-users filter available Zaps based on their investment goals and risk profile. Users answer a few multiple-choice questions to see which Zap might fit their needs. Some combinations are still being finalized so please do not take this as investment advice.

During this hackathon, you can view almost all available Zaps generated, but only Lender Zap is live on the mainnet. *** UPDATE: We deployed ETH Maximalist Zap - open BTC short & ETH 2X margin trades on Fulcrum in a single transaction. Learn more here.

Lender.DefiZap.eth and ETHMax.DeFiZap.eth are registered on The Ethereum Name Service so that transacting on Compound + Fulcrum is as easy as sending a deposit from your wallet.

Ultimately, we intend to allow our users to be able to create their own Zaps, based on their custom requirements. In the meantime, you can submit a custom Zap request here.

How we built it

For the LenderZap (see here), we have 3 Smart Contracts that deploy the investment received from the user into cDai and dLETH2x. The primary reason to write 3 different Smart Contracts is to keep all the Smart Contract code modularised, keeping security as the prime goal.

The first contract with which our front-end interacts (see here) accepts ETH does the necessary allocation of ETH and sends it to the two(2) Sub Smart Contracts that make the investments. Both our Sub Smart Contracts (see here and here) have a function which then makes the investment.

The Key Points to be noted over here are:

-The investment functions take the address of the investor from the Main Smart Contract as the Address to which the assets are to be bought and sold;

-For ETH to WETH to DAI, we use the Kyber Network’s Proxy Contract using the swapEtherToToken function; and

-For the investment in Fulcrum, we talk to the Fulcrum Interface and interact with the mintWithEther function.

-Keeping Security in mind, our Main Smart Contract and the two Sub Smart Contracts have a fall back function which also makes the investment once an ETH is sent to their address.

-Since both the Sub Smart Contracts do not do any allocation of ETH they are modular plug and play and can be used behind any smart contract which does a different allocation.

Keeping Security in mind, our Main Smart Contract also has security toggles that can stop the function of making any investments.

Challenges we ran into

Work in Progress with Token Sets: The Major Challenge that we ran into was working on creating a ZAP on top of TokenSets. Sadly that is still work in progress. Sadly their entire smart contract infrastructure does not simply accept ETH to mint the necessary rebalancing Sets. For this purpose, we had to create a Smart Contract that works with the Provable Oracle to call for the price of the Set every time investment had to be made. However, even after solving that major hurdle, we learned that every investor who had to interact with the Sets Smart Contract had to have not just WETH (for which we were using Kyber Network) but also any other component asset that they have defined in their smart contract - adding to this, there was NO way to determine how much quantity of either of the component assets were required. This threw a major ball into our direction. We are now working with the Token Sets team to resolve this issue so that we can add that as a product offering really really soon.

Lost USD50 worth ETH due to wrong interaction with the Compound Protocol: While doing our first round of testing on the mainnet, our Invest2cDAI function interacted with the Mint Function of the Compound Contract and accepted uint as a return. This uint should be the cDAI tokens that are minted. We then straight-away asked for the Compound Smart Contract to transfer the output uint received. We realized, the hard way, that we were wrong. The returned uints were not being picked by the transfer function thus locking our assets. Thus, we had to re-do a new contract which would first check our updated balanceOf and then do a 100% transfer of cDAI.

No sync on Test Nets: We could not, unfortunately, Test our contracts on Test Nets due to main reason that the DAI and WETH tokens that the Kyber Network, Compound Protocol or bzx Protocol recognized were different (their own custom addresses). Due to which the interaction between multiple protocols on the Test Net was a challenge.

A Global Team: Our team is spread across 5 cities from 4 different countries with 4 different time zones. Singapore, Mumbai, Pune, Peru, & New York. We all come from various individual backgrounds, but ended up working as a team for this hackathon. We range from Accountants, to Entrepreneurs, to Developers, to recent Computer Science graduates. Despite all of our variations, we acclimated to seamlessly communicate and actualize the product from the ground up effectively.

Accomplishments that we're proud of

-Accessing DeFi protocols through Zaps, costs less gas than individually transacting on each one to attain the same result. For example, going from ETH to cDai on Compound and ETH to dLETH2x on Fulcrum will end up costing you ~$5-$6 in transaction fees. Lender's Zap helps you acheive ETH to cDai + LONG2xBZX in a single transaction, for ~$0.86-$1.76.

-Registering Lender Zap on ENS, now investing into Compound + Fulcrum is as easy as sending a deposit from your wallet to Lender.DefiZap.eth

What we learned

We learned a lot about different investment strategies that could be ‘remixed’ with available DeFi tools and how to calculate overall ROIs.

How to interact with Kyber, Compound, Fulcrum and TokenSets smart contracts.

What's next for DeFi Zap

-Launch a simple DeFi Zap Dashboard UI.

-We are starting with ETH only deposits but will soon integrate Wyre to enable deploying capital into DeFi straight from your bank account.

-Automatic Investment Plans - connect your bank accounts and set up recurring deposits to chosen Zap(s).

-‘Anti-Zaps’ which essentially sell your allocated investments to an asset of your choice.

-Unique tokens for each Zap which end users receive to track their overall balances and overall ROI.

+ 36 more
Share this project:
×

Updates

posted an update

UPDATE 4: -Added a new protocol integration: Synthetix. Using ‘Moderate Bull’ Zap anyone can go from ETH to sETH+sBTC in an instant.This Zap’s smart contract address was registered with the Ethereum Name Service under ModerateBull.DeFiZap.eth so that accessing Synths is as easy as sending a text: https://defizap.com/zaps/moderatebull -As usual we made an accompanying tutorial to help end-users understand how Moderate Bull Zap works: https://defitutorials.substack.com/p/moderate-bull-defizap-walk-through. -Furthermore, to help everyone understand how Synthetix protocol works we published a detailed guide: https://defitutorials.substack.com/p/the-ultimate-guide-to-synthetix

Log in or sign up for Devpost to join the conversation.

posted an update

UPDATE: LENDER ZAP has been used 11 times to get from ETH to cDAI + dLETH2x. Average transaction fee: $0.85 YOU CAN VIEW ALL TRANSACTIONS HERE: https://etherscan.io/address/0xe7e5ff8f7745c13bef49d6fddbc6c208e99d5244 We are working to push 'Coming soon' Zaps you see on our website into production in a couple of days. If you want us to create a custom Zap combination for you let us know here.

Log in or sign up for Devpost to join the conversation.