Search in sources :

Example 21 with ContractFunctionResult

use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.

the class ContractResultServiceImplIntegrationTest method getContractCallResultDefaultFunctionResult.

@Test
void getContractCallResultDefaultFunctionResult() {
    RecordItem recordItem = recordItemBuilder.contractCall().record(x -> x.clearContractCallResult()).build();
    ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCreateResult();
    contractResultsTest(recordItem, contractFunctionResult);
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) ContractResultRepository(com.hedera.mirror.importer.repository.ContractResultRepository) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ContractID(com.hederahashgraph.api.proto.java.ContractID) DomainBuilder(com.hedera.mirror.common.domain.DomainBuilder) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) ContractStateChangeRepository(com.hedera.mirror.importer.repository.ContractStateChangeRepository) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) ContractResult(com.hedera.mirror.common.domain.contract.ContractResult) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ContractStateChange(com.hedera.mirror.common.domain.contract.ContractStateChange) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) RecordStreamFileListener(com.hedera.mirror.importer.parser.record.RecordStreamFileListener) DATA(com.hedera.mirror.importer.domain.StreamFilename.FileType.DATA) StreamType(com.hedera.mirror.common.domain.StreamType) ContractLog(com.hedera.mirror.common.domain.contract.ContractLog) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) TokenType(com.hederahashgraph.api.proto.java.TokenType) ContractLogRepository(com.hedera.mirror.importer.repository.ContractLogRepository) ObjectAssert(org.assertj.core.api.ObjectAssert) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 22 with ContractFunctionResult

use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.

the class ContractResultServiceImplIntegrationTest method getContractResultOnTokenMintNFT.

@Test
void getContractResultOnTokenMintNFT() {
    RecordItem recordItem = recordItemBuilder.tokenMint(TokenType.NON_FUNGIBLE_UNIQUE).record(x -> x.setContractCallResult(recordItemBuilder.contractFunctionResult(CONTRACT_ID))).build();
    ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCallResult();
    contractResultsTest(recordItem, contractFunctionResult);
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) ContractResultRepository(com.hedera.mirror.importer.repository.ContractResultRepository) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ContractID(com.hederahashgraph.api.proto.java.ContractID) DomainBuilder(com.hedera.mirror.common.domain.DomainBuilder) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) ContractStateChangeRepository(com.hedera.mirror.importer.repository.ContractStateChangeRepository) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) ContractResult(com.hedera.mirror.common.domain.contract.ContractResult) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ContractStateChange(com.hedera.mirror.common.domain.contract.ContractStateChange) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) RecordStreamFileListener(com.hedera.mirror.importer.parser.record.RecordStreamFileListener) DATA(com.hedera.mirror.importer.domain.StreamFilename.FileType.DATA) StreamType(com.hedera.mirror.common.domain.StreamType) ContractLog(com.hedera.mirror.common.domain.contract.ContractLog) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) TokenType(com.hederahashgraph.api.proto.java.TokenType) ContractLogRepository(com.hedera.mirror.importer.repository.ContractLogRepository) ObjectAssert(org.assertj.core.api.ObjectAssert) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 23 with ContractFunctionResult

use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.

the class ContractResultServiceImplIntegrationTest method contractCreateResultOnFailure.

@Test
void contractCreateResultOnFailure() {
    RecordItem recordItem = recordItemBuilder.contractCreate().record(x -> x.clearContractCreateResult()).receipt(r -> r.clearContractID().setStatus(ResponseCodeEnum.CONTRACT_EXECUTION_EXCEPTION)).build();
    ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCreateResult();
    contractResultsTest(recordItem, contractFunctionResult);
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) ContractResultRepository(com.hedera.mirror.importer.repository.ContractResultRepository) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ContractID(com.hederahashgraph.api.proto.java.ContractID) DomainBuilder(com.hedera.mirror.common.domain.DomainBuilder) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) ContractStateChangeRepository(com.hedera.mirror.importer.repository.ContractStateChangeRepository) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) ContractResult(com.hedera.mirror.common.domain.contract.ContractResult) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ContractStateChange(com.hedera.mirror.common.domain.contract.ContractStateChange) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) RecordStreamFileListener(com.hedera.mirror.importer.parser.record.RecordStreamFileListener) DATA(com.hedera.mirror.importer.domain.StreamFilename.FileType.DATA) StreamType(com.hedera.mirror.common.domain.StreamType) ContractLog(com.hedera.mirror.common.domain.contract.ContractLog) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) TokenType(com.hederahashgraph.api.proto.java.TokenType) ContractLogRepository(com.hedera.mirror.importer.repository.ContractLogRepository) ObjectAssert(org.assertj.core.api.ObjectAssert) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 24 with ContractFunctionResult

