deploy.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash
  2. # usage: $ deploy.sh eth,avax,bsc 1,2,3
  3. function deploy_stargates {
  4. # "$@" is the array of parameters passed to this function
  5. arr=("$@")
  6. for network in "${arr[@]}";
  7. do
  8. eval "npx hardhat --network ${network} deploy"
  9. done
  10. }
  11. function wire_stargate_tokens {
  12. arr=("$@")
  13. for network in "${arr[@]}"
  14. do
  15. for targetNetwork in "${arr[@]}"
  16. do
  17. if [[ $network == $targetNetwork ]]
  18. then
  19. continue
  20. fi
  21. eval "npx hardhat --network ${network} wireMirrorgateTokens --target-networks ${targetNetwork}"
  22. done
  23. done
  24. }
  25. function wire_stargates {
  26. arr=("$@")
  27. for network in "${arr[@]}"
  28. do
  29. for targetNetwork in "${arr[@]}"
  30. do
  31. if [[ $network == $targetNetwork ]]
  32. then
  33. continue
  34. fi
  35. eval "npx hardhat --network ${network} wireBridges --target-networks ${targetNetwork}"
  36. done
  37. done
  38. }
  39. function make_pools {
  40. arr=("$@")
  41. for network in "${arr[@]}"
  42. do
  43. eval "npx hardhat --network ${network} createPools"
  44. done
  45. }
  46. function make_chain_paths {
  47. arr=("$@")
  48. for network in "${arr[@]}"
  49. do
  50. for targetNetwork in "${arr[@]}"
  51. do
  52. if [[ $network == $targetNetwork ]]
  53. then
  54. continue
  55. fi
  56. eval "npx hardhat --network ${network} createChainPaths --target-network ${targetNetwork}"
  57. done
  58. done
  59. }
  60. function make_chain_paths_active {
  61. arr=("$@")
  62. for network in "${arr[@]}"
  63. do
  64. for targetNetwork in "${arr[@]}"
  65. do
  66. if [[ $network == $targetNetwork ]]
  67. then
  68. continue
  69. fi
  70. eval "npx hardhat --network ${network} activateChainPaths --target-network ${targetNetwork}"
  71. done
  72. done
  73. }
  74. # deploy and wire stargate instances
  75. #
  76. #echo "[step 1: *Deploy* Stargate instance(s)]"
  77. #deploy_stargates $@
  78. #
  79. echo "[step 2: *Wire* StargateTokens to other StargateTokens]"
  80. wire_stargate_tokens $@
  81. #
  82. echo "[step 3: *Wire Bridges*, connecting each Stargate instance]"
  83. wire_stargates $@
  84. #
  85. echo "[step 4: *Create Pools* for each Stargate instance]"
  86. make_pools $@
  87. #
  88. echo "[step 5: *Create All Chain Paths*, wiring up the Stargate pool mesh]"
  89. make_chain_paths $@
  90. #
  91. echo "[step 6: *Activate Paths*, activating mesh pathways]"
  92. make_chain_paths_active $@