The Defi Stacker is a smart contract system and web interface that makes it easy to create, visualize, and share defi "pipelines". A pipeline is any series of defi related actions that interact in a sequential order. Our major goal for the project was to (1) integrate as many defi platforms as we could and (2) make it easier for people who are new to defi to understand how to use it. We achieved the first goal through our modular smart contract architecture. We achieved the second goal through our web architecture.
How It's Made
We created adapter contracts in solidity for Aave, Compound, Uniswap v1, Kyber, and Maker. These adapters get used by our Stacker contract to build a "pipeline" of defi transactions such as "trading ETH -> DAI in Uniswap, then DAI -> cDai in Compound". We ran an archive node that is simple to spin up with docker-compose to interact with these different defi platforms and built a React app in TypeScript for the frontend. The docker-compose file also spins up subgraph. Our frontend then creates react hooks to access contracts deployed to subgraph. Our pipeline was structured as a directed acyclic graph, which allowed us to easily serialize it so that pipelines can be quickly shared and saved. We also were able to run topological sort to validate the pipeline. The most difficult part of the project was getting our mainnet fork operating properly. In the end our miss was that we could not get our transactions to execute in time (revert errors, etc). Our big wins were (1) building a modular smart contract system that allowed us to integrate with multiple defi providers and (2) building an efficient way to create and store defi pipelines. One of our team members also had a baby the last week of the hackathon! But he refused to name him "Defi".