Mantle Risk Evaluator
Overview
Run a mandatory pre-flight checklist and return a clear pass, warn, or block verdict. Prevent unsafe execution when any critical condition fails.
Workflow
- Normalize intent input:
- operation type
- token in/out and amount
- target protocol/router/pool addresses
- user risk parameters (slippage cap, deadline, max gas preference)
- Execute the checklist (see Checklist section below).
- Apply the threshold table (see Thresholds section below). Use user-specified parameters first; use defaults only when user constraints are absent.
- Classify each item:
- Produce final verdict:
pass: no fails, optional warns.
warn: no critical fails, but user confirmation required.
block: one or more critical fails.
Mandatory Input Fields
All of the following MUST be present in the intent. If any is missing, immediately set the final verdict to block with blocking reason "mandatory field missing":
operation_type
chain/environment
- token in/out and amount
- target contract/router/pool address
Checklist
1. Slippage check
- The "proposed slippage" is the slippage tolerance the user (or protocol) has set for this transaction.
- ALWAYS compare the proposed slippage against the default threshold table below, regardless of whether the user set it themselves.
- A user choosing a high slippage tolerance does NOT make it safe -- the default thresholds still apply.
- If the user also specifies a separate, stricter cap, apply whichever is more restrictive.
- Fail when proposed slippage exceeds the fail threshold (> 1.0% by default).
2. Liquidity depth check
- Estimate price impact from quote/simulation context.
- Warn on moderate impact, fail on severe impact (see thresholds).
- If liquidity data is unavailable, set warn with note "reduced confidence".
3. Address safety check
- Verify all addresses against trusted registry/tooling.
pass: trusted and verified source.
warn: unknown but not explicitly flagged.
fail: flagged, blacklisted, or malformed address.
4. Allowance scope check
- Detect approvals broader than required for intended amount.
pass: existing allowance fits intended spend scope.
warn: allowance materially larger than intended spend.
fail: new or existing near-unlimited approval without explicit user confirmation. Near-unlimited heuristic: raw allowance >= 2^255.
5. Gas and deadline sanity
- Check gas estimate reasonableness versus recent baseline.
- Check transaction deadline is not stale and not excessively long.
- Apply thresholds below.
Thresholds (defaults when user has not specified)
| Check |
Warn |
Fail |
| Slippage |
> 0.5% |
> 1.0% |
| Estimated price impact |
> 2% |
> 5% |
| Deadline horizon |
> 20 minutes |
> 60 minutes |
| Gas deviation from baseline |
> 20% |
> 40% |
Verdict Rules
- Any
fail in ANY checklist item => final verdict block.
- No
fail and at least one warn => final verdict warn.
- All checks
pass => final verdict pass.
Confidence policy
high: all required signals present and consistent.
medium: one non-critical signal missing.
low: key signals missing (e.g., no liquidity data or unresolved address provenance).
- If confidence is low, downgrade verdict one level toward caution (
pass -> warn, warn -> block).
Blocking Conditions
- Planned slippage exceeds user cap or exceeds 1.0% default.
- Address risk check fails (flagged, blacklisted, or malformed counterparty).
- Liquidity depth indicates severe price impact beyond 5%.
- Gas deviation from baseline exceeds 40%.
- Near-unlimited allowance (>= 2^255) without explicit user confirmation.
- Mandatory intent field is missing (cannot evaluate safely).
Output Format
Always use this exact structure. You MUST include ALL five checklist items in every response, even when blocking early due to missing fields. For checks that cannot be evaluated (e.g., because a required input is missing), mark them as fail with details explaining why (e.g., "cannot evaluate -- required field missing").
Mantle Preflight Risk Report
- operation:
- environment:
- evaluated_at_utc:
Checklist
- slippage_check: pass | warn | fail
details:
- liquidity_depth_check: pass | warn | fail
details:
- address_safety_check: pass | warn | fail
details:
- allowance_scope_check: pass | warn | fail
details:
- gas_and_deadline_check: pass | warn | fail
details:
Final Verdict
- status: pass | warn | block
- blocking_reasons:
- user_action_required:
References
references/risk-checklist.md
references/risk-threshold-guidance.md
1---2name: mantle-risk-evaluator3description: Use when a Mantle state-changing intent needs pre-execution slippage, liquidity, address-safety, allowance-scope, or gas/deadline checks.4---5
6# Mantle Risk Evaluator
7
8## Overview
9
10Run a mandatory pre-flight checklist and return a clear `pass`, `warn`, or `block` verdict. Prevent unsafe execution when any critical condition fails.
11
12## Workflow
13
141. Normalize intent input:
15 - operation type
16 - token in/out and amount
17 - target protocol/router/pool addresses
18 - user risk parameters (slippage cap, deadline, max gas preference)
192. Execute the checklist (see Checklist section below).
203. Apply the threshold table (see Thresholds section below). Use user-specified parameters first; use defaults only when user constraints are absent.
214. Classify each item:
22 - `pass`
23 - `warn`
24 - `fail`
255. Produce final verdict:
26 - `pass`: no fails, optional warns.
27 - `warn`: no critical fails, but user confirmation required.
28 - `block`: one or more critical fails.
29
30## Mandatory Input Fields
31
32All of the following MUST be present in the intent. If any is missing, immediately set the final verdict to `block` with blocking reason "mandatory field missing":
33
34- `operation_type`
35- `chain/environment`
36- token in/out and amount
37- target contract/router/pool address
38
39## Checklist
40
41### 1. Slippage check
42- The "proposed slippage" is the slippage tolerance the user (or protocol) has set for this transaction.
43- ALWAYS compare the proposed slippage against the default threshold table below, regardless of whether the user set it themselves.
44- A user choosing a high slippage tolerance does NOT make it safe -- the default thresholds still apply.
45- If the user also specifies a separate, stricter cap, apply whichever is more restrictive.
46- Fail when proposed slippage exceeds the fail threshold (> 1.0% by default).
47
48### 2. Liquidity depth check
49- Estimate price impact from quote/simulation context.
50- Warn on moderate impact, fail on severe impact (see thresholds).
51- If liquidity data is unavailable, set warn with note "reduced confidence".
52
53### 3. Address safety check
54- Verify all addresses against trusted registry/tooling.
55- `pass`: trusted and verified source.
56- `warn`: unknown but not explicitly flagged.
57- `fail`: flagged, blacklisted, or malformed address.
58
59### 4. Allowance scope check
60- Detect approvals broader than required for intended amount.
61- `pass`: existing allowance fits intended spend scope.
62- `warn`: allowance materially larger than intended spend.
63- `fail`: new or existing near-unlimited approval without explicit user confirmation. Near-unlimited heuristic: raw allowance `>= 2^255`.
64
65### 5. Gas and deadline sanity
66- Check gas estimate reasonableness versus recent baseline.
67- Check transaction deadline is not stale and not excessively long.
68- Apply thresholds below.
69
70## Thresholds (defaults when user has not specified)
71
72| Check | Warn | Fail |
73|---|---|---|
74| Slippage | > 0.5% | > 1.0% |
75| Estimated price impact | > 2% | > 5% |
76| Deadline horizon | > 20 minutes | > 60 minutes |
77| Gas deviation from baseline | > 20% | > 40% |
78
79## Verdict Rules
80
81- Any `fail` in ANY checklist item => final verdict **block**.
82- No `fail` and at least one `warn` => final verdict **warn**.
83- All checks `pass` => final verdict **pass**.
84
85### Confidence policy
86- `high`: all required signals present and consistent.
87- `medium`: one non-critical signal missing.
88- `low`: key signals missing (e.g., no liquidity data or unresolved address provenance).
89- If confidence is low, downgrade verdict one level toward caution (`pass` -> `warn`, `warn` -> `block`).
90
91## Blocking Conditions
92
93- Planned slippage exceeds user cap or exceeds 1.0% default.
94- Address risk check fails (flagged, blacklisted, or malformed counterparty).
95- Liquidity depth indicates severe price impact beyond 5%.
96- Gas deviation from baseline exceeds 40%.
97- Near-unlimited allowance (>= 2^255) without explicit user confirmation.
98- Mandatory intent field is missing (cannot evaluate safely).
99
100## Output Format
101
102Always use this exact structure. You MUST include ALL five checklist items in every response, even when blocking early due to missing fields. For checks that cannot be evaluated (e.g., because a required input is missing), mark them as `fail` with details explaining why (e.g., "cannot evaluate -- required field missing").
103
104```text
105Mantle Preflight Risk Report
106- operation:
107- environment:
108- evaluated_at_utc:
109
110Checklist
111- slippage_check: pass | warn | fail
112 details:
113- liquidity_depth_check: pass | warn | fail
114 details:
115- address_safety_check: pass | warn | fail
116 details:
117- allowance_scope_check: pass | warn | fail
118 details:
119- gas_and_deadline_check: pass | warn | fail
120 details:
121
122Final Verdict
123- status: pass | warn | block
124- blocking_reasons:
125- user_action_required:
126```
127
128## References
129
130- `references/risk-checklist.md`
131- `references/risk-threshold-guidance.md`