GeometricKandel
SetBaseQuoteTickOffset
The tick offset for absolute price used for the on-chain geometric progression deployment in createDistribution
. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
Parameters
value
uint256
the tick offset.
baseQuoteTickOffset
The tick offset for absolute price used for the on-chain geometric progression deployment in createDistribution
. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
constructor
Constructor
Parameters
mgv
contract IMangrove
The Mangrove deployment.
olKeyBaseQuote
struct OLKey
The OLKey for the outbound_tkn base and inbound_tkn quote offer list Kandel will act on, the flipped OLKey is used for the opposite offer list.
reserveId
address
identifier of this contract's reserve when using a router.
setBaseQuoteTickOffset
sets the tick offset if different from existing.
Parameters
_baseQuoteTickOffset
uint256
the new tick offset.
createDistribution
Creates a distribution of bids and asks given by the parameters. Dual offers are included with gives=0.
the absolute price of an offer is the ratio of quote/base volumes of tokens it trades the tick of offers on Mangrove are in relative taker price of maker's inbound/outbound volumes of tokens it trades for Bids, outbound_tkn=quote, inbound_tkn=base so relative taker price of a a bid is the inverse of the absolute price. for Asks, outbound_tkn=base, inbound_tkn=quote so relative taker price of an ask coincides with absolute price. Index0 will contain the ask with the lowest relative price and the bid with the highest relative price. Absolute price is geometrically increasing over indexes. tickOffset moves an offer relative price s.t. `AskTick{i+1} = AskTicki + tickOffsetand
BidTick{i+1} = BidTicki - tickOffsetA hole is left in the middle at the size of stepSize - either an offer or its dual is posted, not both. The caller should make sure the minimum and maximum tick does not exceed the MIN_TICK and MAX_TICK from respectively; otherwise, populate will fail for those offers. If type(uint).max is used for
bidGivesor
askGives` then very high or low prices can yield gives=0 (which results in both offer an dual being dead) or gives>=type(uin96).max which is not supported by Mangrove.
Parameters
from
uint256
populate offers starting from this index (inclusive). Must be at most pricePoints
.
to
uint256
populate offers until this index (exclusive). Must be at most pricePoints
.
baseQuoteTickIndex0
Tick
the tick for the price point at index 0 given as a tick on the base, quote
offer list, i.e. corresponding to an ask with a quote/base ratio. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
_baseQuoteTickOffset
uint256
the tick offset used for the geometric progression deployment. Must be at least 1. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
firstAskIndex
uint256
the (inclusive) index after which offer should be an ask. Must be at most pricePoints
.
bidGives
uint256
The initial amount of quote to give for all bids. If 0, only book the offer, if type(uint).max then askGives is used as base for bids, and the quote the bid gives is set to according to the price.
askGives
uint256
The initial amount of base to give for all asks. If 0, only book the offer, if type(uint).max then bidGives is used as quote for asks, and the base the ask gives is set to according to the price.
pricePoints
uint256
the number of price points for the Kandel instance. Must be at least 2.
stepSize
uint256
in amount of price points to jump for posting dual offer. Must be less than pricePoints
.
Return Values
distribution
struct DirectWithBidsAndAsksDistribution.Distribution
the distribution of bids and asks to populate
populateFromOffset
publishes bids/asks according to a geometric distribution, and sets all parameters according to inputs.
See createDistribution
for further details.
Parameters
from
uint256
populate offers starting from this index (inclusive).
to
uint256
populate offers until this index (exclusive).
baseQuoteTickIndex0
Tick
the tick for the price point at index 0 given as a tick on the base, quote
offer list, i.e. corresponding to an ask with a quote/base ratio. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
_baseQuoteTickOffset
uint256
the tick offset used for the geometric progression deployment. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
firstAskIndex
uint256
the (inclusive) index after which offer should be an ask.
bidGives
uint256
The initial amount of quote to give for all bids. If 0, only book the offer, if type(uint).max then askGives is used as base for bids, and the quote the bid gives is set to according to the price.
askGives
uint256
The initial amount of base to give for all asks. If 0, only book the offer, if type(uint).max then bidGives is used as quote for asks, and the base the ask gives is set to according to the price.
parameters
struct CoreKandel.Params
the parameters for Kandel. Only changed parameters will cause updates. Set gasreq
and gasprice
to 0 to keep existing values.
baseAmount
uint256
base amount to deposit
quoteAmount
uint256
quote amount to deposit
populateChunkFromOffset
publishes bids/asks according to a geometric distribution, and reads parameters from the Kandel instance.
This is typically used after a call to populateFromOffset
to populate the rest of the offers with the same parameters. See that function for further details.
Parameters
from
uint256
populate offers starting from this index (inclusive).
to
uint256
populate offers until this index (exclusive).
baseQuoteTickIndex0
Tick
the tick for the price point at index 0 given as a tick on the base, quote
offer list, i.e. corresponding to an ask with a quote/base ratio. It is recommended that this is a multiple of tickSpacing for the offer lists to avoid rounding.
firstAskIndex
uint256
the (inclusive) index after which offer should be an ask.
bidGives
uint256
The initial amount of quote to give for all bids. If 0, only book the offer, if type(uint).max then askGives is used as base for bids, and the quote the bid gives is set to according to the price.
askGives
uint256
The initial amount of base to give for all asks. If 0, only book the offer, if type(uint).max then bidGives is used as quote for asks, and the base the ask gives is set to according to the price.
Last updated