Skip to content

Commit 00f01fb

Browse files
damir-bajramovicgitbook-bot
authored andcommitted
GITBOOK-412: Damir's Jun 11 changes
1 parent ee10a35 commit 00f01fb

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
* [API Response](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-response/README.md)
6060
* [JSON Example](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-response/json-example.md)
6161
* [Refreshing Estimates](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/refreshing-estimates.md)
62+
* [Quoting Strategies](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/quoting-strategies.md)
6263
* [Monitoring Orders](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/monitoring-orders/README.md)
6364
* [Order States](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/monitoring-orders/order-states.md)
6465
* [Requesting Order Creation Transaction](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/requesting-order-creation-transaction.md)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
description: >-
3+
Quoting strategies supported by DLN, explaining how source and destination
4+
amounts are configured for each strategy, with guidance on when to use each.
5+
---
6+
7+
# Quoting Strategies
8+
9+
DLN supports multiple quoting strategies that allow users to control how much is spent on the source chain and how much is received on the destination chain. Each strategy is expressed by how the `srcChainTokenInAmount` and `dstChainTokenOutAmount` fields are set in the order input. 
10+
11+
Below is an overview of all currently supported quoting strategies.
12+
13+
### Market Order
14+
15+
```typescript
16+
const orderInput: deBridgeOrderInput = {
17+
...,
18+
srcChainTokenInAmount: "<fixed_amount>",
19+
dstChainTokenOutAmount: "auto",
20+
...
21+
}
22+
```
23+
24+
This is the default and most commonly used quoting strategy. It specifies an exact source amount to be transferred, while allowing the protocol to calculate the best possible amount to be received on the destination chain based on current market conditions and solver competition.
25+
26+
* Recommended for most standard transfers
27+
* `srcChainTokenInAmount` must be set to a concrete numeric value
28+
* `dstChainTokenOutAmount` must be set to `"auto"`
29+
30+
### Market Order with Full Balance Utilization
31+
32+
```typescript
33+
const orderInput: deBridgeOrderInput = {
34+
...,
35+
srcChainTokenInAmount: "max",
36+
dstChainTokenOutAmount: "auto",
37+
...
38+
}
39+
```
40+
41+
This strategy attempts to spend **the full wallet balance** of the source token. It is useful when the intention is to "empty" the source wallet of a given asset, such as in account abstraction flows, automated batch processing, or non-custodial smart wallets.
42+
43+
* `srcChainTokenInAmount` must be set to `max`
44+
* `dstChainTokenOutAmount` must be set to `"auto"`
45+
46+
### Reverse Market Order
47+
48+
```typescript
49+
const orderInput: deBridgeOrderInput = {
50+
...,
51+
srcChainTokenInAmount: "auto",
52+
dstChainTokenOutAmount: "<fixed_amount>",
53+
...
54+
}
55+
```
56+
57+
This strategy specifies a desired amount to be received on the estination chain, and allows the protocol to determine how much must be spent on the source chain to fulfill the request. It is commonly used in cases where a precise destination amount is required, such as payments or on-chain contract interactions.
58+
59+
* `` `srcChainTokenInAmount` `` must be set to `"auto"`
60+
* `dstChainTokenOutAmount` must be set to a concrete numeric value
61+
62+
### Limit Order (Not Recommended)
63+
64+
```typescript
65+
const orderInput: deBridgeOrderInput = {
66+
...,
67+
srcChainTokenInAmount: "<fixed_amount>",
68+
dstChainTokenOutAmount: "<fixed_amount>",
69+
...
70+
}
71+
```
72+
73+
This strategy attempts to enforce **both** the source amount to be sent and the destination amount to be received. It effectively functions as a limit order, and will only be fulfilled if a solver is willing to match both values.
74+
75+
* High likelihood of non-fulfillment if the order is unattractive to solvers
76+
* Not recommended for production usage
77+
* Both `srcChainTokenInAmount` and `dstChainTokenOutAmount` must be concrete values
78+
79+
### Example: Order Input Structure
80+
81+
All quoting strategies use the same order input interface, with key fields adjusted per strategy:
82+
83+
```typescript
84+
const arbUsdcAddress = "0xaf88d065e77c8cc2239327c5edb3a432268e5831";
85+
const bnbUsdcAddress = "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d";
86+
const usdcDecimals = 18; // BNB USDC has 6 decimals
87+
const amountToSend = "0.01"; // The amount of USDC to send
88+
89+
const amountInAtomicUnit = ethers.parseUnits(amountToSend, usdcDecimals);
90+
91+
const orderInput: deBridgeOrderInput = {
92+
srcChainId: '56', // BNB Chain Id
93+
srcChainTokenIn: bnbUsdcAddress,
94+
srcChainTokenInAmount: amountInAtomicUnit.toString(),
95+
dstChainTokenOutAmount: "auto",
96+
dstChainId: '42161', // Arbitrum Chain Id
97+
dstChainTokenOut: arbUsdcAddress,
98+
dstChainTokenOutRecipient: wallet.address,
99+
account: wallet.address,
100+
srcChainOrderAuthorityAddress: wallet.address,
101+
dstChainOrderAuthorityAddress: wallet.address,
102+
referralCode: 31805 // Optional
103+
// ... Other optional parameters
104+
};
105+
```
106+
107+
### Choosing a Stratrgy
108+
109+
| Use Case | Recommended Strategy |
110+
| -------------------------------------- | ------------------------------ |
111+
| Standard transfer with known input | Market Order |
112+
| Full wallet balance transfer | Market Order with Full Balance |
113+
| Target fixed destination output | Reverse Market Order |
114+
| Exact 1-to-1 trade with specific terms | Limit Order (not recommended) |

0 commit comments

Comments
 (0)