diff --git a/operate/cli.py b/operate/cli.py index 90e5888dc..501b8c5bf 100644 --- a/operate/cli.py +++ b/operate/cli.py @@ -25,10 +25,6 @@ from aea_ledger_ethereum.ethereum import EthereumCrypto from clea import group, params, run -from operate.constants import KEY, KEYS, OPERATE, SERVICES -from operate.http import Resource -from operate.keys import Keys -from operate.services.manage import Services from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.middleware.cors import CORSMiddleware @@ -36,6 +32,11 @@ from typing_extensions import Annotated from uvicorn.main import run as uvicorn +from operate.constants import KEY, KEYS, OPERATE, SERVICES +from operate.http import Resource +from operate.keys import Keys +from operate.services.manage import Services + DEFAULT_HARDHAT_KEY = ( "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" ).encode() diff --git a/operate/data/contracts/uniswap_v2_erc20/contract.py b/operate/data/contracts/uniswap_v2_erc20/contract.py index 76a10d8f0..06d9c03c3 100644 --- a/operate/data/contracts/uniswap_v2_erc20/contract.py +++ b/operate/data/contracts/uniswap_v2_erc20/contract.py @@ -26,7 +26,6 @@ from aea.contracts.base import Contract from aea_ledger_ethereum import EthereumApi - PUBLIC_ID = PublicId.from_str("valory/uniswap_v2_erc20:0.1.0") _logger = logging.getLogger( diff --git a/operate/http/__init__.py b/operate/http/__init__.py index b4cda4ca4..85de2dc77 100644 --- a/operate/http/__init__.py +++ b/operate/http/__init__.py @@ -23,11 +23,12 @@ import typing as t from abc import ABC -from operate.http.exceptions import NotAllowed, ResourceException from starlette.requests import Request from starlette.responses import JSONResponse from starlette.types import Receive, Scope, Send +from operate.http.exceptions import NotAllowed, ResourceException + GenericResource = t.TypeVar("GenericResource") PostPayload = t.TypeVar("PostPayload") PostResponse = t.TypeVar("PostResponse") diff --git a/operate/keys.py b/operate/keys.py index 035a4e5e3..0d2711caa 100644 --- a/operate/keys.py +++ b/operate/keys.py @@ -24,6 +24,7 @@ from pathlib import Path from aea_ledger_ethereum.ethereum import EthereumCrypto + from operate.types import KeyType diff --git a/operate/ledger/ethereum.py b/operate/ledger/ethereum.py index 8d9d4ad77..be88f061c 100644 --- a/operate/ledger/ethereum.py +++ b/operate/ledger/ethereum.py @@ -22,6 +22,7 @@ import typing as t from aea_ledger_ethereum import EthereumApi, EthereumCrypto + from operate.ledger.base import LedgerHelper from operate.types import LedgerType diff --git a/scripts/fund.py b/scripts/fund.py index 136e7112f..293488c84 100644 --- a/scripts/fund.py +++ b/scripts/fund.py @@ -1,10 +1,11 @@ """Fund an address on gnosis fork.""" -import sys +import json import os -from aea_ledger_ethereum.ethereum import EthereumApi, EthereumCrypto +import sys from pathlib import Path -import json + +from aea_ledger_ethereum.ethereum import EthereumApi, EthereumCrypto from dotenv import load_dotenv OLAS_CONTRACT_ADDRESS_GNOSIS = "0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f" @@ -31,23 +32,37 @@ if staking_keys_path: staking_crypto = EthereumCrypto(staking_keys_path) - with open(Path("operate", "data", "contracts", "uniswap_v2_erc20", "build", "IUniswapV2ERC20.json"), "r") as abi_file: + with open( + Path( + "operate", + "data", + "contracts", + "uniswap_v2_erc20", + "build", + "IUniswapV2ERC20.json", + ), + "r", + ) as abi_file: abi = json.load(abi_file)["abi"] olas_contract = ledger_api.api.eth.contract( address=ledger_api.api.to_checksum_address(OLAS_CONTRACT_ADDRESS_GNOSIS), - abi=abi + abi=abi, ) - tx = olas_contract.functions.transfer(address, int(2e18)).build_transaction({ - "chainId": 100, - "gas": 100000, - "gasPrice": ledger_api.api.to_wei("50", "gwei"), - "nonce": ledger_api.api.eth.get_transaction_count(staking_crypto.address), - }) + tx = olas_contract.functions.transfer(address, int(2e18)).build_transaction( + { + "chainId": 100, + "gas": 100000, + "gasPrice": ledger_api.api.to_wei("50", "gwei"), + "nonce": ledger_api.api.eth.get_transaction_count(staking_crypto.address), + } + ) - signed_txn = ledger_api.api.eth.account.sign_transaction(tx, staking_crypto.private_key) + signed_txn = ledger_api.api.eth.account.sign_transaction( + tx, staking_crypto.private_key + ) tx_hash = ledger_api.api.eth.send_raw_transaction(signed_txn.rawTransaction) balance = olas_contract.functions.balanceOf(address).call() - print(f"Balance of {address} = {balance/1e18} OLAS") \ No newline at end of file + print(f"Balance of {address} = {balance/1e18} OLAS")