Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ Compiler: Solidity 0.8.25, EVM target: cancun, optimizer enabled (1M runs). Fuzz

### Interfaces (`src/interface/`)

- **IOrderBookV5** — Current stable interface. Vault-based order book with deposit/withdraw, add/remove orders, take orders (market buy), and clear (match two orders with bounty). IERC3156 flash loan compliant.
- **IOrderBookV6** (`unstable/`) — Next version. Adds vaultless orders (vault ID `0` means tokens move directly from wallet) and output-based take order limits.
- **IOrderBookV5OrderTaker / IOrderBookV5ArbOrderTaker** — Callback interfaces for takers receiving tokens during `takeOrders`.
- **IOrderBookV6** — Current stable interface. Vault-based order book with deposit/withdraw, add/remove orders, take orders (market buy), and clear (match two orders with bounty). IERC3156 flash loan compliant. Supports vaultless orders (vault ID `0` means tokens move directly from wallet) and input/output-based take order limits via `IOIsInput` flag.
- **IOrderBookV6OrderTaker / IOrderBookV6ArbOrderTaker** — Callback interfaces for takers receiving tokens during `takeOrders`.
- **ierc3156/** — Flash loan interfaces (IERC3156FlashLender, IERC3156FlashBorrower).
- **deprecated/** (v1-v4) — Old interface versions. Do not modify unless undeprecating.
- **deprecated/** (v1-v5) — Old interface versions. Do not modify unless undeprecating.

### Interface Lifecycle

Stable interfaces live directly in `src/interface/`. New unstable interfaces go in `src/interface/unstable/` until stabilised. When stabilising, move from `unstable/` to `src/interface/` and move the previous stable version to `deprecated/v<N>/`.

### Key Types

Expand All @@ -58,7 +61,7 @@ rain.math.float/=lib/rain.interpreter.interface/lib/rain.math.float/src/

- All reverts use custom errors — no `revert("string")` or `require()` with string messages.
- Interfaces use `pragma solidity ^0.8.18` (note: differs from interpreter interface which uses `^0.8.25`).
- Versioned naming: interfaces (`IOrderBookV5`), structs (`OrderV4`, `ClearConfigV2`), events (`AddOrderV3`), functions (`deposit3`, `withdraw3`).
- Versioned naming: interfaces (`IOrderBookV6`), structs (`OrderV4`, `ClearConfigV2`), events (`AddOrderV3`), functions (`deposit4`, `withdraw4`).
- Use `//forge-lint: disable-next-line(...)` comments for lint suppressions: `unused-import`, `mixed-case-variable`, `pascal-case-struct`.
- Use `//forge-lint: disable-start(...)`/`disable-end(...)` for multi-line suppressions.
- Branch naming: `YYYY-MM-DD-description`.
Expand Down
2 changes: 2 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ path = [
".github/workflows/**/",
".gitignore",
".gitmodules",
"CLAUDE.md",
"README.md",
"audit/**/",
"flake.lock",
"flake.nix",
"foundry.toml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

import {IERC3156FlashLender} from "../ierc3156/IERC3156FlashLender.sol";
import {IERC3156FlashLender} from "./ierc3156/IERC3156FlashLender.sol";
import {
IInterpreterCallerV4,
SignedContextV1,
Expand All @@ -12,7 +12,7 @@ import {
IInterpreterV4,
//forge-lint: disable-next-line(unused-import)
IInterpreterStoreV3
} from "../../../lib/rain.interpreter.interface/src/interface/unstable/IInterpreterCallerV4.sol";
} from "../../lib/rain.interpreter.interface/src/interface/IInterpreterCallerV4.sol";

/// Import unmodified structures from older versions of `IOrderBook`.
import {
Expand All @@ -25,7 +25,7 @@ import {
OrderV4,
TakeOrderConfigV4,
QuoteV2
} from "../IOrderBookV5.sol";
} from "./deprecated/v5/IOrderBookV5.sol";

import {Float} from "rain.math.float/lib/LibDecimalFloat.sol";

