package example.ark_smartbridge_listener.eth_bridge;

import org.springframework.stereotype.Service;

@Service
public class ContractMessageViewMapper {

    public ContractMessageView map(ContractMessage contractMessage) {
        ContractMessageView contractMessageView = new ContractMessageView();
        contractMessageView.setToken(contractMessage.getToken());
        contractMessageView.setStatus(contractMessage.getStatus());

        contractMessageView.setServiceArkAddress(contractMessage.getServiceArkAddress());
        contractMessageView.setEstimatedGasCost(contractMessage.getEstimatedGasCost());
        contractMessageView.setEstimatedEthCost(contractMessage.getEstimatedEthCost().toPlainString());
        contractMessageView.setArkPerEthExchangeRate(contractMessage.getArkPerEthExchangeRate().toPlainString());
        contractMessageView.setRequiredArkCost(contractMessage.getRequiredArkCost().toPlainString());
        contractMessageView.setReturnArkAddress(contractMessage.getReturnArkAddress());
        contractMessageView.setReturnArkTransactionId(contractMessage.getReturnArkTransactionId());

        contractMessageView.setContractCode(contractMessage.getContractCode());
        contractMessageView.setContractAbiJson(contractMessage.getContractAbiJson());
        contractMessageView.setContractParamsJson(contractMessage.getContractParamsJson());
        contractMessageView.setGasLimit(contractMessage.getGasLimit());


        if (contractMessage.getReturnArkAmount() != null) {
            contractMessageView.setReturnArkAmount(contractMessage.getReturnArkAmount().toPlainString());
        }
        if (contractMessage.getDeploymentArkCost() != null) {
            contractMessageView.setDeploymentArkCost(contractMessage.getDeploymentArkCost().toPlainString());
        }

        contractMessageView.setContractTransactionHash(contractMessage.getContractTransactionHash());
        contractMessageView.setContractAddress(contractMessage.getContractAddress());
        contractMessageView.setGasUsed(contractMessage.getGasUsed());

        contractMessageView.setCreatedAt(contractMessage.getCreatedAt().toString());

        return contractMessageView;
    }

}

@@ -47,16 +47,50 @@
 ridge;%0A%0A
+import lombok.extern.log4j.Log4j;%0A
 import o
@@ -129,16 +129,23 @@
 rvice;%0A%0A
+@Log4j%0A
 @Service
@@ -2188,24 +2188,172 @@
 String());%0A%0A
+        log.info(%22contract message: %22 + contractMessage.toString());%0A        log.info(%22contract message view: %22 + contractMessageView.toString());%0A%0A
         retu

add logging