Determining gas requirements
Last updated
Last updated
Determining for your offer logic in a maker contract is important to avoid failures, save on provision, and make offers as attractable as possible. There is a lot that can be said and calculated about gas requirements - we will focus on the essential here, and give you pointers for your own assessments.
To determine the gasreq
, you need to measure the worst case gas usage when and are called. There could be exception cases which are very gas costly, where you simply want the offer to fail instead (and you could skip those).
As a strat builder, you should verify your gas usage in some specific scenarios, and compare deltas to other scenarios tested . You should then use the results to set a gasreq
for your strat which covers the desired worst-case scenarios. The gas measurements are for the inner-most operation.
The gasreq should be taken into account when .
Here, we will calculate the optimum gasreq
to use , a Forwarder logic with a :
MangroveOrder's most expensive case is 148451
(more details )
It's worth mentioning as well that there is a slightly more expensive path going through Mangrove core, which should be taken into account:
19675
is the comparable case for core (see )
22841
is the more expensive path, which would be if an offer existed in the same bin as the reposted offer (see )
The difference between the two is just above 3000
, hence we add that and round up to get an optimum gasreq
of 82000
for MangroveOrder.
Standard Kandel
The difference is below 1000
.
Similarly for the primary offer:
The difference is just above 3000
, so we add both (4000
) and round it up to get 126000
.
Here, we will calculate the optimum gasreq
to use the strategy:
Kandel's most expensive case is 121413
(see )
Similarly to , there is a more expensive path going through Mangrove core to be taken into account:
44339
is the comparable case for core (see )
45090
is the more expensive path, if another offer existed on the dual offer's bin (see )
19675
is the comparable case for core (see )
22841
is the more expensive path, if an offer existed in the same bin as the reposted offer (see )