-
Notifications
You must be signed in to change notification settings - Fork 0
/
neoPitchforks
52 lines (45 loc) · 1.79 KB
/
neoPitchforks
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
using Neo;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Attributes;
using Neo.SmartContract.Framework.Services;
using System.Numerics;
namespace NEOPitchforks
{
[SupportedStandards("NEP-17")]
[ContractPermission("*", "*")]
public partial class NEOPitchforksNep17 : Nep17Token
{
protected const string Prefix_Symbol = "symbol";
protected const string Prefix_Decimals = "decimals";
protected const string Prefix_Version = "version";
protected const string VERSION = "v3";
[Safe]
public override string Symbol()
{
return (string)Storage.Get(Storage.CurrentContext, Prefix_Symbol.ToByteArray());
}
[Safe]
public override byte Decimals()
{
var decimals = (BigInteger)Storage.Get(Storage.CurrentContext, Prefix_Decimals.ToByteArray());
return decimals.ToByte();
}
[Safe]
public static string Version() => VERSION;
public static void Init(UInt160 contractOwner, string symbol, int decimals, BigInteger totalSupply)
{
if(Storage.Get(Storage.CurrentContext, Prefix_Symbol.ToByteArray()) != null){
ExecutionEngine.Assert(false, "Contract already initiated.");
}
Storage.Put(Storage.CurrentContext, Prefix_Symbol.ToByteArray(), symbol);
Storage.Put(Storage.CurrentContext, Prefix_Decimals.ToByteArray(), decimals);
Storage.Put(Storage.CurrentContext, Prefix_Version.ToByteArray(), VERSION.ToByteArray());
BigInteger _decimals = BigInteger.Pow(10, decimals);
Mint(contractOwner, totalSupply * _decimals);
}
public static void _deploy(object data, bool update)
{
if (update) return;
}
}
}