Wire the RejectionLogger contract into the risk engine for on-chain rejection transparency
Wire rejection logging for: $ARGUMENTS
Read:
ARIA/contracts/RejectionLogger.sol — logRejection() signatureARIA/agent/tools/risk_engine.py — the TODO about Rejection LoggerARIA/agent/config.py — rejection_logger_addresslogRejection expects:
function logRejection(
string calldata reason, // "POSITION_SIZE_EXCEEDED"
string calldata tradeData, // "Sell 250 USDC for DAI"
uint256 limitValue, // 20 (the limit)
uint256 actualValue, // 25 (actual value)
string calldata riskMetric // "position_size_pct"
) external onlyOwner
Define _REJECTION_LOGGER_ABI in for .
risk_engine.pylogRejectionAfter risk checks fail (passed is False), map each rejection to values:
| Reason | limitValue | actualValue | riskMetric |
|---|---|---|---|
| POSITION_SIZE_EXCEEDED | 20 | position_pct | "position_size_pct" |
| DAILY_LOSS_LIMIT_HIT | 2 | abs(daily_pnl) | "daily_pnl_pct" |
| DRAWDOWN_CIRCUIT_BREAKER | 5 | drawdown | "drawdown_pct" |
| VOLATILITY_TOO_HIGH | 1 | abs(spread) | "spread_pct" |
| STRATEGY_VIOLATION | 0 | 0 | "strategy_alignment" |
Build, sign, send transaction. Add span attributes: aria.rejection.tx_hash, aria.rejection.reason, aria.rejection.gas_used.
Handle errors gracefully — if on-chain logging fails, still return the risk check result. Log the error but don't block.
Config access: the function needs RPC URL, private key, and contract address from AriaConfig.