Skip to content

Commit 14ceca2

Browse files
committed
Merge branch 'dowlandaiello/enhancement-chainagnosticism' into dowlandaiello/enhancement-chainagnosticismastroport
2 parents 29db04c + 2eb9147 commit 14ceca2

File tree

1 file changed

+23
-46
lines changed

1 file changed

+23
-46
lines changed

src/utils/setup/valence.rs

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,14 @@ impl TestContext {
466466
.contract(AUCTIONS_MANAGER_CONTRACT_NAME)
467467
.src(chain)
468468
.get_cw();
469-
let neutron = self.get_chain(chain);
470-
471-
let auction_code_id =
472-
neutron
473-
.contract_codes
474-
.get(AUCTION_CONTRACT_NAME)
475-
.ok_or(Error::Misc(format!(
476-
"contract '{AUCTION_CONTRACT_NAME}' is missing"
477-
)))?;
469+
let local_chain = self.get_chain(chain);
470+
471+
let auction_code_id = local_chain
472+
.contract_codes
473+
.get(AUCTION_CONTRACT_NAME)
474+
.ok_or(Error::Misc(format!(
475+
"contract '{AUCTION_CONTRACT_NAME}' is missing"
476+
)))?;
478477

479478
let contract = contract_a.instantiate(
480479
sender_key,
@@ -490,9 +489,9 @@ impl TestContext {
490489
"",
491490
)?;
492491

493-
let chain = self.get_mut_chain(NEUTRON_CHAIN_NAME);
492+
let local_chain = self.get_mut_chain(chain);
494493

495-
chain
494+
local_chain
496495
.contract_addrs
497496
.insert(AUCTIONS_MANAGER_CONTRACT_NAME.to_owned(), contract.address);
498497

@@ -545,7 +544,7 @@ impl TestContext {
545544
"",
546545
)?;
547546

548-
let chain = self.get_mut_chain(NEUTRON_CHAIN_NAME);
547+
let chain = self.get_mut_chain(chain);
549548

550549
chain
551550
.contract_addrs
@@ -623,10 +622,7 @@ impl TestContext {
623622
receipt
624623
);
625624

626-
self.guard_tx_errors(
627-
NEUTRON_CHAIN_NAME,
628-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
629-
)?;
625+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
630626

631627
Ok(())
632628
}
@@ -686,10 +682,7 @@ impl TestContext {
686682
receipt
687683
);
688684

689-
self.guard_tx_errors(
690-
NEUTRON_CHAIN_NAME,
691-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
692-
)?;
685+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
693686

694687
Ok(())
695688
}
@@ -706,14 +699,10 @@ impl TestContext {
706699
fn tx_update_auction_oracle(&mut self, sender_key: &str, chain: &str) -> Result<(), Error> {
707700
// The auctions manager for this deployment
708701
let contract_a = self.get_auctions_manager().src(chain).get_cw();
709-
let neutron = self.get_chain(chain);
710-
let oracle =
711-
neutron
712-
.contract_addrs
713-
.get(PRICE_ORACLE_NAME)
714-
.ok_or(Error::MissingContextVariable(String::from(
715-
"contract_addrs::price_oracle",
716-
)))?;
702+
let local_chain = self.get_chain(chain);
703+
let oracle = local_chain.contract_addrs.get(PRICE_ORACLE_NAME).ok_or(
704+
Error::MissingContextVariable(String::from("contract_addrs::price_oracle")),
705+
)?;
717706

718707
let receipt = contract_a.execute(
719708
sender_key,
@@ -729,10 +718,7 @@ impl TestContext {
729718
"--gas 2000000",
730719
)?;
731720

732-
self.guard_tx_errors(
733-
NEUTRON_CHAIN_NAME,
734-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
735-
)?;
721+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
736722

737723
Ok(())
738724
}
@@ -774,10 +760,7 @@ impl TestContext {
774760
"--gas 2000000",
775761
)?;
776762

777-
self.guard_tx_errors(
778-
NEUTRON_CHAIN_NAME,
779-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
780-
)?;
763+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
781764

782765
Ok(())
783766
}
@@ -818,10 +801,7 @@ impl TestContext {
818801
format!("--amount {amt_offer_asset}{denom_a} --gas 1000000").as_str(),
819802
)?;
820803

821-
self.guard_tx_errors(
822-
NEUTRON_CHAIN_NAME,
823-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
824-
)?;
804+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
825805

826806
Ok(())
827807
}
@@ -847,9 +827,9 @@ impl TestContext {
847827
pair: (TDenomA, TDenomB),
848828
) -> Result<(), Error> {
849829
let manager = self.get_auctions_manager().src(chain).get_cw();
850-
let neutron = self.get_chain(chain);
830+
let local_chain = self.get_chain(chain);
851831

852-
let start_block_resp = neutron
832+
let start_block_resp = local_chain
853833
.rb
854834
.bin("q block --node=%RPC% --chain-id=%CHAIN_ID%", true);
855835
let maybe_start_block_data: Value = start_block_resp
@@ -885,10 +865,7 @@ impl TestContext {
885865
"--gas 1000000",
886866
)?;
887867

888-
self.guard_tx_errors(
889-
NEUTRON_CHAIN_NAME,
890-
receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str(),
891-
)?;
868+
self.guard_tx_errors(chain, receipt.tx_hash.ok_or(Error::TxMissingLogs)?.as_str())?;
892869

893870
Ok(())
894871
}

0 commit comments

Comments
 (0)