Introducing DeFi777: Decentralized Finance for everyone 🎰

Decentralized finance has made incredible progress in the past few years, opening up new possibilities in permissionless trading, investing and lending. However, these DeFi protocols have struggled to branch out from enthusiasts and reach mainstream users.

DeFi777 simplifies these systems by turning common DeFi actions into simple token transfers. The goal is to be able to take advantage of these protocols from any crypto wallet, without requiring Dapp browsers like Metamask.

Send one token, get a different token back.

ERC-777 Token Wrappers 🎁

Limitations of the popular ERC-20 token standard have made DeFi needlessly complicated. Unlike Ether transfers, basic ERC-20 token transfers can not execute arbitrary code when sent to a smart contract.

This has lead to a common, but complicated pattern: users must first send one transaction to approve token transfers, and a second transaction to execute the intended action.

ERC-777, a newer token standard, adds a number of new features while maintaining backwards-compatibility with ERC-20. DeFi777 is built around ERC-777 hooks, which allows contracts to execute code when they receive tokens.

You may have heard of the ERC-777 standard after the LendfMe hacks in April. In fact, this idea arose out of a Twitter thread in the aftermath of that incident.

While ERC-777 tokens do introduce the possibility of re-entrancy attacks, the tokens are not inherently vulnerable.

ERC-777 wrapper contracts are used to provide these new super-charged features to existing ERC-20 tokens. This means that instead of using normal Dai or USDC, you’ll be using Dai-777 and USDC-777.

ENS-as-a-UI

So far, ENS names have been primarily used as a tool for sending tokens to other individuals, sort of like an “email address” for Ethereum.

However, in DeFi777, ENS names become the user interface for interacting with these protocols. For example, sending tokens to dai.uniswap777.eth indicates that the user would like to use Uniswap to swap their tokens into Dai. This makes ENS behave similarly to a command-line interface.

(Of course, DeFi777 can still be used in browsers that don’t support ENS. QR codes are available as an alternative on defi777.com)

Coinbase Wallet suggesting various DeFi777 ENS addresses

DeFi777 in action 🎰

⚠️ Warning: DeFi777 is still just a prototype! Use at your own risk! ⚠️

Imagine a user that is somewhat-familiar with cryptocurrencies, but new to DeFi. They purchase a few coins (Bitcoin, Ether, etc) and transfer them to a non-custodial wallet such as Coinbase Wallet. This user reads about DeFi-777 (maybe visits defi777.com) and decides to give it a try.

Uniswap

The easiest way to get started is to use Uniswap to swap some of their ETH into a token such as Dai.

First, the user sends some ETH to dai.uniswap777.eth. Once that transaction processed, they will receive wrapped Dai (DAI777) in their wallet.

They can continue to swap this Dai777 to any other token using Uniswap. Sending Dai777 to mkr.uniswap777.eth will swap the tokens into MKR777.

Swapping Dai777 to MKR777 using Coinbase Wallet

Balancer

They can also swap tokens using Balancer. For example sending Dai777 to wbtc.balancer777.eth will swap into WBTC777. The Balancer777 contract automatically compares prices against various Balancer pools, so users should be able to swap with low slippage.

Aave

This user can also earn interest on their token using Aave. When they send Dai777 to aave777.eth, they will automatically receive aDai777. Like normal aDai, the balance will increase as interest is accrued. If the user wants to withdraw, they can simply send aDai777 back to aave777.eth and receive Dai777.

Set

A user can send any token to linkethrsi.set777.eth to invest in Token Set’s LINKETHRSI robo-set.

Set purchases are currently handled by Uniswap. Hopefully, direct integrations to the Set Protocol contracts can be added in the future.

DeFi777 tokens in Coinbase Wallet

Unwrapping

Finally, the user can “unwrap” their tokens at any time by sending them to defi777.eth. For example, if a user sends Dai777 to defi777.eth, they will receive Dai.

⚠️ Be careful not to send unwrapped ERC-20 tokens to DeFi777 contracts. They will be lost! ⚠️

Other features & use cases

Since this project builds new wrapper tokens, it provides the opportunity to add other features to these super-tokens.

Flash loans 📸

Similar to protocols like Aave, DeFi777 wrapper tokens can be borrowed without collateral, as long as they’re repaid within the same transaction.

Since these flash loans are built into the token contract themselves, they can support infinite flashloans, as opposed to platforms like Aave that can only issue flashloans out of their existing liquidity pool.

function flashLoan(address target, uint256 amount, bytes data) external {
borrows[target] = borrows[target].add(amount);
_mint(target, amount, data, '');
require(borrows[target] == 0, 'Flash loan was not returned'); emit FlashLoan(target, amount);
}

Meta-transactions ⛽️

DeFi777 wrappers natively support meta-transactions XXX. These wrappers support the Gas Station Network, allowing any entity to subsidize gas-free transfers of tokens. The contracts also include the ERC-2612 permit() function, popularized by the multi-collateral Dai contract.

DeFi777 for Developers 💻

DeFi777 can also be a great tool for developers building new projects. The DeFi777 contracts provide a simple interface, effectively abstracting away the complexities of various protocols.

Moving forward 🛠

DeFi777 was created as an entry to the HackMoney hackathon. Now that the hackathon has completed, there are a number of steps for the project to continue growing.

Security 🛡

Like any application that handles people’s money, security should be the top concern. The first priority for this project is to ensure that the smart contracts are secure and free of any security vulnerabilities.

Of course, working with security teams and having code audited is quite expensive! Hopefully, this project can raise money during the next Gitcoin Grants round to put towards improving security.

If any DeFi companies would like to support an audit into this project, please reach out. 😁

New protocols 📚

Once the security of these contracts can be established, I’d love to see the project expanded to support other DeFi protocols (Compound, Maker, Synthetix, Kyber, etc).

Educational content 👨‍🏫

DeFi777 can be an incredible tool for onboarding new users into DeFi, especially users that are already comfortable with cryptocurrency wallets.

Once this project reaches a secure & stable state, I plan on creating blog posts & videos to help onboard these users.

If you’d like to follow the progress of this project, follow @dmihal on Twitter

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

{UPDATE} Hearts - Queen of Spades Hack Free Resources Generator

Data Privacy Issues during COVID-19 (key points from an article by Akshit Sangomla for Down To…

AuroraFS

BitHub Bounty Campaign. Part 3

Hunting Down MS Exchange Attacks. Part 2 (CVE-2020–0688, CVE-2020–16875, CVE-2021–24085)

Boring dVPN (nothing to see here Mr government ser, just boring shit…)

Improving Cyber Defense by Purple Team using OODA loop

My Avalanche learning experience

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
David Mihal

David Mihal

More from Medium

Token Review: Aave

Introducing BreakChain Protocol

Evolution of erpetual Trading: Drift Protocol

Nord Finance is exploring e-Money’s suite of stablecoins