@Test public void testHasFunds() throws IOException, ClassNotFoundException { AccountAddress test = AccountAddress.fromHexString("Test"); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(test, accounts); senderAccountState.addToBalance(BigInteger.TEN); AppServiceProvider.getAccountStateService().setAccountState(test, senderAccountState, accounts); Assert.assertTrue(accountsManager.hasFunds(accounts, "Test", BigInteger.TEN)); Assert.assertFalse(accountsManager.hasFunds(accounts, "Test", BigInteger.TEN.add(BigInteger.ONE))); }
public Boolean hasFunds(Accounts accounts, String addressString, BigInteger value) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, value); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); AccountAddress sendAddress = AccountAddress.fromHexString(addressString); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(sendAddress, accounts); return logger.traceExit(senderAccountState.getBalance().compareTo(value) >= 0); }
AccountsManager { public Boolean hasFunds(Accounts accounts, String addressString, BigInteger value) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, value); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); AccountAddress sendAddress = AccountAddress.fromHexString(addressString); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(sendAddress, accounts); return logger.traceExit(senderAccountState.getBalance().compareTo(value) >= 0); } }
AccountsManager { public Boolean hasFunds(Accounts accounts, String addressString, BigInteger value) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, value); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); AccountAddress sendAddress = AccountAddress.fromHexString(addressString); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(sendAddress, accounts); return logger.traceExit(senderAccountState.getBalance().compareTo(value) >= 0); }  }
AccountsManager { public Boolean hasFunds(Accounts accounts, String addressString, BigInteger value) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, value); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); AccountAddress sendAddress = AccountAddress.fromHexString(addressString); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(sendAddress, accounts); return logger.traceExit(senderAccountState.getBalance().compareTo(value) >= 0); }  static AccountsManager instance(); Boolean hasFunds(Accounts accounts, String addressString, BigInteger value); Boolean hasCorrectNonce(Accounts accounts, String addressString, BigInteger nonce); void transferFunds(Accounts accounts, String senderAddress, String receiverAddress, BigInteger value, BigInteger nonce, ShardOperation operation); }
AccountsManager { public Boolean hasFunds(Accounts accounts, String addressString, BigInteger value) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, value); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); AccountAddress sendAddress = AccountAddress.fromHexString(addressString); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(sendAddress, accounts); return logger.traceExit(senderAccountState.getBalance().compareTo(value) >= 0); }  static AccountsManager instance(); Boolean hasFunds(Accounts accounts, String addressString, BigInteger value); Boolean hasCorrectNonce(Accounts accounts, String addressString, BigInteger nonce); void transferFunds(Accounts accounts, String senderAddress, String receiverAddress, BigInteger value, BigInteger nonce, ShardOperation operation);  }