X: Activating Burner service
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
+4
-4
@@ -409,7 +409,7 @@ public final class EvelynIOUBurnerServiceImpl
|
||||
}
|
||||
|
||||
ΩPriceΩ inputPriceInUsdc;
|
||||
if (USDC_ID.equals(currencyId)) {
|
||||
if (USDC_ID.equals(currencyId) || USDT_ID.equals(currencyId)) {
|
||||
inputPriceInUsdc = BigDecimal.ONE;
|
||||
} else {
|
||||
inputPriceInUsdc = findFreshPrice(
|
||||
@@ -895,15 +895,15 @@ public final class EvelynIOUBurnerServiceImpl
|
||||
);
|
||||
if (canonicalCurrency == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"CIS returned null for " + purpose + " UUID "
|
||||
"CIS returned <null> for " + purpose + " UUID "
|
||||
+ currencyId
|
||||
);
|
||||
}
|
||||
if (!currencyId.equals(canonicalCurrency.id())) {
|
||||
throw new IllegalArgumentException(
|
||||
"CIS returned canonical currency UUID "
|
||||
"CIS returned canonical currency UUID '"
|
||||
+ canonicalCurrency.id()
|
||||
+ " while resolving "
|
||||
+ "' while resolving "
|
||||
+ currencyId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.r35157.nenjim.hubd.impl.ref;
|
||||
|
||||
import com.fanitas.evelyn.core.Evelyn;
|
||||
import com.fanitas.evelyn.core.impl.ref.EvelynImpl;
|
||||
import com.fanitas.evelyn.service.burner.EvelynIOUBurnerService;
|
||||
import com.fanitas.evelyn.service.burner.impl.ref.EvelynIOUBurnerServiceImpl;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.r35157.assetaz.services.cis.CurrencyTypeIds;
|
||||
import com.r35157.assetaz.services.ticker.plugins.pricesource.PriceSource;
|
||||
import com.r35157.assetaz.services.ticker.TickerService;
|
||||
import com.r35157.assetaz.services.ticker.plugins.pricesource.impl.hardcoded.HardcodedPriceSource;
|
||||
@@ -18,9 +21,12 @@ import com.r35157.jupiterperpsalarm.JupiterPerpsAlarm;
|
||||
import com.r35157.jupiterperpsalarm.impl.ref.JupiterPerpsAlarmImpl;
|
||||
import com.r35157.libs.jupiter.perps.JupiterPerpsService;
|
||||
import com.r35157.libs.jupiter.perps.impl.anchoridl.AnchorIdlJupiterPerpsServiceImpl;
|
||||
import com.r35157.libs.jupiter.swap.JupiterSwapService;
|
||||
import com.r35157.libs.jupiter.swap.impl.ref.JupiterSwapServiceImpl;
|
||||
import com.r35157.libs.objcache.ObjectCache;
|
||||
import com.r35157.libs.objcache.impl.ref.ObjectCacheImpl;
|
||||
import com.r35157.libs.solana.impl.cached.CachedSolanaBlockChain;
|
||||
import com.r35157.libs.valuetypes.basic.MoneyAmount;
|
||||
import com.r35157.nenjim.composer.NenjimComposer;
|
||||
import com.r35157.nenjim.composer.impl.ref.NenjimComposerImpl;
|
||||
import com.r35157.nenjim.hubd.NenjimHub;
|
||||
@@ -33,6 +39,8 @@ import com.r35157.libs.raydium.impl.ref.RaydiumImpl;
|
||||
import com.r35157.libs.solana.SolanaBlockChain;
|
||||
import com.r35157.libs.solana.impl.ref.SolanaBlockChainImpl;
|
||||
import com.r35157.libs.valuetypes.basic.TradingPair;
|
||||
import com.r35157.service.notification.BoundNotificationService;
|
||||
import com.r35157.service.notification.impl.discord.DiscordNotificationServiceImpl;
|
||||
import com.r35157.stm.SodaTaskManager;
|
||||
import com.r35157.stm.impl.ref.SodaTaskManagerImpl;
|
||||
import com.r35157.suwimo.hub.client.SuwimoClient;
|
||||
@@ -41,9 +49,13 @@ import crypto.r35157.nenjim.NenjimProcess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import static com.r35157.assetaz.services.cis.CurrencyTypeIds.EVE_ID;
|
||||
@@ -66,17 +78,18 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
log.info("Starting:");
|
||||
log.info(" Services...");
|
||||
tickerService.start();
|
||||
jupiterPerpsAlarm.start();
|
||||
//jupiterPerpsAlarm.start();
|
||||
evelynServiceProd.start();
|
||||
evelynServiceTest.start();
|
||||
evelynIOUBurnerServiceProd.start();
|
||||
|
||||
log.info(" Applications...");
|
||||
missionControl.start();
|
||||
nenjimComposer.start();
|
||||
processManager.start();
|
||||
testTool.start();
|
||||
sodaTaskManager.start();
|
||||
suwimoClient.start();
|
||||
//nenjimComposer.start();
|
||||
//processManager.start();
|
||||
//testTool.start();
|
||||
//sodaTaskManager.start();
|
||||
//suwimoClient.start();
|
||||
|
||||
System.out.println("Done - Now online!");
|
||||
|
||||
@@ -154,6 +167,11 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
"evelyn_perps_prod",
|
||||
solanaBlockChain
|
||||
);
|
||||
solanaWalletEvelynBurnerProd = new SolanaWalletImpl(
|
||||
"5kjVTc1rebYHg56NyTxSSN1XMKqT2E81eWiaSx1CmzmV",
|
||||
"evelyn_burner_prod",
|
||||
solanaBlockChain
|
||||
);
|
||||
}
|
||||
|
||||
private void initializePlugins() {
|
||||
@@ -189,6 +207,32 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
|
||||
evelynServiceTest = new EvelynImpl("Test", tickerService, eveUSDT, clockUTC);
|
||||
|
||||
jupiterSwapService = new JupiterSwapServiceImpl(solanaBlockChain, solanaWalletEvelynBurnerProd);
|
||||
discordAssetAZTokenNotificationService = new DiscordNotificationServiceImpl(
|
||||
URI.create("https://discordapp.com/api/webhooks/1537799046025187458/RtoNR5HnGmnutsMfM8AKP8mLDVqP1AxpEQ3p2IvBiaqVOjuVWNcShMkIh2D9uT27Mt4A"),
|
||||
"DiscordBot (https://git.r35157.com/r35157/com_r35157_nenjim-hubd-impl_ref, 0.1)",
|
||||
Duration.ofSeconds(10)
|
||||
);
|
||||
|
||||
List<MoneyAmount> burnTokenCandidates = List.of(new MoneyAmount(new ΩAmountΩ("0.1"), cis.resolve(CurrencyTypeIds.USDT_ID)));
|
||||
|
||||
ΩUSDCAmountΩ maximumSwapAmountPerIterationInUSD = new ΩUSDCAmountΩ("0.25");
|
||||
|
||||
evelynIOUBurnerServiceProd = new EvelynIOUBurnerServiceImpl(
|
||||
solanaWalletEvelynBurnerProd,
|
||||
jupiterSwapService,
|
||||
solanaBlockChain,
|
||||
tickerService,
|
||||
cis,
|
||||
discordAssetAZTokenNotificationService,
|
||||
burnTokenCandidates,
|
||||
maximumSwapAmountPerIterationInUSD,
|
||||
200,
|
||||
2*1000*60L,
|
||||
Duration.ofSeconds(10),
|
||||
Duration.ofHours(1)
|
||||
);
|
||||
|
||||
// TODO: Old but more correct way to auto start plugins - but it is currently broken.
|
||||
/*
|
||||
String[] processesToAutoStart = {
|
||||
@@ -208,12 +252,12 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
}
|
||||
|
||||
private void initializeApplications() {
|
||||
nenjimComposer = new NenjimComposerImpl();
|
||||
processManager = new NenjimProcessManagerImpl();
|
||||
testTool = new NenjimTestToolImpl();
|
||||
sodaTaskManager = new SodaTaskManagerImpl();
|
||||
//nenjimComposer = new NenjimComposerImpl();
|
||||
//processManager = new NenjimProcessManagerImpl();
|
||||
//testTool = new NenjimTestToolImpl();
|
||||
//sodaTaskManager = new SodaTaskManagerImpl();
|
||||
missionControl = new EvelynMissionControlImpl(evelynServiceProd, evelynServiceTest);
|
||||
suwimoClient = new SuwimoClientImpl();
|
||||
//suwimoClient = new SuwimoClientImpl();
|
||||
}
|
||||
|
||||
private void waitForAndShutdown() throws InterruptedException {
|
||||
@@ -253,6 +297,7 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
private SolanaWallet evelynPerpsProd;
|
||||
private SolanaWallet solanaWalletEvelynPerpsProd;
|
||||
private SolanaWallet solanaWalletEvelynPerpsTest;
|
||||
private SolanaWallet solanaWalletEvelynBurnerProd;
|
||||
private JupiterPerpsService jupiterServicePerpsProd;
|
||||
private JupiterPerpsService jupiterServicePerpsTest;
|
||||
|
||||
@@ -265,6 +310,9 @@ public class NenjimHubImpl implements NenjimHub {
|
||||
private JupiterPerpsAlarm jupiterPerpsAlarm;
|
||||
private Evelyn evelynServiceProd;
|
||||
private Evelyn evelynServiceTest;
|
||||
private JupiterSwapService jupiterSwapService;
|
||||
private BoundNotificationService discordAssetAZTokenNotificationService;
|
||||
private EvelynIOUBurnerService evelynIOUBurnerServiceProd;
|
||||
|
||||
// Applications
|
||||
private EvelynMissionControl missionControl;
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
* Synchronously delivers bound notification messages through a Discord
|
||||
* incoming webhook.
|
||||
*/
|
||||
public class DiscordNotificationService implements BoundNotificationService {
|
||||
public class DiscordNotificationServiceImpl implements BoundNotificationService {
|
||||
|
||||
/**
|
||||
* Creates a service bound to a canonical Discord incoming-webhook endpoint.
|
||||
@@ -44,7 +44,7 @@ public class DiscordNotificationService implements BoundNotificationService {
|
||||
* the required Discord format, or if the
|
||||
* timeout is null, zero, or negative
|
||||
*/
|
||||
public DiscordNotificationService(
|
||||
public DiscordNotificationServiceImpl(
|
||||
@NotNull ΩRestEndpointΩ discordWebhookEndpoint,
|
||||
@NotNull ΩUserAgentΩ userAgent,
|
||||
@NotNull Duration timeout
|
||||
@@ -134,7 +134,7 @@ public class DiscordNotificationService implements BoundNotificationService {
|
||||
|| !endpoint.isAbsolute()
|
||||
|| !"https".equalsIgnoreCase(endpoint.getScheme())
|
||||
|| endpoint.getHost() == null
|
||||
|| !"discord.com".equalsIgnoreCase(endpoint.getHost())
|
||||
|| !"discordapp.com".equalsIgnoreCase(endpoint.getHost())
|
||||
|| endpoint.getUserInfo() != null
|
||||
|| endpoint.getFragment() != null
|
||||
|| endpoint.getQuery() != null
|
||||
Reference in New Issue
Block a user