package example.ark_smartbridge_listener.eth_bridge;

import com.fasterxml.jackson.databind.ObjectMapper;
import lib.NiceObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.backoff.FixedBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;

@Configuration
public class EthBridgeConfig {

    @Bean
    public String serviceArkAddress(Environment environment) {
        return environment.getProperty("ethBridge.serviceArkWallet.address");
    }

    @Bean
    public String serviceArkPassphrase(Environment environment) {
        return environment.getProperty("ethBridge.serviceArkWallet.passphrase");
    }

    @Bean
    public String serviceEthAccountAddress(Environment environment) {
        return environment.getProperty("ethBridge.serviceEthAccount.address");
    }

    @Bean
    public String serviceEthAccountPassword(Environment environment) {
        return environment.getProperty("ethBridge.serviceEthAccount.password");
    }

    @Bean
    public String scriptPath(Environment environment) {
        return environment.getProperty("ethBridge.scriptPath");
    }

    @Bean
    public String nodeCommand(Environment environment) {
        return environment.getProperty("ethBridge.nodeCommand");
    }

    @Bean
    public String ethServerUrl(Environment environment) {
        return environment.getProperty("ethBridge.ethServerUrl");
    }

    @Bean
    public NiceObjectMapper defaultObjectMapper() {
        return new NiceObjectMapper(new ObjectMapper());
    }

    @Bean
    public RetryTemplate arkClientRetryTemplate() {
        RetryTemplate retryTemplate = new RetryTemplate();

        ExponentialBackOffPolicy exponentialBackOffPolicy = new ExponentialBackOffPolicy();
        exponentialBackOffPolicy.setInitialInterval(100);
        exponentialBackOffPolicy.setMultiplier(2.0);
        retryTemplate.setBackOffPolicy(exponentialBackOffPolicy);

        SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
        retryPolicy.setMaxAttempts(5);
        retryTemplate.setRetryPolicy(retryPolicy);

        return retryTemplate;
    }
}

@@ -534,16 +534,65 @@
 plate;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 @Configu
@@ -1947,24 +1947,172 @@
 emplate();%0A%0A
+        Map%3CClass%3C? extends Throwable%3E, Boolean%3E includeExceptions = new HashMap%3C%3E();%0A        includeExceptions.put(RuntimeException.class, true);%0A%0A
         Expo
@@ -2427,24 +2427,44 @@
 RetryPolicy(
+5, includeExceptions
 );%0A        r

fix retry logic