createStrategy()
Last updated
Last updated
Only standard ERC20 tokens are supported (rebase, fee-on-transfer etc are not supported)
This function is used to create a strategy on Carbon DeFi. Each strategy must include two linked orders.
Name | Type | Description |
---|---|---|
This function returns the assigned id of the strategy.
While all required data is available on chain, it is recommended to use the Carbon DeFi SDK.
Due to input value normalization and memory restrictions, the order parameters stored on chain might be slightly different than those `input` via the UI and/or the SDK.
To create a strategy with the ETH token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
token0
Token
The first token in the strategy. Order0 will be referring to selling this token for token1. (The Carbon DeFi UI will use this as "Base" token)
token1
Token
The second token in the strategy. Order1 will be referring to selling this token for token0. (The Carbon DeFi UI will use this as "Quote" token)
orders
array
This is an array of two Order objects. Each order contains the following: y: uint128 The amount of tokens deposited into the order. z: uint128 The y intercept of the order, which is used to calculate the marginal price. A: uint64 Price range (width) parameter, encoded. B: uint64 Price range (edge) parameter, encoded.