-
Notifications
You must be signed in to change notification settings - Fork 34
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
Feature Request: Support onchain-onchain deposit and withdrawals #1479
Comments
Thanks @philipliu, its great to hear we can support onchain/onchain transactions without breaking changes to the SEP and Anchor Platform APIs. However, it does sound like clients would have to update their implementations for the SEP-6 and SEP-24 deposit cases, given that they make the assumption that the transfer of funds is offchain and therefore they don't need to facilitate an onchain payment to the anchor. To avoid this and make things simpler, I propose leaving the deposit endpoints for both SEP-6 and SEP-24 unchanged, and only supporting onchain/onchain transactions via the withdraw endpoints. Clients already expect to make onchain payments when facilitating withdraw flows, so they could use the |
Also, I don't see the need for the |
In SEP-6 deposit, |
This comment was marked as resolved.
This comment was marked as resolved.
@JakeUrban @Ifropc Taking a million steps back, I feel it is weird to use Aren't these the same? (USDC -> SRT)
|
Summary
To support onchain-onchain deposits and withdrawals in SEP-6 and SEP-24, we propose extending the existing exchange functionality. Currently, SEP-6 and SEP-24 limit
source_asset
(for deposits) anddestination_asset
(for withdrawals) to ISO 4217 assets, which aligns with the typical on-ramp/off-ramp use case. However, this restriction is not a fundamental requirement for deposits or withdrawals.SEP-38 will be utilized to provide quotes for onchain-onchain transactions. The protocol (SEP-38) does not inherently restrict one of the assets to be an off-chain asset, so no changes are needed in the protocol itself.
On the Anchor Platform side, updates will be made to the RPCs and SEP (SEP-6 and SEP-24) transaction creation to relax some validations on
source_asset
anddestination_asset
. TheRequestOnchainFunds
RPC will be updated to handle both deposits and withdrawals for onchain-onchain transactions. These changes can be implemented in a non-breaking manner, allowing them to be included in version 3.1.Protocol Changes
SEP-6 Deposit
Summary:
source_asset
can now be a Stellar asset.Request (deposit USDC for SRT):
GET [TRANSFER_SERVER]/deposit-exchange?source_asset=stellar:USDC:G...&destination_asset=SRT&...&type=stellar
GET /transaction
orGET /deposit-exchange
Response:Alternative Approach
We could include
withdraw_anchor_account
,withdraw_memo
, andwithdraw_memo_type
in the response. This provides a structured response that wallets can easily parse, but it requires wallet support for implementation.Considerations
Reusing the
instructions
field is lightweight and does not require wallet implementation for onchain-onchain deposits. However, the user experience (UX) may be awkward. Users, already in the wallet, would need to copy the deposit information, exit the deposit flow UI, and submit a transaction to the Anchor's deposit address.To improve UX, we can define standard values/descriptions when the
crypto_address
is a Stellar account, allowing wallets to easily parse this information and create the transaction programmatically. However, if we are considering this, thenwithdraw_anchor_account
approach is preferable.SEP-6 Withdraw
Summary:
destination_asset
can be a Stellar asset.Request (withdraw SRT to USDC):
GET [TRANSFER_SERVER]/withdraw-exchange?source_asset=SRT&destination_asset=stellar:USDC:G...&
GET /transaction
Response:Or in the
GET /withdraw-exchange
response if it can be provided synchronously:SEP-24 Deposit
Summary:
source_asset
can be a Stellar asset.Request (deposit USDC for SRT):
POST [TRANSFER_SERVER_SEP0024]/transactions/deposit/interactive
Response:
Interactive URL link with the deposit instructions on the web page.
SEP-24 Withdraw
Summary:
destination_asset
can be a Stellar asset.Request (withdraw SRT to USDC):
POST [TRANSFER_SERVER_SEP0024]/transactions/withdraw/interactive
Response:
Interactive URL link with the deposit instructions on the web page.
Anchor Platform Changes
RPC
The
RequestOnchainFunds
RPC is currently called by the business server during the withdraw (exchange) flows. Moving forward, the business server will also call this RPC for exchange transactions where both assets are Stellar assets, meaning it will be used in bothdeposit
andwithdraw
flows. The RPC currently validates that theamount_out.asset
is not a Stellar asset. This validation will be updated to allowamount_out.asset
to be a Stellar asset for exchange transactions.Config
Using SRT as an example, if USDC <-> SRT is supported and if a business also wants to support USD <-> SRT, there is no need to change the asset config schema. The asset config should include
USDC
andSRT
with deposit/withdraw enabled, and the counter asset correctly set in thesep38.exchangable_assets
list.If USD <-> SRT should not be supported, a new field called
swap_only
can be added under thedeposit
/withdraw
operations. Enablingswap_only
would disable USD <-> SRT transactions.The text was updated successfully, but these errors were encountered: