|
| 1 | +module_address="${1:-}" |
| 2 | +admin="${2:-}" |
| 3 | +eid="${3:-40101}" |
| 4 | +peer="${4:-}" |
| 5 | +cli=${5:-"movement"} |
| 6 | +network=${6:-"mainnet"} |
| 7 | +profile=${7:-"default"} |
| 8 | + |
| 9 | +echo "Using CLI: $cli" |
| 10 | +echo "Using Network: $network" |
| 11 | +echo "Module Address: $module_address" |
| 12 | +echo "Admin: $admin" |
| 13 | +echo "EID: $eid" |
| 14 | +echo "Peer: $peer" |
| 15 | + |
| 16 | +multisig=false |
| 17 | +multisig_address="" |
| 18 | + |
| 19 | +# ── Set these per deployment ───────────────────────────────────────────────── |
| 20 | + |
| 21 | +# ───────────────────────────────────────────────────────────────────────────── |
| 22 | + |
| 23 | +if $multisig; then |
| 24 | + if [ -z "$multisig_address" ]; then |
| 25 | + echo "Error: multisig_address must be set if multisig is true" |
| 26 | + exit 1 |
| 27 | + fi |
| 28 | + command="multisig create_transaction --multisig-address $multisig_address" |
| 29 | +else |
| 30 | + command="move run" |
| 31 | +fi |
| 32 | + |
| 33 | +deployer=$(awk '/^ '$profile':/{flag=1} flag && /^ account:/{print $2; exit}' .$cli/config.yaml) |
| 34 | +[[ "$deployer" != 0x* ]] && deployer="0x${deployer}" |
| 35 | +if [ -z "$module_address" ]; then |
| 36 | + module_address="$deployer" |
| 37 | +fi |
| 38 | +[[ "$module_address" != 0x* ]] && module_address="0x${module_address}" |
| 39 | +[[ -n "$multisig_address" && "$multisig_address" != 0x* ]] && multisig_address="0x${multisig_address}" |
| 40 | +[[ -n "$peer" && "$peer" != 0x* ]] && peer="0x${peer}" |
| 41 | +[[ -n "$admin" && "$admin" != 0x* ]] && admin="0x${admin}" |
| 42 | + |
| 43 | +case "${cli}:${network}" in |
| 44 | + movement:testnet) |
| 45 | + msg_lib=0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690 |
| 46 | + executor=0x93353700091200ef9fdc536ce6a86182cc7e62da25f94356be9421c6310b9585 |
| 47 | + endpoint=0x7f03103b83c51c8b09be1751a797a65ac6e755f72947ecdecffc203d32d816c6 |
| 48 | + required_dvns="0x5b983a8faf6977f0bc76ed2a96fda5abdacaeb829841c2d4da176acd78d19d97,0x5e621608b81aa5243d193bf69438c9402712303490d5d974f06f63c154fd977b,0x756f8ab056688d22687740f4a9aeec3b361170b28d08b719e28c4d38eed1043e" |
| 49 | + ;; |
| 50 | + movement:mainnet) |
| 51 | + msg_lib=0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9 |
| 52 | + executor=0x15a5bbf1eb7998a22c9f23810d424abe40bd59ddd8e6ab7e59529853ebed41c4 |
| 53 | + endpoint=0xe60045e20fc2c99e869c1c34a65b9291c020cd12a0d37a00a53ac1348af4f43c |
| 54 | + required_dvns="0x2b696b3ee859b7eb624e1fd5de49f4d3806f49862f1177d6827fd1beffde9179,0xdf8f0a53b20f1656f998504b81259698d126523a31bdbbae45ba1e8a3078d8da,0xbcfb6d3ce5e99275e5fa09b3f53eaaea32365c776d023c51a680c4c420d88b91" |
| 55 | + ;; |
| 56 | + aptos:testnet) |
| 57 | + msg_lib=0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690 |
| 58 | + executor=0x93353700091200ef9fdc536ce6a86182cc7e62da25f94356be9421c6310b9585 |
| 59 | + endpoint=0x7f03103b83c51c8b09be1751a797a65ac6e755f72947ecdecffc203d32d816c6 |
| 60 | + required_dvns="0x5e621608b81aa5243d193bf69438c9402712303490d5d974f06f63c154fd977b,0x756f8ab056688d22687740f4a9aeec3b361170b28d08b719e28c4d38eed1043e,0x5b983a8faf6977f0bc76ed2a96fda5abdacaeb829841c2d4da176acd78d19d97" |
| 61 | + ;; |
| 62 | + aptos:mainnet) |
| 63 | + msg_lib=0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9 |
| 64 | + executor=0x15a5bbf1eb7998a22c9f23810d424abe40bd59ddd8e6ab7e59529853ebed41c4 |
| 65 | + endpoint=0xe60045e20fc2c99e869c1c34a65b9291c020cd12a0d37a00a53ac1348af4f43c |
| 66 | + required_dvns="0x9880ed7ade7e7f8f8eb070ce72c51b231921e29e65b3d51fa3810814bba32c00,0xf3f0a412626edba5ddd3613d91109b241893873ac5479ade231cf0b3130572b5,0xcb2ab3c2fb799c6578b9950f9db7ff555a2d4967ef15437230346f56599801ae" |
| 67 | + ;; |
| 68 | + *) |
| 69 | + echo "Error: unknown cli/network combination '${cli}:${network}'. Use cli=movement|aptos and network=testnet|mainnet." |
| 70 | + exit 1 |
| 71 | + ;; |
| 72 | +esac |
| 73 | + |
| 74 | +enforced_options="0x00030100110100000000000000000000000000013880" |
| 75 | +optional_dvns="" |
| 76 | +use_default_dvns=false |
| 77 | +use_default_confirmations=false |
| 78 | +use_default_optional_dvns=false |
| 79 | +send_confirmations=10 |
| 80 | +receive_confirmations=10 |
| 81 | +max_message_length=10000 |
| 82 | + |
| 83 | +source ./encode_configs.sh |
| 84 | +read -r executor_config send_config receive_config <<<"$(encode_lz_configs \ |
| 85 | + $use_default_confirmations $send_confirmations $receive_confirmations \ |
| 86 | + $use_default_dvns $use_default_optional_dvns \ |
| 87 | + "$required_dvns" "$optional_dvns" \ |
| 88 | + $executor $max_message_length $msg_lib)" |
| 89 | + |
| 90 | +echo "Executor Config: $executor_config" |
| 91 | +echo "Send Config: $send_config" |
| 92 | +echo "Receive Config: $receive_config" |
| 93 | + |
| 94 | +echo yes | $cli $command \ |
| 95 | + --function-id "$module_address::oapp_core::set_delegate" \ |
| 96 | + --args address:$deployer \ |
| 97 | + --profile $profile |
| 98 | + |
| 99 | +echo yes | $cli $command \ |
| 100 | + --function-id "$module_address::oapp_core::set_enforced_options" \ |
| 101 | + --args u32:$eid u16:1 hex:$enforced_options \ |
| 102 | + --profile $profile |
| 103 | + |
| 104 | +echo yes | $cli $command \ |
| 105 | + --function-id "$module_address::oapp_core::set_enforced_options" \ |
| 106 | + --args u32:$eid u16:2 hex:$enforced_options \ |
| 107 | + --profile $profile |
| 108 | + |
| 109 | +echo yes | $cli $command \ |
| 110 | + --function-id "$module_address::oapp_core::set_send_library" \ |
| 111 | + --args u32:$eid address:$msg_lib \ |
| 112 | + --profile $profile |
| 113 | + |
| 114 | +echo yes | $cli $command \ |
| 115 | + --function-id "$module_address::oapp_core::set_receive_library" \ |
| 116 | + --args u32:$eid address:$msg_lib u64:0 \ |
| 117 | + --profile $profile |
| 118 | + |
| 119 | +echo yes | $cli $command \ |
| 120 | + --function-id "$module_address::oapp_core::set_config" \ |
| 121 | + --args address:$msg_lib u32:$eid u32:1 hex:$executor_config \ |
| 122 | + --profile $profile |
| 123 | + |
| 124 | +echo yes | $cli $command \ |
| 125 | + --function-id "$module_address::oapp_core::set_config" \ |
| 126 | + --args address:$msg_lib u32:$eid u32:2 hex:$send_config \ |
| 127 | + --profile $profile |
| 128 | + |
| 129 | +echo yes | $cli $command \ |
| 130 | + --function-id "$module_address::oapp_core::set_config" \ |
| 131 | + --args address:$msg_lib u32:$eid u32:3 hex:$receive_config \ |
| 132 | + --profile $profile |
| 133 | + |
| 134 | +echo yes | $cli $command \ |
| 135 | + --function-id "$module_address::oapp_core::set_peer" \ |
| 136 | + --args u32:$eid hex:$peer \ |
| 137 | + --profile $profile |
0 commit comments