Skip to content

Commit

Permalink
test_demos
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Jan 12, 2024
1 parent 11e12fa commit 409d19d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/dipdup/datasources/abi_etherscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dipdup.config import HttpConfig
from dipdup.config.abi_etherscan import EtherscanDatasourceConfig
from dipdup.datasources import AbiDatasource
from dipdup.exceptions import DatasourceError


class EtherscanDatasource(AbiDatasource[EtherscanDatasourceConfig]):
Expand All @@ -32,4 +33,6 @@ async def get_abi(self, address: str) -> dict[str, Any]:
url='',
params=params,
)
if message := response.get('message'):
raise DatasourceError(message, self.name)
return cast(dict[str, Any], orjson.loads(response['result']))
34 changes: 34 additions & 0 deletions tests/configs/demo_evm_transactions_node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
spec_version: 2.0
package: demo_evm_transactions

datasources:
ethscan:
kind: abi.etherscan

mainnet_node:
kind: evm.node
url: https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY:-''}
ws_url: wss://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY:-''}

mainnet_subsquid:
kind: evm.subsquid
url: ${ARCHIVE_URL:-https://v2.archive.subsquid.io/network/ethereum-mainnet}
node: mainnet_node
node_only: true

contracts:
eth_usdt:
kind: evm
address: 0xdac17f958d2ee523a2206206994597c13d831ec7
typename: eth_usdt

indexes:
eth_usdt_transactions:
kind: evm.subsquid.transactions
datasource: mainnet_subsquid
handlers:
- callback: on_transfer
to: eth_usdt
method: transfer
first_level: 18077421
last_level: 18077421
4 changes: 3 additions & 1 deletion tests/test_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,13 @@ async def assert_run_dao() -> None:
('demo_raw.yml', 'demo_raw', 'init', None),
('demo_evm_events.yml', 'demo_evm_events', 'run', assert_run_evm_events),
('demo_evm_events.yml', 'demo_evm_events', 'init', None),
('demo_evm_events_node.yml', 'demo_evm_events', 'run', assert_run_evm_events),
('demo_evm_transactions.yml', 'demo_evm_transactions', 'run', assert_run_evm_transactions),
('demo_evm_transactions.yml', 'demo_evm_transactions', 'init', None),
('demo_etherlink.yml', 'demo_etherlink', 'run', None),
('demo_etherlink.yml', 'demo_etherlink', 'init', None),
# NOTE: EVM indexes with `node_only`
('demo_evm_events_node.yml', 'demo_evm_events', 'run', assert_run_evm_events),
('demo_evm_transactions_node.yml', 'demo_evm_transactions', 'run', assert_run_evm_transactions),
# NOTE: Smoke tests for small tools.
('demo_dex.yml', 'demo_dex', ('config', 'env', '--compose', '--internal'), None),
('demo_dex.yml', 'demo_dex', ('config', 'export', '--full'), None),
Expand Down

0 comments on commit 409d19d

Please sign in to comment.