Automated smart contracts creating successful DeFi protocols
New advancements in the Ethereum network service-layer protocol have helped to scale DApp usage to the wider audience. These service-layer protocols can be seen as anything sitting just below the interface layer (i.e., the applications the end-user interacts with), but leveraging the lower-level functionality provided by layer-1 blockchains and interoperability protocols.
Service-layer protocols also called middleware protocols provide specific services to the interface layer, be that:
- financial services like exchange protocols from 0X that developers can utilize to build DEX
- social services that offer functionality like voting or
- provide technological services to the dApps such as storage, caching, location services etc.
Not only do these services provide enhanced user experience but also make dApp development accessible, easier, and cheaper for companies. One such service (technology) is ‘automated-smart contracts execution’ developed by Gelato Network.
Catalyst for DeFi protocols success:
dApp users often get the false impression that the applications function autonomously when in reality it’s the work of organizations (third-parties) in the background which creates the illusion of automation.
An example of this is the Maker system, in which users lock ETH as collateral to take out a loan in DAI. If the collateral values decrease below a certain threshold, their position is liquidated and the outstanding debt thereby paid off.
But does the liquidation really happens automatically? No, this liquidation process is conducted by “Maker Keepers”. Keepers are competing individuals and organizations that are financially incentivized to do so. For each successful liquidation, keepers are incentivized. Without them, bad debt positions would never be liquidated on-time, and the entire Maker system would collapse.
Imagine a scenario without these individuals in which the user has to monitor the debt positions, exchange rates, and manually end liquidation – 24/7. In such a scenario, DeFi would not be that great or usable.
Gelato aims to bring the smart contract automation for wider dApp developers. Using Gelato, developers can use Gelato’s automated smart contracts to perform actions on behalf of users under the conditions specified by them. This approach is fully non-custodian and has found many use cases for ETH dApps, especially DeFi protocols. For example, developers can program the smart contract (and specify the conditions) to:
- Auto-execute trades for favorable gas prices or halts the automation of trades if gas prices rise above a certain threshold.
- Automatically refinance funds between multiple lending protocols to always get the highest yield.
- Automatically buy ETH when its price drops and then sell it after the price has gone up (automatic volatility trader).
- Pull funds from the liquidity pool after a certain number of days.
What goes in the process of automatic smart contract execution:
- dApp developers set the condition in the smart contracts that show there are X days remaining until transaction execution.
- On the day of condition maturity, the barrier withholding the transaction is removed and the defined action gets executed.
- The execution of a transaction is performed by an executor. Executors are part of the Gelato network ecosystem who maintains a network of relay node servers.
- On-behalf of users, Dapp developers pay execution cost to the executors for using their relay network. This way, developers are able to minimize steps at the user side and enhance user experience.
- The execution cost comprises the service fee and gas fee for the transaction. This is charged in-advance from the developer’s account on Gelato. To ensure developers pay a fair and up-to-date gas fee, Gelato Network references the gas price reported by Chainlink’s Fast Gas Oracle at the point of smart contract maturity.
This automation process has opened doors for many developers in the DeFi space, most notably asset management (yield aggregator) protocols. Using Gelato, DeFi dApp developers have streamlined users (yield farmers) experience by removing the complexity of manually monitoring and placing each transaction themselves.
Instead of leaving funds in just one pool, yield farmers now can utilize these asset protocols to hop from one pool to another and maximize their profits. Additionally, asset DeFi protocols provide a diversified APY strategy that would make users sticky across market cycles.