Skip to content

Commit

Permalink
NeoToken: add NEP-27 to supported standards list starting from Echidna
Browse files Browse the repository at this point in the history
#3597 introduces `onNEP17Payment`
handler to native NeoToke contract starting from Echidna hardfork. We
need to update the list of supported standards respectively.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Dec 23, 2024
1 parent 216c39e commit 285ee2c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Neo/SmartContract/Native/FungibleToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected FungibleToken() : base()
Factor = BigInteger.Pow(10, Decimals);
}

protected override void OnManifestCompose(ContractManifest manifest)
protected override void OnManifestCompose(IsHardforkEnabledDelegate hfChecker, uint blockHeight, ContractManifest manifest)
{
manifest.SupportedStandards = new[] { "NEP-17" };
}
Expand Down
4 changes: 2 additions & 2 deletions src/Neo/SmartContract/Native/NativeContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public ContractState GetContractState(IsHardforkEnabledDelegate hfChecker, uint
Extra = null
};

OnManifestCompose(manifest);
OnManifestCompose(hfChecker, blockHeight, manifest);

// Return ContractState
return new ContractState
Expand All @@ -271,7 +271,7 @@ public ContractState GetContractState(IsHardforkEnabledDelegate hfChecker, uint
};
}

protected virtual void OnManifestCompose(ContractManifest manifest) { }
protected virtual void OnManifestCompose(IsHardforkEnabledDelegate hfChecker, uint blockHeight, ContractManifest manifest) { }

/// <summary>
/// It is the initialize block
Expand Down
13 changes: 13 additions & 0 deletions src/Neo/SmartContract/Native/NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Neo.IO;
using Neo.Persistence;
using Neo.SmartContract.Iterators;
using Neo.SmartContract.Manifest;
using Neo.VM;
using Neo.VM.Types;
using System;
Expand Down Expand Up @@ -107,6 +108,18 @@ private protected override async ContractTask PostTransferAsync(ApplicationEngin
await GAS.Mint(engine, distribution.Account, distribution.Amount, callOnPayment);
}

protected override void OnManifestCompose(IsHardforkEnabledDelegate hfChecker, uint blockHeight, ContractManifest manifest)
{
if (hfChecker(Hardfork.HF_Echidna, blockHeight))
{
manifest.SupportedStandards = new[] { "NEP-17", "NEP-27" };
}
else
{
manifest.SupportedStandards = new[] { "NEP-17" };
}
}

private GasDistribution DistributeGas(ApplicationEngine engine, UInt160 account, NeoAccountState state)
{
// PersistingBlock is null when running under the debugger
Expand Down
Loading

0 comments on commit 285ee2c

Please sign in to comment.