Skip to content

Conversation

@shargon
Copy link
Member

@shargon shargon commented Nov 4, 2025

Description

This pull request introduces a new native contract called Treasury to the Neo smart contract platform and integrates it into the codebase. Unit tests are updated to cover the new contract and its identifier.

New Treasury contract integration:

  • Added the new Treasury native contract implementation in Treasury.cs, including NEP-26 and NEP-27 support, payment callbacks, and committee verification logic.
  • Registered the Treasury contract as a static property in NativeContract.cs, making it accessible like other native contracts.
  • Updated test setup data to include the Treasury contract definition and manifest for unit testing.
  • Extended native contract ID tests to verify the new Treasury contract ID (-11).

Bonus calculation refactor:

  • Renamed variables in the CalculateBonus method of NeoToken.cs from sumNeoHold to sumGasPerBlock for improved clarity and consistency, and updated the return statement accordingly. [1] [2]

Type of change

  • 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?

  • UT_NativeContract

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

@shargon shargon requested a review from erikzhang November 4, 2025 13:13
@erikzhang
Copy link
Member

What is the purpose of this native contract?

@shargon
Copy link
Member Author

shargon commented Nov 4, 2025

What is the purpose of this native contract?

2.4 Neo4 roadmap said:

GAS Treasury Allocation:
A portion of newly generated GAS is allocated to the Treasury.

So we will need a treasury contract, isn't it?

Copy link
Member

@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.

I think it looks like to be a good idea.

@erikzhang
Copy link
Member

OK, it's a good idea.

erikzhang
erikzhang previously approved these changes Nov 5, 2025
Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

Unit-tests are failing.

@shargon shargon added the Discussion Initial issue state - proposed but not yet accepted label Nov 5, 2025
erikzhang
erikzhang previously approved these changes Nov 5, 2025
ajara87
ajara87 previously approved these changes Nov 5, 2025
@shargon shargon dismissed stale reviews from Wi1l-B0t, ajara87, erikzhang, and AnnaShaleva via a2c003b November 14, 2025 17:47
ajara87
ajara87 previously approved these changes Nov 14, 2025
@erikzhang erikzhang mentioned this pull request Nov 22, 2025
18 tasks
@shargon shargon changed the base branch from master to master-n3 November 22, 2025 10:33
@shargon shargon dismissed ajara87’s stale review November 22, 2025 10:33

The base branch was changed.

@shargon shargon changed the title [N4] Init Treasury [N3] Init Treasury Nov 22, 2025
@shargon shargon added N3 and removed Discussion Initial issue state - proposed but not yet accepted labels Nov 22, 2025
@shargon
Copy link
Member Author

shargon commented Nov 22, 2025

moved to N3, ready for review @neo-project/core

@shargon shargon added the Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. label Nov 22, 2025
ajara87
ajara87 previously approved these changes Nov 25, 2025
@shargon
Copy link
Member Author

shargon commented Nov 25, 2025

@erikzhang shall this be ported to N4?

@shargon shargon merged commit 9a9ebaf into master-n3 Nov 25, 2025
6 checks passed
@shargon shargon deleted the n4-treasury-init branch November 25, 2025 11:19
@erikzhang
Copy link
Member

Please port to N4.

@shargon shargon mentioned this pull request Nov 25, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. Hardfork N3 Port-to-4.x Ready to Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants