use of org.ethereum.vm.DataWord in project rskj by rsksmart.
the class ProgramInvokeMockImpl method getDataValue.
/**
**************
*/
/**
* msg data **
*/
/**
* *************
*/
/* CALLDATALOAD op */
public DataWord getDataValue(DataWord indexData) {
byte[] data = new byte[32];
int index = indexData.value().intValue();
int size = 32;
if (msgData == null)
return new DataWord(data);
if (index > msgData.length)
return new DataWord(data);
if (index + 32 > msgData.length)
size = msgData.length - index;
System.arraycopy(msgData, index, data, 0, size);
return new DataWord(data);
}
use of org.ethereum.vm.DataWord in project rskj by rsksmart.
the class RepositoryBlockStore method setChainHead.
@Override
public void setChainHead(StoredBlock chainHead) throws BlockStoreException {
byte[] ba = storedBlockToByteArray(chainHead);
repository.addStorageBytes(contractAddress, new DataWord(BLOCK_STORE_CHAIN_HEAD_KEY.getBytes(StandardCharsets.UTF_8)), ba);
}
use of org.ethereum.vm.DataWord in project rskj by rsksmart.
the class RepositoryBlockStore method put.
@Override
public synchronized void put(StoredBlock block) throws BlockStoreException {
Sha256Hash hash = block.getHeader().getHash();
byte[] ba = storedBlockToByteArray(block);
repository.addStorageBytes(contractAddress, new DataWord(hash.toString()), ba);
}
use of org.ethereum.vm.DataWord in project rskj by rsksmart.
the class SamplePrecompiledContract method GetResult.
public int GetResult(Object... args) {
DataWord keyWord = new DataWord("result".getBytes(StandardCharsets.UTF_8));
DataWord storedValue = repository.getStorageValue(contractAddress, keyWord);
int result = (storedValue != null ? storedValue.intValue() : 0);
return result;
}
use of org.ethereum.vm.DataWord in project rskj by rsksmart.
the class BridgeEventLoggerImpl method logReleaseBtc.
public void logReleaseBtc(BtcTransaction btcTx) {
List<DataWord> topics = Collections.singletonList(Bridge.RELEASE_BTC_TOPIC);
byte[] data = RLP.encodeList(RLP.encodeString(btcTx.getHashAsString()), RLP.encodeElement(btcTx.bitcoinSerialize()));
this.logs.add(new LogInfo(BRIDGE_CONTRACT_ADDRESS, topics, data));
}
Aggregations