Java Code Examples for org.ethereum.core.AccountState#getBalance()

The following examples show how to use org.ethereum.core.AccountState#getBalance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryImpl.java    From nuls-v2 with MIT License 4 votes vote down vote up
@Override
public synchronized BigInteger getBalance(byte[] addr) {
    AccountState accountState = getAccountState(addr);
    return accountState == null ? BigInteger.ZERO : accountState.getBalance();
}
 
Example 2
Source File: RepositoryImpl.java    From nuls-v2 with MIT License 4 votes vote down vote up
@Override
public synchronized BigInteger addBalance(byte[] addr, BigInteger value) {
    AccountState accountState = getOrCreateAccountState(addr);
    accountStateCache.put(addr, accountState.withBalanceIncrement(value));
    return accountState.getBalance();
}
 
Example 3
Source File: RepositoryImpl.java    From nuls with MIT License 4 votes vote down vote up
@Override
public synchronized BigInteger getBalance(byte[] addr) {
    AccountState accountState = getAccountState(addr);
    return accountState == null ? BigInteger.ZERO : accountState.getBalance();
}
 
Example 4
Source File: RepositoryImpl.java    From nuls with MIT License 4 votes vote down vote up
@Override
public synchronized BigInteger addBalance(byte[] addr, BigInteger value) {
    AccountState accountState = getOrCreateAccountState(addr);
    accountStateCache.put(addr, accountState.withBalanceIncrement(value));
    return accountState.getBalance();
}
 
Example 5
Source File: RepositoryImpl.java    From ethereumj with MIT License 4 votes vote down vote up
public BigInteger getBalance(byte[] addr) {
    AccountState state = getAccountState(addr);
    if (state == null) return BigInteger.ZERO;
    return state.getBalance();
}