Skip to content

Commit

Permalink
onNEP[*]Payment (#2287)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Feb 2, 2021
1 parent 6285ee1 commit bbb458d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/neo/SmartContract/Native/FungibleToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ private void PostTransfer(ApplicationEngine engine, UInt160 from, UInt160 to, Bi

if (!callOnPayment || to is null || ContractManagement.GetContract(engine.Snapshot, to) is null) return;

// Call onPayment method (NEP-17)
// Call onNEP17Payment method

engine.CallFromNativeContract(Hash, to, "onPayment", from?.ToArray() ?? StackItem.Null, amount, data);
engine.CallFromNativeContract(Hash, to, "onNEP17Payment", from?.ToArray() ?? StackItem.Null, amount, data);
}
}
}
3 changes: 3 additions & 0 deletions src/neo/SmartContract/Native/NonfungibleToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ private void PostTransfer(ApplicationEngine engine, UInt160 from, UInt160 to, by
{
engine.SendNotification(Hash, "Transfer",
new Array { from?.ToArray() ?? StackItem.Null, to?.ToArray() ?? StackItem.Null, 1, tokenId });

if (to is not null && ContractManagement.GetContract(engine.Snapshot, to) is not null)
engine.CallFromNativeContract(Hash, to, "onNEP11Payment", from?.ToArray() ?? StackItem.Null, 1, tokenId);
}

class NFTAccountState : AccountState
Expand Down

0 comments on commit bbb458d

Please sign in to comment.