Cover photo

StreamFi: Week 7 @ ETHIndia Fellowship 3.0

Smart Contract Automation

Smart contracts do not internally have the ability to automate themselves. They require automation to be set up outside that can call them on a regular basis. Gelato is one such service that allows this - basically acting as a server that executes a cron job periodically, with the cron job being a smart contract call.

Gelato task for streamfi
Gelato task for streamfi

Slippage & Token Volatility

Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed. Slippage can occur at any time but is most prevalent during periods of higher volatility when market orders are used. And as we all know, cryptocurrencies have this nasty habit of being volatile - even the stable ones 🥲

This becomes an incredibly necessary thing to consider when working with user funds and automation.

Current State of Streamfi

Tasks accomplished:

  1. Set up smart contract automation using gelato, currently, the contract has been called every day for a week, with 0 bugs, with swaps happening in the correct quantities and ratios with respect to multiple users.

  2. Added a slippage check to the swap function which checks if the price of the token is above a certain threshold before swapping funds. Currently, a check of 80% of the initial value has been added i.e. swaps will stop happening once the value of WETH drops below 80% of its value at the time of setting up the task.

post image

PS: The gas fee required for this currently is a little high because of the app being on goerli testnet.

Conclusion

With the fellowship nearing its end, I will start applying the finishing touches to the UI and backend, fixing outstanding bugs and issues. The project will also undergo beta testing this week and a final feedback loop will be run. This has really been a surreal process to build this website among my peers and I would love to see where it goes from now 🚀