Skip to content

Conversation

@superboyiii
Copy link

@superboyiii superboyiii commented Jan 6, 2026

Description

  1. Fix all failed UTs in Move NEO to TokenManagement neo-project/neo#4413.
  2. Added _OnPayment method in Governance contract to handle NEP-27 payments for validator registration, accepting only GAS tokens and burning the registration fee. (I think it's missing and should be desgined, because existed UT has this scenario)
  3. Enhanced Governance contract _OnTransfer method to handle zero-amount NEO transfers, allowing users to claim unclaimed GAS by transferring 0 NEO. (This makes Neo behavior compatible with the previous)
  4. Make Wallet.cs and AssetDescriptor.cs support Neo token.
  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Testing
  • Run Application
  • Local Computer Tests
  • No Testing

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules


// Handle unclaimed gas distribution when transferring zero amount
// This allows claiming unclaimed gas by transferring 0 NEO
if (amount.IsZero && from is not null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe move this piece of code to a function, @superboyiii

Copy link

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent, @superboyiii


// Register the candidate
if (!RegisterInternal(engine, pubkey))
throw new InvalidOperationException("Failed to register candidate. The witness does not match the public key.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about if it is already registered?
should we abort?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is good to return false as well

/// <param name="amount">The amount of tokens sent.</param>
/// <param name="data">Optional data containing the public key for registration.</param>
[ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States | CallFlags.AllowNotify)]
private async ContractTask _OnPayment(ApplicationEngine engine, UInt160 assetId, UInt160 from, BigInteger amount, StackItem data)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to keep this? RegisterCandidate doesn't work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both can work. Just keep it compatible. Not bad but more convenient.

public AssetDescriptor(DataCache snapshot, ProtocolSettings settings, UInt160 assetId)
{
// GasToken is managed by TokenManagement, not a contract itself
// GasToken and NeoToken are managed by TokenManagement, not contracts themselves
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to support NEP-17 in N4 I think.

@erikzhang erikzhang merged commit c502a93 into erikzhang:move-neo Jan 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants