Search in sources :

Example 11 with AccountInformationProvider

use of co.rsk.core.bc.AccountInformationProvider in project rskj by rsksmart.

the class Web3Impl method eth_getStorageAt.

@Override
public String eth_getStorageAt(String address, String storageIdx, String blockId) {
    String s = null;
    try {
        RskAddress addr = new RskAddress(address);
        AccountInformationProvider accountInformationProvider = web3InformationRetriever.getInformationProvider(blockId);
        DataWord sv = accountInformationProvider.getStorageValue(addr, DataWord.valueOf(TypeConverter.strHexOrStrNumberToByteArray(storageIdx)));
        if (sv == null) {
            s = "0x0";
        } else {
            s = toUnformattedJsonHex(sv.getData());
        }
        return s;
    } finally {
        if (logger.isDebugEnabled()) {
            logger.debug("eth_getStorageAt({}, {}, {}): {}", address, storageIdx, blockId, s);
        }
    }
}
Also used : RskAddress(co.rsk.core.RskAddress) DataWord(org.ethereum.vm.DataWord) AccountInformationProvider(co.rsk.core.bc.AccountInformationProvider)

Aggregations

AccountInformationProvider (co.rsk.core.bc.AccountInformationProvider)11 RskAddress (co.rsk.core.RskAddress)7 Test (org.junit.Test)7 RepositorySnapshot (co.rsk.db.RepositorySnapshot)3 DataWord (org.ethereum.vm.DataWord)3 Coin (co.rsk.core.Coin)2 PendingState (co.rsk.core.bc.PendingState)1 BigInteger (java.math.BigInteger)1