Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
remove gateway contract location
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Nov 2, 2023
1 parent 4f3bf79 commit 3308601
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ use xcm::latest::prelude::*;
use xcm_executor::XcmExecutor;

use crate::xcm_config::{
bridging::to_rococo::EthereumGatewayLocation, ForeignCreatorsSovereignAccountOf,
bridging::to_rococo::EthereumLocation, ForeignCreatorsSovereignAccountOf,
LocalAndForeignAssetsMultiLocationMatcher, TrustBackedAssetsPalletLocation,
};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
Expand Down Expand Up @@ -391,7 +391,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
(
FromSiblingParachain<parachain_info::Pallet<Runtime>>,
snowbridge_router_primitives::inbound::FromEthereumGlobalConsensus<
EthereumGatewayLocation,
EthereumLocation,
>,
),
ForeignCreatorsSovereignAccountOf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use parachains_common::{
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use rococo_runtime_constants::system_parachain::SystemParachains;
use snowbridge_router_primitives::inbound::GlobalConsensusEthereumAccountConvertsFor;
use snowbridge_router_primitives::inbound::GlobalConsensusEthereumConvertsFor;
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use xcm::latest::prelude::*;
use xcm_builder::{
Expand Down Expand Up @@ -113,7 +113,7 @@ pub type LocationToAccountId = (
GlobalConsensusParachainConvertsFor<UniversalLocation, AccountId>,
// Ethereum contract sovereign account.
// (Used to get convert ethereum contract locations to sovereign account)
GlobalConsensusEthereumAccountConvertsFor<AccountId>,
GlobalConsensusEthereumConvertsFor<AccountId>,
);

/// Means for transacting the native currency on this chain.
Expand Down Expand Up @@ -699,7 +699,7 @@ pub type ForeignCreatorsSovereignAccountOf = (
SiblingParachainConvertsVia<Sibling, AccountId>,
AccountId32Aliases<RelayNetwork, AccountId>,
ParentIsPreset<AccountId>,
GlobalConsensusEthereumAccountConvertsFor<AccountId>,
GlobalConsensusEthereumConvertsFor<AccountId>,
);

/// Simple conversion of `u32` into an `AssetId` for use in benchmarking.
Expand Down Expand Up @@ -872,17 +872,7 @@ pub mod bridging {
pub AssetHubRococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(RococoNetwork::get()), Parachain(bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID)));
pub RocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(RococoNetwork::get())));
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 };
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get()))); // TODO: Maybe registry address belongs here

pub const EthereumGatewayAddress: [u8; 20] = hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39");
// The Registry contract for the bridge which is also the origin for reserves and the prefix of all assets.
pub EthereumGatewayLocation: MultiLocation = EthereumLocation::get()
.pushed_with_interior(
AccountKey20 {
network: None,
key: EthereumGatewayAddress::get(),
}
).unwrap();
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get())));

pub RocFromAssetHubRococo: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }),
Expand Down Expand Up @@ -923,7 +913,7 @@ pub mod bridging {
];

pub AllowedReserveTransferAssetsToEthereum: sp_std::vec::Vec<MultiAssetFilter> = sp_std::vec![
Wild(AllOf { fun: WildFungible, id: Concrete(EthereumGatewayLocation::get()) }),
Wild(AllOf { fun: WildFungible, id: Concrete(EthereumLocation::get()) }),
];

/// Universal aliases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ use pallet_xcm::EnsureXcm;
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm::VersionedMultiLocation;
use xcm_config::{EthereumGatewayAddress, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};

use bp_runtime::HeaderId;

Expand Down Expand Up @@ -500,7 +500,7 @@ impl pallet_message_queue::Config for Runtime {

parameter_types! {
pub const Reward: u128 = 10;
pub const GatewayAddress: H160 = H160(EthereumGatewayAddress::get());
pub const GatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
pub const CreateAssetCall: [u8;2] = [53, 0];
pub const CreateAssetExecutionFee: u128 = 2_000_000_000;
pub const SendTokenExecutionFee: u128 = 1_000_000_000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ parameter_types! {
// Network and location for the local Ethereum testnet.
pub const EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 };
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get())));

pub const EthereumGatewayAddress: [u8; 20] = hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39");
// The Registry contract for the bridge which is also the origin for reserves and the prefix of all assets.
pub EthereumGatewayLocation: MultiLocation = EthereumLocation::get()
.pushed_with_interior(
AccountKey20 {
network: None,
key: EthereumGatewayAddress::get(),
}
).unwrap();
}

/// Adapter for resolving `NetworkId` based on `pub storage Flavor: RuntimeFlavor`.
Expand Down Expand Up @@ -428,7 +418,7 @@ pub type AgentIdOf = HashedDescription<H256, DescribeFamily<DescribeAllTerminal>

pub type SnowbridgeExporter = EthereumBlobExporter<
UniversalLocation,
EthereumGatewayLocation,
EthereumLocation,
snowbridge_outbound_queue::Pallet<Runtime>,
AgentIdOf,
>;
Expand Down

0 comments on commit 3308601

Please sign in to comment.