Skip to content

Commit

Permalink
vaults: parse slippage response helper (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Sep 17, 2024
1 parent 2ea207a commit f420b78
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package exchange.dydx.abacus.functional.vault

import exchange.dydx.abacus.output.input.ErrorType
import exchange.dydx.abacus.protocols.asTypedObject
import exchange.dydx.abacus.utils.IList
import exchange.dydx.abacus.utils.Parser
import kollections.toIList
import kotlinx.serialization.Serializable
import kotlin.js.JsExport
Expand Down Expand Up @@ -101,11 +103,16 @@ data class VaultFormValidationResult(

@JsExport
object VaultDepositWithdrawFormValidator {
private val parser = Parser()

private const val SLIPPAGE_PERCENT_WARN = 0.01
private const val SLIPPAGE_PERCENT_ACK = 0.04
private const val SLIPPAGE_TOLERANCE = 0.01

fun getVaultDepositWithdrawSlippageResponse(apiResponse: String): VaultDepositWithdrawSlippageResponse? {
return parser.asTypedObject<VaultDepositWithdrawSlippageResponse>(apiResponse)
}

fun validateVaultForm(
formData: VaultFormData,
accountData: VaultFormAccountData?,
Expand Down

0 comments on commit f420b78

Please sign in to comment.