bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 31쪽 중 3쪽
entFee,
uint32 referralCode
);
```
This event emits an `Order` struct, which provides the information necessary to either fulfill or cancel the order.
Further details about the Order structure can be found here.
Solvers evaluate whether an order is worth fulfilling based on its profitability, which they simulate on their infrastructure.
To ensure orders are attractive to solvers, integrators must configure them so that the spread between input assets and wanted
assets covers all associated costs, including operating expenses and all of the fees. Additional considerations around profitability
are discussed in the following section.
Solvers typically begin by simulating the order to evaluate its profitability. Unprofitable orders are ignored. However, if market conditions
change, solvers may re-simulate previously ignored orders to reassess their viability.
# Fulfilling an Order
Source: https://docs.debridge.com/dln-details/dln-specifics/order-fulfillment/fulfilling-order
Fulfillment steps on the destination chain and related solver actions.
After the `OrderCreated` event is detected, and solvers deem the order profitable, they enter the next stage of the process, illustrated by the green background in the diagram below.
```mermaid theme={null}
sequenceDiagram
actor Solver
participant DlnDestination
participant SwapService
actor Beneficiary
rect rgba(240, 240, 240, .15)
note right of Solver: Fulfil Order (Destination Chain)
Solver ->> DlnDestination : fulfillOrder(...) with reserve assets
activate DlnDestination
alt reserveAssetsWanted == false
note right of DlnDestination: Pre-Fill Swap
DlnDestination ->> SwapService : swapReserveToWanted()
activate SwapService
SwapService -->> DlnDestination : wantedAssets
deactivate SwapService
else
note right of DlnDestination: No swap needed
end
DlnDestination ->> Beneficiary : transferWantedAssets(amount)
DlnDestination -->> Solver : fulfilReceipt
deactivate DlnDestination
end
```
# Order Fulfillment
Source: https://docs.debridge.com/dln-details/dln-specifics/order-fulfillment/order-fulfillment
Order fulfillment steps, solver transactions, and cost considerations for DLN orders.
This page outlines secondary but relevant concepts related to order creation. While not central to the core flow for creating an order,
they are important for transparency and for understanding various fields in the create-tx API response.
Order fulfillment involves three distinct steps:
* Detecting the created order on the source chain
* Fulfilling the order on the destination chain
* Claiming the order on the source chain
In total, a solver performs three transactions during the lifecycle of an order:
* Fulfilling the order on the destination chain
* Sending unlock message via DMP from destination to the source chain
* Claiming the locked order input assets on the source chain
The gas fees associated with those transactions are considered operating costs and should be factored in when creating an order.
```mermaid theme={null}
sequenceDiagram
actor Solver
participant DlnSource
participant SimulateService
participant DlnDestination
participant SwapService
participant DMP
actor Beneficiary
Beneficiary ->> DlnSource : CreateOrder()
rect rgba(240, 240, 240, .15)
note right of Solver: Simulate Order
DlnSource ->> Solver : CreatedOrder(orderId)
Solver ->> SimulateService : simulateOrder(orderId)
activate SimulateService
SimulateService -->> Solver : simulationResult
deactivate SimulateService
end
alt not simulationResult.profitable
note right of Solver: Order Ignored
else simulationResult.profitable
rect rgba(240, 240, 240, .15)
note right of Solver: Fulfil Order (Destination Chain)
Solver ->> DlnDestination : fulfillOrder(...) with reserve assets
activate DlnDestination
alt reserveAssetsWanted == false
note right of DlnDestination: Pre-Fill Swap
DlnDestination ->> SwapService : swapReserveToWanted()
activate SwapService
SwapService -->> DlnDestination : wantedAssets
deactivate SwapService
else
note right of DlnDestination: No swap needed
end
DlnDestination ->> Beneficiary : transferWantedAssets(amount)
DlnDestination -->> Solver : fulfilReceipt
deactivate DlnDestination
end
rect rgba(240, 240, 240, .15)
note right of Solver: Send Unlock
Solver ->> DMP : sendCrossChainMessage(orderId)
activate DMP
DMP -->> Solver : ack
DMP ->> DlnSource : unlockOrder
deactivate DMP
end
rect rgba(230, 230, 255, .15)
note right of Solver: Claim Input Assets
Solver ->> DlnSource : claimOrder(...)
activate DlnSource
DlnSource -->> Solver : claimReceipt
deactivate DlnSource
end
end
```
# Pre-Fill Swap
Source: https://docs.debridge.com/dln-details/dln-specifics/order-fulfillment/pre-fill-swap
Pre-fill swap behavior for reserve assets before destination transfer.
Solvers exclusively hold reserve assets to simplify accounting and minimize risk exposure. The Pre-Fill-Swap section is highlighted in the diagram
below. It illustrates an intermediary step in order fulfillment process that occurs **when requested assets are not [reserve
assets](dln-details/dln-specifics/reserve-assets)**.
```mermaid theme={null}
sequenceDiagram
participant DlnDestination
participant SwapService
actor Beneficiary
activate DlnDestination
alt reserveAssetsWanted == false
note right of DlnDestination: Pre-Fill Swap
DlnDestination ->> SwapService : swapReserveToWanted()
activate SwapService
SwapService -->> DlnDestination : wantedAssets
deactivate SwapService
else
note right of DlnDestination: No swap needed
end
DlnDestination ->> Beneficiary : transferWantedAssets(amount)
deactivate DlnDestination
```
When the order requests [reserve assets](dln-details/dln-specifics/reserve-assets), this swap step is skipped, as solvers are expected to maintain
sufficient balances of reserve assets at all times.
The DLN supports requesting arbitrary assets on the destination chain. When **requested assets are not reserve assets**, the solver performs a
**Pre-Fill-Swap**, which is similar in concept to a [Pre-Order-Swap](/dln-details/dln-specifics/bridging-non-reserve-assets#pre-order-swap), but
reversed. In this case, the solver swaps [reserve assets](dln-details/dln-specifics/reserve-assets) for the requested assets and transfers the
guaranteed amount to the beneficiary address on the destination chain specified in the order.
# Reserve Assets
Source: https://docs.debridge.com/dln-details/dln-specifics/reserve-assets
What reserve assets are and how solvers use them in DLN.
[deBridge Liquidity Network (DLN)](/dln-details/overview/introduction) operates as a free and competitive market where solvers fulfill cross-chain
orders if doing so is profitable. Solvers are responsible for covering the order execution costs (gas fees). These costs include
transferring the bridged assets to the beneficiary on the destination chain, as well as the fees required to claim the assets that were
initially bridged by the user on the source chain. These combined expenses constitute the [operating expenses](/dln-details/overview/fee-structure) for solvers.
<Tip>
Although DLN enables the bridging of arbitrary liquid assets across supported networks, settlement between chains is always performed
in a limited set of predefined tokens known as reserve assets.
</Tip>
To reduce operational complexity, DLN is designed such that solvers only need to maintain liquidity in a small set of reserve assets.
These assets currently include:
* ETH on Ethereum, Arbitrum, Base, and Linea
* wETH on Avalanche, BNB Chain, and Polygon
* USDC (issued by Circle Inc.) on all DLN-supported chains
* On Arc, use native USDC (`0x0000000000000000000000000000000000000000`, 18 decimals) as the input/output USDC variant for cross-chain orders, not the ERC-20 USDC (`0x3600000000000000000000000000000000000000`, 6 decimals)
* USDT on TRON
This model ensures reliable settlement and minimizes the capital management burden on solvers while still supporting a wide variety of
bridged tokens. Further details about operating costs and fees are available [here](/dln-details/overview/fees-supported-chains).
<Warning>
In most cases, USDC will be used. If the reserve asset on one chain is USDC, but on another it is ETH or wETH, USDC will be used on both the source
and destination chains.
</Warning>
# Authentication
Source: https://docs.debridge.com/dln-details/integration-guidelines/order-creation/authentication
Authentication requirements and rate limits for the DLN API.
The DLN API is open to everyone with a limited RPS and doesn't require authentication. To make sure we keep delivering a
high-quality service, we've introduced a requirement for commercial integrations to authenticate requests with dedicated API keys.
Please fill in [the Authentication Request form](https://forms.gle/doWLQpr8oemphoaf9) so we can provide you with a dedicated API
key and custom limits.
[https://forms.gle/doWLQpr8oemphoaf9](https://forms.gle/doWLQpr8oemphoaf9)
## Rate Limits
deBridge Liquidity Network API offers generous RPM limits for unauthenticated requests, but authenticated requests with API keys
receive significantly higher limits. This ensures that commercial integrations can operate smoothly without hitting rate limits
while still allowing developers to experiment and build with the API.
| Authentication Status | Rate Limit (RPM) |
| --------------------- | ---------------- |
| Unauthenticated | 50 |
| Authenticated | 300 |
More details on how to use your API key and the benefits of authentication can be found in the [API documentation](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#authentication).
# Cancelling an Order
Source: https://docs.debridge.com/dln-details/integration-guidelines/order-creation/cancelling-order
Handling an unfulfilled order – cancellations on the destination chain, response payload, and important considerations.
It can be the case that the given order remains unfulfilled for a prolonged period of time. The reason for this may be that the order became
unprofitable, and no one is willing to fulfill it. In this case, the order must be cancelled to unlock the input amount of funds.
[Limit orders](/dln-details/integration-guidelines/order-creation/creating-order/quoting-strategies#limit-order-not-recommended) have a high potential
of remaining unfulfilled for prolonged periods of time, until the market conditions are met. One example of such an order is a [0.01 SOL for 20.000
POL limit order](https://app.debridge.finance/order?orderId=0x5aa527db4bb244bb30b05d443db3370e42d29c4a1364601deb54e632f7c70c51) which was created for
demonstration purposes of this article.
The only way to cancel the order is to initiate the cancellation procedure on the chain it was intended to be fulfilled on (the `dstChainId` parameter
from `create-tx` call payload). During the cancellation process, the order enters a `OrderCancelled`
[state](/dln-details/integration-guidelines/order-creation/order-tracking-api/order-states#order-states), which prevents fulfillment. A cross-chain
message is sent through the deBridge cross-chain messaging infrastructure to the DLN contract on the source chain to unlock the given funds. **The
funds locked on the source chain are returned in full including affiliate and protocol fees**.
The cancellation procedure can only be initiated by the `dstChainOrderAuthorityAddress` in a separate transaction on the destination chain. Such
transaction can be requested by calling the `/v1.0/dln/order/:id/cancel-tx` endpoint:
```
https://dln.debridge.finance/v1.0/dln/order/0x5aa527db4bb244bb30b05d443db3370e42d29c4a1364601deb54e632f7c70c51/cancel-tx
```
This gives the response from which the transaction data can be extracted to be signed and broadcasted to the destination chain, described by the
following TypeScript type:
```typescript theme={null}
export type CancelTxResponsePayload = {
cancelBeneficiary: string; // Source chain input funds recipient after cancellation
chainId: number; // Chain to submit on
data: string; // TX data
from: string; // Allowed tx sender address
to: string; // TX `to`
value: string; // TX `value`
}
```
Detailed runnable script on how to cancel an order is available in [the accompanying examples
repository](https://github.com/debridge-finance/api-integrator-example/blob/master/src/scripts/orders/cancellation/cancel-order.ts).
Several considerations:
* the transaction can be submitted only to the chain where the order has been intended to be fulfilled on, designated with `chainId` field in the response
* the transaction call would be accepted only if made by the `dstChainOrderAuthorityAddress` specified during the given order creation, designated
with `from` field in the response
* the funds locked on the source chain upon order creation are returned to the `srcChainOrderAuthorityAddress` specified during the given order
creation, designated with the `cancelBeneficiary` response field
* the `value` for the transaction is always positive, needed to cover:
* the deBridge cross-chain messaging protocol fee (measured in the blockchain native currency where the message is being sent from) to make a
cancellation message accepted. Consider looking at [the list of supported chains and fees](/dmp-details/dmp/fees-supported-chains) and [details on
retrieving the deBridge protocol fee](dln-details/integration-guidelines/smart-contracts/placing-orders);
* a small amount to cover the gas on the source chain, which gives an incentive to keepers for the successful claim of the cross-chain message on
the source chain. In other words, this is a prepayment for potential gas expenses, that will be transferred by the protocol.
## Further reading
* [Automatic Cancellations](/dln-details/affiliates/auto-cancellations)
# API Parameters
Source: https://docs.debridge.com/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters
List of API parameters and descriptions. Deep dive into certain parameters.
Below is a succinct breakdown of the parameters used in the `create-tx` API endpoint. Detailed descriptions and usage examples are
provided in dedicated subpages.
## Notable API Categories
There are several categories of parameters that are particularly important to understand when working with the `create-tx`
endpoint:
### Authentication
| **Parameter** | **Example Value** | **Description** |
| ------------- | ----------------- | ----------------------------------- |
| `accesstoken` | `xx789x` | Access token generated by deBridge. |
### Directional Parameters
These parameters define the origin and destination of the transaction, including the assets being sold on the source chain and the
assets being purchased on the destination chain.
| **Parameter** | **Example Value** | **Description** |
| ------------------ | -------------------------------------------- | ---------------------------------------------------- |
| `srcChainId` | `56` | Internal chainId of the supported source chain. |
| `srcChainTokenIn` | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` | Input asset address (what the user sells). |
| `dstChainId` | `43114` | Internal chainId of the supported destination chain. |
| `dstChainTokenOut` | `0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7` | Output asset address (what the user buys). |
### Offer Parameters
These parameters specify the amounts of tokens to be sold and received. The API can also be configured to automatically determine
the output amount to ensure a reasonably profitable market order.
| **Parameter** | **Example Value** | **Description** |
| ------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
| `srcChainTokenInAmount` | `100000000000000000000` or `auto` | Amount of input token (with decimals). Can be `auto` if `dstChainTokenOutAmount` is specified. |
| `dstChainTokenOutAmount` | `auto` or `100000000000000000000` | Amount of output token. Recommended to use `auto` for optimal solver matching. |
| `prependOperatingExpense` | `true` | Adds estimated operating expense to input token. Recommended for better UX. |
### Authorities and Recipient Address
Optional parameters defining entities authorized to patch/cancel the order, and the recipient of funds on fulfillment. Typically
user addresses are used.
> These parameters are optional. However, omitting them means the API won't return a signable transaction payload until wallet
> connection.
<Warning>
**Ensure** `dstChainOrderAuthorityAddress` is user-accessible — otherwise funds may become inaccessible.
</Warning>
| **Parameter** | **Example Value** | **Description** |
| ------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `srcChainOrderAuthorityAddress` | `0xd8dA...ABCD` or `862oLANN...` | Set the source chain authority address to the user's address. Used as fallback for [`srcAllowedCancelBeneficiary`](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#cancellation-beneficiary) if the latter is not set explicitly. |
| `dstChainOrderAuthorityAddress` | `0xd8dA...ABCD` or `862oLANN...` | Can cancel order on destination chain. **Must be controlled by the user.** |
| `dstChainTokenOutRecipient` | `0xd8dA...ABCD` or `862oLANN...` | Recipient of funds on destination chain after fulfillment. Typically the user's address. |
### Affiliate Fee Parameters
These settings define the affiliate fee recipient and amount.
| **Parameter** | **Example Value** | **Description** |
| ----------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `affiliateFeePercent` | `0.1` | Percentage of input amount to assign as affiliate fee. |
| `affiliateFeeRecipient` | `0xd8dA...ABCD` or `862oLANN...` | Address (EVM) or pubkey (Solana) that will receive affiliate fees once order reaches `ClaimUnlocked` state. |
### Referral Code
Optional tracking and reward parameter.
| **Parameter** | **Example Value** | **Description** |
| -------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `referralCode` | `31805` | Integrator's referral code. [Can be generated in-app](/dln-details/affiliates/integrators#how-to-make-sure-your-integration-activity-is-accounted-for%3F). |
### Cancellation Beneficiary
Optional parameters, but required for [auto-cancellations](/dln-details/affiliates/auto-cancellations) to work.
| **Parameter** | **Example Value** | **Description** |
| ----------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `srcAllowedCancelBeneficiary` | `0xd8dA...ABCD` or `862oLANN...` | Address receiving the source chain input funds in an event of cancellation. More information available in the [auto-cancellations article](/dln-details/affiliates/auto-cancellations). |
### Transaction Estimation
For EVM chains, the API can be configured to validate the resulting transaction and provide an estimate of its gas consumption.
This is particularly useful for ensuring that all of the conditions for executing the transaction are met before submission, such
as sufficient token balances and approvals.
| **Parameter** | **Example Value** | **Description** |
| ----------프로젝트로 돌아가기