-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Zerion configuration to Chain (#1153)
Add Chain['balances_provider'] field, holding chainName and enabled properties
- Loading branch information
1 parent
46e916d
commit 43ed504
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/chains/migrations/0042_chain_balances_provider_chain_name_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.2 on 2024-06-13 11:11 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("chains", "0041_chain_prices_provider_chain_name_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="chain", | ||
name="balances_provider_chain_name", | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name="chain", | ||
name="balances_provider_enabled", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="This flag informs API clients whether the balances provider is enabled for the chain", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.db.migrations.state import StateApps | ||
|
||
from chains.migrations.tests.utils import TestMigrations | ||
|
||
|
||
class Migration0042TestCase(TestMigrations): | ||
migrate_from = "0041_chain_prices_provider_chain_name_and_more" | ||
migrate_to = "0042_chain_balances_provider_chain_name_and_more" | ||
|
||
def setUpBeforeMigration(self, apps: StateApps) -> None: | ||
Chain = apps.get_model("chains", "Chain") | ||
Chain.objects.create( | ||
id=1, | ||
name="Mainnet", | ||
short_name="eth", | ||
description="", | ||
l2=False, | ||
rpc_authentication="API_KEY_PATH", | ||
rpc_uri="https://mainnet.infura.io/v3/", | ||
safe_apps_rpc_authentication="API_KEY_PATH", | ||
safe_apps_rpc_uri="https://mainnet.infura.io/v3/", | ||
block_explorer_uri_address_template="https://etherscan.io/address/{{address}}", | ||
block_explorer_uri_tx_hash_template="https://etherscan.io/tx/{{txHash}}", | ||
currency_name="Ether", | ||
currency_symbol="ETH", | ||
currency_decimals=18, | ||
currency_logo_uri="https://gnosis-safe-token-logos.s3.amazonaws.com/ethereum-eth-logo.png", | ||
transaction_service_uri="http://mainnet-safe-transaction-web.safe.svc.cluster.local", | ||
vpc_transaction_service_uri="", | ||
theme_text_color="#001428", | ||
theme_background_color="#E8E7E6", | ||
ens_registry_address="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", | ||
recommended_master_copy_version="1.3.0", | ||
prices_provider_native_coin="ethereum", | ||
prices_provider_chain_name="ethereum", | ||
hidden=False, | ||
) | ||
|
||
def test_new_fields(self) -> None: | ||
Chain = self.apps_registry.get_model("chains", "Chain") | ||
|
||
chain = Chain.objects.get(id=1) | ||
|
||
self.assertEqual(chain.balances_provider_chain_name, None) | ||
self.assertEqual(chain.balances_provider_enabled, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters