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
  • LogIncident
  • Parameters
  • SetRouter
  • Parameters
  • setRouter
  • Parameters
  • approve
  • Parameters
  • Return Values
  • provisionOf
  • Parameters
  • Return Values
  • checkList
  • Parameters
  • activate
  • Parameters
  • withdrawFromMangrove
  • Parameters
  • OfferArgs
  • Parameters
  • router
  • Return Values
  • MGV
  • Return Values
  1. Strat Lib
  2. Technical references
  3. API preferences
  4. Strats
  5. SRC
  6. Strategies
  7. Interfaces

IOfferLogic

It is an IMaker for Mangrove.

LogIncident

event LogIncident(bytes32 olKeyHash, uint256 offerId, bytes32 makerData, bytes32 mgvData)

Log incident (during post trade execution) By emitting this data, an indexer can keep track of what incidents has happened.

Parameters

Name
Type
Description

olKeyHash

bytes32

the hash of the offer list key. This is indexed so that RPC calls can filter on it.

offerId

uint256

the Mangrove offer id. This is indexed so that RPC calls can filter on it.

makerData

bytes32

from the maker.

mgvData

bytes32

from Mangrove.

SetRouter

event SetRouter(contract AbstractRouter router)

Logging change of router address By emitting this an indexer can keep track of what router is used.

Parameters

Name
Type
Description

router

contract AbstractRouter

the new router address.

setRouter

function setRouter(contract AbstractRouter router_) external

sets a new router to pull outbound tokens from contract's reserve to this and push inbound tokens to reserve.

new router needs to be approved by this to push funds to reserve (see activate function). It also needs to be approved by reserve to pull from it.

Parameters

Name
Type
Description

router_

contract AbstractRouter

the new router contract that this contract should use. Use NO_ROUTER for no router.

approve

function approve(contract IERC20 token, address spender, uint256 amount) external returns (bool)

Approves a spender to transfer a certain amount of tokens on behalf of this.

admin may use this function to revoke specific approvals of this that are set after a call to activate.

Parameters

Name
Type
Description

token

contract IERC20

the ERC20 token contract

spender

address

the approved spender

amount

uint256

the spending amount

Return Values

Name
Type
Description

[0]

bool

result of token approval.

provisionOf

function provisionOf(struct OLKey olKey, uint256 offerId) external view returns (uint256 provision)

computes the amount of native tokens that can be redeemed when deprovisioning a given offer.

Parameters

Name
Type
Description

olKey

struct OLKey

the offer list key.

offerId

uint256

the identifier of the offer in the offer list

Return Values

Name
Type
Description

provision

uint256

the amount of native tokens that can be redeemed when deprovisioning the offer

checkList

function checkList(contract IERC20[] tokens) external view

verifies that this contract's current state is ready to be used to post offers on Mangrove

throws with a reason if something (e.g. an approval) is missing.

Parameters

Name
Type
Description

tokens

contract IERC20[]

the list of tokens that are traded by this contract

activate

function activate(contract IERC20[] tokens) external

performs the required approvals so as to allow this to interact with Mangrove on a set of assets.

Parameters

Name
Type
Description

tokens

contract IERC20[]

the ERC20 this will approve to be able to trade on Mangrove's corresponding markets.

withdrawFromMangrove

function withdrawFromMangrove(uint256 amount, address payable receiver) external

withdraws native tokens from this balance on Mangrove.

Since a call is made to the receiver, this function is subject to reentrancy.

Parameters

Name
Type
Description

amount

uint256

the amount of WEI one wishes to withdraw.

receiver

address payable

the address of the receiver of the funds.

OfferArgs

Memory allocation for _new/updateOffer's arguments.

owner is required in Forwarder logics, when _newOffer or _updateOffer in called in a hook (msg.sender==MGV).

Parameters

struct OfferArgs {
  struct OLKey olKey;
  Tick tick;
  uint256 gives;
  uint256 gasreq;
  uint256 gasprice;
  uint256 fund;
  bool noRevert;
}

router

function router() external view returns (contract AbstractRouter)

Contract's router getter.

if contract has a no router, function returns NO_ROUTER.

Return Values

Name
Type
Description

[0]

contract AbstractRouter

the router.

MGV

function MGV() external view returns (contract IMangrove)

Contract's Mangrove getter

Return Values

Name
Type
Description

[0]

contract IMangrove

the Mangrove contract.

PreviousILiquidityProviderNextIOrderLogic