# 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](https://docs.carbondefi.xyz/developer-guides/carbon-defi-sdk).
{% endhint %}

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