updateStrategy

CarbonController.sol
    function updateStrategy(
        uint256 strategyId,
        Order[2] calldata currentOrders,
        Order[2] calldata newOrders
    ) external payable nonReentrant whenNotPaused greaterThanZero(strategyId) onlyProxyDelegate 

This function is used to make changes to a strategy on Carbon DeFi, such as adding or removing liquidity, pausing/unpausing, changing trade rates, etc.

Function Arguments

Name
Type
Description

strategyId

uint256

The ID of the strategy to update.

currentOrders

array

This is the current values of the order being edited. This is included to verify the state of the order before changing it, ensuring it's being updated from the expected state. This safeguard prevents editing an order right after it was changed due to trades.

newOrders

array

This is an array of the new Order objects, with their updated parameters, exactly the same as the object in createStrategy. Each order contains the following: y: uint128 The amount of tokens deposited into the order. z: uint128 The y intercept of the order. A: uint64 Price range (width) parameter. B: uint64 Price range (edge) parameter.

Example

updateStrategy(
712, //strategyId
[{y, z, A, B},{y, z, A, B}], //current orders
[{y, z, A, B},{y, z, A, B}] // updated orders
)

While all required data is available on chain, it is recommended to use the Carbon DeFi SDK.

To create a strategy with the ETH token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

Last updated