Density
Density is the ratio of tokens promised by an offer over the gas it requires to be executed. Mangrove requires that offers posted on an offer list provide at least a density of outbound tokens superior or equal to the offer list's density parameter.
Details
- Density is similar to a ‘dust’ parameter.
- We prevent spamming of low-volume offers by asking for a minimum ‘density’ in
outbound_tkn
per gas requested. - For instance, if:
density
is worth10
,offer_gasbase == 5000
,- then an offer with
gasreq == 30000
must promise at least10 × (30000 + 5000) = 350000 outbound_tkn
- The density of a semibook is stored as a 9 bits float. For convenience, governance functions read density as a 96.32 fixed point number.
- As a guideline, fixed-point densities should be uints and should use hungarian notation (for instance
uint density96X32
) - We store the density as a float with 2 bits for the mantissa, 7 for the exponent, and an exponent bias of 32.
- As a guideline, fixed-point densities should be uints and should use hungarian notation (for instance
References
- Local variable: density
- More information on DensityLib.sol in the annotated codebase