-
Notifications
You must be signed in to change notification settings - Fork 1k
Move NEO to TokenManagement #4413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@superboyiii Can you fix the UTs? 🙏🙏🙏 |
Sure |
|
@erikzhang All done on erikzhang#3. Please review. |
# Conflicts: # tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
|
Need review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request moves NEO token functionality from a standalone native contract (NeoToken) into the Governance contract, managed through TokenManagement. This is a major architectural change that consolidates token management.
Changes:
- Deleted
NeoTokenandFungibleTokenclasses, moving NEO token logic into theGovernancecontract - Removed
AssetDescriptorclass and NEO-specific extension methods - Updated all references from
NativeContract.NEOtoNativeContract.Governancefor governance-related operations andNativeContract.TokenManagementfor balance/transfer operations - Modified storage structure: NEO balances now stored in TokenManagement (prefix 12), while NEO-specific state (voting, gas distribution) stored in Governance (prefix 10)
- Updated test files extensively to use reflection for accessing internal types and adapted to new storage patterns
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Neo/SmartContract/Native/NeoToken.cs | Deleted - NEO token logic moved to Governance |
| src/Neo/SmartContract/Native/FungibleToken.cs | Deleted - base class no longer needed |
| src/Neo/SmartContract/Native/Governance.cs | Major expansion - now handles NEO token, voting, rewards, and committee management |
| src/Neo/SmartContract/Native/NativeContract.cs | Removed NEO property, updated committee checks |
| src/Neo/Wallets/AssetDescriptor.cs | Deleted - asset descriptor functionality removed |
| src/Neo/Wallets/Wallet.cs | Simplified to use TokenManagement.BalanceOf for all tokens |
| tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs | Extensively refactored to use reflection for internal types |
| tests/Neo.UnitTests/Wallets/UT_Wallet.cs | Updated storage setup for NEO/GAS balances |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [ContractMethod(CpuFee = 1 << 17, RequiredCallFlags = CallFlags.ReadStates)] | ||
| public BigInteger UnclaimedGas(ApplicationEngine engine, UInt160 account, uint end) | ||
| { | ||
| var expectEnd = Ledger.CurrentIndex(engine.SnapshotCache) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use PersistingBlock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But UnclaimedGas can be called in verify, and verify typically runs in an environment without a PersistingBlock.
No description provided.