public static bool Transfer(UInt160 from, UInt160 to, BigInteger amount, object data)
        {
            if (amount <= 0)
            {
                throw new Exception("The parameter amount MUST be greater than 0.");
            }
            if (!Runtime.CheckWitness(from) && !from.Equals(ExecutionEngine.CallingScriptHash))
            {
                throw new Exception("No authorization.");
            }
            if (AssetStorage.Get(from) < amount)
            {
                throw new Exception("Insufficient balance.");
            }
            if (from == to)
            {
                return(true);
            }

            AssetStorage.Reduce(from, amount);
            AssetStorage.Increase(to, amount);

            OnTransfer(from, to, amount);

            // Validate payable
            if (ContractManagement.GetContract(to) != null)
            {
                Contract.Call(to, "onNEP17Payment", CallFlags.All, new object[] { from, amount, data });
            }
            return(true);
        }
        public static void _deploy(object data, bool update)
        {
            if (update)
            {
                return;
            }
            if (TotalSupplyStorage.Get() > 0)
            {
                throw new Exception("Contract has been deployed.");
            }

            TotalSupplyStorage.Increase(InitialSupply);
            AssetStorage.Increase(Owner, InitialSupply);

            OnTransfer(null, Owner, InitialSupply);
        }
        private static void Mint(BigInteger amount)
        {
            var totalSupply = TotalSupplyStorage.Get();

            var avaliable_supply = MaxSupply - totalSupply;

            if (amount <= 0)
            {
                throw new Exception("Amount must be greater than zero.");
            }
            if (amount > avaliable_supply)
            {
                throw new Exception("Insufficient supply for mint tokens.");
            }

            Transaction tx = (Transaction)ExecutionEngine.ScriptContainer;

            AssetStorage.Increase(tx.Sender, amount);
            TotalSupplyStorage.Increase(amount);

            OnTransfer(null, tx.Sender, amount);
        }