use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.

the class ContractResultServiceImplIntegrationTest method getContractCreateResultDefaultFunctionResult.

@Test
void getContractCreateResultDefaultFunctionResult() {
    RecordItem recordItem = recordItemBuilder.contractCreate().record(x -> x.clearContractCreateResult()).build();
    ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCreateResult();
    contractResultsTest(recordItem, contractFunctionResult);
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) ContractResultRepository(com.hedera.mirror.importer.repository.ContractResultRepository) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ContractID(com.hederahashgraph.api.proto.java.ContractID) DomainBuilder(com.hedera.mirror.common.domain.DomainBuilder) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) ContractStateChangeRepository(com.hedera.mirror.importer.repository.ContractStateChangeRepository) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) ContractResult(com.hedera.mirror.common.domain.contract.ContractResult) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ContractStateChange(com.hedera.mirror.common.domain.contract.ContractStateChange) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) RecordStreamFileListener(com.hedera.mirror.importer.parser.record.RecordStreamFileListener) DATA(com.hedera.mirror.importer.domain.StreamFilename.FileType.DATA) StreamType(com.hedera.mirror.common.domain.StreamType) ContractLog(com.hedera.mirror.common.domain.contract.ContractLog) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) TokenType(com.hederahashgraph.api.proto.java.TokenType) ContractLogRepository(com.hedera.mirror.importer.repository.ContractLogRepository) ObjectAssert(org.assertj.core.api.ObjectAssert) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 25 with ContractFunctionResult

use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-services by hashgraph.

the class HapiContractCallLocal method assertExpectationsGiven.

@Override
protected void assertExpectationsGiven(HapiApiSpec spec) throws Throwable {
    if (expectations.isPresent()) {
        ContractFunctionResult actual = response.getContractCallLocal().getFunctionResult();
        if (!loggingOff) {
            log.info(CommonUtils.hex(actual.getContractCallResult().toByteArray()));
        }
        ErroringAsserts<ContractFunctionResult> asserts = expectations.get().assertsFor(spec);
        List<Throwable> errors = asserts.errorsIn(actual);
        rethrowSummaryError(log, "Bad local call result!", errors);
    }
}
Also used : ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult)

Aggregations

ContractFunctionResult (com.hederahashgraph.api.proto.java.ContractFunctionResult)30 Test (org.junit.jupiter.api.Test)20 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)14 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)13 ByteString (com.google.protobuf.ByteString)12 EntityId (com.hedera.mirror.common.domain.entity.EntityId)12 RecordFile (com.hedera.mirror.common.domain.transaction.RecordFile)12 ContractLog (com.hedera.mirror.common.domain.contract.ContractLog)11 ContractResult (com.hedera.mirror.common.domain.contract.ContractResult)11 ContractStateChange (com.hedera.mirror.common.domain.contract.ContractStateChange)11 DomainUtils (com.hedera.mirror.common.util.DomainUtils)11 RecordItemBuilder (com.hedera.mirror.importer.parser.domain.RecordItemBuilder)11 ContractLogRepository (com.hedera.mirror.importer.repository.ContractLogRepository)11 ContractStateChangeRepository (com.hedera.mirror.importer.repository.ContractStateChangeRepository)11 ContractID (com.hederahashgraph.api.proto.java.ContractID)11 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)11 TokenType (com.hederahashgraph.api.proto.java.TokenType)11 Collectors (java.util.stream.Collectors)11 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)11 ObjectAssert (org.assertj.core.api.ObjectAssert)11