You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The <strong>Valence Clearing Queue</strong> library allows <strong>registration and settlement of withdrawal obligations</strong> in a FIFO (First-In-First-Out) manner. It maintains a queue of pending withdrawal obligations, with each obligation containing recipient information, payout amounts, and a unique identifier. When settling obligations, funds are pulled from a <strong>settlement input account</strong> and sent to the specified recipients.</p>
176
+
<p>The queue processes obligations based on a strict, monotonically increasing order of the obligation ids.
177
+
This is meant to prevent any out-of-order errors that may arise from latency or other issues.</p>
176
178
<blockquote>
177
179
<p><strong>Important:</strong>
178
180
This library functions solely as a settlement engine. The settlement account funding (liquidity-management) flow is outside of its scope and is managed by a strategist. This management process likely involves monitoring both the settlement account balance and the obligation queue in order to ensure the settlement account maintains sufficient liquidity for obligation settlements.</p>
<tr><td><strong>RegisterObligation</strong></td><td><code>recipient: String</code><br><code>payout_coins: Vec<Coin></code><br><code>id: Uint64</code></td><td>Registers a new withdrawal obligation in the queue with the specified recipient, payout coins, and unique ID. Each obligation must have non-zero payout amounts. Recipient must be a valid bech32 address.</td></tr>
200
+
<tr><td><strong>RegisterObligation</strong></td><td><code>recipient: String</code><br><code>payout_amount: Uint128</code><br><code>id: Uint64</code></td><td>Registers a new withdrawal obligation in the queue with the specified recipient, payout coins, and unique ID. Each obligation must have a non-zero payout amount. Recipient must be a valid bech32 address. Obligation id must equal the latest registered obligation id plus 1.</td></tr>
199
201
<tr><td><strong>SettleNextObligation</strong></td><td>-</td><td>Settles the oldest withdrawal obligation in the queue by transferring funds from the <strong>settlement input account</strong> to the specified recipient. Fails if there are no pending obligations or if the input account has insufficient balance.</td></tr>
/// settlement input account which we tap into in order
208
210
/// to settle the obligations
209
211
pub settlement_acc_addr: LibraryAccountType,
212
+
/// obligation base denom
213
+
pub denom: String,
214
+
/// latest registered obligation id.
215
+
/// if `None`, defaults to 0
216
+
pub latest_id: Option<Uint64>,
210
217
}
211
218
<spanclass="boring">}</span></code></pre></pre>
212
219
<p>The <code>settlement_acc_addr</code> specifies the account from which funds will be pulled to fulfill settlement obligations. The library will check that this account has sufficient balance before attempting to settle each obligation.</p>
220
+
<p>Configured <code>denom</code> is the base clearing denomination which will be applied to all obligation amounts.</p>
221
+
<p>Lastly, the optional <code>latest_id</code> field allows to configure the library order to start from a specific id.
222
+
If <code>None</code>, latest id defaults to 0. Otherwise, it will start from the specified id.</p>
<p>The <strong>Valence Clearing Queue</strong> library allows <strong>registration and settlement of withdrawal obligations</strong> in a FIFO (First-In-First-Out) manner. It maintains a queue of pending withdrawal obligations, with each obligation containing recipient information, payout amounts, and a unique identifier. When settling obligations, funds are pulled from a <strong>settlement input account</strong> and sent to the specified recipients.</p>
1543
+
<p>The queue processes obligations based on a strict, monotonically increasing order of the obligation ids.
1544
+
This is meant to prevent any out-of-order errors that may arise from latency or other issues.</p>
1543
1545
<blockquote>
1544
1546
<p><strong>Important:</strong>
1545
1547
This library functions solely as a settlement engine. The settlement account funding (liquidity-management) flow is outside of its scope and is managed by a strategist. This management process likely involves monitoring both the settlement account balance and the obligation queue in order to ensure the settlement account maintains sufficient liquidity for obligation settlements.</p>
<tr><td><strong>RegisterObligation</strong></td><td><code>recipient: String</code><br><code>payout_coins: Vec<Coin></code><br><code>id: Uint64</code></td><td>Registers a new withdrawal obligation in the queue with the specified recipient, payout coins, and unique ID. Each obligation must have non-zero payout amounts. Recipient must be a valid bech32 address.</td></tr>
1567
+
<tr><td><strong>RegisterObligation</strong></td><td><code>recipient: String</code><br><code>payout_amount: Uint128</code><br><code>id: Uint64</code></td><td>Registers a new withdrawal obligation in the queue with the specified recipient, payout coins, and unique ID. Each obligation must have a non-zero payout amount. Recipient must be a valid bech32 address. Obligation id must equal the latest registered obligation id plus 1.</td></tr>
1566
1568
<tr><td><strong>SettleNextObligation</strong></td><td>-</td><td>Settles the oldest withdrawal obligation in the queue by transferring funds from the <strong>settlement input account</strong> to the specified recipient. Fails if there are no pending obligations or if the input account has insufficient balance.</td></tr>
/// settlement input account which we tap into in order
1575
1577
/// to settle the obligations
1576
1578
pub settlement_acc_addr: LibraryAccountType,
1579
+
/// obligation base denom
1580
+
pub denom: String,
1581
+
/// latest registered obligation id.
1582
+
/// if `None`, defaults to 0
1583
+
pub latest_id: Option<Uint64>,
1577
1584
}
1578
1585
<spanclass="boring">}</span></code></pre></pre>
1579
1586
<p>The <code>settlement_acc_addr</code> specifies the account from which funds will be pulled to fulfill settlement obligations. The library will check that this account has sufficient balance before attempting to settle each obligation.</p>
1587
+
<p>Configured <code>denom</code> is the base clearing denomination which will be applied to all obligation amounts.</p>
1588
+
<p>Lastly, the optional <code>latest_id</code> field allows to configure the library order to start from a specific id.
1589
+
If <code>None</code>, latest id defaults to 0. Otherwise, it will start from the specified id.</p>
<p>The <strong>Valence Forwarder</strong> library allows to <strong>continuously forward funds</strong> from an <strong>input account</strong> to an <strong>output account</strong>, following some time <strong>constraints</strong>. It is typically used as part of a <strong>Valence Program</strong>. In that context, a <strong>Processor</strong> contract will be the main contract interacting with the Forwarder library.</p>
0 commit comments