Skip to content

Commit

Permalink
refactor: refactored e2e test to use interfaces provided by the ados
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy0015 committed Nov 19, 2024
1 parent 574959d commit 3b0a4ea
Show file tree
Hide file tree
Showing 30 changed files with 462 additions and 391 deletions.
57 changes: 39 additions & 18 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,45 @@ jobs:
path: ./artifacts/
if-no-files-found: error

# ibc-tests:
# runs-on: ubuntu-latest
# name: Post Build - IBC Tests
# needs: build
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 1
# - name: Download Contracts
# uses: actions/download-artifact@v2
# with:
# name: contracts
# path: "./ibc-tests/contracts"
# - name: Run IBC Tests
# run: |
# cd ./ibc-tests
# npm i
# npm test
ibc-tests:
runs-on: ubuntu-latest
name: Running E2E Test
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: andromedaprotocol/localrelayer
ref: develop
token: ${{ secrets.LOCALRELAYER_ACCESS_TOKEN }}
path: localrelayer
- name: Setup docker
run: |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Setup localrelayer
run: |
cd ./localrelayer
make start-chains
make start-validators
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.75.0
profile: minimal
- name: Download Artifacts To ibc-tests
uses: actions/download-artifact@v3
with:
name: contracts
path: ./ibc-tests/artifacts
- name: Download Artifacts To andromeda testing
uses: actions/download-artifact@v3
with:
name: contracts
path: ./packages/andromeda-testing-e2e/artifacts
- name: Run IBC Tests
run: |
cargo test -p ibc-tests -- --test-threads 1
build-schemas:
runs-on: ubuntu-latest
Expand Down
55 changes: 42 additions & 13 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion contracts/app/andromeda-app-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum-repr = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
andromeda-testing = { workspace = true, optional = true }
cw-orch = { workspace = true }

cw-orch-daemon = "0.24.2"

[features]
testing = ["cw-multi-test", "andromeda-testing"]
10 changes: 10 additions & 0 deletions contracts/app/andromeda-app-contract/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
use andromeda_app::app::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{ado_base::MigrateMsg, contract_interface, deploy::ADOMetadata};
use cw_orch_daemon::{DaemonBase, Wallet};

pub const CONTRACT_ID: &str = "app-contract";

contract_interface!(AppContract, CONTRACT_ID, "andromeda_app_contract.wasm");

type Chain = DaemonBase<Wallet>;

impl AppContract<Chain> {
pub fn get_address(&self, name: impl Into<String>) -> String {
let query_msg = QueryMsg::GetAddress { name: name.into() };
self.query(&query_msg).unwrap()
}
}
1 change: 1 addition & 0 deletions contracts/finance/andromeda-validator-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ chrono = "0.3"
cw-multi-test = { workspace = true, optional = true }
andromeda-testing = { workspace = true }
cw-orch = { workspace = true }
cw-orch-daemon = "0.24.2"
10 changes: 10 additions & 0 deletions contracts/finance/andromeda-validator-staking/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use andromeda_finance::validator_staking::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{ado_base::MigrateMsg, contract_interface, deploy::ADOMetadata};
use cw_orch_daemon::{DaemonBase, Wallet};

pub const CONTRACT_ID: &str = "validator-staking";

Expand All @@ -8,3 +9,12 @@ contract_interface!(
CONTRACT_ID,
"andromeda_validator_staking.wasm"
);

type Chain = DaemonBase<Wallet>;

impl ValidatorStakingContract<Chain> {
pub fn staked_tokens(&self, validator: Option<Addr>) -> Option<::cosmwasm_std::FullDelegation> {
let query_msg = QueryMsg::StakedTokens { validator };
self.query(&query_msg).unwrap()
}
}
1 change: 1 addition & 0 deletions contracts/fungible-tokens/andromeda-cw20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ andromeda-fungible-tokens = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
andromeda-testing = { workspace = true, optional = true }
cw-orch = { workspace = true }
cw-orch-daemon = "0.24.2"

[dev-dependencies]
andromeda-app = { workspace = true }
13 changes: 13 additions & 0 deletions contracts/fungible-tokens/andromeda-cw20/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
use andromeda_fungible_tokens::cw20::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{ado_base::MigrateMsg, contract_interface, deploy::ADOMetadata};
use cw20::BalanceResponse;
use cw_orch_daemon::{DaemonBase, Wallet};

pub const CONTRACT_ID: &str = "cw20";

contract_interface!(CW20Contract, CONTRACT_ID, "andromeda_cw20.wasm");

type Chain = DaemonBase<Wallet>;

impl CW20Contract<Chain> {
pub fn balance(&self, address: impl Into<String>) -> BalanceResponse {
let query_msg = QueryMsg::Balance {
address: address.into(),
};
self.query(&query_msg).unwrap()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ andromeda-non-fungible-tokens = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
andromeda-testing = { workspace = true, optional = true }
cw-orch = { workspace = true }
cw-orch-daemon = "0.24.2"

[dev-dependencies]
andromeda-app = { workspace = true }
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
use andromeda_non_fungible_tokens::crowdfund::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_non_fungible_tokens::crowdfund::{
CampaignSummaryResponse, ExecuteMsg, InstantiateMsg, QueryMsg,
};
use andromeda_std::{ado_base::MigrateMsg, contract_interface, deploy::ADOMetadata};
use cw_orch_daemon::{DaemonBase, Wallet};

pub const CONTRACT_ID: &str = "crowdfund";

contract_interface!(CrowdfundContract, CONTRACT_ID, "andromeda_crowdfund.wasm");

type Chain = DaemonBase<Wallet>;

impl CrowdfundContract<Chain> {
pub fn campaign_summary(&self) -> CampaignSummaryResponse {
let query_msg = QueryMsg::CampaignSummary {};
self.query(&query_msg).unwrap()
}
}
1 change: 1 addition & 0 deletions contracts/non-fungible-tokens/andromeda-cw721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ andromeda-std = { workspace = true, features = ["rates"] }
cw-multi-test = { workspace = true, optional = true }
cw-orch = { workspace = true }
andromeda-testing = { workspace = true, optional = true }
cw-orch-daemon = "0.24.2"
13 changes: 13 additions & 0 deletions contracts/non-fungible-tokens/andromeda-cw721/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
use andromeda_non_fungible_tokens::cw721::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{ado_base::MigrateMsg, contract_interface, deploy::ADOMetadata};
use cw_orch_daemon::{DaemonBase, Wallet};

pub const CONTRACT_ID: &str = "cw721";

contract_interface!(CW721Contract, CONTRACT_ID, "andromeda_cw721.wasm");

type Chain = DaemonBase<Wallet>;

impl CW721Contract<Chain> {
pub fn owner_of(&self, token_id: impl Into<String>) -> cw721::OwnerOfResponse {
let query_msg = QueryMsg::OwnerOf {
token_id: token_id.into(),
include_expired: None,
};
self.query(&query_msg).unwrap()
}
}
Loading

0 comments on commit 3b0a4ea

Please sign in to comment.