-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: top level withdrawal methods [OTE-389] [1/2] #417
feat: top level withdrawal methods [OTE-389] [1/2] #417
Conversation
34c288a
to
a3a42da
Compare
1ab2d4b
to
96f3d50
Compare
27617af
to
9a96fbf
Compare
13f0b0e
to
b62e37b
Compare
chainId != null && | ||
dydxTokenDemon != null && | ||
squidIntegratorId != null | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we add an else
to call Logger.e { }
to log an error? Same with other functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm wait do you mean if we don't have all the args? are we sure that's what we want?
any transfer state change will fire off a retrieve deposit/withdrawal route function even if it doesn't make sense to do so, like when we clear the modal after submitting a withdraw/deposit. If we add an error log we'll be logging an error for all of those instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we should just error()
out for things like fromChain
and nativeChainUSDCDenom
being null.
} | ||
val chainId = helper.environment.dydxChainId | ||
val squidIntegratorId = helper.environment.squidIntegratorId | ||
val dydxTokenDemon = helper.environment.tokens["usdc"]?.denom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use nativeTokenDemon instead? Legal prefers "native" over "dydx" in our codebase.
Also, tokens["usdc"] would be the UDSC instead Native token, so the variable name should change accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah got it thanks! this was c/p'ed from another method and was confused by this naming as well. thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to nativeChainUSDCDenom
since nativeTokenDenom
isn't quite accurate.
"Content-Type" to "application/json", | ||
) | ||
helper.post(url, header, body.toJsonPrettyPrint()) { _, response, code, headers -> | ||
if (response != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to check the http code as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually accept 4XX codes and save the error msg into state so the users can see why their withdraw/deposit attempts are failing!
@@ -39,6 +39,8 @@ internal fun TradingStateMachine.squidV2SdkInfo(payload: String): StateChanges? | |||
} | |||
} | |||
|
|||
@Suppress("ForbiddenComment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit you can make a ticket and use the ticket number instead of TODO
val header = iMapOf( | ||
"Content-Type" to "application/json", | ||
) | ||
helper.post(url, header, body.toJsonPrettyPrint()) { _, response, code, headers -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why .toJsonPrettyPrint()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post body arg accepts a string - just following the convention we've been using thus far in other fns for str formatting
followup to: #415
adds top level withdrawal methods.
retrieveSkipWithdrawalRouteNonCCTP matches retrieveWithdrawalRouteV1
retrieveSkipWithdrawalRouteCCTP matches retrieveWithdrawalRouteV2
retrieveSkipWithdrawalRouteExchange matches retrieveWithdrawalRouteNoble
cctpToNobleSkip matches cctpToNobleSquid (renamed from cctpToNoble)
This PR is followed up by https://github.com/dydxprotocol/v4-abacus/pull/443/files