Skip to content

Commit

Permalink
delete comments code
Browse files Browse the repository at this point in the history
  • Loading branch information
3hajk committed Sep 8, 2021
1 parent 9af1ad1 commit a9e54fc
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 19 deletions.
3 changes: 0 additions & 3 deletions contracts/terraswap_factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ mod testing;

#[cfg(test)]
mod mock_querier;

//#[cfg(target_arch = "wasm32")]
//cosmwasm_std::create_entry_points_with_migration!(contract);
8 changes: 4 additions & 4 deletions contracts/terraswap_pair/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ pub fn try_provide_liquidity(
];

if deposits[0].is_zero() || deposits[1].is_zero() {
return Err(ContractError::InvalidZeroAmount {});
return Err(ContractError::ZeroAmount {});
}

let mut messages: Vec<SubMsg> = vec![];
Expand Down Expand Up @@ -284,7 +284,7 @@ pub fn try_provide_liquidity(
assert_slippage_tolerance(&slippage_tolerance, &deposits, &pools)?;

let liquidity_token = pair_info.liquidity_token.clone();
let total_share = query_supply(deps.as_ref(), liquidity_token)?;
let total_share = query_supply(deps.as_ref(), &liquidity_token)?;

let share = if total_share.is_zero() {
// Initial share = collateral amount
Expand Down Expand Up @@ -340,7 +340,7 @@ pub fn try_withdraw_liquidity(
let liquidity_addr: Addr = pair_info.liquidity_token.clone();

let pools: [WeightedAsset; 2] = pair_info.query_pools(deps.as_ref(), &env.contract.address)?;
let total_share: Uint128 = query_supply(deps.as_ref(), liquidity_addr)?;
let total_share: Uint128 = query_supply(deps.as_ref(), &liquidity_addr)?;

let share_ratio: Decimal = Decimal::from_ratio(amount, total_share);
let refund_assets: Vec<Asset> = pools
Expand Down Expand Up @@ -533,7 +533,7 @@ pub fn query_pool(deps: Deps) -> StdResult<PoolResponse> {
let pair_info: PairInfo = PAIR_INFO.load(deps.storage)?;
let contract_addr = pair_info.contract_addr.clone();
let assets: [WeightedAsset; 2] = pair_info.query_pools(deps, &contract_addr)?;
let total_share: Uint128 = query_supply(deps, pair_info.liquidity_token)?;
let total_share: Uint128 = query_supply(deps, &pair_info.liquidity_token)?;

let resp = PoolResponse {
assets,
Expand Down
2 changes: 1 addition & 1 deletion contracts/terraswap_pair/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ pub enum ContractError {
Unauthorized {},

#[error("Event of zero transfer")]
InvalidZeroAmount {},
ZeroAmount {},
}
3 changes: 0 additions & 3 deletions contracts/terraswap_pair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ mod testing;

#[cfg(test)]
mod mock_querier;

// #[cfg(all(target_arch = "wasm32", not(feature = "library")))]
// cosmwasm_std::create_entry_points_with_migration!(contract);
3 changes: 0 additions & 3 deletions contracts/terraswap_router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ pub mod state;

#[cfg(test)]
mod testing;

// #[cfg(target_arch = "wasm32")]
// cosmwasm_std::create_entry_points_with_migration!(contract);
3 changes: 0 additions & 3 deletions contracts/terraswap_token/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
pub mod contract;

// #[cfg(all(target_arch = "wasm32", not(feature = "library")))]
// cosmwasm_std::create_entry_points_with_migration!(contract);
2 changes: 1 addition & 1 deletion packages/terraswap/src/querier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn query_token_balance(
Ok(res.balance)
}

pub fn query_supply(deps: Deps, contract_addr: Addr) -> StdResult<Uint128> {
pub fn query_supply(deps: Deps, contract_addr: &Addr) -> StdResult<Uint128> {
let res: TokenInfoResponse = deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: contract_addr.to_string(),
msg: to_binary(&Cw20QueryMsg::TokenInfo {})?,
Expand Down
2 changes: 1 addition & 1 deletion packages/terraswap/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn supply_querier() {
deps.querier.with_cw20_query_handler();

assert_eq!(
query_supply(deps.as_ref(), Addr::unchecked("liquidity0000")).unwrap(),
query_supply(deps.as_ref(), &Addr::unchecked("liquidity0000")).unwrap(),
Uint128::from(492u128)
)
}
Expand Down

0 comments on commit a9e54fc

Please sign in to comment.