use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractDeleteToNewCreate2EvmAddress.
@Test
void contractDeleteToNewCreate2EvmAddress() {
SetupResult setupResult = setupContract(CONTRACT_ID, ContractIdType.CREATE2_EVM, false, false);
Transaction transaction = contractDeleteTransaction(setupResult.protoContractId, false);
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ContractTransactionType.DELETE);
RecordItem recordItem = new RecordItem(transaction, record);
parseRecordItemAndCommit(recordItem);
var dbTransaction = getDbTransaction(record.getConsensusTimestamp());
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertEntities(setupResult.contract.toEntityId()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertThat(dbTransaction.getEntityId()).isEqualTo(setupResult.contract.toEntityId()));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractUpdateAllToNew.
@ParameterizedTest
@EnumSource(value = ContractIdType.class, names = { "PLAIN", "PARSABLE_EVM" })
void contractUpdateAllToNew(ContractIdType contractIdType) {
SetupResult setupResult = setupContract(CONTRACT_ID, contractIdType, false, false, c -> c.obtainerId(null));
Transaction transaction = contractUpdateAllTransaction(setupResult.protoContractId, true);
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ContractTransactionType.UPDATE);
ContractUpdateTransactionBody contractUpdateTransactionBody = transactionBody.getContractUpdateInstance();
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(setupResult.contract.toEntityId()), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertContractEntity(contractUpdateTransactionBody, record.getConsensusTimestamp()).returns(null, Contract::getCreatedTimestamp).returns(null, // FileId is ignored on updates by HAPI
Contract::getFileId));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractUpdateAllToNewCreate2EvmAddress.
@Test
void contractUpdateAllToNewCreate2EvmAddress() {
SetupResult setupResult = setupContract(CONTRACT_ID, ContractIdType.CREATE2_EVM, false, false);
Transaction transaction = contractUpdateAllTransaction(setupResult.protoContractId, true);
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ContractTransactionType.UPDATE);
parseRecordItemAndCommit(new RecordItem(transaction, record));
var dbTransaction = getDbTransaction(record.getConsensusTimestamp());
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(setupResult.contract.toEntityId()), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertThat(dbTransaction.getEntityId()).isEqualTo(setupResult.contract.toEntityId()));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractDeleteToNewInvalidTransaction.
@Test
void contractDeleteToNewInvalidTransaction() {
Transaction transaction = contractDeleteTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE, ContractTransactionType.DELETE);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertEntities(), () -> assertTransactionAndRecord(transactionBody, record), () -> assertThat(transactionBody.getContractDeleteInstance().getContractID()).isNotNull());
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method contractUpdateAllWithMemoToNew.
@Test
void contractUpdateAllWithMemoToNew() {
Transaction transaction = contractUpdateAllTransaction(false);
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = getContractTransactionRecord(transactionBody, ContractTransactionType.UPDATE);
ContractUpdateTransactionBody contractUpdateTransactionBody = transactionBody.getContractUpdateInstance();
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(EntityId.of(CONTRACT_ID)), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(3, cryptoTransferRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertContractEntity(contractUpdateTransactionBody, record.getConsensusTimestamp()).returns(null, Contract::getCreatedTimestamp).returns(null, // FileId is ignored on updates by HAPI
Contract::getFileId));
}
Aggregations