Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 613af4c

Browse files
Feat/mtp response (#447)
* fix * fix test
1 parent 6092be9 commit 613af4c

File tree

10 files changed

+44
-44
lines changed

10 files changed

+44
-44
lines changed

bindings-test/src/multitest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,10 @@ impl Module for ElysModule {
802802
take_profit_custody: Int128::zero(),
803803
trading_asset,
804804
stop_loss_price: SignedDecimal::zero(),
805-
last_interest_calc_time: Uint64::zero().into(),
806-
last_interest_calc_block: Uint64::zero().into(),
807-
last_funding_calc_time: Uint64::zero().into(),
808-
last_funding_calc_block: Uint64::zero().into(),
805+
last_interest_calc_time: None,
806+
last_interest_calc_block: None,
807+
last_funding_calc_time: None,
808+
last_funding_calc_block: None,
809809
};
810810

811811
let msg_resp = PerpetualOpenResponse { id: mtp.id };

bindings-test/src/tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ fn query_positions() {
156156
take_profit_custody: Int128::zero(),
157157
trading_asset: "".to_string(),
158158
stop_loss_price: SignedDecimal::zero(),
159-
last_interest_calc_time: Uint64::zero().into(),
160-
last_interest_calc_block: Uint64::zero().into(),
161-
last_funding_calc_time: Uint64::zero().into(),
162-
last_funding_calc_block: Uint64::zero().into(),
159+
last_interest_calc_time: None,
160+
last_interest_calc_block: None,
161+
last_funding_calc_time: None,
162+
last_funding_calc_block: None,
163163
}];
164164
let mut app = ElysApp::new();
165165

@@ -204,10 +204,10 @@ fn query_single_mtp() {
204204
take_profit_custody: Int128::zero(),
205205
trading_asset: "".to_string(),
206206
stop_loss_price: SignedDecimal::zero(),
207-
last_interest_calc_time: Uint64::zero().into(),
208-
last_interest_calc_block: Uint64::zero().into(),
209-
last_funding_calc_time: Uint64::zero().into(),
210-
last_funding_calc_block: Uint64::zero().into(),
207+
last_interest_calc_time: None,
208+
last_interest_calc_block: None,
209+
last_funding_calc_time: None,
210+
last_funding_calc_block: None,
211211
}];
212212
let mut app = ElysApp::new();
213213

bindings/src/types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ pub struct Mtp {
287287
pub take_profit_price: SignedDecimal256,
288288
pub trading_asset: String,
289289
pub stop_loss_price: SignedDecimal,
290-
pub last_interest_calc_time: u64,
291-
pub last_interest_calc_block: u64,
292-
pub last_funding_calc_time: u64,
293-
pub last_funding_calc_block: u64,
290+
pub last_interest_calc_time: Option<u64>,
291+
pub last_interest_calc_block: Option<u64>,
292+
pub last_funding_calc_time: Option<u64>,
293+
pub last_funding_calc_block: Option<u64>,
294294
}
295295

296296
#[cw_serde]

contracts/trade-shield-contract/src/tests/close_perpetual_position/closing_a_perpetual_position.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ fn closing_perpetualg_position() {
3636
take_profit_price: SignedDecimal256::from_str("30").unwrap(),
3737
trading_asset: "uatom".to_string(),
3838
stop_loss_price: SignedDecimal::zero(),
39-
last_interest_calc_time: Uint64::zero().into(),
40-
last_interest_calc_block: Uint64::zero().into(),
41-
last_funding_calc_time: Uint64::zero().into(),
42-
last_funding_calc_block: Uint64::zero().into(),
39+
last_interest_calc_time: None,
40+
last_interest_calc_block: None,
41+
last_funding_calc_time: None,
42+
last_funding_calc_block: None,
4343
}];
4444

4545
// Create a mock message to instantiate the contract with no initial orders.

contracts/trade-shield-contract/src/tests/create_perpetual_order/change_trigger_price.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ fn successful_create_perpetual_order() {
5151
take_profit_price: SignedDecimal256::from_str("0.28").unwrap(),
5252
trading_asset: "uelys".to_owned(),
5353
stop_loss_price: SignedDecimal::zero(),
54-
last_interest_calc_time: Uint64::zero().into(),
55-
last_interest_calc_block: Uint64::zero().into(),
56-
last_funding_calc_time: Uint64::zero().into(),
57-
last_funding_calc_block: Uint64::zero().into(),
54+
last_interest_calc_time: None,
55+
last_interest_calc_block: None,
56+
last_funding_calc_time: None,
57+
last_funding_calc_block: None,
5858
}];
5959

