Skip to content

Commit

Permalink
refactoring file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
humanalgorithm committed Jan 25, 2024
1 parent 33c4caa commit 5372088
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 43 deletions.
2 changes: 1 addition & 1 deletion contracts/sg-eth-airdrop/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_schema::write_api;

use sg_eth_airdrop::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use sg_eth_airdrop::rekt_airdrop::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
Expand Down
Empty file.
9 changes: 1 addition & 8 deletions contracts/sg-eth-airdrop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
pub mod contract;
pub mod error;
pub mod msg;
pub mod query;
pub mod reply;
pub mod state;
pub use crate::error::ContractError;
mod claim_airdrop;
pub mod rekt_airdrop;
8 changes: 8 additions & 0 deletions contracts/sg-eth-airdrop/src/rekt_airdrop.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub mod claim_airdrop;
pub mod contract;
pub mod error;
pub mod msg;
pub mod query;
pub mod reply;
pub mod state;
pub mod testing;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::query::query_collection_whitelist;
use crate::state::ADDRS_TO_MINT_COUNT;
use crate::{state::CONFIG, ContractError};
use crate::rekt_airdrop::error::ContractError;
use crate::rekt_airdrop::query::query_collection_whitelist;
use crate::rekt_airdrop::state::ADDRS_TO_MINT_COUNT;
use crate::rekt_airdrop::state::CONFIG;
use build_messages::claim_and_whitelist_add;
use cosmwasm_std::DepsMut;
use cosmwasm_std::{coins, Addr, BankMsg, StdResult};
Expand Down Expand Up @@ -88,7 +89,7 @@ mod validation {
use cosmwasm_std::StdError;
use ethereum_verify::verify_ethereum_text;

use crate::{
use crate::rekt_airdrop::{
query::{query_airdrop_is_eligible, query_per_address_limit},
state::Config,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::claim_airdrop::claim_airdrop;
use crate::rekt_airdrop::claim_airdrop::claim_airdrop;
#[cfg(not(feature = "library"))]
use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg};
use crate::state::CONFIG;
use crate::rekt_airdrop::error::ContractError;
use crate::rekt_airdrop::msg::{ExecuteMsg, InstantiateMsg};
use crate::rekt_airdrop::state::CONFIG;

use cosmwasm_std::entry_point;
use cosmwasm_std::{DepsMut, Env, MessageInfo};
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn execute(

mod build_message {
use super::*;
use crate::state::Config;
use crate::rekt_airdrop::state::Config;
use cosmwasm_std::{to_binary, Deps, WasmMsg};
use sg_std::{StargazeMsgWrapper, SubMsg};
use validation::validate_airdrop_amount;
Expand Down Expand Up @@ -119,6 +119,7 @@ mod validation {

pub fn validate_instantiate_funds(info: MessageInfo) -> Result<(), ContractError> {
let amount = must_pay(&info, NATIVE_DENOM)?;

if amount < Uint128::from(INSTANTIATION_FEE) {
return Err(ContractError::InsufficientFundsInstantiate {});
};
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{msg::QueryMsg, state::CONFIG, ContractError};
use crate::rekt_airdrop::{error::ContractError, msg::QueryMsg, state::CONFIG};
use cosmwasm_std::{entry_point, to_binary, Binary};
use cosmwasm_std::{Addr, Env};
use cosmwasm_std::{Deps, DepsMut, StdResult};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(not(feature = "library"))]
use crate::error::ContractError;
use crate::state::CONFIG;
use crate::rekt_airdrop::error::ContractError;
use crate::rekt_airdrop::state::CONFIG;
use cosmwasm_std::entry_point;
use cosmwasm_std::{DepsMut, Env, Reply};
use cw_utils::{parse_reply_instantiate_data, MsgInstantiateContractResponse, ParseReplyError};
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions contracts/sg-eth-airdrop/src/rekt_airdrop/testing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// #[cfg(test)]
// mod constants;
// #[cfg(test)]
// mod setup;
// #[cfg(test)]
// mod tests;
6 changes: 0 additions & 6 deletions contracts/sg-eth-airdrop/src/testing.rs

This file was deleted.

11 changes: 5 additions & 6 deletions test-suite/src/common_setup/contract_boxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ pub fn contract_collection_whitelist() -> Box<dyn Contract<StargazeMsgWrapper>>
Box::new(contract)
}


pub fn contract_open_edition_minter() -> Box<dyn Contract<StargazeMsgWrapper>> {
let contract = ContractWrapper::new(
open_edition_minter::contract::execute,
Expand Down Expand Up @@ -124,11 +123,11 @@ pub fn contract_group() -> Box<dyn Contract<StargazeMsgWrapper>> {

pub fn contract_eth_airdrop() -> Box<dyn Contract<StargazeMsgWrapper>> {
let contract = ContractWrapper::new(
sg_eth_airdrop::contract::execute,
sg_eth_airdrop::contract::instantiate,
sg_eth_airdrop::query::query,
sg_eth_airdrop::rekt_airdrop::contract::execute,
sg_eth_airdrop::rekt_airdrop::contract::instantiate,
sg_eth_airdrop::rekt_airdrop::query::query,
)
.with_reply(sg_eth_airdrop::reply::reply);
.with_reply(sg_eth_airdrop::rekt_airdrop::reply::reply);
Box::new(contract)
}

Expand All @@ -148,4 +147,4 @@ pub fn contract_whitelist_merkletree() -> Box<dyn Contract<StargazeMsgWrapper>>
whitelist_mtree::contract::query,
);
Box::new(contract)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn execute_airdrop_claim(
target_wallet: Addr,
airdrop_contract: Addr,
) {
let claim_message = sg_eth_airdrop::msg::ExecuteMsg::ClaimAirdrop {
let claim_message = sg_eth_airdrop::rekt_airdrop::msg::ExecuteMsg::ClaimAirdrop {
eth_address: eth_addr_str,
eth_sig: eth_sig_str,
};
Expand Down
2 changes: 1 addition & 1 deletion test-suite/src/sg_eth_airdrop/setup/execute_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use cosmwasm_std::{coins, Addr};
use cw_multi_test::error::Error;
use cw_multi_test::{AppResponse, BankSudo, Executor, SudoMsg};
use eyre::Result;
use sg_eth_airdrop::msg::{ExecuteMsg, InstantiateMsg};
use sg_eth_airdrop::rekt_airdrop::msg::{ExecuteMsg, InstantiateMsg};
use sg_multi_test::StargazeApp;
use sg_std::NATIVE_DENOM;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cosmwasm_std::{
to_binary, Binary, Coin, Deps, DepsMut, Env, MessageInfo, StdResult, Timestamp,
};
use cw_multi_test::{Contract, ContractWrapper};
use sg_eth_airdrop::error::ContractError;
use sg_eth_airdrop::rekt_airdrop::error::ContractError;
use sg_std::{Response, StargazeMsgWrapper};
use vending_factory::msg::VendingMinterCreateMsg;
use vending_minter::msg::{ExecuteMsg, QueryMsg};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_std::entry_point;
use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, StdResult};
use cw_multi_test::{Contract, ContractWrapper};
use sg_eth_airdrop::error::ContractError;
use sg_eth_airdrop::rekt_airdrop::error::ContractError;
use sg_std::{Response, StargazeMsgWrapper};
use sg_whitelist::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

Expand Down
4 changes: 2 additions & 2 deletions test-suite/src/sg_eth_airdrop/tests/test_claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::sg_eth_airdrop::setup::setup_signatures::{
use crate::sg_eth_airdrop::setup::test_msgs::InstantiateParams;
use async_std::task;
use cosmwasm_std::{Addr, Attribute, Coin, Uint128};
use sg_eth_airdrop::msg::{ExecuteMsg, QueryMsg};
use sg_eth_airdrop::rekt_airdrop::msg::{ExecuteMsg, QueryMsg};

use ethers_core::rand::thread_rng;
use ethers_signers::{LocalWallet, Signer};
Expand All @@ -22,7 +22,7 @@ use crate::sg_eth_airdrop::setup::execute_msg::{
execute_contract_error_with_msg, execute_contract_with_msg, instantiate_contract,
};

use sg_eth_airdrop::contract::INSTANTIATION_FEE;
use sg_eth_airdrop::rekt_airdrop::contract::INSTANTIATION_FEE;

fn query_minter_as_expected(app: &mut StargazeApp, airdrop_contract: Addr, minter_addr: Addr) {
let query_msg = QueryMsg::GetMinter {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use crate::sg_eth_airdrop::setup::execute_msg::instantiate_contract;
use crate::sg_eth_airdrop::setup::setup_signatures::{get_msg_plaintext, get_wallet_and_sig};
use crate::sg_eth_airdrop::setup::test_msgs::InstantiateParams;
use cosmwasm_std::Addr;
use sg_eth_airdrop::msg::QueryMsg;
use sg_eth_airdrop::rekt_airdrop::msg::QueryMsg;
use sg_std::GENESIS_MINT_START_TIME;
extern crate whitelist_immutable;
use crate::common_setup::templates::vending_minter_template;
use sg_eth_airdrop::contract::INSTANTIATION_FEE;
use sg_eth_airdrop::rekt_airdrop::contract::INSTANTIATION_FEE;

#[test]
fn test_set_minter_contract_success() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::sg_eth_airdrop::setup::execute_msg::instantiate_contract;
use crate::sg_eth_airdrop::setup::test_msgs::InstantiateParams;

use cosmwasm_std::Addr;
use sg_eth_airdrop::contract::INSTANTIATION_FEE;
use sg_eth_airdrop::msg::QueryMsg;
use sg_eth_airdrop::rekt_airdrop::contract::INSTANTIATION_FEE;
use sg_eth_airdrop::rekt_airdrop::msg::QueryMsg;
use whitelist_immutable::helpers::WhitelistImmutableContract;

#[test]
Expand Down

0 comments on commit 5372088

Please sign in to comment.