Mangrove
Developper
Developper
  • Welcome
  • Protocol
    • Introduction
    • Technical References
      • Overview
      • Ticks, ratios, and prices
      • Offer-list
        • Views on offers
      • Market-order
        • Delegation
      • Creating & Updating offers
        • Maker contract
        • Offer provisions
        • Gas requirement
        • Public data structures
        • Executing offers
      • Cleaning offers
      • Governance-parameters
        • Global variables
        • Local variables
        • Data structures and views
      • Periphery Contracts
        • MgvReader
        • MgvOracle
      • Literate Source Code
    • Background
      • Taking available liquidity
      • Making liquidity available
      • Reneging on offers
  • Strat Lib
    • What is the Strat Library?
    • Getting-started
      • Set Up Your Local Environment
      • Post a Smart Offer
    • Guides
      • Unlocking liquidity
      • Reposting an offer in the posthook
      • Using last look to renege trades
      • Determining gas requirements
      • Creating a Direct contract
      • Deploying your contract
      • Testing a maker contract
      • Safe offer logic guidelines
      • Approvals
    • Technical references
      • Principal hooks
      • Liquidity routing
      • API preferences
        • Core
          • SRC
            • IMangrove
        • Strats
          • SRC
            • Strategies
              • MangroveOffer
              • MangroveOrder
              • Integrations
                • AaveV3Borrower
                • AaveV3BorrowerImplementation
                • AaveV3BorrowerStorage
                • AaveV3Lender
                • CompoundModule
              • Interfaces
                • IForwarder
                • ILiquidityProvider
                • IOfferLogic
                • IOrderLogic
              • Offer_forwarder
                • Abstract
                  • Forwarder
              • Offer_maker
                • Abstract
                  • Direct
                • Market_making
                  • Kandel
                    • AaveKandel
                    • AaveKandelSeeder
                    • KandelSeeder
                    • Abstract
                      • AbstractKandelSeeder
                      • CoreKandel
                      • DirectWithBidsAndAsksDistribution
                      • GeometricKandel
                      • HasIndexedBidsAndAsks
                      • KandelLib
                      • TradesBaseQuotePair
              • Routeurs
                • SimpleRouter
                • Abstract
                  • AbstractRouter
                • Integrations
                  • AavePooledRouter
                  • HasAaveBalanceMemoizer
              • Utils
                • AccessControlled
              • Vendor
                • AAVE
                  • V3
                    • Contracts
                      • Dependencies
                        • Oppenzeppelin
                          • Contracts
                            • IERC20
                      • Interfaces
                        • IAToken
                        • IAaveIncentivesController
                        • IAaveOracle
                        • ICreditDelegationToken
                        • IInitializableAToken
                        • IPool
                        • IPoolAddressesProvider
                        • IPriceOracleGetter
                        • IScaledBalanceToken
                      • Protocol
                        • Libraries
                          • Configurations
                            • ReserveConfiguration
                          • Helpers
                            • Errors
                          • Types
                            • DataTypes
                    • Periphery
                      • Contracts
                        • MISC
                          • Interfaces
                            • IEACAggregatorProxy
                        • Rewards
                          • Interfaces
                            • IRewardsController
                            • IRewardsDistributor
                            • ITransferStrategyBase
                          • Libraries
                            • RewardsDataTypes
                • Compound
                  • CarefulMath
                  • Exponential
                  • ExponentialNoError
                  • ICompound
    • Background
      • Building Blocks
        • MangroveOffer
        • Direct
        • Forwarder
  • Vaults
    • Understanding vaults
      • Oracles
    • Managing a vault (CLI)
      • Deploying an oracle
      • Creating a vault
      • Monitoring the vault
      • Setting the vault position
      • Setting the fee data
      • Rebalancing
      • Adding or removing liquidity
    • Custom interactions
      • Oracles
      • Vault Factory
      • Managing a vault
        • Setting the position
        • Rebalancing
        • Setting a manager
        • Setting fee
  • Keeper Bots
    • Keeper Bots
    • Guides
      • Using borrowed funds for cleaning
    • Backgroud
      • The role of cleaning bots in Mangrove
      • The role of gas price updater bots in Mangrove
  • Adresses
    • Deployment Addresses
  • Quick Links
    • Glossary
    • Website
    • Whitepaper
Powered by GitBook
On this page
  • Taker fees
  • Offer gas base
  • Density
  • (De)activating an Offer List
  1. Protocol
  2. Technical References
  3. Governance-parameters

Local variables

PreviousGlobal variablesNextData structures and views

Last updated 28 days ago

Taker fees

Taker feeTaker 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;
event SetFee(bytes32 indexed olKeyHash, uint value); // Emitted when fee is set.

Offer gas base

Offer gas baseOffer 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;
event SetGasbase(bytes32 indexed olKeyHash, uint offer_gasbase); // Emitted when gasbase is set.

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 with an set to ββββββ is defined as:

δ=Vβ+γ\delta = \frac{V}{\beta + \gamma}δ=β+γV​

where VVVis the volume of outbound tokens given by the offer and γγγ 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;
event SetDensity96X32(bytes32 indexed olKeyHash, uint value); // Emitted when density is set.

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 ΔΔΔ with the formula:

Δ:=C∗Γpout\Delta := \frac{C*\Gamma}{p_{out}}Δ:=pout​C∗Γ​

with poutpout​poutpout​poutpout​ being the unit price of outbound tokens in ETH and C≥1C≥1C≥1 insuring that the amount delivered per gas unit is CCC times greater than ΓΓΓ, 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;
event SetActive(
    bytes32 indexed olKeyHash,
    address indexed outbound_tkn,
    address indexed inbound_tkn,
    uint tickSpacing,
    bool value
);
offer list
offer gasbase