Skip to content
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

fix nep11 tracker #755

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/TokensTracker/Trackers/TrackerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ protected TransferRecord GetTransferRecord(UInt160 asset, Array stateItems)
return stateItems.Count switch
{
3 => new TransferRecord(asset, @from, to, null, amountItem.GetInteger()),
4 when (stateItems[3] is ByteString tokenId) => new TransferRecord(asset, @from, to, tokenId, amountItem.GetInteger()),
4 when stateItems[3] is ByteString tokenId => new TransferRecord(asset, @from, to, tokenId, amountItem.GetInteger()),
4 when stateItems[3] is Integer tokenId => new TransferRecord(asset, from, to, tokenId.GetSpan().ToArray(), amountItem.GetInteger()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why tokenId is an Integer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it can be used in absence of neo-project/neo#1879?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the developer calls the contract, the tokenid is used as an Integer. The notified field is Integer。

event Example:

public static event Action<ByteString> OnTest;

public static void CallEvent(ByteString tokenId)
{
        OnTest(tokenId);
}

sb.EmitDynamicCall(contract, "callEvent", 1);
type of the field in event : Integer

sb.EmitDynamicCall(contract, "callEvent", ((BigInteger)1).ToByteArray());
type of the field in event: ByteString

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the developer calls the contract, the tokenid is used as an Integer. The notified field is Integer。

event Example:

public static event Action<ByteString> OnTest;

public static void CallEvent(ByteString tokenId)
{
        OnTest(tokenId);
}

sb.EmitDynamicCall(contract, "callEvent", 1); type of the field in event : Integer

sb.EmitDynamicCall(contract, "callEvent", ((BigInteger)1).ToByteArray()); type of the field in event: ByteString

For neo-project/neo#2810, we can ignore these "invalid" transactions and close this PR, right?

_ => null
};
}
Expand Down