DirectWithBidsAndAsksDistribution
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
logs the end of a call to populate By emitting this, an indexer will know that the previous PopulateStart event is over.
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
logs the end of a call to retractOffers By emitting this, an indexer will know that the previous RetractStart event is over.
constructor
Constructor
Parameters
mgv
contract IMangrove
The Mangrove deployment.
reserveId
address
identifier of this contract's reserve when using a router.
DistributionOffer
Parameters
Distribution
Parameters
populateChunkInternal
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
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
populates one of the offer lists with the given offers
Parameters
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
publishes (by either creating or updating) a bid/ask at a given price index.
Parameters
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
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
from
uint256
the start index.
to
uint256
the end index.
retractOffersOnOfferList
retracts and deprovisions offers of the distribution interval [from, to[
for the given offer type.
Parameters
from
uint256
the start index.
to
uint256
the end index.
ba
enum OfferType
the offer type.
getOffer
gets the Mangrove offer at the given index for the offer type.
Parameters
ba
enum OfferType
the offer type.
index
uint256
the index.
Return Values
offer
Offer
the Mangrove offer.
offeredVolume
gets the total gives of all offers of the offer type.
function is very gas costly, for external calls only.
Parameters
ba
enum OfferType
offer type.
Return Values
volume
uint256
the total gives of all offers of the offer type.