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
  • PopulateStart
  • PopulateEnd
  • RetractStart
  • RetractEnd
  • constructor
  • Parameters
  • DistributionOffer
  • Parameters
  • Distribution
  • Parameters
  • populateChunkInternal
  • Parameters
  • populateOfferListChunkInternal
  • Parameters
  • populateIndex
  • Parameters
  • retractOffers
  • Parameters
  • retractOffersOnOfferList
  • Parameters
  • getOffer
  • Parameters
  • Return Values
  • offeredVolume
  • Parameters
  • Return Values
  1. Strat Lib
  2. Technical references
  3. API preferences
  4. Strats
  5. SRC
  6. Strategies
  7. Offer_maker
  8. Market_making
  9. Kandel
  10. Abstract

DirectWithBidsAndAsksDistribution

PopulateStart

event PopulateStart()

logs the start of a call to populate By emitting this, an indexer will be able to know that the following events are in the context of populate.

PopulateEnd

event PopulateEnd()

logs the end of a call to populate By emitting this, an indexer will know that the previous PopulateStart event is over.

RetractStart

event RetractStart()

logs the start of a call to retractOffers By emitting this, an indexer will be able to know that the following events are in the context of retract.

RetractEnd

event RetractEnd()

logs the end of a call to retractOffers By emitting this, an indexer will know that the previous RetractStart event is over.

constructor

constructor(contract IMangrove mgv, address reserveId) internal

Constructor

Parameters

Name
Type
Description

mgv

contract IMangrove

The Mangrove deployment.

reserveId

address

identifier of this contract's reserve when using a router.

DistributionOffer

Parameters

struct DistributionOffer {
  uint256 index;
  Tick tick;
  uint256 gives;
}

Distribution

Parameters

struct Distribution {
  struct DirectWithBidsAndAsksDistribution.DistributionOffer[] asks;
  struct DirectWithBidsAndAsksDistribution.DistributionOffer[] bids;
}

populateChunkInternal

function populateChunkInternal(struct DirectWithBidsAndAsksDistribution.Distribution distribution, uint256 gasreq, uint256 gasprice) internal

Publishes bids/asks for the distribution in the indices. Care must be taken to publish offers in meaningful chunks. For instance, for Kandel an offer and its dual should be published in the same chunk (one being optionally initially dead).

Gives of 0 means create/update and then retract offer (but update price, gasreq, gasprice of the offer)

Parameters

Name
Type
Description

distribution

struct DirectWithBidsAndAsksDistribution.Distribution

the distribution of bids and asks to populate

gasreq

uint256

the amount of gas units that are required to execute the trade.

gasprice

uint256

the gasprice used to compute offer's provision.

populateOfferListChunkInternal

function populateOfferListChunkInternal(struct DirectWithBidsAndAsksDistribution.DistributionOffer[] offers, enum OfferType ba, struct IOfferLogic.OfferArgs args) internal

populates one of the offer lists with the given offers

Parameters

Name
Type
Description

offers

struct DirectWithBidsAndAsksDistribution.DistributionOffer[]

the offers to populate

ba

enum OfferType

whether to populate bids or asks

args

struct IOfferLogic.OfferArgs

a reused offer creation args structure with defaults passed from caller.

populateIndex

function populateIndex(enum OfferType ba, uint256 offerId, uint256 index, struct IOfferLogic.OfferArgs args, uint256 minGives) internal

publishes (by either creating or updating) a bid/ask at a given price index.

Parameters

Name
Type
Description

ba

enum OfferType

whether the offer is a bid or an ask.

offerId

uint256

the Mangrove offer id (0 for a new offer).

index

uint256

the price index.

args

struct IOfferLogic.OfferArgs

the argument of the offer. args.gives=0 means offer will be created/updated and then retracted.

minGives

uint256

the minimum gives to satisfy density requirement - used for creating/updating offers when args.gives=0.

retractOffers

function retractOffers(uint256 from, uint256 to) public

retracts and deprovisions offers of the distribution interval [from, to[.

use in conjunction of withdrawFromMangrove if the user wishes to redeem the available WEIs.

Parameters

Name
Type
Description

from

uint256

the start index.

to

uint256

the end index.

retractOffersOnOfferList

function retractOffersOnOfferList(uint256 from, uint256 to, enum OfferType ba) internal

retracts and deprovisions offers of the distribution interval [from, to[ for the given offer type.

Parameters

Name
Type
Description

from

uint256

the start index.

to

uint256

the end index.

ba

enum OfferType

the offer type.

getOffer

function getOffer(enum OfferType ba, uint256 index) public view returns (Offer offer)

gets the Mangrove offer at the given index for the offer type.

Parameters

Name
Type
Description

ba

enum OfferType

the offer type.

index

uint256

the index.

Return Values

Name
Type
Description

offer

Offer

the Mangrove offer.

offeredVolume

function offeredVolume(enum OfferType ba) public view returns (uint256 volume)

gets the total gives of all offers of the offer type.

function is very gas costly, for external calls only.

Parameters

Name
Type
Description

ba

enum OfferType

offer type.

Return Values

Name
Type
Description

volume

uint256

the total gives of all offers of the offer type.

PreviousCoreKandelNextGeometricKandel