private bool CheckBalance(Snapshot snapshot) { long sysfee = SystemFee.GetData(); if (sysfee <= 0) { return(true); } BigInteger balance = NativeAPI.BalanceOf(snapshot, Genesis.BcpContractAddress, Account); if (balance < sysfee) { return(false); } return(true); }
private bool OnListAssetCommand(string[] args) { if (NoWallet()) { return(true); } try { UInt160 chainHash = args.Length == 3 ? UInt160.Parse(args[2]) : UInt160.Zero; Blockchain blockchain = ZoroChainSystem.Singleton.GetBlockchain(chainHash); using (Snapshot snapshot = blockchain.GetSnapshot()) { foreach (var account in Program.Wallet.GetAccounts()) { Console.WriteLine($" account:{account.ScriptHash}"); Console.WriteLine(); foreach (var item in snapshot.NativeNEP5s.Find().Select(p => p.Value)) { BigInteger balance = NativeAPI.BalanceOf(snapshot, item.AssetId, account.ScriptHash); Console.WriteLine($" id:{item.AssetId}"); Console.WriteLine($" name:{item.Name}"); Console.WriteLine($" balance:{balance}"); Console.WriteLine(); } } } } catch (Exception) { return(true); } return(true); }