diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 519d6db..e07ab27 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,7 +19,7 @@ Related issue: [ASSET-000](https://pi-lab.atlassian.net/browse/ASSET-000) ## Checklist -- [ ] Did you pass the tests? (Did you execute `pytest -l` in your PC and get a green light?) +- [ ] Did you pass the tests? (Did you execute `pytest -l -all` in your PC and get a green light?) - [ ] Did you run the pre-process? - [ ] Have you added and run tests to validate the changes? - [ ] Have you updated the documentation? diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1cbbcf..3b184cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,25 +10,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --tags - name: Set up Python 3.12 uses: actions/setup-python@v2 with: python-version: "3.12" - - name: Set up requirements for simple test - if: github.event_name == 'pull_request' - run: pip install -e ".[test_simple]" - - - name: Test without rpc using test - if: github.event_name == 'pull_request' - run: pytest -l --skip-rpc-using-test --skip-image-test --ignore=tests/additional/test_file.py - - name: Set up requirements - if: github.event_name == 'push' run: pip install -e ".[test]" - - name: Test with rpc using test - if: github.event_name == 'push' + - name: Test run: pytest -l diff --git a/assets/kaia-0/image-128.png b/assets/kaia-0/image-128.png new file mode 100644 index 0000000..d92495d Binary files /dev/null and b/assets/kaia-0/image-128.png differ diff --git a/assets/kaia-0/image-256.png b/assets/kaia-0/image-256.png new file mode 100644 index 0000000..6202911 Binary files /dev/null and b/assets/kaia-0/image-256.png differ diff --git a/assets/kaia-0/image-32.png b/assets/kaia-0/image-32.png new file mode 100644 index 0000000..81f9f1d Binary files /dev/null and b/assets/kaia-0/image-32.png differ diff --git a/assets/kaia-0/image-64.png b/assets/kaia-0/image-64.png new file mode 100644 index 0000000..c6b0d2d Binary files /dev/null and b/assets/kaia-0/image-64.png differ diff --git a/assets/kaia-0/image.svg b/assets/kaia-0/image.svg new file mode 100644 index 0000000..dcb2f39 --- /dev/null +++ b/assets/kaia-0/image.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/klay-0/info.json b/assets/kaia-0/info.json similarity index 71% rename from assets/klay-0/info.json rename to assets/kaia-0/info.json index a963d39..7fb2dba 100644 --- a/assets/klay-0/info.json +++ b/assets/kaia-0/info.json @@ -3,9 +3,9 @@ { "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "decimals": 18, - "name": "KLAY", + "name": "KAIA", "network": "evm-1001", - "symbol": "KLAY", + "symbol": "KAIA", "tags": [ "native-coin", "testnet" @@ -14,16 +14,16 @@ { "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "decimals": 18, - "name": "KLAY", + "name": "KAIA", "network": "evm-8217", - "symbol": "KLAY", + "symbol": "KAIA", "tags": [ "mainnet", "native-coin" ] } ], - "id": "klay-0", + "id": "kaia-0", "images": { "png128": true, "png256": true, @@ -31,19 +31,19 @@ "png64": true, "svg": true }, - "name": "KLAY", + "name": "KAIA", "references": [ { "id": "coingecko", - "url": "https://www.coingecko.com/en/coins/klaytn" + "url": "https://www.coingecko.com/en/coins/kaia" }, { "id": "coinmarketcap", - "url": "https://coinmarketcap.com/currencies/klaytn/" + "url": "https://coinmarketcap.com/currencies/kaia/" } ], "tags": [ - "klaytn", + "kaia", "native-coin" ] } diff --git a/assets/klay-0/image-128.png b/assets/klay-0/image-128.png deleted file mode 100644 index 97a4747..0000000 Binary files a/assets/klay-0/image-128.png and /dev/null differ diff --git a/assets/klay-0/image-256.png b/assets/klay-0/image-256.png deleted file mode 100644 index 5b0da17..0000000 Binary files a/assets/klay-0/image-256.png and /dev/null differ diff --git a/assets/klay-0/image-32.png b/assets/klay-0/image-32.png deleted file mode 100644 index 8ed908d..0000000 Binary files a/assets/klay-0/image-32.png and /dev/null differ diff --git a/assets/klay-0/image-64.png b/assets/klay-0/image-64.png deleted file mode 100644 index 1343f8d..0000000 Binary files a/assets/klay-0/image-64.png and /dev/null differ diff --git a/assets/klay-0/image.svg b/assets/klay-0/image.svg deleted file mode 100644 index 8ebca24..0000000 --- a/assets/klay-0/image.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/assets/unknown-kaia/image-128.png b/assets/unknown-kaia/image-128.png new file mode 100644 index 0000000..d97253d Binary files /dev/null and b/assets/unknown-kaia/image-128.png differ diff --git a/assets/unknown-kaia/image-256.png b/assets/unknown-kaia/image-256.png new file mode 100644 index 0000000..c4766e7 Binary files /dev/null and b/assets/unknown-kaia/image-256.png differ diff --git a/assets/unknown-kaia/image-32.png b/assets/unknown-kaia/image-32.png new file mode 100644 index 0000000..d44c231 Binary files /dev/null and b/assets/unknown-kaia/image-32.png differ diff --git a/assets/unknown-kaia/image-64.png b/assets/unknown-kaia/image-64.png new file mode 100644 index 0000000..a51fbed Binary files /dev/null and b/assets/unknown-kaia/image-64.png differ diff --git a/assets/unknown-kaia/image.svg b/assets/unknown-kaia/image.svg new file mode 100644 index 0000000..0d4ba89 --- /dev/null +++ b/assets/unknown-kaia/image.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/assets/unknown-klaytn/info.json b/assets/unknown-kaia/info.json similarity index 79% rename from assets/unknown-klaytn/info.json rename to assets/unknown-kaia/info.json index 858db2c..892008b 100644 --- a/assets/unknown-klaytn/info.json +++ b/assets/unknown-kaia/info.json @@ -3,7 +3,7 @@ { "address": "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF", "decimals": 0, - "name": "Unknown Klaytn Asset", + "name": "Unknown Kaia Asset", "network": "evm-1001", "symbol": "UNKNOWN", "tags": [ @@ -13,7 +13,7 @@ { "address": "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF", "decimals": 0, - "name": "Unknown Klaytn Asset", + "name": "Unknown Kaia Asset", "network": "evm-8217", "symbol": "UNKNOWN", "tags": [ @@ -21,7 +21,7 @@ ] } ], - "id": "unknown-klaytn", + "id": "unknown-kaia", "images": { "png128": true, "png256": true, @@ -29,9 +29,9 @@ "png64": true, "svg": true }, - "name": "Unknown Klaytn Asset", + "name": "Unknown Kaia Asset", "references": [], "tags": [ - "klaytn" + "kaia" ] } diff --git a/assets/unknown-klaytn/image-128.png b/assets/unknown-klaytn/image-128.png deleted file mode 100644 index bac51c1..0000000 Binary files a/assets/unknown-klaytn/image-128.png and /dev/null differ diff --git a/assets/unknown-klaytn/image-256.png b/assets/unknown-klaytn/image-256.png deleted file mode 100644 index c45e961..0000000 Binary files a/assets/unknown-klaytn/image-256.png and /dev/null differ diff --git a/assets/unknown-klaytn/image-32.png b/assets/unknown-klaytn/image-32.png deleted file mode 100644 index 8edb7df..0000000 Binary files a/assets/unknown-klaytn/image-32.png and /dev/null differ diff --git a/assets/unknown-klaytn/image-64.png b/assets/unknown-klaytn/image-64.png deleted file mode 100644 index 1b0b593..0000000 Binary files a/assets/unknown-klaytn/image-64.png and /dev/null differ diff --git a/assets/unknown-klaytn/image.svg b/assets/unknown-klaytn/image.svg deleted file mode 100644 index 0ea6bf7..0000000 --- a/assets/unknown-klaytn/image.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/assets/wklay-0/image-128.png b/assets/wklay-0/image-128.png deleted file mode 100644 index 97a4747..0000000 Binary files a/assets/wklay-0/image-128.png and /dev/null differ diff --git a/assets/wklay-0/image-256.png b/assets/wklay-0/image-256.png deleted file mode 100644 index 5b0da17..0000000 Binary files a/assets/wklay-0/image-256.png and /dev/null differ diff --git a/assets/wklay-0/image-32.png b/assets/wklay-0/image-32.png deleted file mode 100644 index 8ed908d..0000000 Binary files a/assets/wklay-0/image-32.png and /dev/null differ diff --git a/assets/wklay-0/image-64.png b/assets/wklay-0/image-64.png deleted file mode 100644 index 1343f8d..0000000 Binary files a/assets/wklay-0/image-64.png and /dev/null differ diff --git a/assets/wklay-0/image.svg b/assets/wklay-0/image.svg deleted file mode 100644 index 8ebca24..0000000 --- a/assets/wklay-0/image.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/assets/wklay-0/info.json b/assets/wklay-0/info.json deleted file mode 100644 index 9b3c079..0000000 --- a/assets/wklay-0/info.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "contracts": [ - { - "address": "0xe4f05A66Ec68B54A58B17c22107b02e0232cC817", - "decimals": 18, - "name": "Wrapped Klay", - "network": "evm-8217", - "symbol": "WKLAY", - "tags": [ - "mainnet", - "wrapped-coin" - ] - } - ], - "id": "wklay-0", - "images": { - "png128": true, - "png256": true, - "png32": true, - "png64": true, - "svg": true - }, - "name": "Wrapped Klay", - "references": [ - { - "id": "coingecko", - "url": "https://www.coingecko.com/en/coins/wrapped-klay" - }, - { - "id": "coinmarketcap", - "url": "https://coinmarketcap.com/currencies/wrapped-klaytn" - } - ], - "tags": [ - "klaytn", - "native-coin" - ] -} diff --git a/enums/ids/asset.json b/enums/ids/asset.json index 8d6c32c..04cf3e5 100644 --- a/enums/ids/asset.json +++ b/enums/ids/asset.json @@ -695,6 +695,10 @@ "description": "JUST", "value": "jst-1" }, + { + "description": "KAIA", + "value": "kaia-0" + }, { "description": "KarratCoin", "value": "karrat-0" @@ -711,10 +715,6 @@ "description": "Kendu Inu", "value": "kendu-0" }, - { - "description": "KLAY", - "value": "klay-0" - }, { "description": "Kusama", "value": "ksm-1" @@ -1268,8 +1268,8 @@ "value": "unknown-ethereum" }, { - "description": "Unknown Klaytn Asset", - "value": "unknown-klaytn" + "description": "Unknown Kaia Asset", + "value": "unknown-kaia" }, { "description": "Unknown Optimism Asset", @@ -1379,10 +1379,6 @@ "description": "Witch Token", "value": "witch-0" }, - { - "description": "Wrapped Klay", - "value": "wklay-0" - }, { "description": "Worldcoin", "value": "wld-0" diff --git a/enums/ids/network.explorer.json b/enums/ids/network.explorer.json index 961347a..6aaeb4f 100644 --- a/enums/ids/network.explorer.json +++ b/enums/ids/network.explorer.json @@ -16,8 +16,12 @@ "description": "Explorer powered by Etherscan" }, { - "value": "klaytnscope", - "description": "Explorer for Klaytn network" + "value": "kaiascan", + "description": "Explorer powered by BISONAI" + }, + { + "value": "kaiascope", + "description": "Explorer powered by Ozys" }, { "value": "otterscan", diff --git a/enums/ids/network.json b/enums/ids/network.json index c1fe23e..2bf5d01 100644 --- a/enums/ids/network.json +++ b/enums/ids/network.json @@ -16,7 +16,7 @@ "value": "evm-10" }, { - "description": "Klaytn Testnet Baobab", + "description": "Kaia Testnet Kairos", "value": "evm-1001" }, { @@ -88,7 +88,7 @@ "value": "evm-80002" }, { - "description": "Klaytn Mainnet Cypress", + "description": "Kaia Mainnet", "value": "evm-8217" }, { diff --git a/enums/tags/asset.json b/enums/tags/asset.json index 3959130..3a854ff 100644 --- a/enums/tags/asset.json +++ b/enums/tags/asset.json @@ -32,8 +32,8 @@ "description": "Main network of asset is Ethereum" }, { - "value": "klaytn", - "description": "Main network of asset is Klaytn" + "value": "kaia", + "description": "Main network of asset is Kaia" }, { "value": "native-coin", diff --git a/enums/tags/network.json b/enums/tags/network.json index 046db79..b66ce8f 100644 --- a/enums/tags/network.json +++ b/enums/tags/network.json @@ -36,8 +36,8 @@ "description": "Goerli testnet" }, { - "value": "klaytn", - "description": "Klaytn networks" + "value": "kaia", + "description": "Kaia networks" }, { "value": "l2-ethereum", diff --git a/networks/evm-1001/image-128.png b/networks/evm-1001/image-128.png index d60c4d9..6a5caea 100644 Binary files a/networks/evm-1001/image-128.png and b/networks/evm-1001/image-128.png differ diff --git a/networks/evm-1001/image-256.png b/networks/evm-1001/image-256.png index e43e4e0..b2c4362 100644 Binary files a/networks/evm-1001/image-256.png and b/networks/evm-1001/image-256.png differ diff --git a/networks/evm-1001/image-32.png b/networks/evm-1001/image-32.png index d7e3ac4..3ed5b0e 100644 Binary files a/networks/evm-1001/image-32.png and b/networks/evm-1001/image-32.png differ diff --git a/networks/evm-1001/image-64.png b/networks/evm-1001/image-64.png index 610d9cd..219033c 100644 Binary files a/networks/evm-1001/image-64.png and b/networks/evm-1001/image-64.png differ diff --git a/networks/evm-1001/image.svg b/networks/evm-1001/image.svg index e291314..fe73261 100644 --- a/networks/evm-1001/image.svg +++ b/networks/evm-1001/image.svg @@ -1,5 +1,29 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/networks/evm-1001/info.json b/networks/evm-1001/info.json index 2f48162..3985b29 100644 --- a/networks/evm-1001/info.json +++ b/networks/evm-1001/info.json @@ -2,15 +2,19 @@ "currency": { "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "decimals": 18, - "id": "klay-0", - "name": "KLAY", - "symbol": "KLAY" + "id": "kaia-0", + "name": "KAIA", + "symbol": "KAIA" }, "engine": "evm", "explorers": [ { - "id": "klaytnscope", - "url": "https://baobab.klaytnscope.com/" + "id": "kaiascan", + "url": "https://kairos.kaiascan.io/" + }, + { + "id": "kaiascope", + "url": "https://kairos.kaiascope.com/" } ], "id": "evm-1001", @@ -21,10 +25,10 @@ "png64": true, "svg": true }, - "name": "Klaytn Testnet Baobab", + "name": "Kaia Testnet Kairos", "network": "testnet", "tags": [ - "klaytn" + "kaia" ], - "unknownAssetId": "unknown-klaytn" + "unknownAssetId": "unknown-kaia" } diff --git a/networks/evm-8217/image-128.png b/networks/evm-8217/image-128.png index a9222fb..606c1d7 100644 Binary files a/networks/evm-8217/image-128.png and b/networks/evm-8217/image-128.png differ diff --git a/networks/evm-8217/image-256.png b/networks/evm-8217/image-256.png index fee2de0..965c2e0 100644 Binary files a/networks/evm-8217/image-256.png and b/networks/evm-8217/image-256.png differ diff --git a/networks/evm-8217/image-32.png b/networks/evm-8217/image-32.png index d442fdc..06e1218 100644 Binary files a/networks/evm-8217/image-32.png and b/networks/evm-8217/image-32.png differ diff --git a/networks/evm-8217/image-64.png b/networks/evm-8217/image-64.png index 4c8a3e9..b4fbb52 100644 Binary files a/networks/evm-8217/image-64.png and b/networks/evm-8217/image-64.png differ diff --git a/networks/evm-8217/image.svg b/networks/evm-8217/image.svg index 8ffaf7b..09e27bb 100644 --- a/networks/evm-8217/image.svg +++ b/networks/evm-8217/image.svg @@ -1,15 +1,45 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/networks/evm-8217/info.json b/networks/evm-8217/info.json index d4e5fc1..e77ef62 100644 --- a/networks/evm-8217/info.json +++ b/networks/evm-8217/info.json @@ -2,15 +2,19 @@ "currency": { "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "decimals": 18, - "id": "klay-0", - "name": "KLAY", - "symbol": "KLAY" + "id": "kaia-0", + "name": "KAIA", + "symbol": "KAIA" }, "engine": "evm", "explorers": [ { - "id": "klaytnscope", - "url": "https://klaytnscope.com/" + "id": "kaiascan", + "url": "https://kaiascan.io/" + }, + { + "id": "kaiascope", + "url": "https://kaiascope.com/" } ], "id": "evm-8217", @@ -21,10 +25,10 @@ "png64": true, "svg": true }, - "name": "Klaytn Mainnet Cypress", + "name": "Kaia Mainnet", "network": "mainnet", "tags": [ - "klaytn" + "kaia" ], - "unknownAssetId": "unknown-klaytn" + "unknownAssetId": "unknown-kaia" } diff --git a/requirements/test.txt b/requirements/test.txt index 1c250e9..5933515 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,5 @@ # Specifies the packages for testing the project. +GitPython==3.1.43 pytest==7.4.4 pytest-asyncio==0.23.7 pigar==2.1.6 diff --git a/tests/additional/test_rpc.py b/tests/additional/test_rpc.py index c18c7a3..c828a70 100644 --- a/tests/additional/test_rpc.py +++ b/tests/additional/test_rpc.py @@ -2,9 +2,9 @@ from copy import deepcopy from pathlib import Path from re import search -from subprocess import run, PIPE import pytest +from git import Repo from pydantic import HttpUrl from web3 import Web3, HTTPProvider @@ -71,11 +71,18 @@ async def __test_rpc_url(self, network: Network): pass @pytest.mark.asyncio - async def test_all_contracts_info_valid(self): + async def test_modified_contracts_info_valid(self): """All contracts in asset information are valid.""" for asset in self.__filter_modified_assets(): await gather(*[self.__test_all_contract_info_valid(asset)]) + @pytest.mark.all + @pytest.mark.asyncio + async def test_all_contracts_info_valid(self): + """All contracts in asset information are valid.""" + for asset, _ in self.asset_list: + await gather(*[self.__test_all_contract_info_valid(asset)]) + async def __test_all_contract_info_valid(self, asset: Asset): """Test the validity of the contract information. @@ -106,27 +113,10 @@ async def __test_all_contract_info_valid(self, asset: Asset): pass def __filter_modified_assets(self) -> list[Asset]: - """Filter the modified assets.""" - # Get recent tag - recent_tag_result = run( - ["git", "describe", "--tags", "--abbrev=0", "HEAD^"], - stdout=PIPE, - stderr=PIPE, - text=True, - check=True, - ) - recent_tag = recent_tag_result.stdout.strip() - # Get modified files - diff_result = run( - ["git", "diff", "--name-only", recent_tag], - stdout=PIPE, - stderr=PIPE, - text=True, - check=True, - ) - changed_files = [ - file for file in diff_result.stdout.strip().split("\n") if file - ] + """Filter the modified assets until the recent tag.""" + repo = Repo(PWD) + recent_tag = repo.tags[-1] + changed_files = [item.a_path for item in repo.index.diff(recent_tag.commit)] asset_matches = [ search(r"assets/([^/]+)/info.json", file) for file in changed_files ] diff --git a/tests/conftest.py b/tests/conftest.py index e1c010a..7eda787 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,21 +10,30 @@ def pytest_addoption(parser: pytest.Parser): parser.addoption( "--skip-image-test", action="store_true", help="Skip the image test." ) + parser.addoption( + "--all", + action="store_true", + help="Run all tests.", + ) def pytest_configure(config: pytest.Config): config.addinivalue_line("markers", "rpc: Skip the RPC connection using test.") config.addinivalue_line("markers", "image: Skip the image test.") + config.addinivalue_line("markers", "all: Run all tests.") def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]): - if config.getoption("--skip-rpc-using-test"): + if config.getoption("--all", default=False): + return + else: + skip_not_all = pytest.mark.skip(reason="Skip the test in all.") skip_rpc = pytest.mark.skip(reason="Skip the RPC connection using test.") - for item in items: - if "rpc" in item.keywords: - item.add_marker(skip_rpc) - if config.getoption("--skip-image-test"): skip_image = pytest.mark.skip(reason="Skip the image test.") for item in items: - if "image" in item.keywords: + if "all" in item.keywords: + item.add_marker(skip_not_all) + elif config.getoption("--skip-rpc-using-test") and "rpc" in item.keywords: + item.add_marker(skip_rpc) + elif config.getoption("--skip-image-test") and "image" in item.keywords: item.add_marker(skip_image)