diff --git a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh index 9707b8280d6ed..f730efc1e66e3 100755 --- a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh +++ b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh @@ -54,6 +54,7 @@ GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT="5HmYPhRNAenHN6xnDLQDLZq71d4BgzPrdJ2sN ASSET_HUB_WESTEND_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WESTEND="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV" GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT="5CtHyjQE8fbPaQeBrwaGph6qsSEtnMFBAZcAkxwnEfQkkYAq" ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV" +ALICE_SOVEREIGN_ACCOUNT="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" # Expected sovereign accounts for rewards on BridgeHubs. # @@ -178,7 +179,7 @@ function run_parachains_relay() { local relayer_path=$(ensure_relayer) RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ - $relayer_path relay-parachains rococo-to-bridge-hub-westend \ + $relayer_path relay-parachains bridge-hub-rococo-to-bridge-hub-westend \ --only-free-headers \ --source-uri ws://localhost:9942 \ --source-version-mode Auto \ @@ -188,7 +189,7 @@ function run_parachains_relay() { --target-transactions-mortality 4& RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ - $relayer_path relay-parachains westend-to-bridge-hub-rococo \ + $relayer_path relay-parachains bridge-hub-westend-to-bridge-hub-rococo \ --only-free-headers \ --source-uri ws://localhost:9945 \ --source-version-mode Auto \ @@ -250,6 +251,21 @@ case "$1" in "$GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT" \ 10000000000 \ true + # create foreign asset pool + create_pool \ + "ws://127.0.0.1:9910" \ + "//Alice" \ + "$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$WESTEND_GENESIS_HASH' } }] } }')" + # Create liquidity in the pool + add_liquidity \ + "ws://127.0.0.1:9910" \ + "//Alice" \ + "$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$WESTEND_GENESIS_HASH' } }] } }')" \ + 10000000000 \ + 10000000000 \ + "$ALICE_SOVEREIGN_ACCOUNT" # HRMP open_hrmp_channels \ "ws://127.0.0.1:9942" \ @@ -309,6 +325,21 @@ case "$1" in "$GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT" \ 10000000000 \ true + # create foreign asset pool + create_pool \ + "ws://127.0.0.1:9010" \ + "//Alice" \ + "$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ROCOCO_GENESIS_HASH' } }] } }')" + # Create liquidity in the pool + add_liquidity \ + "ws://127.0.0.1:9010" \ + "//Alice" \ + "$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ROCOCO_GENESIS_HASH' } }] } }')" \ + 10000000000 \ + 10000000000 \ + "$ALICE_SOVEREIGN_ACCOUNT" # HRMP open_hrmp_channels \ "ws://127.0.0.1:9945" \ diff --git a/bridges/testing/framework/utils/bridges.sh b/bridges/testing/framework/utils/bridges.sh index 9cd23b509b4ff..db56af28e4b15 100755 --- a/bridges/testing/framework/utils/bridges.sh +++ b/bridges/testing/framework/utils/bridges.sh @@ -243,6 +243,41 @@ function force_create_foreign_asset() { send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 } +function create_pool() { + local runtime_para_endpoint=$1 + local seed=$2 + local native_asset_id=$3 + local foreign_asset_id=$4 + + call_polkadot_js_api \ + --ws "${runtime_para_endpoint?}" \ + --seed "${seed?}" \ + tx.assetConversion.createPool \ + "${native_asset_id}" \ + "${foreign_asset_id}" + } + +function add_liquidity() { + local runtime_para_endpoint=$1 + local seed=$2 + local native_asset_id=$3 + local foreign_asset_id=$4 + local native_asset_amount=$5 + local foreign_asset_amount=$6 + local pool_owner_account_id=$7 + + call_polkadot_js_api \ + --ws "${runtime_para_endpoint?}" \ + --seed "${seed?}" \ + tx.assetConversion.addLiquidity \ + "${native_asset_id}" \ + "${foreign_asset_id}" \ + "${native_asset_amount}" \ + "${foreign_asset_amount}" \ + "1" \ + "1" \ + "${pool_owner_account_id}" +} function limited_reserve_transfer_assets() { local url=$1 local seed=$2