Search in sources :

Example 56 with DataWord

use of org.ethereum.vm.DataWord in project rskj by rsksmart.

the class BridgeEventLoggerImpl method logAddSignature.

public void logAddSignature(BtcECKey federatorPublicKey, BtcTransaction btcTx, byte[] rskTxHash) {
    List<DataWord> topics = Collections.singletonList(Bridge.ADD_SIGNATURE_TOPIC);
    byte[] data = RLP.encodeList(RLP.encodeString(btcTx.getHashAsString()), RLP.encodeElement(federatorPublicKey.getPubKeyHash()), RLP.encodeElement(rskTxHash));
    this.logs.add(new LogInfo(BRIDGE_CONTRACT_ADDRESS, topics, data));
}
Also used : LogInfo(org.ethereum.vm.LogInfo) DataWord(org.ethereum.vm.DataWord)

Example 57 with DataWord

use of org.ethereum.vm.DataWord in project rskj by rsksmart.

the class RemascStorageProvider method getSiblings.

public SortedMap<Long, List<Sibling>> getSiblings() {
    if (siblings != null) {
        return siblings;
    }
    DataWord address = new DataWord(SIBLINGS_KEY.getBytes(StandardCharsets.UTF_8));
    byte[] bytes = this.repository.getStorageBytes(this.contractAddress, address);
    siblings = getSiblingsFromBytes(bytes);
    return siblings;
}
Also used : DataWord(org.ethereum.vm.DataWord)

Example 58 with DataWord

use of org.ethereum.vm.DataWord in project rskj by rsksmart.

the class RemascStorageProvider method saveSiblings.

private void saveSiblings() {
    if (this.siblings == null) {
        return;
    }
    byte[] bytes = getSiblingsBytes(this.siblings);
    DataWord address = new DataWord(SIBLINGS_KEY.getBytes(StandardCharsets.UTF_8));
    this.repository.addStorageBytes(this.contractAddress, address, bytes);
}
Also used : DataWord(org.ethereum.vm.DataWord)

Example 59 with DataWord

use of org.ethereum.vm.DataWord in project rskj by rsksmart.

the class RemascStorageProvider method getBurnedBalance.

public Coin getBurnedBalance() {
    if (burnedBalance != null) {
        return burnedBalance;
    }
    DataWord address = new DataWord(BURNED_BALANCE_KEY.getBytes(StandardCharsets.UTF_8));
    DataWord value = this.repository.getStorageValue(this.contractAddress, address);
    if (value == null) {
        return Coin.ZERO;
    }
    return new Coin(value.getData());
}
Also used : Coin(co.rsk.core.Coin) DataWord(org.ethereum.vm.DataWord)

Example 60 with DataWord

use of org.ethereum.vm.DataWord in project rskj by rsksmart.

the class RemascStorageProvider method saveBurnedBalance.

private void saveBurnedBalance() {
    if (burnedBalance == null) {
        return;
    }
    DataWord address = new DataWord(BURNED_BALANCE_KEY.getBytes(StandardCharsets.UTF_8));
    this.repository.addStorageRow(this.contractAddress, address, new DataWord(this.burnedBalance.getBytes()));
}
Also used : DataWord(org.ethereum.vm.DataWord)

Aggregations

DataWord (org.ethereum.vm.DataWord)133 Test (org.junit.Test)88 Repository (org.ethereum.core.Repository)41 RskAddress (co.rsk.core.RskAddress)25 TestUtils.randomDataWord (org.ethereum.TestUtils.randomDataWord)22 BigInteger (java.math.BigInteger)19 LogInfo (org.ethereum.vm.LogInfo)17 HashMapDB (org.ethereum.datasource.HashMapDB)14 Program (org.ethereum.vm.program.Program)13 Stack (org.ethereum.vm.program.Stack)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)11 InvocationOnMock (org.mockito.invocation.InvocationOnMock)11 RepositoryImpl (co.rsk.db.RepositoryImpl)9 ContractDetails (org.ethereum.db.ContractDetails)9 Trie (co.rsk.trie.Trie)8 CallTransaction (org.ethereum.core.CallTransaction)8 TrieImpl (co.rsk.trie.TrieImpl)7 TrieStore (co.rsk.trie.TrieStore)7 Coin (co.rsk.core.Coin)5