Skip to content

Commit

Permalink
bridge-hub-polkadot: Update tests to use RelayTreasuryPalletAccount c…
Browse files Browse the repository at this point in the history
…onstant
  • Loading branch information
vgeddes committed Mar 25, 2024
1 parent 3671100 commit c842fca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::*;
use asset_hub_polkadot_runtime::xcm_config::bridging::to_ethereum::{
BridgeHubEthereumBaseFee, EthereumNetwork,
use asset_hub_polkadot_runtime::xcm_config::{
RelayTreasuryPalletAccount,
bridging::to_ethereum::{
BridgeHubEthereumBaseFee, EthereumNetwork
},
};
use bp_bridge_hub_polkadot::snowbridge::CreateAssetCall;
use bridge_hub_polkadot_runtime::{
Expand Down Expand Up @@ -51,8 +54,6 @@ use system_parachains_constants::polkadot::currency::UNITS;

const INITIAL_FUND: u128 = 5_000_000_000 * POLKADOT_ED;
const CHAIN_ID: u64 = 1;
const TREASURY_ACCOUNT: [u8; 32] =
hex!("af3e7da28608e13e4399cc7d14a57bdb154dde5f3d546f5f293994ef36ef7f11");
const WETH: [u8; 20] = hex!("87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d");
const ETHEREUM_DESTINATION_ADDRESS: [u8; 20] = hex!("44a57ee2f2FCcb85FDa2B0B18EBD0D8D2333700e");
const GATEWAY_ADDRESS: [u8; 20] = hex!("EDa338E4dC46038493b885327842fD3E301CaB39");
Expand Down Expand Up @@ -440,7 +441,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {

BridgeHubPolkadot::fund_accounts(vec![
(assethub_sovereign.clone(), INITIAL_FUND),
(TREASURY_ACCOUNT.into(), INITIAL_FUND),
(RelayTreasuryPalletAccount::get(), INITIAL_FUND),
]);
AssetHubPolkadot::fund_accounts(vec![
(AssetHubPolkadotReceiver::get(), INITIAL_FUND),
Expand Down Expand Up @@ -505,7 +506,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {

// check treasury account balance on BH before
let treasury_account_before = BridgeHubPolkadot::execute_with(|| {
<<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into())
<<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&RelayTreasuryPalletAccount::get())
});

AssetHubPolkadot::execute_with(|| {
Expand Down Expand Up @@ -577,7 +578,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
);

// check treasury account balance on BH after (should receive some fees)
let treasury_account_after = <<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into());
let treasury_account_after = <<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&RelayTreasuryPalletAccount::get());
let local_fee = treasury_account_after - treasury_account_before;

let events = BridgeHubPolkadot::events();
Expand All @@ -586,7 +587,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
events.iter().any(|event| matches!(
event,
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount })
if *who == TREASURY_ACCOUNT.into() && *amount == local_fee
if *who == RelayTreasuryPalletAccount::get() && *amount == local_fee
)),
"Snowbridge sovereign takes local fee."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use crate::{
xcm_config, xcm_config::UniversalLocation, Balances, EthereumInboundQueue,
xcm_config, xcm_config::{UniversalLocation, RelayTreasuryPalletAccount}, Balances, EthereumInboundQueue,
EthereumOutboundQueue, EthereumSystem, MessageQueue, Runtime, RuntimeEvent, TransactionByteFee,
TreasuryAccount,
};
pub use bp_bridge_hub_polkadot::snowbridge::EthereumNetwork;
use bp_bridge_hub_polkadot::snowbridge::{CreateAssetCall, InboundQueuePalletInstance, Parameters};
Expand Down Expand Up @@ -157,7 +156,7 @@ impl snowbridge_pallet_system::Config for Runtime {
type OutboundQueue = EthereumOutboundQueue;
type SiblingOrigin = EnsureXcm<AllowSiblingsOnly>;
type AgentIdOf = snowbridge_core::AgentIdOf;
type TreasuryAccount = TreasuryAccount;
type TreasuryAccount = RelayTreasuryPalletAccount;
type Token = Balances;
type WeightInfo = crate::weights::snowbridge_pallet_system::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{
FellowshipLocation, GovernanceLocation, TreasuryAccount, XcmOriginToTransactDispatchOrigin,
FellowshipLocation, GovernanceLocation, XcmOriginToTransactDispatchOrigin,
};

#[cfg(any(feature = "std", test))]
Expand Down

0 comments on commit c842fca

Please sign in to comment.