Skip to content

Commit

Permalink
Simplify local private key creation
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Sep 27, 2024
1 parent c700180 commit 808f88d
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions tests/enzyme/test_arbitrum_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def wbtc(web3) -> TokenDetails:
def enzyme(
web3,
) -> EnzymeDeployment:
"""Deploy Enzyme protocol with few Chainlink feeds mocked with a static price."""
deployment = EnzymeDeployment.fetch_deployment(web3, ARBITRUM_DEPLOYMENT)
return deployment

Expand Down Expand Up @@ -151,21 +150,12 @@ def vault(
- TermedVaultUSDCPaymentForwarder
"""

# Note that the only way to deploy vault is with a local private key,
# because we call external foundry processes
local_signer: LocalAccount = Account.create()
stash = web3.eth.get_balance(deployer)
tx_hash = web3.eth.send_transaction({"from": deployer, "to": local_signer.address, "value": stash // 2})
assert_transaction_success_with_explanation(web3, tx_hash)

hot_wallet = HotWallet(local_signer)
hot_wallet.sync_nonce(web3)
hot_wallet = HotWallet.create_for_testing(web3)
web3.middleware_onion.add(construct_sign_and_send_raw_middleware_anvil(hot_wallet.account))

# TODO: Hack
enzyme.deployer = hot_wallet.address

web3.middleware_onion.add(construct_sign_and_send_raw_middleware_anvil(local_signer))

return deploy_vault_with_generic_adapter(
enzyme,
deployer=hot_wallet,
Expand Down

0 comments on commit 808f88d

Please sign in to comment.