Contract automation
Smart contract automation enables decentralized applications (dapps) to interact with both on-chain and off-chain data in an automated and trustless manner. Automation tools allow developers to build
Available automation services
How Gelato Web3 functions work?
Triggers
What to Execute?
Typescript Functions
Solidity Functions
Automated Transaction
What is dedicatedMsgSender?
Quick Start
Writing & Deploying Typescript Functions
git clone web3-functions-hardhat-templatecd web3-functions-hardhat-template && yarn installWeb3Function.onRun(async (context: Web3FunctionContext) => {
const { userArgs, multiChainProvider } = context;
const provider = multiChainProvider.default();
// Retrieve Last oracle update time
const oracleAddress =
(userArgs.oracle as string) ?? "0x71B9B0F6C999CBbB0FeF9c92B80D54e4973214da";
// YOUR CUSTOM LOGIC
.....
// Return if nothing has to be pushed on-chain
return { canExec: false, message: `Coingecko call failed` };
// Return if tx has to be pushed on-chain
return {
canExec: true,
callData: [
{
to: oracleAddress,
data: oracle.interface.encodeFunctionData("updatePrice", [price]),
},
],
};
});npx w3f deploy web3-functions/YOUR-FUNCTION/index.ts$ npx w3f deploy web3-functions/YOUR-FUNCTION/index.ts
✓ Web3Function deployed to ipfs.
✓ CID: QmYMysfAhYYYrdhVytSTiE9phuoT49kMByktXSbVp1aRPx
To create a task that runs your Web3 Function every minute, visit:
> https://beta.app.gelato.network/new-task?cid=QmYMysfAhYYYrdhVytSTiE9phuoT49kMByktXSbVp1aRPx
✨ Done in 3.56s.Further Resources
Last updated