-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
DeFiFor DeFi ApplicationsFor DeFi Applicationsgood first issueGood for newcomersGood for newcomerspolicyWriting CSL policies for business useWriting CSL policies for business use
Description
📝 Context
DeFi agents often execute trades in low-liquidity pools. We need a safety policy to prevent the agent from getting "sandwiched" or losing money due to high slippage.
🎯 The Goal
Write a CSL policy that acts as a hard constraint for a trading bot.
Variables you can use:
price_impact(Float): The percentage impact on the pool (e.g., 2.5 for 2.5%).slippage_tolerance(Float): The user's setting (e.g., 0.5).is_verified_pool(Boolean): Whether the token contract is verified.
Requirements:
- BLOCK if
price_impactis greater thanslippage_tolerance. - BLOCK if
price_impact> 5.0 (Hard cap, even if user allows it). - BLOCK if
is_verified_poolisFalse.
📚 Resources
- Start here:
docs/getting-started.md - Check syntax:
quickstart/01_hello_world.csl - See how we handle numbers:
docs/syntax-spec.md - Reference:
examples/chimera_banking_case_study.csl
✅ Definition of Done
Submit a PR with: examples/community/defi_slippage_guard.csl
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DeFiFor DeFi ApplicationsFor DeFi Applicationsgood first issueGood for newcomersGood for newcomerspolicyWriting CSL policies for business useWriting CSL policies for business use