Skip to content

Commit

Permalink
https://github.com/neo-project/neo/pull/2187
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Feb 5, 2021
1 parent 91b0da9 commit b26696c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions neo3/contracts/native/nativecontract.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,18 +658,18 @@ def _set_storage_price(self, engine: contracts.ApplicationEngine, value: int) ->
return True


class Nep17Token(NativeContract):
class FungibleToken(NativeContract):
_id: int = -99999
_decimals: int = -1

_PREFIX_ACCOUNT = b'\x14'
_PREFIX_TOTAL_SUPPLY = b'\x0B'

_state = storage.Nep17StorageState
_state = storage.FungibleTokenStorageState
_symbol: str = ""

def init(self):
super(Nep17Token, self).init()
super(FungibleToken, self).init()
self.manifest.supported_standards = ["NEP-17"]
self.manifest.abi.events = [
contracts.ContractEventDescriptor(
Expand Down Expand Up @@ -930,7 +930,7 @@ def on_balance_changing(self, engine: contracts.ApplicationEngine,
pass


class _NeoTokenStorageState(storage.Nep17StorageState):
class _NeoTokenStorageState(storage.FungibleTokenStorageState):
"""
Helper class for storing voting and bonus GAS state
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def deserialize(self, reader: serialization.BinaryReader) -> None:
self._records = reader.read_serializable_list(_GasRecord)


class NeoToken(Nep17Token):
class NeoToken(FungibleToken):
_id: int = -1
_decimals: int = 0

Expand Down Expand Up @@ -1666,11 +1666,11 @@ def _distribute_gas(self,
GasToken().mint(engine, account, gas, True)


class GasToken(Nep17Token):
class GasToken(FungibleToken):
_id: int = -2
_decimals: int = 8

_state = storage.Nep17StorageState
_state = storage.FungibleTokenStorageState
_symbol = "GAS"

def _initialize(self, engine: contracts.ApplicationEngine) -> None:
Expand Down
2 changes: 1 addition & 1 deletion neo3/contracts/native/nonfungible.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _serializable_init(cls):
return cls(types.UInt160.zero(), "", "")


class NFTAccountState(storage.Nep17StorageState):
class NFTAccountState(storage.FungibleTokenStorageState):
def __init__(self):
super(NFTAccountState, self).__init__()
self.tokens: List[bytes] = []
Expand Down
2 changes: 1 addition & 1 deletion neo3/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
CloneStorageCache,
AttributeCache)
from .snapshot import CloneSnapshot, Snapshot
from .storageitem import StorageItem, StorageFlags, Nep17StorageState
from .storageitem import StorageItem, StorageFlags, FungibleTokenStorageState
from .storagekey import StorageKey
from .contractstate import ContractState
from .utils import NEOByteCompare, NEOSeekSort
4 changes: 2 additions & 2 deletions neo3/storage/storageitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _serializable_init(cls):
return cls(b'')


class Nep17StorageState(IInteroperable, serialization.ISerializable):
class FungibleTokenStorageState(IInteroperable, serialization.ISerializable):
"""
Helper class for NEP17 balance state
Expand All @@ -53,7 +53,7 @@ class Nep17StorageState(IInteroperable, serialization.ISerializable):
"""

def __init__(self):
super(Nep17StorageState, self).__init__()
super(FungibleTokenStorageState, self).__init__()
self._balance: vm.BigInteger = vm.BigInteger.zero()
self._storage_item = StorageItem(b'')

Expand Down

0 comments on commit b26696c

Please sign in to comment.