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
  • boundMakerContracts
  • onlyBound
  • boundOrAdmin
  • MakerBind
  • Parameters
  • MakerUnbind
  • Parameters
  • isBound
  • Parameters
  • Return Values
  • pull
  • Parameters
  • Return Values
  • pull
  • Parameters
  • Return Values
  • push
  • Parameters
  • Return Values
  • push
  • Parameters
  • Return Values
  • flush
  • Parameters
  • bind
  • Parameters
  • _unbind
  • Parameters
  • unbind
  • unbind
  • Parameters
  • checkList
  • Parameters
  • checkList
  • Parameters
  • activate
  • Parameters
  • activate
  • Parameters
  • balanceOfReserve
  • Parameters
  • Return Values
  1. Strat Lib
  2. Technical references
  3. API preferences
  4. Strats
  5. SRC
  6. Strategies
  7. Routeurs
  8. Abstract

AbstractRouter

Partial implementation and requirements for liquidity routers.

boundMakerContracts

mapping(address => bool) boundMakerContracts

the bound maker contracts which are allowed to call this router.

onlyBound

modifier onlyBound()

This modifier verifies that msg.sender an allowed caller of this router.

boundOrAdmin

modifier boundOrAdmin()

This modifier verifies that msg.sender is the admin or an allowed caller of this router.

MakerBind

event MakerBind(address maker)

logging bound maker contract by emitting this data, an indexer will be able to keep track of what maker contracts are allowed to call this router.

Parameters

Name
Type
Description

maker

address

the maker address. This is indexed, so that RPC calls can filter on it.

MakerUnbind

event MakerUnbind(address maker)

logging unbound maker contract by emitting this data, an indexer will be able to keep track of what maker contracts are allowed to call this router.

Parameters

Name
Type
Description

maker

address

the maker address. This is indexed, so that RPC calls can filter on it.

isBound

function isBound(address mkr) public view returns (bool)

getter for the makers: addr => bool mapping

Parameters

Name
Type
Description

mkr

address

the address of a maker contract

Return Values

Name
Type
Description

[0]

bool

true if mkr is authorized to call this router.

pull

function pull(contract IERC20 token, address reserveId, uint256 amount, bool strict) external returns (uint256 pulled)

pulls liquidity from the reserve and sends it to the calling maker contract.

Parameters

Name
Type
Description

token

contract IERC20

is the ERC20 managing the pulled asset

reserveId

address

identifies the fund owner (router implementation dependent).

amount

uint256

of token the maker contract wishes to pull from its reserve

strict

bool

when the calling maker contract accepts to receive more funds from reserve than required (this may happen for gas optimization)

Return Values

Name
Type
Description

pulled

uint256

the amount that was successfully pulled.

pull

function __pull__(contract IERC20 token, address reserveId, uint256 amount, bool strict) internal virtual returns (uint256)

router-dependent implementation of the pull function

Parameters

Name
Type
Description

token

contract IERC20

Token to be transferred

reserveId

address

determines the location of the reserve (router implementation dependent).

amount

uint256

The amount of tokens to be transferred

strict

bool

wether the caller maker contract wishes to pull at most amount tokens of owner.

Return Values

Name
Type
Description

[0]

uint256

pulled The amount pulled if successful; otherwise, 0.

push

function push(contract IERC20 token, address reserveId, uint256 amount) external returns (uint256 pushed)

pushes assets from calling's maker contract to a reserve

Parameters

Name
Type
Description

token

contract IERC20

is the asset the maker is pushing

reserveId

address

determines the location of the reserve (router implementation dependent).

amount

uint256

is the amount of asset that should be transferred from the calling maker contract

Return Values

Name
Type
Description

pushed

uint256

fraction of amount that was successfully pushed to reserve.

push

function __push__(contract IERC20 token, address reserveId, uint256 amount) internal virtual returns (uint256 pushed)

router-dependent implementation of the push function

Parameters

Name
Type
Description

token

contract IERC20

Token to be transferred

reserveId

address

determines the location of the reserve (router implementation dependent).

amount

uint256

The amount of tokens to be transferred

Return Values

Name
Type
Description

pushed

uint256

The amount pushed if successful; otherwise, 0.

flush

function flush(contract IERC20[] tokens, address reserveId) external

iterative push for the whole balance in a single call

Parameters

Name
Type
Description

tokens

contract IERC20[]

to flush

reserveId

address

determines the location of the reserve (router implementation dependent).

bind

function bind(address makerContract) public

adds a maker contract address to the allowed makers of this router

this function is callable by router's admin to bootstrap, but later on an allowed maker contract can add another address

Parameters

Name
Type
Description

makerContract

address

the maker contract address

_unbind

function _unbind(address makerContract) internal

removes a maker contract address from the allowed makers of this router

Parameters

Name
Type
Description

makerContract

address

the maker contract address

unbind

function unbind() external

removes msg.sender from the allowed makers of this router

unbind

function unbind(address makerContract) external

removes a makerContract from the allowed makers of this router

Parameters

Name
Type
Description

makerContract

address

the maker contract address

checkList

function checkList(contract IERC20 token, address reserveId) external view

allows a makerContract to verify it is ready to use this router for a particular reserve

checkList returns normally if all needed approval are strictly positive. It reverts otherwise with a reason.

Parameters

Name
Type
Description

token

contract IERC20

is the asset (and possibly its overlyings) whose approval must be checked

reserveId

address

of the tokens that are being pulled

checkList

function __checkList__(contract IERC20 token, address reserveId) internal view virtual

router-dependent additional checks

Parameters

Name
Type
Description

token

contract IERC20

is the asset (and possibly its overlyings) whose approval must be checked

reserveId

address

of the tokens that are being pulled

activate

function activate(contract IERC20 token) external

performs necessary approval to activate router function on a particular asset

Parameters

Name
Type
Description

token

contract IERC20

the asset one wishes to use the router for

activate

function __activate__(contract IERC20 token) internal virtual

router-dependent implementation of the activate function

Parameters

Name
Type
Description

token

contract IERC20

the asset one wishes to use the router for

balanceOfReserve

function balanceOfReserve(contract IERC20 token, address reserveId) public view virtual returns (uint256)

Balance of a reserve

Parameters

Name
Type
Description

token

contract IERC20

the asset one wishes to know the balance of

reserveId

address

the identifier of the reserve

Return Values

Name
Type
Description

[0]

uint256

the balance of the reserve

PreviousAbstractNextIntegrations