Skip to content

Commit

Permalink
Polygon deployment woes again
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Aug 13, 2024
1 parent bbecfba commit af8a801
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions eth_defi/enzyme/generic_adapter_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import logging
import os
import time
from pathlib import Path
from typing import Collection

Expand Down Expand Up @@ -220,6 +221,12 @@ def deploy_vault_with_generic_adapter(

deployer.sync_nonce(web3)

# Some issue with Polygon deployment,
# bind_vault() fails in the estimate gas
if web3.eth.chain_id == 137:
logger.info("Polygon RPC bug around sleep")
time.sleep(30)

bind_vault(
generic_adapter,
vault,
Expand Down Expand Up @@ -548,6 +555,10 @@ def bind_vault(
):
"""Make GenericAdapter to work with a single vault only."""
assert isinstance(vault, Contract), f"Got {vault}"

assert generic_adapter.functions.vault().call() == ZERO_ADDRESS, "vault() accessor tells vault already bound"
assert generic_adapter.functions.guard().call() != ZERO_ADDRESS, "Does not look like GuardedGenericAdapter: guard() accessor missing"

web3 = vault.w3
tx_hash = generic_adapter.functions.bindVault(
vault.address,
Expand Down
2 changes: 1 addition & 1 deletion eth_defi/hotwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def from_private_key(key: str) -> "HotWallet":
:param key: 0x prefixed hex string
:return: Ready to go hot wallet account
"""
assert type(key) == str
assert type(key) == str, f"Expectd private key as string, got {type(key)}"
assert key.startswith("0x"), f"This system assumes private keys are prefixed with 0x, your key starts with {key[0:4]}... Please add 0x prefix to your private key hex string"
account = Account.from_key(key)
return HotWallet(account)
Expand Down

0 comments on commit af8a801

Please sign in to comment.