Skip to content

Commit

Permalink
Completed integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larry0x committed Jan 2, 2022
1 parent 2c968bb commit d147557
Show file tree
Hide file tree
Showing 10 changed files with 2,354 additions and 1,905 deletions.
8 changes: 4 additions & 4 deletions contracts/martian-field/src/execute_callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ pub fn cover(
2,
&primary_to_sell,
None,
Some(Decimal::from_ratio(1u128, 10u128)),
Some(Decimal::from_ratio(1u128, 2u128)), // TODO: may not be a good idea. should think about this
)?)
.add_attribute("action", "martian_field :: callback :: cover")
.add_attribute("debt_amount", debt_amount)
Expand Down Expand Up @@ -609,17 +609,17 @@ pub fn assert_health(deps: DepsMut, env: Env, user_addr: Addr) -> StdResult<Resp
let ltv_str = if let Some(ltv) = health.ltv {
ltv.to_string()
} else {
"undefined".to_string()
"null".to_string()
};

if !healthy {
return Err(StdError::generic_err(format!("ltv greater than threshold: {}", ltv_str)));
}

let event = Event::new("field_position_changed")
let event = Event::new("position_changed")
.add_attribute("timestamp", env.block.time.seconds().to_string())
.add_attribute("height", env.block.height.to_string())
.add_attribute("user_addr", &user_addr)
.add_attribute("user", &user_addr)
.add_attribute("bond_units", position.bond_units)
.add_attribute("debt_units", position.debt_units)
.add_attribute("bond_value", health.bond_value)
Expand Down
10 changes: 5 additions & 5 deletions contracts/martian-field/src/execute_replies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ pub fn after_withdraw_liquidity(

Ok(Response::new()
.add_attribute("action", "martian_field :: reply :: after_withdraw_liquidity")
.add_attribute("user_addr", user_addr)
.add_attribute("primary_withdrawn_amount", primary_asset_withdrawn.amount)
.add_attribute("primary_added_amount", primary_asset_to_add.amount)
.add_attribute("secondary_withdrawn_amount", secondary_asset_withdrawn.amount)
.add_attribute("secondary_added_amount", secondary_asset_to_add.amount))
.add_attribute("user", user_addr)
.add_attribute("primary_withdrawn", primary_asset_withdrawn.amount)
.add_attribute("primary_added", primary_asset_to_add.amount)
.add_attribute("secondary_withdrawn", secondary_asset_withdrawn.amount)
.add_attribute("secondary_added", secondary_asset_to_add.amount))
}

pub fn after_swap(deps: DepsMut, response: SubMsgExecutionResponse) -> StdResult<Response> {
Expand Down
Loading

0 comments on commit d147557

Please sign in to comment.