Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -250,6 +251,21 @@ case "$1" in
"$GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT" \
10000000000 \
true
# create foreign asset pool
create_pool \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antkve Anthony, cool, create_pool / add_liquidity works, but I think we need here more fixes for polkadot-sdk, please port the changes from here polkadot-fellows/runtimes#764 to the polkadot-sdk

"ws://127.0.0.1:9910" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use variables here instead of raw addresses ? like "${WESTEND_RPC_URL}" vs "ws://127.0.0.1:9910" so its clear which chain this is targetting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karolk91 actually, a very good point :), yes, we could do this, but I am also thinking about rewriting this scripts to PAPI, so I would keep it this way for now

"//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" \
Expand Down Expand Up @@ -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" \
Expand Down
35 changes: 35 additions & 0 deletions bridges/testing/framework/utils/bridges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down