From b26696cce5edc068d10822771db001dc610eeecb Mon Sep 17 00:00:00 2001 From: Erik van den Brink Date: Fri, 5 Feb 2021 15:04:58 +0100 Subject: [PATCH] https://github.com/neo-project/neo/pull/2187 --- neo3/contracts/native/nativecontract.py | 14 +++++++------- neo3/contracts/native/nonfungible.py | 2 +- neo3/storage/__init__.py | 2 +- neo3/storage/storageitem.py | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/neo3/contracts/native/nativecontract.py b/neo3/contracts/native/nativecontract.py index c268a57f..6be1aa00 100644 --- a/neo3/contracts/native/nativecontract.py +++ b/neo3/contracts/native/nativecontract.py @@ -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( @@ -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 @@ -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 @@ -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: diff --git a/neo3/contracts/native/nonfungible.py b/neo3/contracts/native/nonfungible.py index 6650fc69..33e06b76 100644 --- a/neo3/contracts/native/nonfungible.py +++ b/neo3/contracts/native/nonfungible.py @@ -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] = [] diff --git a/neo3/storage/__init__.py b/neo3/storage/__init__.py index 8a7d7697..bb2cc6b8 100644 --- a/neo3/storage/__init__.py +++ b/neo3/storage/__init__.py @@ -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 diff --git a/neo3/storage/storageitem.py b/neo3/storage/storageitem.py index 84c12064..dfd67fb3 100644 --- a/neo3/storage/storageitem.py +++ b/neo3/storage/storageitem.py @@ -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 @@ -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'')