Market Manager
Last updated
Last updated
The Market Manager is a core component of the Curvance protocol, responsible for risk management and orchestrating interactions between various protocol modules. Market Managers are designed as thesis-driven micro-ecosystems, each focusing on specific asset types (e.g., interest-bearing stablecoins, bluechip assets, volatile LP tokens), which helps minimize systemic risk across the protocol.
Liquidity Manager: Calculates account liquidity across positions
Liquidation Manager: Manages liquidation queues and OEV auction integration
Position Management: Handles position creation, modification, and leverage
Dynamic Interest Rate Model: Manages borrow and supply interest rates for Curvance debt tokens
Market Tokens: Tokens in Curvance that represent collateral, and debt
OEV Auction System: Off chain liquidation auctions that capture MEV
Two primary token types exist within Curvance markets:
Position Tokens (pTokens): Represent collateral positions
Debt Tokens (eTokens): Represent borrowed assets
Together, these are collectively called Market Tokens (mTokens).
Users deposit assets into pToken contracts
pTokens can be posted as collateral (subject to collateral caps)
Posted collateral enables borrowing capacity
Market Manager tracks all collateral positions
When OEV is enabled, the system prioritizes auction winners for liquidations:
Block N:Oracle update lands on-chain
Auctioneer/bundler (Fastlane) submits winning liquidation bids
OEV liquidations execute immediately if caller is whitelisted
Fallback Mechanism:
If OEV auctions are offline or fail, system falls back to queued liquidations
Liquidators must call queueLiquidation()
to enter the queue
Liquidations proceed through priority → regular → end phases
The Market Manager implements a three-tiered liquidation threshold system:
Soft Liquidation Threshold (collReqSoft
)
Initiates partial liquidations with base incentives
Minimal disruption to user positions
Hard Liquidation Threshold (collReqHard
)
Permits complete position liquidation
Maximum liquidation incentives
Bad Debt Threshold
Triggered when collateral value falls below total debt
Bad debt is socialized among lenders
Every collateral asset has a Collateral Cap measured in shares
As collateral is posted, the collateralPosted
invariant increases
Caps can be decreased without forcing unwinding of existing positions
Prevents excessive concentration of risky assets
Curvance employs a 20-minute minimum duration requirement for:
Posting pToken collateral
Lending/borrowing eTokens
This cooldown period:
Improves protocol security
Prevents flash loan attacks
Enables more sophisticated interest rate models
Reduces market manipulation opportunities
The state transition looks like:
The Dynamic Interest Rate Model adjusts rates based on market conditions:
Base rate increases linearly until vertex point is reached
Includes dynamic Vertex Multiplier that adjusts based on liquidity utilization
Higher utilization increases borrowing costs to incentivize repayments and new lenders
Decay mechanism balances rate reversion during normal conditions
20-minute minimum duration for posting collateral and lending
No rehypothecation of user deposits
Isolation of market risks through market-specific tokens
Bad debt socialization system to protect protocol solvency
Curvance implements two distinct types of market managers to address different risk models and use cases: Cross Market Managers and Isolated Market Managers.
The Cross MarketManager contract supports multiple collateral assets and debt positions within a single market environment. This design enables users to post various types of collateral against different debt positions, thereby creating a diverse risk portfolio under a single manager. Cross market managers are well-suited for ecosystems with complementary assets that share similar risk characteristics, enabling efficient capital utilization across the entire portfolio. The protocol can optimize risk management at a holistic level, with liquidation and collateralization requirements balanced across all positions.
The MarketManagerIsolated contract focuses on a single position token type as collateral. This design creates a thesis-driven micro-ecosystem that isolates risk to specific asset classes or strategies. Isolated markets are ideal for specialized use cases, such as interest-bearing stablecoins, volatile LP tokens, or other assets with unique risk profiles that shouldn't contaminate other markets. This separation prevents contagion between different risk profiles while still enabling the protocol to support diverse asset types across separate, isolated markets. Each isolated market can be configured with parameters specifically tailored to its underlying asset's volatility and liquidity characteristics.
Both designs contribute to Curvance's approach of minimizing systemic risk while maximizing the range of supportable assets, allowing the protocol to safely incorporate nearly any ERC20 token into its ecosystem through the appropriate market manager structure.
The Market Manager interacts with multiple other components:
Central Registry for protocol parameters and permissions
Oracle Manager for price feeds
Token contracts for position management
Position Management contracts for leveraging operations
External bundlers/auctioneers for OEV liquidations
Through these interactions, the Market Manager maintains the integrity and stability of each market while optimizing capital efficiency and risk management.
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if an mToken (pToken or eToken) is listed in the lending market.
Function signature:
address
mToken
Address of the pToken or eToken
Return data:
bool
Whether the token is an mToken (true), or not (false).
Contract: MarketManagerCross and MarketManagerIsolated
Description: Returns an array of all mToken addresses that are listed in the market.
Function signature:
Return Data:
address[]
Array of all mToken addresses listed in the market
Contract: MarketManagerCross and MarketManagerIsolated
Description: Returns all assets that an account has entered.
Function signature:
address
account
The address of the account to query
Return data:
IMToken[]
Array of mTokens that the account has entered.
Contract: MarketManagerCross and MarketManagerIsolated
Description: Returns detailed information about an account's position in a specific market token, including whether they have an active position, their balance, and collateral posted.
Function signature:
address
account
The address of the account to check
address
mToken
The address of the market token
Return data:
bool
Whether the account has an active position in the specified market token
uint256
The account's balance of the specified market token
uint256
The amount of collateral posted by the account in the specified market token
Contract: MarketManagerCross and MarketManagerIsolated
Description: Determine the account's current status between collateral and additional liquidity in USD.
Function signature:
address
account
The account to determine liquidity for
Return data:
uint256
Total value of account collateral
uint256
The maximum amount of debt the account could take on based on an account's collateral
uint256
Total value of an account's debt.
Contract: MarketManagerCross and MarketManagerIsolated
Description: Calculates what an account's liquidity would be after a hypothetical action such as redeeming or borrowing. Will natively revert if a hypothetical borrow will result in a loan less than MIN_ACTIVE_LOAN_SIZE
, set in LiquidityManager
.
Function signature:
address
account
The account to determine liquidity for
address
mTokenModified
The market to hypothetically redeem/borrow in
uint256
redeemTokens
The number of tokens to hypothetically redeem in shares
uint256
borrowAmount
The amount of underlying to hypothetically borrow in assets
Return data:
uint256
Hypothetical account liquidity in excess of collateral requirements
uint256
Hypothetical account liquidity deficit below collateral requirements
bool[]
An array of whether the positions should be closed or not
Contract: MarketManagerCross and MarketManagerIsolated
Description: Posts tokens as collaPermission and Validation Functionsteral in the market (subject to cooldown period). Caller must be the same as account
or the pToken contract associated. The account must have sufficient pTokens to post as collateral. The pToken configuration must have collateralization enabled.
Function signature:
address
account
The address of the account posting collateral
address
pToken
The address of the position token to use as collateral
uint256
tokens
The amount of tokens to post as collateral, in shares
Contract: MarketManagerCross and MarketManagerIsolated
Description: Removes collateral from the market (subject to cooldown period). Only called by a user's address. Can only succeed if the account has no active loan, if the removal does not cause a liquidity deficit, or past the 20 minute hold period. Also clears inactive positions in the MarketManager's internal accounting.
Function signature:
address
pToken
The address of the position token to remove collateral for
uint256
tokens
The number of tokens to remove from collateral, in shares
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if an account is allowed to mint tokens in the specified market, validating system parameters and account state. Transaction succeeds if true, reverts if false. Used by mTokens to check if minting is paused.
Function signature:
address
mToken
The market token address to verify minting for
address
account
The account which would mint the tokens
uint256
amount
The amount of underlying asset the account would deposit
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if an account is allowed to redeem their tokens in the given market. Verifies that redeeming is not paused, and transfers aren't disabled in the centralRegistry.
Function signature:
address
mToken
The market token to verify redemption for
address
account
The account which would redeem the tokens
uint256
amount
The number of tokens to redeem for the underlying asset
Return data:
uint256
Flag indicating if positions need to be closed after redemption
bool[]
Array indicating which positions should be closed
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if a loan repayment is allowed for an account in the given market. Reverts if false, succeeds if true.
Function signature:
address
mToken
The market token to verify the repayment for
address
account
The account who will have their loan repaid
Important market states are stored in variables, but can still be called using a contract interface
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if minting of a particular mToken is paused or not.
Inputs:
address
Address of the mToken to check the minting status of
Return data:
uint256
Return value of 0 or 1 indicates minting is not paused. A value of 2 or greater indicates it is paused
Contract: MarketManagerCross and MarketManagerIsolated
Description: Checks if borrowing for a particular eToken is paused or not.
Inputs:
address
Address of the eToken to check the borrowing status of
Return data:
uint256
Return value of 0 or 1 indicates borrowing is not paused. A value of 2 or greater indicates it is paused
Contract: MarketManagerCross and MarketManagerIsolated
Description: Returns the amount of pTokens that has been posted as collateral in shares
Inputs:
address
Address of the pToken to check the amount of collateral posted
Return data:
uint256
amount of pTokens that has been posted as collateral in shareA
Contract: MarketManagerCross and MarketManagerIsolated
Description: Returns the amount of pToken that can be posted of collateral, in shares
Inputs:
address
Address of the pToken to check the max amount of shares that can be posted as collateral
Return data:
uint256
amount of pTokens that has can be posted as collateral