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
  • SetBaseQuoteTickOffset
  • Parameters
  • baseQuoteTickOffset
  • constructor
  • Parameters
  • setBaseQuoteTickOffset
  • Parameters
  • createDistribution
  • Parameters
  • Return Values
  • populateFromOffset
  • Parameters
  • populateChunkFromOffset
  • Parameters
  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

GeometricKandel

SetBaseQuoteTickOffset

event SetBaseQuoteTickOffset(uint256 value)

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

Name
Type
Description

value

uint256

the tick offset.

baseQuoteTickOffset

uint256 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(contract IMangrove mgv, struct OLKey olKeyBaseQuote, address reserveId) internal

Constructor

Parameters

Name
Type
Description

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

function setBaseQuoteTickOffset(uint256 _baseQuoteTickOffset) public

sets the tick offset if different from existing.

Parameters

Name
Type
Description

_baseQuoteTickOffset

uint256

the new tick offset.

createDistribution

function createDistribution(uint256 from, uint256 to, Tick baseQuoteTickIndex0, uint256 _baseQuoteTickOffset, uint256 firstAskIndex, uint256 bidGives, uint256 askGives, uint256 pricePoints, uint256 stepSize) public pure returns (struct DirectWithBidsAndAsksDistribution.Distribution distribution)

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 + tickOffsetandBidTick{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 forbidGivesoraskGives` 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

Name
Type
Description

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

Name
Type
Description

distribution

struct DirectWithBidsAndAsksDistribution.Distribution

the distribution of bids and asks to populate

populateFromOffset

function populateFromOffset(uint256 from, uint256 to, Tick baseQuoteTickIndex0, uint256 _baseQuoteTickOffset, uint256 firstAskIndex, uint256 bidGives, uint256 askGives, struct CoreKandel.Params parameters, uint256 baseAmount, uint256 quoteAmount) public payable

publishes bids/asks according to a geometric distribution, and sets all parameters according to inputs.

See createDistribution for further details.

Parameters

Name
Type
Description

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

function populateChunkFromOffset(uint256 from, uint256 to, Tick baseQuoteTickIndex0, uint256 firstAskIndex, uint256 bidGives, uint256 askGives) public payable

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

Name
Type
Description

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.

PreviousDirectWithBidsAndAsksDistributionNextHasIndexedBidsAndAsks

Last updated 1 month ago