-
Notifications
You must be signed in to change notification settings - Fork 4
/
BurgerAgent.cs
55 lines (47 loc) · 1.83 KB
/
BurgerAgent.cs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.ComponentModel;
using System.Numerics;
using Neo;
using Neo.SmartContract;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Native;
using Neo.SmartContract.Framework.Services;
using Neo.SmartContract.Framework.Attributes;
namespace NeoBurger
{
[ManifestExtra("Author", "NEOBURGER")]
[ManifestExtra("Email", "[email protected]")]
[ManifestExtra("Description", "Agent Contract")]
[ContractPermission("*", "*")]
public class BurgerAgent : SmartContract
{
[InitialValue("[TODO]: ARGS", ContractParameterType.Hash160)]
private static readonly UInt160 CORE = default;
public static void Transfer(UInt160 to, BigInteger amount)
{
ExecutionEngine.Assert(Runtime.CheckWitness(CORE));
ExecutionEngine.Assert(NEO.Transfer(Runtime.ExecutingScriptHash, to, amount));
}
public static void Sync()
{
ExecutionEngine.Assert(NEO.Transfer(Runtime.ExecutingScriptHash, Runtime.ExecutingScriptHash, 0));
}
public static void Claim()
{
ExecutionEngine.Assert(GAS.Transfer(Runtime.ExecutingScriptHash, CORE, GAS.BalanceOf(Runtime.ExecutingScriptHash), true));
}
public static void Vote(Neo.Cryptography.ECC.ECPoint target)
{
ExecutionEngine.Assert(Runtime.CheckWitness(CORE));
ExecutionEngine.Assert(NEO.Vote(Runtime.ExecutingScriptHash, target));
}
public static void OnNEP17Payment(UInt160 from, BigInteger amount, object data)
{
}
public static void Update(ByteString nefFile, string manifest)
{
ExecutionEngine.Assert(Runtime.CheckWitness((UInt160)Contract.Call(CORE, "owner", CallFlags.All)));
ContractManagement.Update(nefFile, manifest, null);
}
}
}