-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathEvent.cs
More file actions
40 lines (35 loc) · 1.43 KB
/
Event.cs
File metadata and controls
40 lines (35 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2015-2026 The Neo Project.
//
// Event.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Attributes;
using System;
using System.ComponentModel;
using System.Numerics;
namespace Event;
[DisplayName("SampleEvent")]
[ContractAuthor("code-dev", "dev@neo.org")]
[ContractDescription("A sample contract that demonstrates how to use Events")]
[ContractVersion("0.0.1")]
[ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")]
[ContractPermission(Permission.Any, Method.Any)]
public class SampleEvent : SmartContract
{
[DisplayName("new_event_name")]
public static event Action<byte[], string, BigInteger> event_name;
public static event Action<byte[], BigInteger> event2;
public static bool Main()
{
byte[] ba = new byte[] { 0x01, 0x02, 0x03 };
event_name(ba, "oi", 10); // will Example.SmartContract.Runtime.Notify: 'new_event_name', '\x01\x02\x03', 'oi', 10
event2(ba, 50); // will Example.SmartContract.Runtime.Notify: 'event2', '\x01\x02\x03', '\x32'
return false;
}
}