Skip to content
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

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

yogurtandjam
Copy link
Contributor

@yogurtandjam yogurtandjam commented Jun 5, 2024

followup to: #415
adds top level withdrawal methods.
retrieveSkipWithdrawalRouteNonCCTP matches retrieveWithdrawalRouteV1
retrieveSkipWithdrawalRouteCCTP matches retrieveWithdrawalRouteV2
retrieveSkipWithdrawalRouteExchange matches retrieveWithdrawalRouteNoble

cctpToNobleSkip matches cctpToNobleSquid (renamed from cctpToNoble)

  • cctpToNoble is now a routing method that runs either the Skip or Squid counterpart based on FF

This PR is followed up by https://github.com/dydxprotocol/v4-abacus/pull/443/files

Copy link

linear bot commented Jun 5, 2024

@yogurtandjam yogurtandjam force-pushed the jerms/OTE-388_top-level-deposit-methods branch from 34c288a to a3a42da Compare June 5, 2024 18:25
@yogurtandjam yogurtandjam force-pushed the jerms/OTE-389_top-level-withdrawal-methods branch from 1ab2d4b to 96f3d50 Compare June 5, 2024 18:28
Base automatically changed from jerms/OTE-388_top-level-deposit-methods to main June 5, 2024 19:59
@yogurtandjam yogurtandjam force-pushed the jerms/OTE-389_top-level-withdrawal-methods branch from 27617af to 9a96fbf Compare June 5, 2024 20:01
@yogurtandjam yogurtandjam marked this pull request as draft June 7, 2024 16:21
@yogurtandjam yogurtandjam marked this pull request as ready for review June 13, 2024 23:23
@yogurtandjam yogurtandjam force-pushed the jerms/OTE-389_top-level-withdrawal-methods branch from 13f0b0e to b62e37b Compare June 13, 2024 23:36
@yogurtandjam yogurtandjam changed the title feat: top level withdrawal methods [OTE-389] feat: top level withdrawal methods [OTE-389] [1/2] Jun 13, 2024
chainId != null &&
dydxTokenDemon != null &&
squidIntegratorId != null
) {
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

Copy link
Contributor Author

@yogurtandjam yogurtandjam Jun 14, 2024

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

@yogurtandjam yogurtandjam Jun 14, 2024

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!

@yogurtandjam yogurtandjam requested a review from ruixhuang June 14, 2024 11:58
@@ -39,6 +39,8 @@ internal fun TradingStateMachine.squidV2SdkInfo(payload: String): StateChanges?
}
}

@Suppress("ForbiddenComment")
Copy link
Contributor

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 ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why .toJsonPrettyPrint() ?

Copy link
Contributor Author

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

@yogurtandjam yogurtandjam merged commit 108059f into main Jun 14, 2024
4 checks passed
@yogurtandjam yogurtandjam deleted the jerms/OTE-389_top-level-withdrawal-methods branch June 14, 2024 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants