Skip to content

Commit

Permalink
Neo: add NEP-27 to the list of supported standards starting from Echidna
Browse files Browse the repository at this point in the history
Follow #3597.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Dec 23, 2024
1 parent 216c39e commit 4a393cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 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
9 changes: 9 additions & 0 deletions src/Neo/SmartContract/Native/NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ private protected override async ContractTask PostTransferAsync(ApplicationEngin
await GAS.Mint(engine, distribution.Account, distribution.Amount, callOnPayment);
}

internal 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

0 comments on commit 4a393cb

Please sign in to comment.