Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-agarwal-coinbase committed Nov 21, 2024
1 parent 550e459 commit 632b8e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cdp/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def from_model(cls, model: AssetModel, asset_id: str | None = None) -> "Asset":

return cls(
network_id=model.network_id,
asset_id=model.asset_id,
asset_id=asset_id or model.asset_id,
contract_address=model.contract_address,
decimals=decimals,
)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_asset_from_model_with_gwei(asset_model_factory):
asset_model = asset_model_factory(asset_id="eth", decimals=18)

asset = Asset.from_model(asset_model, asset_id="gwei")
assert asset.asset_id == "gwei"
assert asset.decimals == 9


Expand All @@ -40,6 +41,7 @@ def test_asset_from_model_with_wei(asset_model_factory):
asset_model = asset_model_factory(asset_id="eth", decimals=18)

asset = Asset.from_model(asset_model, asset_id="wei")
assert asset.asset_id == "wei"
assert asset.decimals == 0


Expand Down
2 changes: 1 addition & 1 deletion tests/test_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_balance_from_model_with_asset_id(balance_model_factory):
balance = Balance.from_model(balance_model, asset_id="gwei")
assert balance.amount == Decimal("1000000000")
assert isinstance(balance.asset, Asset)
assert balance.asset.asset_id == "eth"
assert balance.asset.asset_id == "gwei"
assert balance.asset_id == "gwei"


Expand Down

0 comments on commit 632b8e5

Please sign in to comment.