Use DeFi protocols from any wallet! Wrapper tokens let you use Uniswap, Aave, Balancer & Set in normal wallets without a dapp browser.
DeFi protocols are incredibly powerful tools for personal finance. However, there are still many UX barriers that prevent everyday people from taking advantage of them. Installing Dapp browsers such as Metamask is a high barrier to entry, and and transaction confirmation popups can be confusing. Argent has done great work at simplifying DeFi protocols, however this requires custom integration by the wallet developer. DeFi777 takes a hint from the user experience of the ICO boom. To participate in an ICO, users would typically send ETH to a provided address, and instantly receive their ICO tokens. This action could be initiated from any wallet, and would feel familiar to anyone who is used to sending transactions with Bitcoin or other cryptocurrencies. DeFi777 lets users use DeFi protocols from any Ethereum wallet (ENS isn't required, but it makes the experience much easier). Users send tokens to various "adapter" contracts, and receive other tokens in response. Here are some actions that are supported by DeFi777 * Send ETH or any DeFi777 wrapper token to dai.uniswap777.eth, and swap that token into a Dai wrapper (Dai777) using Uniswap * Send ETH or any DeFi777 wrapper token to dai.balancer777.eth, and swap that token into Dai777 using Balancer pools * Send ETH or supported DeFi777 wrapper tokens to aave777.eth, and receive wrapped aTokens that accrue interest. Send those aToken wrappers back to aave777.eth to withdraw from Aave * Send any DeFi777 wrapper token to linkethrsi.set777.eth to swap for wrapped Set Protocol LINKETHRSI tokens If users wish to unwrap their 777 wrapper, they can send it to defi777.eth and receive the inner wrapped token. One other benefit of DeFi777: it can be a tool for developers that wish to integrate with DeFi protocols. Developers may find it is easier to interact with DeFi protocols using DeFi777, as opposed to learning the sometimes-complex APIs of these protocols.
How it's made
The key component of this project is the ERC-777 token standard, which is a superset of the ERC-20 standard. ERC-777 adds receive hooks, which lets contracts execute code when they receive a token. *Some random background on this project: I got the idea after ERC-777 tokens were used in the Uniswap & LendfMe hacks in April. While people on Twitter labeled ERC-777 as "insecure", I realized that there were no projects taking advantage of the cool features of ERC-777.* In order to add this functionality to existing tokens (Dai, USDC, MKR, etc), a wrapper factory generates ERC777 wrappers for ERC20 tokens. These wrappers append 777 to the token symbol, so Dai gets wrapped into Dai777, USDC into USDC777, etc. The token wrapper contract also includes two other features: ERC-2612 permit calls for metatransactions, and the ability to take infinite flashloans. These features are not key parts of the project, however other developers may find these features useful. To allow users to interact with DeFi protocols, various "adapter" contracts are created. While each contract is implemented differently, they all typically follow this pattern: 1. Receive an ERC-777 token 2. Unwrap that token, retrieving the inner-token 3. Interact with the DeFi protocol (swap, loan, etc) 4. Wrap the output token into an ERC-777 token 5. Return the new wrapped token to the user. For Uniswap, each contract represents the "output token". When the contract receives any token it will attempt to swap that token into the output token and return it to the user. For example, one contract may represent "Dai" as an output token. It will attempt to convert any token (MKR, USDC, ETH) into Dai using the Uniswap V2 Router. Balancer works similar to Uniswap, except that Balancer stores a list of balancer pools. When trying to swap 2 assets, the contract will check each applicable Balancer pool for the best price before swapping. The Aave contract was actually the most difficult to implement. Unlike Compound cTokens, Aave ATokens increase the balance as interest is accrued. That means that ATokens could not be simply wrapped into a new token. The AToken wrapper must fetch data from the AavePoolCore and calculate interest in the same manner that the normal AToken contract does. Set Protocol is included as an available DeFi protocol, however all Set purchases are currently routed through Uniswap. Finally, ENS names are used so that users can easily look up the address they want to use. Aave transactions can be sent directly to aave777.eth, while Balancer, Uniswap & Set use ENS subdomains (ex, dai.balancer777.eth, usdc.uniswap777.eth, linkethrsi.set777.eth).