6060
app.init_modules(|router, _, store| router.custom.set_mtp(store, &mtps))

contracts/trade-shield-contract/src/tests/create_perpetual_order/successful_create_perpetual_market_close.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ fn successful_create_perpetual_market_open_order() {
6464
take_profit_custody: Int128::zero(),
6565
trading_asset: "usdc".to_string(),
6666
stop_loss_price: SignedDecimal::zero(),
67-
last_interest_calc_time: Uint64::zero().into(),
68-
last_interest_calc_block: Uint64::zero().into(),
69-
last_funding_calc_time: Uint64::zero().into(),
70-
last_funding_calc_block: Uint64::zero().into(),
67+
last_interest_calc_time: None,
68+
last_interest_calc_block: None,
69+
last_funding_calc_time: None,
70+
last_funding_calc_block: None,
7171
}],
7272
)
7373
})

contracts/trade-shield-contract/src/tests/process_perpetual_order/pending_limit_open_long_with_price_met.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ impl Module for ElysModuleWrapper {
231231
take_profit_custody: Int128::zero(),
232232
trading_asset,
233233
stop_loss_price: SignedDecimal::zero(),
234-
last_interest_calc_time: Uint64::zero().into(),
235-
last_interest_calc_block: Uint64::zero().into(),
236-
last_funding_calc_time: Uint64::zero().into(),
237-
last_funding_calc_block: Uint64::zero().into(),
234+
last_interest_calc_time: None,
235+
last_interest_calc_block: None,
236+
last_funding_calc_time: None,
237+
last_funding_calc_block: None,
238238
};
239239

240240
let msg_resp = PerpetualOpenResponse { id: mtp.id };

contracts/trade-shield-contract/src/tests/process_perpetual_order/pending_limit_open_long_with_price_not_met.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ impl Module for ElysModuleWrapper {
231231
take_profit_custody: Int128::zero(),
232232
trading_asset,
233233
stop_loss_price: SignedDecimal::zero(),
234-
last_interest_calc_time: Uint64::zero().into(),
235-
last_interest_calc_block: Uint64::zero().into(),
236-
last_funding_calc_time: Uint64::zero().into(),
237-
last_funding_calc_block: Uint64::zero().into(),
234+
last_interest_calc_time: None,
235+
last_interest_calc_block: None,
236+
last_funding_calc_time: None,
237+
last_funding_calc_block: None,
238238
};
239239

240240
let msg_resp = PerpetualOpenResponse { id: mtp.id };

contracts/trade-shield-contract/src/tests/process_perpetual_order/pending_limit_open_short_with_price_met.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ impl Module for ElysModuleWrapper {
231231
take_profit_custody: Int128::zero(),
232232
trading_asset,
233233
stop_loss_price: SignedDecimal::zero(),
234-
last_interest_calc_time: Uint64::zero().into(),
235-
last_interest_calc_block: Uint64::zero().into(),
236-
last_funding_calc_time: Uint64::zero().into(),
237-
last_funding_calc_block: Uint64::zero().into(),
234+
last_interest_calc_time: None,
235+
last_interest_calc_block: None,
236+
last_funding_calc_time: None,
237+
last_funding_calc_block: None,
238238
};
239239

240240
let msg_resp = PerpetualOpenResponse { id: mtp.id };

contracts/trade-shield-contract/src/tests/process_perpetual_order/pending_limit_open_short_with_price_not_met.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ impl Module for ElysModuleWrapper {
231231
take_profit_custody: Int128::zero(),
232232
trading_asset,
233233
stop_loss_price: SignedDecimal::zero(),
234-
last_interest_calc_time: Uint64::zero().into(),
235-
last_interest_calc_block: Uint64::zero().into(),
236-
last_funding_calc_time: Uint64::zero().into(),
237-
last_funding_calc_block: Uint64::zero().into(),
234+
last_interest_calc_time: None,
235+
last_interest_calc_block: None,
236+
last_funding_calc_time: None,
237+
last_funding_calc_block: None,
238238
};
239239

240240
let msg_resp = PerpetualOpenResponse { id: mtp.id };

0 commit comments

Comments
 (0)