Skip to content

Commit

Permalink
cleanup contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Oct 17, 2024
1 parent 766672c commit 4362c29
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
6 changes: 6 additions & 0 deletions contracts/cron/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --example schema"
29 changes: 14 additions & 15 deletions contracts/dex_grpc/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use cosmwasm_std::{
entry_point, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response,
entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response,
StdResult,
};
use cw2::set_contract_version;
Expand Down Expand Up @@ -32,8 +32,7 @@ pub fn execute(
_info: MessageInfo,
msg: ExecuteMsg,
) -> StdResult<Response> {
deps.api
.debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str());
deps.api.debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str());
match msg {
ExecuteMsg::Deposit {
receiver,
Expand All @@ -45,7 +44,7 @@ pub fn execute(
fees,
options,
} => Ok(
Response::new().add_message(Into::<CosmosMsg>::into(MsgDeposit {
Response::new().add_message(MsgDeposit {
creator: env.contract.address.to_string(),
receiver,
token_a,
Expand All @@ -55,7 +54,7 @@ pub fn execute(
tick_indexes_a_to_b,
fees,
options,
})),
}),
),

ExecuteMsg::Withdrawal {
Expand All @@ -66,15 +65,15 @@ pub fn execute(
tick_indexes_a_to_b,
fees,
} => Ok(
Response::new().add_message(Into::<CosmosMsg>::into(MsgWithdrawal {
Response::new().add_message(MsgWithdrawal {
creator: env.contract.address.to_string(),
receiver,
token_a,
token_b,
shares_to_remove,
tick_indexes_a_to_b,
fees,
})),
}),
),
#[allow(deprecated)]
ExecuteMsg::PlaceLimitOrder {
Expand All @@ -88,7 +87,7 @@ pub fn execute(
expiration_time,
max_amount_out,
} => Ok(
Response::new().add_message(Into::<CosmosMsg>::into(MsgPlaceLimitOrder {
Response::new().add_message(MsgPlaceLimitOrder {
creator: env.contract.address.to_string(),
receiver,
token_in,
Expand All @@ -100,21 +99,21 @@ pub fn execute(
expiration_time,
max_amount_out,
min_average_sell_price: "".to_string(), // TODO
})),
}),
),
ExecuteMsg::WithdrawFilledLimitOrder { tranche_key } => Ok(Response::new().add_message(
Into::<CosmosMsg>::into(MsgWithdrawFilledLimitOrder {
MsgWithdrawFilledLimitOrder {
creator: env.contract.address.to_string(),
tranche_key,
}),
},
)),

ExecuteMsg::CancelLimitOrder { tranche_key } => {
Ok(
Response::new().add_message(Into::<CosmosMsg>::into(MsgCancelLimitOrder {
Response::new().add_message(MsgCancelLimitOrder {
creator: env.contract.address.to_string(),
tranche_key,
})),
}),
)
}

Expand All @@ -125,14 +124,14 @@ pub fn execute(
exit_limit_price,
pick_best_route,
} => Ok(
Response::new().add_message(Into::<CosmosMsg>::into(MsgMultiHopSwap {
Response::new().add_message(MsgMultiHopSwap {
creator: env.contract.address.to_string(),
receiver,
routes,
amount_in,
exit_limit_price,
pick_best_route,
})),
}),
),
}
}
Expand Down
12 changes: 6 additions & 6 deletions contracts/tokenfactory/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ pub fn execute(
) -> StdResult<Response> {
let msg: CosmosMsg = match msg {
ExecuteMsg::CreateDenom { subdenom } => MsgCreateDenom {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
subdenom,
}
.into(),
ExecuteMsg::ChangeAdmin {
denom,
new_admin_address,
} => MsgChangeAdmin {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
denom,
new_admin: new_admin_address,
}
Expand All @@ -49,7 +49,7 @@ pub fn execute(
amount,
mint_to_address,
} => MsgMint {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
amount: Some(CosmosCoin {
denom,
amount: amount.to_string(),
Expand All @@ -62,7 +62,7 @@ pub fn execute(
amount,
burn_from_address,
} => MsgBurn {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
amount: Some(CosmosCoin {
denom,
amount: amount.to_string(),
Expand All @@ -74,7 +74,7 @@ pub fn execute(
denom,
contract_addr,
} => MsgSetBeforeSendHook {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
denom,
contract_addr,
}
Expand Down Expand Up @@ -113,7 +113,7 @@ pub fn execute(
uri,
uri_hash,
} => MsgSetDenomMetadata {
sender: info.sender.to_string(),
sender: env.contract.address.to_string(),
metadata: Some(Metadata {
description,
denom_units,
Expand Down

0 comments on commit 4362c29

Please sign in to comment.