Skip to content

Commit cc63a7c

Browse files
werner-stacksgitbook-bot
authored andcommitted
GITBOOK-90: No subject
1 parent aaaa223 commit cc63a7c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

docs/build/post-conditions/implementation.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,25 @@ const sftFtCondition = Pc
233233
.ft('ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.sft-contract', 'sft-token');
234234
```
235235

236+
Multi-bin withdrawals (Bitflow DLMM, concentrated-liquidity pools) typically produce one `willMaybeSendAsset()` post-condition per affected bin. The position SFT for each bin may be burned (transferred to the contract) or kept depending on the remaining liquidity after the call. Pairing each per-bin condition with `willSendLte` conditions on the underlying FTs gives the signer a precise upper bound on what can leave their account while allowing the contract to skip burns for bins that retain liquidity.
237+
238+
```ts
239+
// SFT-as-NFT with MAY SEND — for contracts that may or may not transfer
240+
// a specific token-id depending on runtime state (e.g. DLMM/CLMM pools
241+
// where a bin's position SFT is burned only if its liquidity reaches zero).
242+
const sftBinCondition = Pc
243+
.principal(senderAddress)
244+
.willMaybeSendAsset()
245+
.nft(
246+
'SP000...pool.dlmm-position::position',
247+
Cl.tuple({
248+
'pool-id': Cl.uint(1),
249+
'bin-id': Cl.uint(8421),
250+
owner: Cl.principal(senderAddress),
251+
})
252+
);
253+
```
254+
236255
#### Originator-mode post-conditions for DeFi (SIP-040)
237256

238257
When calling a contract that routes assets through several intermediate contracts, listing every hop in `Deny` mode is brittle. `Originator` mode restricts only the sender's own outflows and allows asset movement between other principals.

0 commit comments

Comments
 (0)