Skip to main content

Local variables

Taker fees​

Taker fee

Taker fee is defined in basis points (i.e., in percents of a percent) of the total amount of outbound tokens received by taker. It is capped by the protocol to ~2.5%. Collected fees accrue on the Mangrove contract and can be withdrawn by governance.

// Governance sets the fee for the offer list identified by olKey
function setFee(OLKey memory olKey, uint fee) external;

Offer gas base​

Offer gas base

Offer gas base is an over-approximation of the gas overhead associated with processing one offer. Mangrove considers that a failed offer has used at least this amount of gas. The parameter is offer list specific since the costs of calling outbound and inbound transferFrom are part of the offer gasbase.

offer gas base update

Offer gas base needs to be updated when ERC20 contracts managing inbound or outbound tokens change or when opcode prices are updated.
This parameter may aslo be used to increase/decrease bounty of failing offers on a specific offer list.

// Governance sets the gas overhead for the offer list identified by olKey
function setGasbase(OLKey memory olKey, uint offer_gasbase) external;

Density​

Density

Density is expressed in amount of outbound tokens delivered per gas unit. The offer list's density corresponds to a "dust" parameter, which constrains the volume of outbound tokens an offer must deliver w.r.t the gas it requires to be executed. An offer cannot be posted on an offer list if its density is below the offer list's density.

The density of an offer in an offer list with an offer gasbase set to Ξ²\beta is defined as:

Ξ΄=VΞ²+Ξ³\delta = \frac{V}{\beta + \gamma}

where VV is the volume of outbound tokens given by the offer and Ξ³\gamma is the gas required by the offer.

// Governance sets density for the offer list identified by olKey
// Density is given as a 96.32 fixed point number. It will be stored as a 9-bit float and be approximated towards 0. The maximum error is 20%.
function setDensity96X32(OLKey memory olKey, uint density96X32) external;

A rationale to define density is to set it such that the gas required by an offer is negligible in front of the volume delivered. For instance setting offer list density Ξ”\Delta with the formula:

Ξ”:=Cβˆ—Ξ“pout\Delta := \frac{C*\Gamma}{p_{out}}

with poutp_{out} being the unit price of outbound tokens in ETH and Cβ‰₯1C\geq 1 insuring that the amount delivered per gas unit is CC times greater than Ξ“\Gamma, a realistic gas price.

(De)activating an Offer List​

(De)Activating offer lists

An offer list is inactive by default, but may be activated/deactivated by governance. Only offer removals (and deprovision) are possible on inactive offer lists.

// Governance activates the offer list identified by olKey
function activate(OLKey memory olKey, uint fee, uint density96X32, uint offer_gasbase) public;

// Governance deactivates the offer list identified by olKey
function deactivate(OLKey memory olKey) public;