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
  • GlobalUnpacked
  • LocalUnpacked
  • Views
  1. Protocol
  2. Technical References
  3. Governance-parameters

Data structures and views

PreviousLocal variablesNextPeriphery Contracts

Last updated 1 month ago

Ground truth for configuration can be found in the code . All configuration options are under the control of governance.

GlobalUnpacked

Type
Field
Description

address

monitor

If enabled, acts as a gas price oracle for Mangrove and/or receives notifications when an offer is executed.

bool

useOracle

If true, monitor will be used as a gas price oracle. Otherwise, the internal gas price global parameter will be used.

bool

notify

If true, monitor will be called every time an offer has been executed.

uint

gasprice

Internal gas price estimate, in Mwei/gas. Used to calculate the provision required for writing offers.

uint

gasmax

Maximum gas an offer can require.

bool

dead

If true, this Mangrove instance is dead and the only possible interactions are retracting offers and getting provisions back. Once true, it cannot be set back to false.

uint

maxRecursionDepth

The maximum number of times a market order can recursively execute offers. This is a protection against stack overflows.

uint

maxGasreqForFailingOffers

The maximum gasreq failing offers can consume in total. This is used in a protection against failing offers collectively consuming the block gas limit in a market order.

LocalUnpacked

For every offer list, there is a set of local parameters. Note that the parameters for an (A,B,t) offer list might be different from the (B, A, t) offer list parameters.

Note that root and level{1,2,3} are part of the internal tick tree datastructure.

Type
Field
Description

bool

active

If inactive, offers on this pair can only be retracted.

uint

fee

Fee in basis points, at most 255 (~2.5%).

Density

density

Minimum amount of token an offer must promise per gas required.

uint

kilo_offer_gasbase

Represents the gas overhead used by processing the offer inside Mangrove + the overhead of initiating an entire order, in 1k gas increments.

bool

lock

Re-entrancy and read-lock that is applied during order execution and cleaning.

uint

last

Counter for offer IDs, incremented every time a new offer is created.

Field

level3

Cache of level 3 for the best, non-empty tick of the tick tree.

Field

level2

Cache of level 2 for the best, non-empty tick of the tick tree.

Field

level1

Cache of level 1 for the best, non-empty tick of the tick tree.

Field

root

Root of the tick tree.

Views

Info : The data structures containing Mangrove's global and local configuration parameters are accessible via the public view function configInfo(address outbound, address inbound) function on the MgvReader periphery contract.

Info : For read/write efficiency, Mangrove provides access to configuration parameters in a packed manner via the getter config(OLKey memory olKey).

import "src/IMangrove.sol";

// context of the call

// IMangrove mgv = IMangrove(payable(<address of Mangrove>));
// Mangrove contract
IMangrove mgv = IMangrove(payable(mangrove));

// MgvReader reader = MgvReader(<address of MgvReader>);
MgvReader reader = MgvReader(readerAddress);

// OLKey olkey = OLKey(<address of outbound token>, <address of inbound token>, <tick spacing>);
// struct containing outbound_tkn, inbound_tkn and tickSpacing
OLKey memory olkey = OLKey(address(base), address(quote), 1);

// getting packed config data (gas efficient)
(GlobalPacked global32, LocalPacked local32) = mgv.config(olKey);

// for all fields f of `GlobalUnpacked global` 
// one may unpack a specific element of `GlobalPacked global32` using the following scheme:
global.f == global32.f()

// for all fields f of `LocalUnpacked local` 
// a similar scheme applies to `LocalPacked local32`:
local.f == local32.f()

// getting Mangrove's global configuration parameters and those that pertain to the olKey offer list
// in an ABI compatible format (gas costly, use for off-chain static calls)
(GlobalUnpacked global, LocalUnpacked local) = reader.configInfo(olKey);
documentation