Gas Requirement
Overview
The gas requirement (gasreq) defines how much gas an offer's logic may consume when executed by Mangrove. It plays a critical role in the provision calculation, which determines the amount of native tokens locked to compensate the taker if the offer fails.
gasreq represents the total gas needed for the offer logic to run successfully, including both execution callbacks:
makerExecute— the main trade execution logicmakerPostHook— optional logic that runs after successful execution
The gasreq value directly affects:
The provision locked with the offer (higher
gasreq-> higher provision).The bounty amount paid to takers when an offer fails.
The density constraint, since higher
gasreqincreases the minimal required offer size.
The gas requirement should be estimated to cover the worst-case successful execution path in your maker contract.
Underestimating gasreq
gasreqIf your estimate is too low:
The offer may run out of gas during
makerExecute.The trade fails, and the maker is penalized (their provision pays the taker's bounty).
If
makerPostHookruns out of gas, it does not execute, and any expected bookkeeping or offer updates will be lost.
Overestimating gasreq
gasreqIf your estimate is too high:
The offer becomes less attractive to takers because of the higher apparent provision cost.
The required locked funds (provision) increase unnecessarily.
The minimum offer size (due to density requirements) also increases.
To get an idea of the gasreq for your contract, see Determining gas requirements which also covers extra details when using the StratLibrary.
Last updated