Skip to content

Commit

Permalink
Merge pull request #262 from openmoneymarket/baln-price
Browse files Browse the repository at this point in the history
Add method to get BALN price from dex
  • Loading branch information
redlarva authored Dec 21, 2021
2 parents 4694ada + 67f6b16 commit 5cb5fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions score/priceOracle/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def getPoolStats(self, _id: int) -> dict:
def getPriceByName(self, _name: str) -> int:
pass

@interface
def getBalnPrice(self) -> int:
pass


class TokenInterface(InterfaceScore):
@interface
Expand Down
3 changes: 3 additions & 0 deletions score/priceOracle/priceOracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def getOMMPool(self) -> str:
def _get_price(self, _base: str, _quote) -> int:
if _base in STABLE_TOKENS:
return 1 * 10 ** 18
elif _base == "BALN":
dex = self.create_interface_score(self.getAddress(DEX), DataSourceInterface)
return dex.getBalnPrice()
else:
oracle = self.create_interface_score(self.getAddress(BAND_ORACLE), OracleInterface)
price = oracle.get_reference_data(_base, _quote)
Expand Down

0 comments on commit 5cb5fc4

Please sign in to comment.