Automate Tasks On BuildBear Sandboxes With Gelato Web3 Functions

BuildBear Team
BuildBear Labs
Published in
5 min readMay 29, 2024

We are thrilled to announce the support of Gelato Web3 Functions on BuildBear Sandbox. With this integration, you can now use Gelato Web3 Functions to Automate tasks on BuildBear Sandboxes.

If you’re new to BuildBear Sandboxes, here’s a quick intro:

BuildBear Sandboxes are tailored Sandboxes for DApp development and testing. Developers have the freedom to construct a customized Private Testnet sandbox across various blockchain networks. The platform allows the minting of unlimited Native and ERC20 tokens, and with rapid transaction times on BuildBear (under 3 seconds!), the DApp development lifecycle is greatly enhanced. The platform is equipped with tools designed for real-time testing and debugging, ensuring developers can monitor intricate blockchain transactions with unparalleled ease.

Now, let’s delve into Gelato and Web3 Functions.

Introducing Gelato

Gelato Network revolutionizes how web3 developers execute smart contract transactions on EVM and various EVM-compatible Blockchains. It utilizes Web3 Functions, decentralized cloud functions that automate transactions, eliminating the need for manual management tasks. Developers can now focus more on building innovative applications using blockchain.

What are Gelato Web3 Functions?

Web3 Functions is an automation system by Gelato that allows developers to effortlessly set up, manage, and automate their smart contract tasks. The main features of Web3 Functions include Typescript Functions, Solidity Functions & Automated Transactions. For more details on Web3 Functions, please visit here

Understanding Automated Transaction

An Automated Transaction ensures that a specific function on the target smart contract gets reliably triggered. When you pre-define the inputs, it means that every time Gelato initiates the function call, it uses consistent, predetermined arguments.

Scenarios for Automated Transactions:

  • Periodic Payments: Automate regular payments, like subscriptions or salaries, where the amount and recipient remain constant.
  • Maintenance Operations: Execute routine smart contract operations, such as refreshing oracles or updating interest rates, where the action does not change.
  • Trigger-Based Actions: For actions that must occur in response to a specific event, a transaction can be scheduled to execute when the event is observed.
  • Automated Token Transfers: Transfer tokens at specified intervals or when your contract’s logic deems it necessary, without additional input or variation.

Types of Triggers for Automated Tasks

Developers can set up Tasks to link their Web3 Function with smart contracts. These tasks let them choose when their functions run, providing control in automation. Gelato offers the following trigger types for this:

  1. Time Interval: Use this trigger to execute tasks at regular intervals, e.g., every 10 minutes or once every 24 hours. It’s like setting a straightforward, recurring alarm.
  2. Cron Expressions: This offers more refined control compared to the Time Interval. With cron expressions, you can set tasks to run at specific moments, such as “every Tuesday at 3 PM” or “on the 1st of every month”. It gives you precision in task scheduling.
  3. On-Chain Event: Ideal for those wanting their tasks to respond dynamically to blockchain activities. Whenever a specified event occurs on the blockchain, the trigger executes your task into action.
  4. Every Block: This function operates with the rhythm of the blockchain itself, executing your chosen function each time a new block is created.

Why would you need a Trigger for Automated Tasks?

By leveraging Gelato Web3 Functions, developers can automate various aspects of DApp testing, such as periodic payments, maintenance operations, trigger-based actions, and automated token transfers. Here are some examples:

Automated Risk Management

In Automated Risk Management for a DeFi Protocol, a Web3 Function can be deployed to continuously monitor the prices of collateral assets by fetching real-time data from external APIs. This function calculates the risk based on pre-defined thresholds. Additionally, the trigger can be configured to monitor specific on-chain events related to collateral assets, like large sell-offs or price anomalies. If these events occur, the trigger automatically activates the risk assessment function to evaluate their impact on the protocol’s health.

Decentralized Governance Automation

In Decentralized Governance Automation, Web3 Functions are set to manage to vote, execute proposals, and handle governance actions within a DAO. Triggers are set up to respond to events such as new proposal submissions or the expiration of voting periods. These triggers automatically activate governance actions such as fund transfers, protocol upgrades, or changes to smart contract parameters through Gelato Web3 Functions. This automation streamlines DAO governance processes, ensuring efficient decision-making and execution of governance tasks.

Oracle Data

Blockchain cannot interact with outside world data. However, for the DeFi protocols, it is important to have up-to-date information like price feeds to execute accurate transactions. Automating Oracle data refreshment using triggers Web3 function with cron expression can schedule data refresh tasks at regular intervals.

Advantage of Testing your DApp on BuildBear Sandbox with the Gelato Plugin

If you are developing a dApp that is already configured or will be configured to use the Gelato Web3 Function Automation, you will be required to install and use the gelatonetwork/automate-sdk. BuildBear Sandbox supports this official SDK and you will be able to test your application as if it deployed on any mainnet. This saves you and your tech team expensive time costs that would otherwise be involved in trying to mock the Web3 Functions or only be dependent on testing on Public Testnets (where the state of the blockchain is not what you would want).

In addition to the aboveBuildBear Sandbox offers several advantages such as:

  • Controlled and Isolated Environment: BuildBear Sandbox provides a controlled and isolated environment for DApp development and testing.
  • Replication of Mainnet State: Developers can replicate the mainnet experience within this sandbox, ensuring thorough testing and simulation of real-world scenarios.
  • Code Base Unchanged on Mainnet Deployment: Your code base remains unchanged during deployment on the mainnet. This means that once you have tested and finalized your smart contract on BuildBear Sandbox, you can deploy it to the mainnet without making any further modifications.
  • Unlimited Token & Rapid Transaction: Unlimited Native and ERC20 tokens minting with rapid transaction time to seamless development experience. This feature allows you to simulate various token-based scenarios, test token functionalities, and evaluate contract interactions without limitations.

Connect with us on Twitter | LinkedIn | Telegram | GitHub

--

--

BuildBear Team
BuildBear Labs

BuildBear Team, helping users test their dApps at Scale