Expand Down
4 changes: 2 additions & 2 deletions src/interface/deprecated/v1/IOrderBookV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
Evaluable,
SignedContext,
IInterpreterCallerV1
} from "rain.interpreter.interface/interface/deprecated/IInterpreterCallerV1.sol";
import {IExpressionDeployerV3} from "rain.interpreter.interface/interface/deprecated/IExpressionDeployerV3.sol";
} from "rain.interpreter.interface/interface/deprecated/v1/IInterpreterCallerV1.sol";
import {IExpressionDeployerV3} from "rain.interpreter.interface/interface/deprecated/v1/IExpressionDeployerV3.sol";

/// Configuration for a deposit. All deposits are processed by and for
/// `msg.sender` so the vaults are unambiguous here.
Expand Down
6 changes: 3 additions & 3 deletions src/interface/deprecated/v2/IOrderBookV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
pragma solidity ^0.8.18;

import {IERC3156FlashLender} from "../../ierc3156/IERC3156FlashLender.sol";
import {EvaluableConfig, Evaluable} from "rain.interpreter.interface/interface/deprecated/IInterpreterCallerV1.sol";
import {EvaluableConfig, Evaluable} from "rain.interpreter.interface/interface/deprecated/v1/IInterpreterCallerV1.sol";
import {
SignedContextV1,
IInterpreterCallerV2
} from "rain.interpreter.interface/interface/deprecated/IInterpreterCallerV2.sol";
import {IExpressionDeployerV2} from "rain.interpreter.interface/interface/deprecated/IExpressionDeployerV2.sol";
} from "rain.interpreter.interface/interface/deprecated/v1/IInterpreterCallerV2.sol";
import {IExpressionDeployerV2} from "rain.interpreter.interface/interface/deprecated/v1/IExpressionDeployerV2.sol";

/// Configuration for a deposit. All deposits are processed by and for
/// `msg.sender` so the vaults are unambiguous here.
Expand Down
6 changes: 3 additions & 3 deletions src/interface/deprecated/v3/IOrderBookV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
pragma solidity ^0.8.18;

import {IERC3156FlashLender} from "../../ierc3156/IERC3156FlashLender.sol";
import {EvaluableV2} from "rain.interpreter.interface/lib/caller/LibEvaluable.sol";
import {
EvaluableV2,
EvaluableConfigV3,
IInterpreterCallerV2,
SignedContextV1
} from "rain.interpreter.interface/interface/deprecated/IInterpreterCallerV2.sol";
import {IExpressionDeployerV3} from "rain.interpreter.interface/interface/deprecated/IExpressionDeployerV3.sol";
} from "rain.interpreter.interface/interface/deprecated/v1/IInterpreterCallerV2.sol";
import {IExpressionDeployerV3} from "rain.interpreter.interface/interface/deprecated/v1/IExpressionDeployerV3.sol";

/// Import unmodified structures from older versions of `IOrderBook`.
import {IO, ClearConfig, ClearStateChange} from "../v2/IOrderBookV2.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interface/deprecated/v4/IOrderBookV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
IInterpreterV3,
//forge-lint: disable-next-line(unused-import)
IInterpreterStoreV2
} from "../../../../lib/rain.interpreter.interface/src/interface/IInterpreterCallerV3.sol";
} from "../../../../lib/rain.interpreter.interface/src/interface/deprecated/v2/IInterpreterCallerV3.sol";

/// Import unmodified structures from older versions of `IOrderBook`.
import {ClearStateChange, ClearConfig, IO} from "../v3/IOrderBookV3.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

import {IERC3156FlashLender} from "./ierc3156/IERC3156FlashLender.sol";
import {IERC3156FlashLender} from "../../ierc3156/IERC3156FlashLender.sol";
import {
EvaluableV4,
IInterpreterCallerV4,
Expand All @@ -11,11 +11,11 @@ import {
IInterpreterV4,
//forge-lint: disable-next-line(unused-import)
IInterpreterStoreV3
} from "../../lib/rain.interpreter.interface/src/interface/unstable/IInterpreterCallerV4.sol";
} from "../../../../lib/rain.interpreter.interface/src/interface/IInterpreterCallerV4.sol";

/// Import unmodified structures from older versions of `IOrderBook`.
//forge-lint: disable-start(unused-import)
import {NoOrders, ZeroMaximumInput} from "./deprecated/v4/IOrderBookV4.sol";
import {NoOrders, ZeroMaximumInput} from "../v4/IOrderBookV4.sol";
//forge-lint: disable-end(unused-import)

import {Float} from "rain.math.float/lib/LibDecimalFloat.sol";
Expand Down