Coverage Summary for Class: AccountInformationProvider (co.rsk.core.bc)
Class |
AccountInformationProvider$MockitoMock$126589947 |
AccountInformationProvider$MockitoMock$126589947$auxiliary$20ikZ36p |
AccountInformationProvider$MockitoMock$126589947$auxiliary$lvMycLru |
Total |
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2018 RSK Labs Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 package co.rsk.core.bc;
20
21 import co.rsk.core.Coin;
22 import co.rsk.core.RskAddress;
23 import org.ethereum.vm.DataWord;
24
25 import javax.annotation.Nullable;
26 import java.math.BigInteger;
27 import java.util.Iterator;
28
29 public interface AccountInformationProvider {
30
31 /**
32 * Retrieve balance of an account
33 *
34 * @param addr of the account
35 * @return balance of the account as a <code>BigInteger</code> value
36 */
37 Coin getBalance(RskAddress addr);
38
39 /**
40 * Retrieve storage value from an account for a given key
41 *
42 * @param addr of the account
43 * @param key associated with this value
44 * @return data in the form of a <code>DataWord</code>
45 */
46 @Nullable
47 DataWord getStorageValue(RskAddress addr, DataWord key);
48
49 /**
50 *
51 * @param addr of the account
52 * @param key associated with this value
53 * @return raw data
54 */
55 @Nullable
56 byte[] getStorageBytes(RskAddress addr, DataWord key);
57
58 /**
59 *
60 * @param addr of the account
61 * @return the keys for that addr
62 */
63 Iterator<DataWord> getStorageKeys(RskAddress addr);
64
65 /**
66 *
67 * @param addr of the account
68 * @return the count of keys for that addr
69 */
70 int getStorageKeysCount(RskAddress addr);
71
72 /**
73 * Retrieve the code associated with an account
74 *
75 * This method returns null if there is no code at the address.
76 * It may return the empty array for contracts that have installed zero code on construction.
77 * (not checked)
78 *
79 * @param addr of the account
80 * @return code in byte-array format
81 */
82 @Nullable
83 byte[] getCode(RskAddress addr);
84
85 /**
86 * @param addr an address account
87 * @return true if the addr identifies a contract
88 */
89 boolean isContract(RskAddress addr);
90
91 /**
92 * Get current nonce of a given account
93 *
94 * @param addr of the account
95 * @return value of the nonce
96 */
97 BigInteger getNonce(RskAddress addr);
98 }