Skip to content

Commit

Permalink
Add actualWithdrawalAmount property to vault withdraw response
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang committed Oct 14, 2024
1 parent f35a73e commit a927bd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.12.22"
version = "1.12.23"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package indexer.models.chain

import exchange.dydx.abacus.protocols.asTypedObject
import exchange.dydx.abacus.utils.Parser
import exchange.dydx.abacus.utils.QUANTUM_MULTIPLIER
import kotlinx.serialization.Serializable

// Define the structure of the error message
Expand Down Expand Up @@ -61,4 +62,11 @@ data class OnChainTransactionSuccessResponse(
return parser.asTypedObject<OnChainTransactionSuccessResponse>(payload)
}
}

val actualWithdrawalAmount: Double?
get() {
val withdrawalEvent = events?.firstOrNull { it.type == "withdraw_from_megavault" }
val amountAttribute = withdrawalEvent?.attributes?.firstOrNull { it.key == "redeemed_quote_quantums" }
return parser.asDouble(parser.asDecimal(amountAttribute?.value)?.div(QUANTUM_MULTIPLIER))
}
}
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.12.22'
spec.version = '1.12.23'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit a927bd4

Please sign in to comment.