Skip to content

Commit

Permalink
fix: genesis generate script
Browse files Browse the repository at this point in the history
  • Loading branch information
cosinlink committed Aug 23, 2024
1 parent 91220e9 commit cc8cadf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def generate_from_template(data, template_file, output_file):


def generate_cross_chain(init_batch_size="50"):
contract = "CrossChain.sol"
contract = "deprecated/CrossChain.sol"
backup_file(
os.path.join(work_dir, "contracts", contract), os.path.join(work_dir, "contracts", contract[:-4] + ".bak")
)
Expand All @@ -103,7 +103,7 @@ def generate_cross_chain(init_batch_size="50"):


def generate_relayer_hub(whitelist_1, whitelist_2):
contract = "RelayerHub.sol"
contract = "deprecated/RelayerHub.sol"
backup_file(
os.path.join(work_dir, "contracts", contract), os.path.join(work_dir, "contracts", contract[:-4] + ".bak")
)
Expand Down Expand Up @@ -204,7 +204,7 @@ def generate_system_reward():


def generate_tendermint_light_client(init_consensus_state_bytes, init_reward_for_validator_ser_change="1e16"):
contract = "TendermintLightClient.sol"
contract = "deprecated/TendermintLightClient.sol"
backup_file(
os.path.join(work_dir, "contracts", contract), os.path.join(work_dir, "contracts", contract[:-4] + ".bak")
)
Expand Down Expand Up @@ -522,6 +522,13 @@ def recover():
shutil.copyfile(os.path.join(contracts_dir, file), os.path.join(contracts_dir, c_file))
os.remove(os.path.join(contracts_dir, file))

contracts_dir = os.path.join(contracts_dir, "deprecated")
for file in os.listdir(contracts_dir):
if file.endswith(".bak"):
c_file = file[:-4] + ".sol"
shutil.copyfile(os.path.join(contracts_dir, file), os.path.join(contracts_dir, c_file))
os.remove(os.path.join(contracts_dir, file))

print("Recover from the backup successfully")


Expand Down

0 comments on commit cc8cadf

Please sign in to comment.