Skip to content

Commit

Permalink
bigz/fix-test.py (#34)
Browse files Browse the repository at this point in the history
* bigz/fix-test.py

* fix test

* rename ch to drift client in tests

* update protocol v2

---------

Co-authored-by: Chris Heaney <[email protected]>
  • Loading branch information
0xbigz and crispheaney authored Nov 15, 2023
1 parent 3ce200f commit f908649
Show file tree
Hide file tree
Showing 5 changed files with 9,905 additions and 9,900 deletions.
2 changes: 1 addition & 1 deletion protocol-v2
Submodule protocol-v2 updated 739 files
2 changes: 2 additions & 0 deletions src/driftpy/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def initialize(

async def initialize_perp_market(
self,
market_index: int,
price_oracle: PublicKey,
base_asset_reserve: int,
quote_asset_reserve: int,
Expand All @@ -108,6 +109,7 @@ async def initialize_perp_market(
)

return await self.program.rpc["initialize_perp_market"](
market_index,
base_asset_reserve,
quote_asset_reserve,
periodicity,
Expand Down
5 changes: 3 additions & 2 deletions src/driftpy/drift_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

DEFAULT_USER_NAME = "Main Account"

DEFAULT_PUBKEY = PublicKey("11111111111111111111111111111111")

class DriftClient:
"""This class is the main way to interact with Drift Protocol including
Expand Down Expand Up @@ -232,7 +233,7 @@ async def track_market(market_index, is_writable):
spot_market = await get_spot_market_account(
self.program, perp_market.quote_spot_market_index
)
if spot_market.oracle is not None:
if spot_market.oracle != DEFAULT_PUBKEY:
oracle_map[str(spot_market.oracle)] = AccountMeta(
pubkey=spot_market.oracle, is_signer=False, is_writable=False
)
Expand All @@ -248,7 +249,7 @@ async def track_spot_market(spot_market_index, is_writable):
is_writable=is_writable,
)

if include_oracles:
if include_oracles and spot_market.oracle != DEFAULT_PUBKEY:
oracle_map[str(spot_market.pubkey)] = AccountMeta(
pubkey=spot_market.oracle, is_signer=False, is_writable=False
)
Expand Down
Loading

0 comments on commit f908649

Please sign in to comment.