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 <[email protected]>
  • Loading branch information
AnnaShaleva committed Dec 23, 2024
1 parent 216c39e commit 0771b26
Show file tree
Hide file tree
Showing 4 changed files with 13 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
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)) {

Check warning on line 112 in src/Neo/SmartContract/Native/NeoToken.cs

View workflow job for this annotation

GitHub Actions / Format

Fix formatting
manifest.SupportedStandards = new[] { "NEP-17", "NEP-27" };
} else {

Check warning on line 114 in src/Neo/SmartContract/Native/NeoToken.cs

View workflow job for this annotation

GitHub Actions / Format

Fix formatting

Check warning on line 114 in src/Neo/SmartContract/Native/NeoToken.cs

View workflow job for this annotation

GitHub Actions / Format

Fix formatting
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 0771b26

Please sign in to comment.