Carbon DeFi Dev
  • Carbon DeFi
    • Introducing Carbon DeFi
      • What Makes Carbon DeFi Unique?
      • Fees & Payments
      • Resources
    • Security & Audits
  • Contracts & Functions
    • Contracts
      • CarbonController
      • CarbonVortex
      • CarbonVortexBridge
      • Deployments
        • Mainnet Contracts
        • Testnet Contracts
    • CarbonController Functions
      • Write Functions
        • Transaction Prerequisites
          • approve() / allowance()
        • Trade
          • tradeBySourceAmount()
          • tradeByTargetAmount()
        • Strategy Management
          • createStrategy()
          • updateStrategy
          • deleteStrategy()
      • Read Functions
        • controllerType()
        • tradingFeePPM()
        • pairTradingFeePPM()
        • pair()
        • pairs()
        • strategy()
        • strategiesByPair()
        • strategiesByPairCount()
        • calculateTradeSourceAmount()
        • calculateTradeTargetAmount()
      • Data & Events
        • TradingFeePPMUpdated()
        • PairCreated()
        • StrategyCreated()
        • StrategyDeleted()
        • StrategyUpdated()
        • TokensTraded()
        • FeesWithdrawn()
    • CarbonVortex Functions
      • Write Functions
        • trade()
        • execute()
      • Read Functions
        • amountAvailableForTrading()
        • availableTokens()
        • expectedTradeInput()
        • expectedTradeReturn()
        • finalTargetToken()
        • minTargetTokenSaleAmount()
        • minTokenSaleAmount()
        • pairDisabled()
        • priceDecayHalfLife()
        • rewardsPPM()
        • targetToken()
        • targetTokenPriceDecayHalfLife()
        • targetTokenSaleAmount()
        • tokenPrice()
        • totalCollected()
        • tradingEnabled()
    • CarbonVortexBridge Functions
      • Write Functions
        • Bridge()
  • Rest API
    • Carbon DeFi Public REST API
  • Developer Guides
    • Carbon DeFi SDK
      • Getting started
      • Interacting with the SDK
        • Managing Strategies
        • Performing Trades
        • Getting User and Pair Data
        • Collecting Liquidity Data
      • SDK Functions
        • constructor
        • startDataSync
        • getCachedPairs
        • hasLiquidityByPair
        • getLiquidityByPair
        • getUserStrategies
        • getTradeData
        • composeTradeByTargetTransaction
        • composeTradeBySourceTransaction
        • createBuySellStrategy
        • updateStrategy
        • deleteStrategy
        • getMinRateByPair
        • getMaxRateByPair
        • getRateLiquidityDepthByPair
    • The Carbon DeFi versus Uniswap V3 Invariant Functions
    • Carbon DeFi Subgraph
      • Accessing the Subgraph
      • Creating Subgraph Queries
      • Subgraph Query in Python
      • Sample Subgraph Queries
    • Using CarbonVortex
      • CarbonVortex Dynamics
Powered by GitBook
On this page
  • Function Arguments
  • Returns
  • Example
  1. Contracts & Functions
  2. CarbonController Functions
  3. Read Functions

strategiesByPair()

CarbonController.sol
   function strategiesByPair(
        Token token0,
        Token token1,
        uint256 startIndex,
        uint256 endIndex
    ) external view returns (Strategy[] memory)

This function is used to obtain a list of strategies for the specified token pair.

Function Arguments

Name
Type
Description

token0

Token

The address of the first token in the pair

token1

Token

The address of the second token in the pair

startIndex

uint256

Index of first strategy to view

endIndex

uint256

Index of last strategy to view

Returns

This function returns a list of strategy objects containing details for strategies from the specified token pair.

Example

strategiesByPairl(
 0x514910771AF9Ca656af840dff83E8264EcF986CA, //token0
 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, //token1
 0, //startIndex
 25, //endIndex
)

// returns
// [(Strategy), (Strategy), (Strategy)]

// struct Strategy {
//    uint256 id;
//    address owner;
//    Token[2] tokens;
//    Order[2] orders;
// }

// Order objects:
//        [
//            Order({
//                y: uint128,
//                z: uint128,
//                A: uint64,
//                B: uint64
//            }),
//            Order({
//                y: uint128),
//                z: uint128,
//                A: uint64,
//                B: uint64
//            })
//        ]
Previousstrategy()NextstrategiesByPairCount()

Last updated 5 months ago