Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Jun 14, 2024
1 parent e5069ed commit 6ff73c3
Showing 1 changed file with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,22 @@ internal class OnboardingSupervisor(
}
}
val chainId = helper.environment.dydxChainId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.skipV2MsgsDirect()
if (fromChain != null &&
fromToken != null &&
fromAmount != null && fromAmount > 0 &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null
) {
val body: Map<String, Any> = mapOf(
"amount_in" to fromAmountString,
"source_asset_denom" to fromToken,
"source_asset_chain_id" to fromChain,
"dest_asset_denom" to dydxTokenDemon,
"dest_asset_denom" to nativeTokenUSDCDenom,
"dest_asset_chain_id" to chainId,
"chain_ids_to_addresses" to mapOf(
"fromChain" to sourceAddress,
Expand Down Expand Up @@ -295,7 +295,7 @@ internal class OnboardingSupervisor(
}
}
val chainId = helper.environment.dydxChainId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val nobleAddress = accountAddress.toNobleAddress()
val url = helper.configs.skipV2MsgsDirect()
Expand All @@ -307,7 +307,7 @@ internal class OnboardingSupervisor(
fromAmountString != null &&
nobleAddress != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
toChain != null &&
toToken != null
) {
Expand Down Expand Up @@ -363,15 +363,15 @@ internal class OnboardingSupervisor(
}
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.squidRoute()
if (fromChain != null &&
fromToken != null &&
fromAmount != null && fromAmount > 0 &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null &&
squidIntegratorId != null
) {
Expand All @@ -380,7 +380,7 @@ internal class OnboardingSupervisor(
"fromToken" to fromToken,
"fromAmount" to fromAmountString,
"toChain" to chainId,
"toToken" to dydxTokenDemon,
"toToken" to nativeTokenUSDCDenom,
"toAddress" to accountAddress,
"slippage" to "1",
"enableForecall" to "false",
Expand Down Expand Up @@ -425,7 +425,7 @@ internal class OnboardingSupervisor(
}
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val nobleAddress = accountAddress.toNobleAddress()
val url = helper.configs.squidV2Route()
Expand All @@ -437,7 +437,7 @@ internal class OnboardingSupervisor(
fromAmountString != null &&
nobleAddress != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null &&
squidIntegratorId != null &&
toChain != null &&
Expand Down Expand Up @@ -763,7 +763,7 @@ internal class OnboardingSupervisor(
}
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.squidRoute()
val fromAddress = accountAddress
Expand All @@ -774,13 +774,13 @@ internal class OnboardingSupervisor(
fromAmount > 0 &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null &&
squidIntegratorId != null
) {
val params: IMap<String, String> = iMapOf(
"fromChain" to chainId,
"fromToken" to dydxTokenDemon,
"fromToken" to nativeTokenUSDCDenom,
"fromAmount" to fromAmountString,
"fromAddress" to fromAddress,
"toChain" to nobleChain,
Expand Down Expand Up @@ -822,7 +822,7 @@ internal class OnboardingSupervisor(
}
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.squidRoute()
val fromAddress = accountAddress
Expand All @@ -833,13 +833,13 @@ internal class OnboardingSupervisor(
fromAmount > 0 &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null &&
squidIntegratorId != null
) {
val params: IMap<String, String> = iMapOf(
"fromChain" to chainId,
"fromToken" to dydxTokenDemon,
"fromToken" to nativeTokenUSDCDenom,
"fromAmount" to fromAmountString,
"fromAddress" to fromAddress,
"toChain" to toChain,
Expand Down Expand Up @@ -882,7 +882,7 @@ internal class OnboardingSupervisor(
}
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.squidV2Route()
val fromAddress = accountAddress.toNobleAddress()
Expand All @@ -895,7 +895,7 @@ internal class OnboardingSupervisor(
fromAmount > 0 &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
url != null &&
fromAddress != null &&
squidIntegratorId != null &&
Expand Down Expand Up @@ -957,7 +957,7 @@ internal class OnboardingSupervisor(
null
}
val fromChain = helper.environment.dydxChainId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.skipV2MsgsDirect()
val fromAddress = accountAddress
Expand All @@ -968,11 +968,11 @@ internal class OnboardingSupervisor(
fromChain != null &&
toToken != null &&
toChain != null &&
dydxTokenDemon != null
nativeTokenUSDCDenom != null
) {
val body: Map<String, Any> = mapOf(
"amount_in" to fromAmountString,
"source_asset_denom" to dydxTokenDemon,
"source_asset_denom" to nativeTokenUSDCDenom,
"source_asset_chain_id" to fromChain,
"dest_asset_denom" to toToken,
"dest_asset_chain_id" to toChain,
Expand Down Expand Up @@ -1073,7 +1073,7 @@ internal class OnboardingSupervisor(
null
}
val chainId = helper.environment.dydxChainId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val fromAmountString = helper.parser.asString(fromAmount)
val url = helper.configs.skipV2MsgsDirect()
val fromAddress = accountAddress.toNobleAddress()
Expand All @@ -1087,7 +1087,7 @@ internal class OnboardingSupervisor(
fromAddress != null &&
fromAmountString != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
fromChain != null &&
fromToken != null
) {
Expand Down Expand Up @@ -1169,13 +1169,13 @@ internal class OnboardingSupervisor(
val nobleAddress = accountAddress.toNobleAddress()
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
if (url != null &&
fromChain != null &&
fromToken != null &&
nobleAddress != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
squidIntegratorId != null
) {
val params: Map<String, String> = mapOf(
Expand All @@ -1184,7 +1184,7 @@ internal class OnboardingSupervisor(
"fromAddress" to nobleAddress,
"fromAmount" to amount.toPlainString(),
"toChain" to chainId,
"toToken" to dydxTokenDemon,
"toToken" to nativeTokenUSDCDenom,
"toAddress" to accountAddress.toString(),
"slippage" to "1",
"enableForecall" to "false",
Expand Down Expand Up @@ -1422,7 +1422,7 @@ internal class OnboardingSupervisor(
val nobleAddress = accountAddress.toNobleAddress()
val chainId = helper.environment.dydxChainId
val squidIntegratorId = helper.environment.squidIntegratorId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val usdcSize = helper.parser.asDecimal(state?.input?.transfer?.size?.usdcSize)
val fromAmount = if (usdcSize != null && usdcSize > gas) {
((usdcSize - gas) * Numeric.decimal.TEN.pow(decimals)).toBigInteger()
Expand All @@ -1436,7 +1436,7 @@ internal class OnboardingSupervisor(
nobleToken != null &&
nobleAddress != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
squidIntegratorId != null &&
fromAmountString != null && fromAmount != null && fromAmount > 0
) {
Expand All @@ -1446,7 +1446,7 @@ internal class OnboardingSupervisor(
"toAddress" to nobleAddress,
"fromAmount" to fromAmountString,
"fromChain" to chainId,
"fromToken" to dydxTokenDemon,
"fromToken" to nativeTokenUSDCDenom,
"fromAddress" to accountAddress,
"slippage" to "1",
"enableForecall" to "false",
Expand Down Expand Up @@ -1528,7 +1528,7 @@ internal class OnboardingSupervisor(
val nobleToken = helper.configs.nobleDenom()
val nobleAddress = accountAddress.toNobleAddress()
val chainId = helper.environment.dydxChainId
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom
val nativeTokenUSDCDenom = helper.environment.tokens["usdc"]?.denom
val usdcSize = helper.parser.asDecimal(state?.input?.transfer?.size?.usdcSize)
val fromAmount = if (usdcSize != null && usdcSize > gas) {
((usdcSize - gas) * Numeric.decimal.TEN.pow(decimals)).toBigInteger()
Expand All @@ -1542,13 +1542,13 @@ internal class OnboardingSupervisor(
nobleToken != null &&
nobleAddress != null &&
chainId != null &&
dydxTokenDemon != null &&
nativeTokenUSDCDenom != null &&
fromAmountString != null && fromAmount != null && fromAmount > 0
) {
val body: Map<String, Any> = mapOf(
"amount_in" to fromAmountString,
// from dydx denom and chain
"source_asset_denom" to dydxTokenDemon,
"source_asset_denom" to nativeTokenUSDCDenom,
"source_asset_chain_id" to chainId,
// to noble denom and chain
"dest_asset_denom" to nobleToken,
Expand Down

0 comments on commit 6ff73c3

Please sign in to comment.