> For the complete documentation index, see [llms.txt](https://docs.carbondefi.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carbondefi.xyz/contracts-and-functions/carboncontroller-functions/write-functions/strategy-management/updatestrategy.md).

# updateStrategy

{% code title="CarbonController.sol" overflow="wrap" lineNumbers="true" %}

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

{% endcode %}

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.&#x20;

### **Function Arguments**

<table><thead><tr><th width="162">Name</th><th width="114.66666666666663">Type</th><th>Description</th></tr></thead><tbody><tr><td>strategyId</td><td>uint256</td><td>The ID of the strategy to update.</td></tr><tr><td>currentOrders</td><td>array</td><td>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. </td></tr><tr><td>newOrders</td><td>array</td><td>This is an array of the new Order objects, with their updated parameters, exactly the same as the object in <strong>createStrategy</strong>. <br><br>Each order contains the following:<br><strong>y: uint128</strong> The amount of tokens deposited into the order.<br><strong>z: uint128</strong>  The y intercept of the order.<br><strong>A: uint64</strong> Price range (width) parameter. <br><strong>B: uint64</strong> Price range (edge) parameter.  </td></tr></tbody></table>

### Example

{% code overflow="wrap" %}

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

{% endcode %}

{% hint style="success" %}
While all required data is available on chain, it is recommended to use the [Carbon DeFi SDK](/developer-guides/carbon-defi-sdk.md).
{% endhint %}

{% hint style="info" %}
To create a strategy with the ETH token, use the contract address: *0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE*&#x20;
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carbondefi.xyz/contracts-and-functions/carboncontroller-functions/write-functions/strategy-management/updatestrategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
