public static BigInteger balanceOf(byte[] account) { BigInteger balance = (BigInteger)0; if (NeoTrace.VERBOSE) { NeoTrace.Trace("balanceOf():entered"); } NPCNEP5LedgerEntry accountLedgerEntry = NPCNEP5LedgerEntry.Get(account); if (NeoTrace.VERBOSE) { NPCNEP5LedgerEntry.Log("balanceOf().ledgerEntry", accountLedgerEntry); } if (!NPCNEP5LedgerEntry.IsMissing(accountLedgerEntry)) { if (NeoTrace.VERBOSE) { NeoTrace.Trace("accountLedgerEntry is not Missing"); } balance = NPCNEP5LedgerEntry.GetBalance(accountLedgerEntry); } return(balance); }
public static bool deploy(NPCNEP5Base tokenbase) { bool result = false; if (NeoTrace.VERBOSE) { NeoTrace.Trace("deploy():entered"); } NPCEnvironment env = NPCEnvironment.New(); NPCEnvironment.Initialize(env); NPCNEP5LedgerEntry ownerLedgerEntry = NPCNEP5LedgerEntry.Get(OwnerAccountScriptHash); if (NeoTrace.VERBOSE) { NPCNEP5LedgerEntry.Log("deploy().ownerLedgerEntry", ownerLedgerEntry); } if (NPCNEP5LedgerEntry.IsMissing(ownerLedgerEntry)) { if (NeoTrace.VERBOSE) { NeoTrace.Trace("ownerLedgerEntry is Missing"); } NPCNEP5LedgerEntry.Set(ownerLedgerEntry, NPCEnvironment.GetBlockTimestamp(env), 0, NPCNEP5Base.GetTotalSupply(tokenbase)); NPCNEP5LedgerEntry.Put(ownerLedgerEntry, OwnerAccountScriptHash); if (NeoTrace.VERBOSE) { NPCNEP5LedgerEntry.Log("deploy().ownerLedgerEntry", ownerLedgerEntry); } result = true; } return(result); }