Callback gas limit Estimation
When interacting with the AI Oracle, it is crucial to allocate sufficient gas for the execution of the callback function. The gas consumed during the callback depends entirely on the implementation of the aiOracleCallback
method. Its logic directly impacts gas usage - the more complex the logic, the higher the gas consumption. Carefully design your aiOracleCallback
to balance functionality and gas efficiency.
To estimate the gas required for the aiOracleCallback
in a Foundry project:
Run the following command to generate a gas report:
Locate your Prompt contract in the report and check the gas usage for the
aiOracleCallback
method.Use the calculated gas amount to set the gas limit during the initialisation of the Prompt contract (in the constructor).
Alternatively you can use other tools like Hardhat or Tenderly.
Last updated