Skip to content

Commit cb445ed

Browse files
committed
resolving comments
1 parent 5841a07 commit cb445ed

3 files changed

Lines changed: 22 additions & 29 deletions

File tree

contracts/libraries/vortex-lper/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ pub struct LibraryConfig {
2020
}
2121

2222
pub struct LiquidityProviderConfig {
23-
// Code of the vortex contract we are going to instantiate
23+
/// Code of the vortex contract we are going to instantiate
2424
pub vortex_code: u64,
25-
// Label for the contract instantiation
25+
/// Label for the contract instantiation
2626
pub label: String,
27-
// Id of the pool we are going to provide liquidity for
27+
/// Id of the pool we are going to provide liquidity for
2828
pub pool_id: u64,
29-
// Duration of the round in seconds
29+
/// Duration of the round in seconds
3030
pub round_duration: u64,
31-
// Duration of the auction in seconds
31+
/// Duration of the auction in seconds
3232
pub auction_duration: u64,
33-
// Denoms of both assets we are going to provide liquidity for
33+
/// Denoms of both assets we are going to provide liquidity for
3434
pub asset_data: AssetData,
35-
// Whether the principal token is first in the pool
35+
/// Whether the principal token is first in the pool
3636
pub principal_first: bool,
3737
}
3838
```

contracts/libraries/vortex-lper/src/contract.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use valence_library_utils::{
1111
msg::{ExecuteMsg, InstantiateMsg},
1212
};
1313
use valence_osmosis_utils::utils::cl_utils::query_cl_pool;
14-
use valence_vortex_utils::msg::CreatePositionMsg;
1514

1615
use crate::{
1716
msg::{Config, FunctionMsgs, LibraryConfig, LibraryConfigUpdate, QueryMsg, ReplyPayload},
@@ -188,22 +187,14 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, LibraryEr
188187
StdError::generic_err(format!("failed to parse reply message: {e:?}"))
189188
})?;
190189

191-
let create_position_msg: CreatePositionMsg = reply_payload.create_position_msg;
192-
193190
VORTEX_CONTRACT_ADDR.save(
194191
deps.storage,
195192
&instantiate_msg_response.contract_address.clone(),
196193
)?;
197194

198-
let create_position_msg = valence_vortex_utils::msg::CreatePositionMsg {
199-
lower_tick: create_position_msg.lower_tick,
200-
upper_tick: create_position_msg.upper_tick,
201-
principal_token_min_amount: create_position_msg.principal_token_min_amount,
202-
counterparty_token_min_amount: create_position_msg.counterparty_token_min_amount,
203-
};
204-
205-
let execute_msg =
206-
valence_vortex_utils::msg::ExecuteMsg::CreatePosition(create_position_msg);
195+
let execute_msg = valence_vortex_utils::msg::ExecuteMsg::CreatePosition(
196+
reply_payload.create_position_msg,
197+
);
207198

208199
let bal_asset_0 = deps
209200
.querier

docs/src/libraries/cosmwasm/vortex_lper.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ graph LR
2626

2727
| Function | Parameters | Description |
2828
|----------|------------|-------------|
29-
| **ProvideLiquidity** | `tick_range: TickRange`<br>`token_min_amount_0: Uint128`<br>`token_min_amount_1: Uint128` | tries to deposit the entire principal and counterparty token amounts from the input account to the pool via Vortex. |
29+
| **ProvideLiquidity** | `tick_range: TickRange`<br>`principal_token_min_amount: Uint128`<br>`counterparty_token_min_amount: Uint128` | tries to deposit the entire principal and counterparty token amounts from the input account to the pool via Vortex. |
3030
| **Withdraw** | - | withdraws all the liquidity from the position Vortex entered including potential rewards. |
3131

3232
## Configuration
@@ -39,27 +39,27 @@ pub struct LibraryConfig {
3939
pub input_addr: LibraryAccountType,
4040
/// Address of the output account
4141
pub output_addr: LibraryAccountType,
42-
/// Address of the second output account
42+
/// Address of the second output account
4343
pub output_addr_2: LibraryAccountType,
4444
/// Configuration for the liquidity provider
4545
/// This includes the pool address and asset data
4646
pub lp_config: LiquidityProviderConfig,
4747
}
4848

4949
pub struct LiquidityProviderConfig {
50-
// Code of the vortex contract we are going to instantiate
50+
/// Code of the vortex contract we are going to instantiate
5151
pub vortex_code: u64,
52-
// Label for the contract instantiation
52+
/// Label for the contract instantiation
5353
pub label: String,
54-
// Id of the pool we are going to provide liquidity for
54+
/// Id of the pool we are going to provide liquidity for
5555
pub pool_id: u64,
56-
// Duration of the round in seconds
56+
/// Duration of the round in seconds
5757
pub round_duration: u64,
58-
// Duration of the auction in seconds
58+
/// Duration of the auction in seconds
5959
pub auction_duration: u64,
60-
// Denoms of both assets we are going to provide liquidity for
60+
/// Denoms of both assets we are going to provide liquidity for
6161
pub asset_data: AssetData,
62-
// Whether the principal token is first in the pool
62+
/// Whether the principal token is first in the pool
6363
pub principal_first: bool,
6464
}
6565
```
@@ -69,7 +69,9 @@ pub struct LiquidityProviderConfig {
6969
### Providing Liquidity Process
7070

7171
1. **Balance Check**: Queries the input account balance for the specified pool assets.
72-
2. **ProvideLiquidity**: Executes a `CreatePosition` message to the Vortex contract making Vortex to create a position in the Osmosis pool.
72+
2. **ProvideLiquidity**: Initiates the liquidity process by executing a `CreatePosition` submessage to the Vortex contract.
73+
- The initial call **instantiates the Vortex contract**.
74+
- Once the submessage completes, the **reply handler** performs the actual position creation in the Osmosis pool by the Vortex contract instance.
7375

7476
### Withdrawal Process
7577

0 commit comments

Comments
 (0)