Testing Web3 Functions

Test your web3 function

To test your Web3 Function locally, run:

npx hardhat w3f-run W3FNAME

Example:

npx hardhat w3f-run oracle

Optional flags:

  • --logs Show internal Web3 Function logs

  • --debug Show Runtime debug messages

  • --network [NETWORK] Set the default runtime network & provider.

Example:

npx hardhat w3f-run oracle --logs --network hardhat

Output:

Web3Function Build result:
  Schema: /Users/chuahsonglin/Documents/GitHub/Gelato/contract/w3f-template/web3-functions/oracle/schema.json
  Built file: /Users/chuahsonglin/Documents/GitHub/Gelato/contract/w3f-template/.tmp/index.js
  File size: 2.47mb
  Build time: 947.91ms

Web3Function user args validation:
  currency: ethereum
  oracle: 0x71B9B0F6C999CBbB0FeF9c92B80D54e4973214da

Web3Function running logs:
> Last oracle update: 0
> Next oracle update: 3600
> Updating price: 1898

Web3Function Result:
  Return value: {
  canExec: true,
  callData: [
    {
      to: '0x71B9B0F6C999CBbB0FeF9c92B80D54e4973214da',
      data: '0x8d6cc56d000000000000000000000000000000000000000000000000000000000000076a'
    }
  ]
}

Web3Function Runtime stats:
  Duration: 1.35s
  Memory: 113.55mb
  Storage: 0.03kb
  Rpc calls: 3

Last updated

#272: W3F context including gelato args

Change request updated