Inspiration
I previously launched BTFDCA, a service for dollar cost averaging, using money streams. Meanwhile, I was experimenting with ERC4626. Through those experiences, I understood that vaults would be a more suitable model for DeFi, and that's when I came up with the idea of a vault that would DCA.
What it does
Users pick a BTFDCA vault (these vary by the token to spend, the token to stash, and the interval in which the swaps happen) and deposit to it (e.g. spend 10 USDT for 10 days = 100 USDT deposit).
BTFDCA periodically swaps the source token (e.g. USDT) for the target token (e.g. WFTM).
How we built it
BTFDCA vault is implemented as a solidity+foundry smart contract. It's NOT ERC4626 compliant because it's a multi-token vault (ERC4626 only support a single asset), but it is heavily inspired by it (deposit/redeem functions).
The frontend is a typescript project using chakra-ui, wagmi, and rainbow kit.
Challenges we ran into
A multi-asset vault (and anything DeFi related) requires deep attention to the math. The fact that this vault also DCAs makes things even trickier, as different assets are spent and stashed. Modelling the possible interactions and making sure everything is correct has been the biggest challenge.
Accomplishments that we're proud of
A multi-asset vault is somewhat novel in DeFi.
What we learned
As mentioned before, handling multiple assets in a smart contract is not straightforward (mainly due to the math).
What's next for
Short term: the contract is still very experimental, more extensive testing is needed, and some nice to have features. Medium term: I want these vaults to replace the existing BTFDCA service.
Built With
- chakra-ui
- foundry
- rainbowkit
- solidity
- typescript
- wagmi
Log in or sign up for Devpost to join the conversation.