-
Notifications
You must be signed in to change notification settings - Fork 1k
[N3] Init Treasury #4271
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
Merged
Merged
[N3] Init Treasury #4271
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
42310ed
Init Treasury
shargon f7a5005
Remove comments
shargon 8bdddc7
Update src/Neo/SmartContract/Native/Treasury.cs
shargon f635cfd
Update src/Neo/SmartContract/Native/Treasury.cs
shargon d0ac231
Update src/Neo/SmartContract/Native/Treasury.cs
shargon 8fe3428
Update src/Neo/SmartContract/Native/Treasury.cs
shargon d2fd7ab
Fix comments
shargon 7bc2f15
Add SupportedStandards
shargon b79bd92
format
shargon 52c0b11
Fix ut
shargon 9eaaa57
Merge branch 'master' into n4-treasury-init
shargon 70a11c6
Merge branch 'master' into n4-treasury-init
ajara87 b4f303e
Merge branch 'master' into n4-treasury-init
shargon ce42537
Merge branch 'master' into n4-treasury-init
ajara87 4e6af1a
Merge branch 'master' into n4-treasury-init
shargon 698d843
Merge branch 'master' into n4-treasury-init
Wi1l-B0t a2c003b
Delete docs/native-contracts-api.md
shargon 94e9306
Merge branch 'master' into n4-treasury-init
shargon 27da304
Fix Name (#4313)
shargon 19d47c8
Merge branch 'master' into n4-treasury-init
shargon 1205d5c
Change price to 1 << 5
shargon 6267372
Change call flags to None
shargon 9ac8400
fix safe manifest
shargon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // Copyright (C) 2015-2025 The Neo Project. | ||
| // | ||
| // Treasury.cs file belongs to the neo project and is free | ||
| // software distributed under the MIT software license, see the | ||
| // accompanying file LICENSE in the main directory of the | ||
| // repository or http://www.opensource.org/licenses/mit-license.php | ||
| // for more details. | ||
| // | ||
| // Redistribution and use in source and binary forms with or without | ||
| // modifications are permitted. | ||
|
|
||
| #nullable enable | ||
| #pragma warning disable IDE0051 | ||
|
|
||
| using Neo.SmartContract.Manifest; | ||
| using Neo.VM.Types; | ||
| using System.Numerics; | ||
|
|
||
| namespace Neo.SmartContract.Native | ||
| { | ||
| /// <summary> | ||
| /// The Treasury native contract used for manage the treasury funds. | ||
| /// </summary> | ||
| public sealed class Treasury : NativeContract | ||
| { | ||
| internal Treasury() : base() { } | ||
|
|
||
| public override Hardfork? ActiveIn => Hardfork.HF_Faun; | ||
|
|
||
| protected override void OnManifestCompose(IsHardforkEnabledDelegate hfChecker, uint blockHeight, ContractManifest manifest) | ||
| { | ||
| manifest.SupportedStandards = ["NEP-26", "NEP-27"]; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verify checks whether the transaction is signed by the committee. | ||
| /// </summary> | ||
| /// <param name="engine">ApplicationEngine</param> | ||
| /// <returns>Whether transaction is valid.</returns> | ||
| [ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.ReadStates)] | ||
| private bool Verify(ApplicationEngine engine) => CheckCommittee(engine); | ||
|
|
||
| /// <summary> | ||
| /// OnNEP17Payment callback. | ||
| /// </summary> | ||
| /// <param name="engine">ApplicationEngine</param> | ||
| /// <param name="from">GAS sender</param> | ||
| /// <param name="amount">The amount of GAS sent</param> | ||
| /// <param name="data">Optional data</param> | ||
| [ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States)] | ||
| private void OnNEP17Payment(ApplicationEngine engine, UInt160 from, BigInteger amount, StackItem data) { } | ||
shargon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// OnNEP11Payment callback. | ||
| /// </summary> | ||
| /// <param name="engine">ApplicationEngine</param> | ||
| /// <param name="from">GAS sender</param> | ||
| /// <param name="amount">The amount of GAS sent</param> | ||
| /// <param name="tokenId">Nep11 token Id</param> | ||
| /// <param name="data">Optional data</param> | ||
| [ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States)] | ||
| private void OnNEP11Payment(ApplicationEngine engine, UInt160 from, BigInteger amount, byte[] tokenId, StackItem data) { } | ||
shargon marked this conversation as resolved.
Show resolved
Hide resolved
shargon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| #nullable disable | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.