Skip to content

Commit

Permalink
♻️ Restructure Repo To Make Launching Adapter Contracts Easier (#65)
Browse files Browse the repository at this point in the history
* 🚚 restructure repo folders and files for ez pz adapter dev x

* 🚨 run make entry-point schema

* 💚 update gh workflow

* 📝 update readme
  • Loading branch information
NotJeremyLiu authored Aug 9, 2023
1 parent 1a57cec commit 0bd9593
Show file tree
Hide file tree
Showing 51 changed files with 72 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Run schema diff check
# use nightly toolchain so that we get all the latest formatting features
run: |
cargo +nightly run --package skip-swap-entry-point --bin schema
cargo +nightly run --package skip-api-entry-point --bin schema
if [[ `git status --porcelain` ]]; then
echo "Schema is different, please run make entry-point schema"
exit 1
Expand Down
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
resolver = "2"
members = [
"contracts/entry-point",
"contracts/networks/neutron/*",
"contracts/networks/osmosis/*",
"contracts/adapters/ibc/*",
"contracts/adapters/swap/*",
"packages/*",
]

[workspace.package]
version = "0.2.0"
version = "0.2.1"
authors = ["Skip"]
edition = "2021"
rust-version = "1.71.0"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fmt:
# Only generates the entry point schema since that is the only
# contract that can be called externally.
entry-point schema:
cargo run --package skip-swap-entry-point --bin schema
cargo run --package skip-api-entry-point --bin schema

test:
cargo test --locked --workspace
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ The repository is organized in the following way:
├── contracts/ <- Contains all contracts
│ ├── entry-point/ <- Contains source code and tests for entry point contract
│ └── networks/ <- Contains source code and tests for all network adapter contracts
│ ├── neutron/
│ │ ├── ibc-transfer/
│ │ └── swap/
│ └── osmosis/
│ ├── ibc-transfer/
│ └── swap/
│ └── adapters/ <- Contains source code and tests for all network adapter contracts
│ ├── ibc/
│ │ ├── ibc-hooks/
│ │ └── neutron-transfer/
│ └── swap/
│ ├── astroport/
│ └── osmosis-poolmanager/
├── deployed-contracts/ <- Contains deployed contracts info for each network
│ ├── neutron/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skip-swap-osmosis-ibc-transfer"
name = "skip-api-ibc-adapter-ibc-hooks"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ibc_proto::cosmos::base::v1beta1::Coin as IbcCoin;
use ibc_proto::ibc::applications::transfer::v1::MsgTransfer;
use prost::Message;
use skip::ibc::{ExecuteMsg, IbcFee, IbcInfo};
use skip_swap_osmosis_ibc_transfer::{
use skip_api_ibc_adapter_ibc_hooks::{
error::ContractResult,
state::{ENTRY_POINT_CONTRACT_ADDRESS, IN_PROGRESS_CHANNEL_ID, IN_PROGRESS_RECOVER_ADDRESS},
};
Expand Down Expand Up @@ -230,7 +230,7 @@ fn test_execute_ibc_transfer(params: Params) -> ContractResult<()> {
ENTRY_POINT_CONTRACT_ADDRESS.save(deps.as_mut().storage, &Addr::unchecked("entry_point"))?;

// Call execute_ibc_transfer with the given test parameters
let res = skip_swap_osmosis_ibc_transfer::contract::execute(
let res = skip_api_ibc_adapter_ibc_hooks::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cosmwasm_std::{
};
use ibc_proto::ibc::applications::transfer::v1::MsgTransferResponse;
use prost::Message;
use skip_swap_osmosis_ibc_transfer::{
use skip_api_ibc_adapter_ibc_hooks::{
error::ContractResult,
state::{ACK_ID_TO_RECOVER_ADDRESS, IN_PROGRESS_CHANNEL_ID, IN_PROGRESS_RECOVER_ADDRESS},
};
Expand Down Expand Up @@ -206,7 +206,7 @@ fn test_reply(params: Params) -> ContractResult<()> {
}

// Call reply with the given test parameters
let res = skip_swap_osmosis_ibc_transfer::contract::reply(deps.as_mut(), env, params.reply);
let res = skip_api_ibc_adapter_ibc_hooks::contract::reply(deps.as_mut(), env, params.reply);

// Assert the behavior is correct
match res {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
StdError, SubMsg,
};
use skip::{ibc::IbcLifecycleComplete, sudo::OsmosisSudoMsg as SudoMsg};
use skip_swap_osmosis_ibc_transfer::{error::ContractResult, state::ACK_ID_TO_RECOVER_ADDRESS};
use skip_api_ibc_adapter_ibc_hooks::{error::ContractResult, state::ACK_ID_TO_RECOVER_ADDRESS};
use test_case::test_case;

/*
Expand Down Expand Up @@ -153,7 +153,7 @@ fn test_sudo(params: Params) -> ContractResult<()> {
}

// Call sudo with the given test parameters
let res = skip_swap_osmosis_ibc_transfer::contract::sudo(deps.as_mut(), env, params.sudo_msg);
let res = skip_api_ibc_adapter_ibc_hooks::contract::sudo(deps.as_mut(), env, params.sudo_msg);

// Assert the behavior is correct
match res {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skip-swap-neutron-ibc-transfer"
name = "skip-api-ibc-adapter-neutron-transfer"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use cosmwasm_std::{
};
use neutron_proto::neutron::{feerefunder::Fee as NeutronFee, transfer::MsgTransfer};
use skip::ibc::{ExecuteMsg, IbcFee, IbcInfo};
use skip_swap_neutron_ibc_transfer::{
use skip_api_ibc_adapter_neutron_transfer::{
error::ContractResult,
state::{ENTRY_POINT_CONTRACT_ADDRESS, IN_PROGRESS_RECOVER_ADDRESS},
};
Expand Down Expand Up @@ -142,7 +142,7 @@ fn test_execute_ibc_transfer(params: Params) -> ContractResult<()> {
ENTRY_POINT_CONTRACT_ADDRESS.save(deps.as_mut().storage, &Addr::unchecked("entry_point"))?;

// Call execute_ibc_transfer with the given test parameters
let res = skip_swap_neutron_ibc_transfer::contract::execute(
let res = skip_api_ibc_adapter_neutron_transfer::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cosmwasm_std::{
};
use neutron_proto::neutron::transfer::MsgTransferResponse;
use prost::Message;
use skip_swap_neutron_ibc_transfer::{
use skip_api_ibc_adapter_neutron_transfer::{
error::{ContractError, ContractResult},
state::{ACK_ID_TO_RECOVER_ADDRESS, IN_PROGRESS_RECOVER_ADDRESS},
};
Expand Down Expand Up @@ -175,7 +175,8 @@ fn test_reply(params: Params) -> ContractResult<()> {
}

// Call reply with the given test parameters
let res = skip_swap_neutron_ibc_transfer::contract::reply(deps.as_mut(), env, params.reply);
let res =
skip_api_ibc_adapter_neutron_transfer::contract::reply(deps.as_mut(), env, params.reply);

// Assert the behavior is correct
match res {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
StdError, SubMsg,
};
use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg};
use skip_swap_neutron_ibc_transfer::{
use skip_api_ibc_adapter_neutron_transfer::{
error::{ContractError, ContractResult},
state::ACK_ID_TO_RECOVER_ADDRESS,
};
Expand Down Expand Up @@ -319,7 +319,8 @@ fn test_sudo(params: Params) -> ContractResult<()> {
}

// Call sudo with the given test parameters
let res = skip_swap_neutron_ibc_transfer::contract::sudo(deps.as_mut(), env, params.sudo_msg);
let res =
skip_api_ibc_adapter_neutron_transfer::contract::sudo(deps.as_mut(), env, params.sudo_msg);

// Assert the behavior is correct
match res {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skip-swap-neutron-astroport-swap"
name = "skip-api-swap-adapter-astroport"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use cosmwasm_std::{
SubMsg, WasmMsg,
};
use skip::swap::{ExecuteMsg, SwapOperation};
use skip_swap_neutron_astroport_swap::{
use skip_api_swap_adapter_astroport::{
error::{ContractError, ContractResult},
state::{ENTRY_POINT_CONTRACT_ADDRESS, ROUTER_CONTRACT_ADDRESS},
};
Expand Down Expand Up @@ -254,7 +254,7 @@ fn test_execute_swap(params: Params) -> ContractResult<()> {
ROUTER_CONTRACT_ADDRESS.save(deps.as_mut().storage, &Addr::unchecked("router_contract"))?;

// Call execute_swap with the given test parameters
let res = skip_swap_neutron_astroport_swap::contract::execute(
let res = skip_api_swap_adapter_astroport::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
SubMsg,
};
use skip::{error::SkipError, swap::ExecuteMsg};
use skip_swap_neutron_astroport_swap::error::{ContractError, ContractResult};
use skip_api_swap_adapter_astroport::error::{ContractError, ContractResult};
use test_case::test_case;

/*
Expand Down Expand Up @@ -122,7 +122,7 @@ fn test_execute_transfer_funds_back(params: Params) -> ContractResult<()> {
let info = mock_info(&params.caller, &[]);

// Call execute_swap with the given test parameters
let res = skip_swap_neutron_astroport_swap::contract::execute(
let res = skip_api_swap_adapter_astroport::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skip-swap-osmosis-poolmanager-swap"
name = "skip-api-swap-adapter-osmosis-poolmanager"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use cosmwasm_std::{
use osmosis_std::types::cosmos::base::v1beta1::Coin as OsmosisStdCoin;
use osmosis_std::types::osmosis::poolmanager::v1beta1::{MsgSwapExactAmountIn, SwapAmountInRoute};
use skip::swap::{ExecuteMsg, SwapOperation};
use skip_swap_osmosis_poolmanager_swap::{
use skip_api_swap_adapter_osmosis_poolmanager::{
error::ContractResult, state::ENTRY_POINT_CONTRACT_ADDRESS,
};
use test_case::test_case;
Expand Down Expand Up @@ -267,7 +267,7 @@ fn test_execute_swap(params: Params) -> ContractResult<()> {
ENTRY_POINT_CONTRACT_ADDRESS.save(deps.as_mut().storage, &Addr::unchecked("entry_point"))?;

// Call execute_swap with the given test parameters
let res = skip_swap_osmosis_poolmanager_swap::contract::execute(
let res = skip_api_swap_adapter_osmosis_poolmanager::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
SubMsg,
};
use skip::{error::SkipError, swap::ExecuteMsg};
use skip_swap_osmosis_poolmanager_swap::error::{ContractError, ContractResult};
use skip_api_swap_adapter_osmosis_poolmanager::error::{ContractError, ContractResult};
use test_case::test_case;

/*
Expand Down Expand Up @@ -122,7 +122,7 @@ fn test_execute_transfer_funds_back(params: Params) -> ContractResult<()> {
let info = mock_info(&params.caller, &[]);

// Call execute_swap with the given test parameters
let res = skip_swap_osmosis_poolmanager_swap::contract::execute(
let res = skip_api_swap_adapter_osmosis_poolmanager::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
2 changes: 1 addition & 1 deletion contracts/entry-point/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skip-swap-entry-point"
name = "skip-api-entry-point"
version = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions contracts/entry-point/tests/test_execute_post_swap_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use skip::{
entry_point::{Action, ExecuteMsg},
ibc::{ExecuteMsg as IbcTransferExecuteMsg, IbcFee, IbcInfo},
};
use skip_swap_entry_point::{
use skip_api_entry_point::{
error::ContractError,
state::{BLOCKED_CONTRACT_ADDRESSES, IBC_TRANSFER_CONTRACT_ADDRESS},
};
Expand Down Expand Up @@ -487,7 +487,7 @@ fn test_execute_post_swap_action(params: Params) {
.unwrap();

// Call execute_post_swap_action with the given test parameters
let res = skip_swap_entry_point::contract::execute(
let res = skip_api_entry_point::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
4 changes: 2 additions & 2 deletions contracts/entry-point/tests/test_execute_swap_and_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use skip::{
ibc::{IbcFee, IbcInfo},
swap::{ExecuteMsg as SwapExecuteMsg, Swap, SwapExactCoinIn, SwapExactCoinOut, SwapOperation},
};
use skip_swap_entry_point::{
use skip_api_entry_point::{
error::ContractError,
state::{IBC_TRANSFER_CONTRACT_ADDRESS, SWAP_VENUE_MAP},
};
Expand Down Expand Up @@ -1212,7 +1212,7 @@ fn test_execute_swap_and_action(params: Params) {
.unwrap();

// Call execute_swap_and_action with the given test case params
let res = skip_swap_entry_point::contract::execute(
let res = skip_api_entry_point::contract::execute(
deps.as_mut(),
env,
info,
Expand Down
Loading

0 comments on commit 0bd9593

Please sign in to comment.