Skip to content

Commit

Permalink
Merge pull request #200 from openmoneymarket/omm-balance-fix
Browse files Browse the repository at this point in the history
return available balance on method balanceOf
  • Loading branch information
srmaharjan authored Aug 23, 2021
2 parents f17c2e8 + 672314e commit 85ecda8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions score/ommToken/tokens/IRC2.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ def totalSupply(self) -> int:
@external(readonly=True)
def balanceOf(self, _owner: Address) -> int:
"""
Returns the amount of tokens owned by the account.
Returns the amount of transferable tokens owned by the account excluding staked tokens
:param _owner: The account whose balance is to be checked.
:return Amount of tokens owned by the `account` with the given address.
"""
return self._balances[_owner]

return self.available_balanceOf(_owner)

@external(readonly=True)
def available_balanceOf(self, _owner: Address) -> int:
Expand Down Expand Up @@ -261,7 +262,7 @@ def _transfer(self, _from: Address, _to: Address, _value: int, _data: bytes):
if self._balances[_from] < _value:
revert(f"{TAG}: ""Insufficient balance")
lending_pool = self.create_interface_score(self.getAddresses()[LENDING_POOL], LendingPoolInterface)
isFeeSharingEnabled=lending_pool.isFeeSharingEnable(_from)
isFeeSharingEnabled = lending_pool.isFeeSharingEnable(_from)
if isFeeSharingEnabled:
self.set_fee_sharing_proportion(100)

Expand Down

0 comments on commit 85ecda8

Please sign in to comment.