BLOG — Use cases

32 days ago

Beefy Finance x Gelato Web3 Functions

Beefy Finance is a Decentralized Finance (DeFi) Yield Optimizer platform that enables users to maximize their cryptocurrency returns. By integrating Gelato's Web3 Functions, Beefy automates two essential processes: harvesting vaults and swapping tokens to manage accrued fees.

How Beefy Uses Web3 Functions

Beefy automates two key processes:

  • Harvesting Vaults: Beefy utilizes Web3 Functions to automate vault harvesting by identifying ready-to-harvest strategies and then trigger the contract method to execute.

  • Swapping Tokens: Web3 Functions automates token swapping on Beefy by monitoring token balances using the 1inch API. When the token balance and swap output meet predefined criteria, the Web3 Function executes the swap.


The integration of Gelato's Web3 Functions with Beefy simplifies the automation of harvesting profits from multiple strategies on the platform, as well as token swapping for managing accrued fees.

For token swapping, the Web3 Function continuously monitors token balances and fetches swap quotes from the 1inch API. It identifies when the balance of a token meets the minimum input amount, and the swap output surpasses a predefined threshold. When these conditions are met, the Web3 Function automatically executes the token swap on the blockchain, making the swapping process efficient and convenient for users.

For harvesting, the Web3 Function automates the execution of a specific function called harvestMultiple(). This function handles the harvesting of multiple strategies at once. The Web3 Function first checks the harvester's settings and identifies which strategies are ready to be harvested.

After verifying whether the current gas price is within the acceptable range, if all conditions are met, the Web3 Function proceeds to prepare the necessary data for executing the harvestMultiple() function.

Gelato’s Web3 Functions automates the harvesting process and token swapping in Beefy, making it more efficient and user-friendly.

Customer Review

Weso, Lead Developer & Head of Strategic Partnerships at Beefy Finance, had this to say about the integration:

"Gelato's Web3 Functions enable our smart contracts to become smarter by combining the power of automation and the ability to access external data. With Web3 Functions we can create more powerful products and also eliminate tedious operational tasks."

In summary, Beefy's integration of Gelato's Web3 Functions enables the platform to automate critical processes, enhancing its overall efficiency and user experience.

About Gelato’s Web3 Functions

Web3 Functions provide an innovative solution for developers to create serverless, decentralized applications with ease. They enable seamless integration of smart contracts with off-chain data, bridging the gap between on-chain and off-chain worlds.

By leveraging Web3 Functions, developers can build robust, scalable, and decentralized web3 applications, supported by a reliable and resilient infrastructure.

Get started in minutes

Join our community and developer discussion on Discord.

Web3 Functions are available today in private beta. For more information, please check out the Web3 Functions documentation. To learn how to write, test, and deploy your own Web3 Functions, check out our in-depth tutorial.

Apply here to be one of the first to test Web3 Functions!