-
Notifications
You must be signed in to change notification settings - Fork 1k
[N4] 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
base: master
Are you sure you want to change the base?
[N4] Init Treasury #4271
Changes from all commits
42310ed
f7a5005
8bdddc7
f635cfd
d0ac231
8fe3428
d2fd7ab
7bc2f15
b79bd92
52c0b11
9eaaa57
70a11c6
b4f303e
ce42537
4e6af1a
698d843
a2c003b
94e9306
19d47c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1<<15 for an empty payment callback?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use just 1
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnnaShaleva do you have a cost estimation of empty calls?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not yet, but we may include native method prices evaluation to nspcc-dev/neo-go#4043. @Turalchik is working on this issue right now. For now I agree to use 1, later we may upgrade prices in a subsequent hardfork once benchmarks are done.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ref. nspcc-dev/neo-go#4043 (comment), ref. #3894.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference: The |
||
| } | ||
| } | ||
|
|
||
| #nullable disable | ||
Uh oh!
There was an error while loading. Please reload this page.