diff --git a/.claude/skills/cmtat/SKILL.md b/.claude/skills/cmtat/SKILL.md new file mode 100644 index 0000000..69254d1 --- /dev/null +++ b/.claude/skills/cmtat/SKILL.md @@ -0,0 +1,102 @@ +--- +name: cmta +description: main concept behind cmta +--- + +CMTAT (CMTA Token) is a **security token framework** for tokenizing real-world financial assets on EVM-compatible blockchains. It's developed by the Capital Markets and Technology Association (CMTA). + +**Version:** 3.2.0-rc0 | **License:** MPL-2.0 | **Solidity:** 0.8.33 + +--- + +## Directory Structure + +``` +contracts/ +├── modules/ # Core smart contract logic +│ ├── internal/ # Internal implementations +│ └── wrapper/ # Public-facing modules +│ ├── core/ # ERC20, Pause, Enforcement, Validation +│ ├── extensions/ # Documents, Snapshots +│ ├── options/ # Debt, ERC2771, Cross-chain +│ └── security/ # Access control +├── deployment/ # Pre-composed contract variants +├── interfaces/ # ERC standards & custom interfaces +└── mocks/ # Test helpers +test/ # 3,078 tests (~99% coverage) +doc/ # Specs & audit reports +``` + +--- + +## Key Modules + +| Category | Modules | Purpose | +|----------|---------|---------| +| **Core** | ERC20Base, Mint, Burn, Pause, Enforcement, Validation | Basic token operations | +| **Extensions** | Snapshot, Document, ExtraInformation | Dividends, legal docs, metadata | +| **Options** | Debt, ERC2771, ERC1363, CrossChain, Allowlist, ERC7551 | Bonds, gasless tx, multi-chain, KYC | +| **Security** | AccessControl | RBAC with roles (MINTER, BURNER, PAUSER, ENFORCER) | + +--- + +## Deployment Variants + +- **Standalone** - Immutable, no proxy +- **Upgradeable** - Transparent/Beacon/UUPS proxy patterns +- **Light** - Minimal for stablecoins +- **Allowlist** - Whitelist-based transfers (KYC) +- **Debt** - Bond-specific fields (maturity, coupon) +- **DebtEngine** - Debt with external engine +- **ERC-7551** - German eWpG compliance +- **ERC-1363** - transferAndCall support + +--- + +## Architecture Highlights + +1. **Modular composition** - Mix-and-match features via inheritance +2. **Engine pattern** - External contracts for complex logic (RuleEngine, SnapshotEngine, DocumentEngine, DebtEngine) +3. **ERC-7201 storage** - Namespaced storage for safe upgrades +4. **Role-based access control** - Granular permissions (not single owner) +5. **10+ standard compliance** - ERC-20, ERC-3643, ERC-7551, ERC-2771, ERC-7802, etc. + +--- + +## Contract Inheritance Hierarchy + +``` +CMTATBaseCore (0) - Basic ERC20 + Mint + Burn + Validation + Access Control + ↓ +CMTATBaseAccessControl (1) - RBAC roles management + ↓ +CMTATBaseRuleEngine/Allowlist (2) - Transfer validation rules + ↓ +CMTATBaseERC1404 (3) - ERC-1404 compliance (restrictedTransfer) + ↓ +CMTATBaseERC20CrossChain (4) - CCIP & ERC-7802 support + ↓ +CMTATBaseERC2771 (5) - Gasless meta-transactions + ↓ +CMTATBaseERC1363/ERC7551 (6) - Additional standards +``` + +--- + +## Key Roles (Access Control) + +- `DEFAULT_ADMIN_ROLE` - Admin access (can grant/revoke roles) +- `MINTER_ROLE` - Can mint tokens +- `BURNER_ROLE` - Can burn tokens +- `PAUSER_ROLE` - Can pause/unpause contract +- `ENFORCER_ROLE` - Can freeze/unfreeze addresses + +--- + +## Key Files to Understand + +- `contracts/modules/0_CMTATBaseCore.sol` - Core base contract +- `contracts/deployment/CMTAT_*.sol` - Pre-composed deployment variants +- `contracts/interfaces/` - All supported interfaces and standards +- `hardhat.config.js` - Build configuration +- `package.json` - Dependencies and scripts diff --git a/.claude/skills/erc173-ownership/SKILL.md b/.claude/skills/erc173-ownership/SKILL.md new file mode 100644 index 0000000..468792c --- /dev/null +++ b/.claude/skills/erc173-ownership/SKILL.md @@ -0,0 +1,90 @@ +--- +name: erc173-ownership +description: ERC-173-A standard interface for ownership of contracts +--- + +## Abstract + +This specification defines standard functions for owning or controlling a contract. + +An implementation allows reading the current owner (`owner() returns (address)`) and transferring ownership (`transferOwnership(address newOwner)`) along with a standardized event for when ownership is changed (`OwnershipTransferred(address indexed previousOwner, address indexed newOwner)`). + +## Motivation + +Many smart contracts require that they be owned or controlled in some way. For example to withdraw funds or perform administrative actions. It is so common that the contract interface used to handle contract ownership should be standardized to allow compatibility with user interfaces and contracts that manage contracts. + +Here are some examples of kinds of contracts and applications that can benefit from this standard: +1. Exchanges that buy/sell/auction ethereum contracts. This is only widely possible if there is a standard for getting the owner of a contract and transferring ownership. +2. Contract wallets that hold the ownership of contracts and that can transfer the ownership of contracts. +3. Contract registries. It makes sense for some registries to only allow the owners of contracts to add/remove their contracts. A standard must exist for these contract registries to verify that a contract is being submitted by the owner of it before accepting it. +4. User interfaces that show and transfer ownership of contracts. + +## Specification + +Every ERC-173 compliant contract must implement the `ERC173` interface. Contracts should also implement `ERC165` for the ERC-173 interface. + +```solidity + +/// @title ERC-173 Contract Ownership Standard +/// Note: the ERC-165 identifier for this interface is 0x7f5828d0 +interface ERC173 /* is ERC165 */ { + /// @dev This emits when ownership of a contract changes. + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /// @notice Get the address of the owner + /// @return The address of the owner. + function owner() view external returns(address); + + /// @notice Set the address of the new owner of the contract + /// @dev Set _newOwner to address(0) to renounce any ownership. + /// @param _newOwner The address of the new owner of the contract + function transferOwnership(address _newOwner) external; +} + +interface ERC165 { + /// @notice Query if a contract implements an interface + /// @param interfaceID The interface identifier, as specified in ERC-165 + /// @dev Interface identification is specified in ERC-165. + /// @return `true` if the contract implements `interfaceID` and + /// `interfaceID` is not 0xffffffff, `false` otherwise + function supportsInterface(bytes4 interfaceID) external view returns (bool); +} +``` + +The `owner()` function may be implemented as `pure` or `view`. + +The `transferOwnership(address _newOwner)` function may be implemented as `public` or `external`. + +To renounce any ownership of a contract set `_newOwner` to the zero address: `transferOwnership(address(0))`. If this is done then a contract is no longer owned by anybody. + +The OwnershipTransferred event should be emitted when a contract is created. + +## Rationale + +Key factors influencing the standard: +- Keeping the number of functions in the interface to a minimum to prevent contract bloat. +- Backwards compatibility with existing contracts. +- Simplicity +- Gas efficient + +Several ownership schemes were considered. The scheme chosen in this standard was chosen because of its simplicity, low gas cost and backwards compatibility with existing contracts. + +Here are other schemes that were considered: +1. **Associating an Ethereum Name Service (ENS) domain name with a contract.** A contract's `owner()` function could look up the owner address of a particular ENS name and use that as the owning address of the contract. Using this scheme a contract could be transferred by transferring the ownership of the ENS domain name to a different address. Short comings to this approach are that it is not backwards compatible with existing contracts and requires gas to make external calls to ENS related contracts to get the owner address. +2. **Associating an ERC721-based non-fungible token (NFT) with a contract.** Ownership of a contract could be tied to the ownership of an NFT. The benefit of this approach is that the existing ERC721-based infrastructure could be used to sell/buy/auction contracts. Short comings to this approach are additional complexity and infrastructure required. A contract could be associated with a particular NFT but the NFT would not track that it had ownership of a contract unless it was programmed to track contracts. In addition handling ownership of contracts this way is not backwards compatible. + +This standard does not exclude the above ownership schemes or other schemes from also being implemented in the same contract. For example a contract could implement this standard and also implement the other schemes so that ownership could be managed and transferred in multiple ways. This standard does provide a simple ownership scheme that is backwards compatible, is light-weight and simple to implement, and can be widely adopted and depended on. + +This standard can be (and has been) extended by other standards to add additional ownership functionality. + +## Security Considerations + +If the address returned by `owner()` is an externally owned account then its private key must not be lost or compromised. + +## Backwards Compatibility + +Many existing contracts already implement this standard. + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). diff --git a/.claude/skills/foundry/SKILL.md b/.claude/skills/foundry/SKILL.md new file mode 100644 index 0000000..d0c0ff6 --- /dev/null +++ b/.claude/skills/foundry/SKILL.md @@ -0,0 +1,293 @@ +--- +name: foundry +description: Instructions for Foundry Development (test & deployment script) +--- + +This file provides instructions for Claude Code when working with Foundry tests and deployment scripts in this project. + +## Project Context + +This is a Foundry-based Solidity project for CMTAT. The main contracts are located in `lib/CMTAT/contracts/`. + +## Writing Foundry Tests + +### File Structure + +- Place test files in `test/` directory +- Name test files with `.t.sol` suffix (e.g., `MyModule.t.sol`) +- Use `HelperContract.sol` as base for shared utilities + +### Test Contract Template + +```solidity +//SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.20; + +import "./HelperContract.sol"; + +contract MyModuleTest is HelperContract { + function setUp() public { + _deployToken(); + // Additional setup + } + + function test_DescriptiveName() public { + // Test implementation + } + + function test_RevertWhen_Condition() public { + vm.expectRevert(); + // Call that should revert + } +} +``` + +### Test Naming Conventions + +- `test_` prefix for standard tests +- `test_RevertWhen_` prefix for tests expecting reverts +- `testFuzz_` prefix for fuzz tests +- Use descriptive names: `test_AdminCanMint`, `test_RevertWhen_NonOwnerCalls` + +### Key Cheatcodes + +```solidity +// Change msg.sender for next call +vm.prank(address); + +// Change msg.sender for all subsequent calls +vm.startPrank(address); +vm.stopPrank(); + +// Expect a revert +vm.expectRevert(); +vm.expectRevert(CustomError.selector); +vm.expectRevert("Error message"); + +// Expect an event +vm.expectEmit(true, true, false, true); +emit ExpectedEvent(param1, param2, param3); +actualCall(); + +// Manipulate block properties +vm.warp(timestamp); // Set block.timestamp +vm.roll(blockNumber); // Set block.number + +// Deal ETH or tokens +deal(address, amount); +deal(tokenAddress, recipient, amount); + +// Environment variables +vm.envOr("VAR_NAME", defaultValue); +vm.envString("VAR_NAME"); +``` + +### Assertions + +```solidity +assertEq(actual, expected); +assertEq(actual, expected, "Error message"); +assertTrue(condition); +assertFalse(condition); +assertGt(a, b); // a > b +assertGe(a, b); // a >= b +assertLt(a, b); // a < b +assertLe(a, b); // a <= b +assertApproxEqAbs(a, b, maxDelta); +assertApproxEqRel(a, b, maxPercentDelta); +``` + +### Testing Events + +```solidity +// Declare event (copy from contract or interface) +event Transfer(address indexed from, address indexed to, uint256 value); + +function test_EmitsTransferEvent() public { + vm.expectEmit(true, true, false, true); + emit Transfer(from, to, amount); + token.transfer(to, amount); +} +``` + +### Testing Access Control + +```solidity +function test_RevertWhen_NonAdminCalls() public { + vm.prank(USER1); // USER1 is not admin + vm.expectRevert(); + cmtat.adminOnlyFunction(); +} + +function test_AdminCanCall() public { + vm.prank(ADMIN); + cmtat.adminOnlyFunction(); + // Assert expected state changes +} +``` + +### Available Test Addresses (from HelperContract) + +```solidity +address constant ZERO_ADDRESS = address(0); +address constant ADMIN = address(1); +address constant USER1 = address(2); +address constant USER2 = address(3); +address constant USER3 = address(4); +``` + +### Available Roles (from HelperContract) + +```solidity +bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; +bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); +bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); +bytes32 public constant ENFORCER_ROLE = keccak256("ENFORCER_ROLE"); +bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); +``` + +## Writing Deployment Scripts + +### File Structure + +- Place scripts in `script/` directory +- Name script files with `.s.sol` suffix +- Use descriptive names: `DeployCMTATStandalone.s.sol` + +### Deployment Script Template + +```solidity +//SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.20; + +import "forge-std/Script.sol"; +// Import contracts to deploy + +contract DeployMyContract is Script { + function run() external returns (MyContract) { + // Read config from environment + address admin = vm.envOr("ADMIN_ADDRESS", msg.sender); + + vm.startBroadcast(); + + MyContract deployed = new MyContract(admin); + + vm.stopBroadcast(); + + return deployed; + } +} +``` + +### Environment Variables for Scripts + +```solidity +// With default fallback +address admin = vm.envOr("ADMIN_ADDRESS", msg.sender); +uint256 amount = vm.envOr("AMOUNT", uint256(1000)); +string memory name = vm.envOr("TOKEN_NAME", "Default"); + +// Required (reverts if not set) +address required = vm.envAddress("REQUIRED_ADDRESS"); +``` + +### Running Scripts + +```bash +# Dry run (simulation) +forge script script/Deploy.s.sol + +# With RPC (simulation on fork) +forge script script/Deploy.s.sol --rpc-url $RPC_URL + +# Broadcast to network +forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast + +# With verification +forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY +``` + +### Multi-Chain Deployment + +```solidity +function run() public { + vm.createSelectFork("mainnet"); + vm.startBroadcast(); + new MyContract(); + vm.stopBroadcast(); + + vm.createSelectFork("polygon"); + vm.startBroadcast(); + new MyContract(); + vm.stopBroadcast(); +} +``` + +## Running Tests + +```bash +# Run all tests +forge test + +# Run with verbosity +forge test -vvv + +# Run specific contract +forge test --match-contract BurnModuleTest + +# Run specific test +forge test --match-test test_AdminCanBurn + +# Run with gas report +forge test --gas-report + +# Run with coverage +forge coverage + +# Watch mode +forge test --watch +``` + +## Project-Specific Notes + +### CMTAT Constructor Parameters + +When deploying CMTATStandalone, these structs are required: + +```solidity +ICMTATConstructor.ERC20Attributes memory erc20Attributes = ICMTATConstructor.ERC20Attributes({ + name: "Token Name", + symbol: "SYM", + decimalsIrrevocable: 0 +}); + +IERC1643CMTAT.DocumentInfo memory termsDoc = IERC1643CMTAT.DocumentInfo({ + name: "Terms", + uri: "https://example.com/terms", + documentHash: bytes32(0) +}); + +ICMTATConstructor.ExtraInformationAttributes memory extraInfoAttributes = ICMTATConstructor.ExtraInformationAttributes({ + tokenId: "TOKEN_ID", + terms: termsDoc, + information: "Token info" +}); + +ICMTATConstructor.Engine memory engines = ICMTATConstructor.Engine({ + ruleEngine: IRuleEngine(address(0)) +}); +``` + +### Required Imports for CMTAT + +```solidity +import "CMTAT/deployment/CMTATStandalone.sol"; +import "CMTAT/interfaces/technical/ICMTATConstructor.sol"; +import "CMTAT/interfaces/tokenization/draft-IERC1643CMTAT.sol"; +``` + +## Code Style + +- Use descriptive test names +- Group related tests with comments: `// ============ Section Name ============` +- Do NOT use `view` modifier on test functions that use assertions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad34e60..e020f82 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,18 +11,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2 - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@de808b1eea699e761c404bda44ba8f21aba30b2c #v1.3.1 with: version: nightly - name: Run Forge install run: forge install + - name: Setup NodeJS 20.5.0 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 #v4.4.0 + with: + node-version: 20.5.0 + - name: Run Forge build run: forge build --sizes - - name: Run Forge tests - run: forge test -vvv --gas-report \ No newline at end of file + - name: Run Forge tests + run: forge test -vvv \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3ca8440..0694597 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ # Compiler files cache/ out/ +# Hardhat build output +/artifacts/ +/cache_hardhat/ # Ignores development broadcast logs !/broadcast @@ -16,3 +19,6 @@ docs/ .env .vscode/ + +# Drafts: local working notes (feedback, instructions, scratch files), never committed +/draft/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..401a698 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,126 @@ +# DebtEngine — Agent Guide + +> **Note — keep in sync:** `AGENTS.md` and `CLAUDE.md` must always be **identical**. Any edit to one must be applied verbatim to the other. + +> **Note — commit messages:** After each group of modifications or each feature added, always provide a **one-line GitHub commit message** (Conventional-Commits style, e.g. `feat: ...`, `fix: ...`, `docs: ...`, `test: ...`). +> +> **Never put `!` in a commit message** — not as the breaking-change marker (`feat!: ...`), not anywhere else. In an interactive bash, `!` inside double quotes triggers history expansion, so `git commit -m "feat!: ..."` aborts with `bash: !: unrecognized history modifier`. Signal a breaking change with an uppercase `BREAKING CHANGE:` line in the commit body instead, and keep the subject line free of `!`. +> +> **Always sign commits** — every commit must be signed with `-S`, both the commands you suggest to the user (`git commit -S -m "..."`) and any commit you make yourself. If signing fails (no key configured, agent locked, `gpg failed to sign the data`), stop and report it; never fall back to an unsigned commit or to `--no-gpg-sign`. + +> **Note — no tool names in the changelog:** never name an assistant tool, skill or slash command in `CHANGELOG.md`. The changelog records what changed in *this project*, for readers who have no idea what tooling produced it. A line ending "the `` skill gained the corresponding check" documents the author's toolbox rather than the release, and it rots independently of the repository — the tool can be renamed or deleted, leaving a dangling reference to something the reader could never have seen. Describe the change and its effect; if the tooling matters, record it in the audit or analysis report instead. +> +> This is about **tool identities, not the word "Claude"**: files committed to the repository — `CLAUDE.md`, `AGENTS.md`, `doc/tools//CLAUDE_ANALYSIS.md` — are cited freely, because a reader can open them. + +> **Note — do not hard-wrap prose in `CHANGELOG.md`:** one line per bullet or paragraph, and let the editor soft-wrap. Markdown collapses a single newline into a space, so a hard-wrapped bullet renders identically — the cost is invisible in the published changelog and paid entirely in the repository. Changing one word reflows every following line, so a one-word correction arrives as a multi-line diff in which a reviewer cannot see what actually changed; and because the wrap column depends on whoever wrote the entry, the file drifts into a mix of styles that reads as damage. Keep the line structure only where it is semantic: fenced code blocks, tables and blockquotes. + +> **Note — never break the code in place to test a test:** when you need to verify that a test actually catches a defect — mutation testing: delete an assert, flip a condition, drop a delivery — do it in a **throwaway copy of the repository**, never in the working tree. +> +> Editing source forces a rebuild, and if that run is interrupted — an OOM kill, a timeout, a cancelled command — the restored source and the stale build output **disagree**: `git status` reports a clean tree while `out/` and `cache/` hold artifacts built from the mutated code. Nothing surfaces that state, and restoring the source does not restore the build. It has already happened once in a sibling project, leaving compiled artifacts missing a safety check one step before a release tag. +> +> The procedure: `git worktree add /tmp/mut HEAD --detach`, copy across any uncommitted test files the mutation needs (a worktree is made from the last commit, so new tests are absent), mutate and run there, then `git worktree remove /tmp/mut`. If a mutation ever does run in the working tree, rebuild and **prove** recovery against a recorded build fingerprint rather than assuming it. + +> **Note — long changelog entries get sub-bullets:** past roughly three sentences, a bullet stops being scannable — the defect, its blast radius, the fix, the precedent and the caveat all run together, so a reader looking for any one of them has to parse all five. Lead with one sentence naming *what changed*, then one sub-bullet per distinct claim: impact, fix, behaviour-change warning, cost, migration note. A useful trigger is length — compare against the file's own median bullet and split anything several times longer, since that length almost always means several claims in one paragraph. Sub-bullets follow the same no-hard-wrap rule: one line each. + +> **Note — never reference documentation, tests or agent reports from production code:** NatSpec and comments in the production sources (`src/`) must not cite a documentation page (`doc/`, `*.md`, `README`), a test file or test name (`test/`, `*.t.sol`, `testFoo`, `invariant_...`), a mock file, a planning ID, or a report produced by an AI assistant (`doc/tools//CLAUDE_ANALYSIS.md`, `FEEDBACK.md`, `CLAUDE_ANALYSIS*.md`, `RESULT.md`, `THREAT_MODEL.md` or any other agent-written review, including its finding IDs), by path or by bare filename. +> +> Documentation paths move, tests are renamed, and agent reports are regenerated with IDs that restart at `-1` each release (so `CLAUDE_ANALYSIS.md D-1` names a different finding in every version). A stale pointer inside a deployed, verified contract cannot be fixed afterwards, and a reader on a block explorer has the source and nothing else. **Write the substance into the comment instead**: the conclusion and the warning, so the reader gets the whole point without the file. If the explanation is too long for NatSpec, the comment states the conclusion and the documentation carries the derivation, with no cross-reference in the code. +> +> - **Exception: tests.** `test/` is never deployed and exists to serve the suite, so a pointer to the page explaining what a test stands in for is useful and costs nothing. +> - **Exception: official audits by an audit company**, cited by **bare filename and finding ID** (e.g. `Halborn-2024-Q3.pdf` H-03, `OpenZeppelin-audit.md` M-2). An external audit is an immutable historical record, the bare filename survives the file being moved, and the ID gives a reviewer context a comment cannot restate. Never cite it by path. +> - **The audit exception does not cover AI-assisted reviews.** A report written with an AI assistant is a working document that is rewritten as the code changes, not a record; treat it like any other documentation. Agent guides (`CLAUDE.md` / `AGENTS.md`), changelogs and audit overviews may cite these reports freely: they are not deployed. +> - **The link between code and AI findings lives in [`doc/tools/CLAUDE_ANALYSIS_SUMMARY.md`](./doc/tools/CLAUDE_ANALYSIS_SUMMARY.md)**, next to the project's tool reports. Whenever an AI-assisted finding changes production code, or explains why it must not change, add an entry there instead of a citation in the comment: the `file:line` and symbol, the code line, the comment (before and after if a citation was removed), the finding with its **report, release, ID and title** (IDs restart each release), and the change applied. Keep the line numbers current when a symbol moves. + +## What this project is + +DebtEngine is an external engine for the [CMTAT](https://github.com/CMTA/CMTAT) security token: a single contract stores `debt` (`DebtInformation`) and `credit events` (`CreditEvents`) for many CMTAT token contracts, keyed by token address. It implements CMTAT's `IDebtEngine` interface; a CMTAT debt token calls `debt()` / `creditEvents()` and the engine answers for `_msgSender()`. Unaudited (see README). + +## Key concepts + +- **Abstract base + deployment variants:** `DebtEngineBase` holds all storage and logic; authorization is delegated to two hooks, `_authorizeSetDebt()` and `_authorizeSetCreditEvents()`, which must revert when the caller is not allowed (used by the `onlyDebtManager` / `onlyCreditEventsManager` modifiers). +- **`DebtEngineAccessControl`** (RBAC, OpenZeppelin `AccessControlEnumerable`): roles `DEBT_MANAGER_ROLE` and `CREDIT_EVENTS_MANAGER_ROLE`; `hasRole` is overridden so `DEFAULT_ADMIN_ROLE` implicitly holds every role (this implicit membership is not listed by `getRoleMember*`). Constructor rejects a zero `admin`. +- **`DebtEngineOwnable`** (OpenZeppelin `Ownable2Step`): the owner is the only writer for both debt and credit events; ownership transfer requires `acceptOwnership` by the new owner. +- **ERC-2771 meta-transactions:** only the deployment contracts inherit `ERC2771Context`; the base defines a virtual `_msgSender()` returning `msg.sender`. The forwarder is set in the constructor and is **immutable**; `address(0)` disables it. +- **Getters:** `debt()` / `creditEvents()` (for the caller), `debt(address)` / `creditEvents(address)`, and `hasDebt(address)` / `hasCreditEvents(address)`, which mean "currently set" (true after a set, false again after a clear) and distinguish "no record" from "set to empty". +- **Setters:** `setDebt`, `setCreditEvents`, `setDebtBatch`, `setCreditEventsBatch`; all writes go through `_setDebt` / `_setCreditEvents` (zero-address check, write, `has*` flag, event) — never write the mappings or emit `DebtSet` / `CreditEventsSet` anywhere else; batches capped by `MAX_BATCH_SIZE = 500` (a ceiling: the mainnet per-transaction gas cap binds first) and require equal array lengths. +- **Clear:** `clearDebt` / `clearCreditEvents` delete a record and its `has*` flag only through `_clearDebt` / `_clearCreditEvents`, which emit `DebtCleared` / `CreditEventsCleared`; gated by the same hooks as the setters; reject `address(0)` like the setters; clearing an unset record succeeds. +- **Errors** live in `DebtEngineInvariantStorage` (abstract). +- **Version:** `version()` comes from `VersionModule`, inherited by `DebtEngineBase` (there is no public `VERSION` getter). +- **Not upgradeable:** plain constructor deployment, no proxy. + +## File tree + +``` +src/ +├── DebtEngineBase.sol # abstract engine: storage, getters/setters, events, auth hooks +├── DebtEngineInvariantStorage.sol # abstract: custom errors +├── modules/ +│ └── VersionModule.sol # abstract: private VERSION constant + version() getter (CMTAT BaseModule pattern) +└── deployment/ + ├── DebtEngineAccessControl.sol # RBAC variant (AccessControlEnumerable + ERC2771Context) + └── DebtEngineOwnable.sol # single-owner variant (Ownable2Step + ERC2771Context) +test/ +├── DebtEngineBase.t.sol # abstract shared suite (DebtEngineBaseTest), incl. CMTATStandaloneDebt integration +├── DebtEngineAccessControl.t.sol # role-specific tests for the RBAC variant +├── DebtEngineOwnable.t.sol # owner-specific tests for the Ownable variant (incl. ERC-165 / ERC-173) +├── DebtEngineHarness.t.sol # test-only engine: proves public functions stay `virtual`, covers the base `_msgSender()` +├── DebtEngineThreatModel.t.sol # security-analysis tests: PoCs for AUDIT/RESULT.md findings, fuzzed access-control and set/clear model +├── DeployGuideCMTATv3.0.0.t.sol # runs every step of doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md against CMTAT v3.0.0 +└── script/DeployScripts.t.sol # tests for the deployment scripts +script/ +├── DeployDebtEngine.s.sol # deploy either variant (env: ENGINE_VARIANT, ENGINE_ADMIN, FORWARDER, DEBT_MANAGER, CREDIT_EVENTS_MANAGER) +└── ConnectDebtEngine.s.sol # token side: setDebtEngine (env: TOKEN, DEBT_ENGINE, ALLOW_EMPTY_RECORD); refuses an empty record +``` + +## Other important files + +- `CHANGELOG.md` — release notes, change-type tags and the pre-release checklist. +- `README.md` — data structures, interface, schemas, toolchain commands. +- `foundry.toml` — solc `0.8.33`, optimizer 200 runs, `evm_version = prague`. +- `hardhat.config.js` — Hardhat 2 compilation of `src/` only, same compiler settings as `foundry.toml` (keep them in sync), imports via the Foundry remappings (`@nomicfoundation/hardhat-foundry`); output in `artifacts/` and `cache_hardhat/` (git-ignored). +- `remappings.txt` — `CMTAT/` → `lib/CMTAT/contracts/`, `OZ/` → `lib/openzeppelin-contracts/contracts/`, `@openzeppelin/contracts-upgradeable/`. +- `doc/coverage/` — lcov + HTML coverage report. +- `doc/compilation/v/` — per-release Hardhat and Foundry artifacts and flattened sources of the two deployable contracts (see its README; added for releases, not release candidates). +- `doc/technical/guides/` — deployment guides (`DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md`); each step is run by a test, keep the two in sync. +- `doc/tools/AUDIT_OVERVIEW.md` — index of every analysis (static analysis, AI reviews, coverage) with their results. +- `doc/tools//` — tool reports per release: `slither-report.md` / `aderyn-report.md` with their `*-feedback.md` triage, the AI-assisted code-quality review `CLAUDE_ANALYSIS.md` and the published security audit `CLAUDE_AUDIT.md` (currently `doc/tools/v0.3.0/`). +- `doc/script/` — Surya scripts; output in `doc/surya/` (graph, inheritance, report). +- `AUDIT/` — working deliverables of the v0.3.0 security analysis (published version: `doc/tools/v0.3.0/CLAUDE_AUDIT.md`): `THREAT_MODEL.md` (actors, threat IDs, invariants), `TEST_IMPROVEMENT.md`, `RESULT.md` (findings with PoCs and fix code). +- `lib/` — git submodules (do not edit). +- `draft/` — local, git-ignored folder for working notes and scratch files (e.g. `FEEDBACK.md`, `INSTRUCTION.md`). Put drafts there, never at the root; never cite a `draft/` file from a committed file (code, docs, changelog), since readers of the repository cannot open it. + +## Dependencies (tested versions) + +- Foundry, solc `0.8.33` (sources use `pragma ^0.8.27`, the minimum for `require(bool, CustomError())` on the legacy pipeline) +- OpenZeppelin Contracts — submodule `lib/openzeppelin-contracts` (v5.x, commit `fcbae539`) +- OpenZeppelin Contracts Upgradeable — submodule v5.5.0 (tests, via CMTAT) +- CMTAT — submodule `lib/CMTAT` at tag `v3.0.0` (provides `IDebtEngine`, `ICMTATDebt`, and `CMTATStandaloneDebt` for tests) +- forge-std v1.13.0 +- npm dev deps: `hardhat` 2.29, `@nomicfoundation/hardhat-foundry` 1.2, `surya`, `prettier-plugin-solidity` + +## Common commands + +```bash +forge build +forge test +forge fmt # formatter (forge fmt --check in CI-style checks) +forge coverage --report lcov --report-file doc/coverage/lcov.info --no-match-coverage "test/|script/" && genhtml doc/coverage/lcov.info --branch-coverage --output-dir doc/coverage/coverage +forge test --gas-report +npm run compile:hardhat # Hardhat compilation of src/ (needs forge for the remappings) +forge script script/DeployDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast # omit --broadcast to simulate +forge script script/ConnectDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast +slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-std|script" > doc/tools/v0.3.0/slither-report.md # runs forge clean +aderyn -x mocks --output doc/tools/v0.3.0/aderyn-report.md +bash doc/script/script_surya_graph.sh && bash doc/script/script_surya_inheritance.sh && bash doc/script/script_surya_report.sh +``` + +## Conventions + +- **Versioning:** bump the private `VERSION` constant in `src/modules/VersionModule.sol`, the `testVersion` assertion in `test/DebtEngineBase.t.sol` and the README compatibility table; follow the checklist in `CHANGELOG.md`. +- **Changelog tags:** keepachangelog types plus `breaking change` (storage / external engine interface), `Dependencies`, `Documentation`, `Testing`. +- **Authorization hooks:** declared `internal view virtual` with no body in `DebtEngineBase`; every override keeps `internal view virtual override`, has an empty body and enforces the policy through the modifier (`onlyRole(ROLE)` / `onlyOwner`), never a bare `_checkRole` / `_checkOwner` call. Role constants live in the contract that enforces them (`DebtEngineAccessControl`), never in shared storage. The README access-control table (capability → role per variant) must be updated with any new hook. +- **New authorization policy:** add a deployment contract under `src/deployment/` that implements both `_authorize*` hooks and the `_msgSender` / `_msgData` / `_contextSuffixLength` overrides; add a test contract that extends `DebtEngineBaseTest`. +- **Security notes (see `doc/tools/v0.3.0/CLAUDE_AUDIT.md`):** an account holding `DEFAULT_ADMIN_ROLE` passes every role check, so granting it a manager role is a silent no-op and revoking one emits `RoleRevoked` without effect (F-1) — when handing admin over, renounce first and let the new admin grant manager roles; the trusted forwarder is trusted for every function, role management included (F-2). +- **Must not break:** the `IDebtEngine` interface (CMTAT calls it), zero-address checks, `MAX_BATCH_SIZE` and length checks on batches, event emission on every write. +- **Style:** NatSpec with `/** */`, section banners as in existing files; function attribute order visibility, mutability, `virtual`, `override`, modifiers (e.g. `internal view virtual override onlyOwner`); every public, external and overriding internal function is `virtual`; guards use `require(condition, CustomError(...))` (keep `if`/`revert` only where building the error arguments would cost an external call or storage read, with a comment saying so); every `if`/`for` body in braces; run `forge fmt` before committing. +- License: MPL-2.0 SPDX header on every source file. diff --git a/AUDIT/RESULT.md b/AUDIT/RESULT.md new file mode 100644 index 0000000..3684a06 --- /dev/null +++ b/AUDIT/RESULT.md @@ -0,0 +1,367 @@ +# DebtEngine v0.3.0 — Security Analysis Results + +## Run options + +| Option | Value | Source | +|---|---|---| +| `--mode` | `full` — new tests in `test/DebtEngineThreatModel.t.sol` | asked | +| `--scope` | `all` — the five files under `src/` (no scope file; `lib/`, `test/` out of scope) | asked (`auto` → `all`) | +| `--out` | `AUDIT/` | asked | +| `--judge` | `on` | asked | + +Audited commit `705208b` (branch `dev`); solc 0.8.33, optimizer 200, no `via_ir`, `prague`; Foundry 1.5.0; CMTAT v3.0.0, OpenZeppelin v5.5.0. Tests were run natively with Foundry, not in Docker (a Solidity/Foundry project; the generic entrypoint exempts it). Produced with Claude Code: an AI-assisted analysis, not an audit by an audit company. + +## Claude Skills Used + +| Skill | Findings contributed | +|---|---| +| `audit-access-control` | F-1, F-3, NAF AC-1, AC-2, AC-5, AC-6 | +| `openzeppelin-v5` | F-1 (role bookkeeping calls the overridden `hasRole`), F-2 | +| `cmtat` | F-5, NAF INT-1, INT-2 | +| `cmtat-audit` | Severity calibration (CMTA down-weights trusted-role issues); no prior finding on F-1 | +| `erc173-ownership` | NAF AC-5 | +| `sc-analyse-and-test`, `sc-analyse-and-test-solidity` | Workflow | +| `qalc` | Not needed: no value computed outside the code | + +## Test Execution Summary + +| Suite | Tests | Result | +|---|---|---| +| `DebtEngineAccessControlTest` (shared suite + RBAC) | 64 | pass | +| `DebtEngineOwnableTest` (shared suite + Ownable) | 58 | pass | +| `DebtEngineHarnessTest` | 2 | pass | +| **`DebtEngineThreatModelTest` (new)** | **12** | pass | +| **Total** | **136** (baseline 124) | 0 failed | + +New tests (`test/DebtEngineThreatModel.t.sol`): + +| Test | Type | Threat | Gas / runs | +|---|---|---|---| +| `testPoC_F1_GrantRoleToAdminIsSilentNoOp` | Unit PoC | AC-3 | 24,013 | +| `testPoC_F1_RevokeRoleFromAdminEmitsButKeepsPower` | Unit PoC | AC-3 | 143,760 | +| `testPoC_F1_AdminHandoverDropsSelfGrantedRole` | Integration PoC | AC-3 | 98,156 | +| `testF1_RunbookGrantAfterRenounceWorks` | Integration | AC-3 | 293,730 | +| `testLastAdminRenounceFreezesRoles` | Unit | AC-4 | 31,797 | +| `testPoC_F2_ForwarderCanGrantAdminRole` | Unit PoC | MTX-2 | 94,350 | +| `testPoC_F2_ForwarderCanStartOwnershipTransfer` | Unit PoC | MTX-2 | 40,602 | +| `testForwarderRelaysClearDebt` | Unit | MTX-1 | 105,748 | +| `testClearAcceptsAddressZero` → `testCannotClearAddressZero` (inverted after the F-4 fix) | Unit | DATA-2 | 67,772 (before inversion) | +| `testPoC_F5_EngineShadowsTokenLocalDebt` | Integration PoC (real `CMTATStandaloneDebt`) | DATA-3 | 5,396,953 | +| `testFuzz_OnlyAuthorizedCanWrite` | Fuzz, both variants, six writers | AC-1 / I-1 | 256 runs | +| `testFuzz_SetClearSequenceMatchesModel` | Fuzz, model check over ≤ 32 ops | I-2 / I-3 | 256 runs | + +## Findings + +### Findings Summary Table + +| ID | Short Description | Severity | Status | Component | Skill | PoC | In-Scope | +|---|---|---|---|---|---|---|---| +| F-1 | Implicit admin breaks role grant/revoke bookkeeping | INFO (was LOW, judge) | Confirmed; docs fixed | `src/deployment/DebtEngineAccessControl.sol:41-53` (at `705208b`; `:43-55` after this run's NatSpec edit) | `openzeppelin-v5` | `testPoC_F1_*` (3) | ✅ | +| F-2 | Immutable forwarder can perform admin actions | — (was INFO, judge) | NOT-A-FINDING: ERC-2771 trust assumption; README note added | `DebtEngineAccessControl.sol:18`, `DebtEngineOwnable.sol:20` | `openzeppelin-v5` | `testPoC_F2_*` (2) | ✅ | +| F-3 | Last admin renounce freezes role management | INFO | By-design; README note added | OZ `AccessControl.renounceRole` | `audit-access-control` | `testLastAdminRenounceFreezesRoles` | ✅ | +| F-4 | Clear functions accept `address(0)` | INFO | Fixed after the audit (`testCannotClearAddressZero`) | `src/DebtEngineBase.sol:188-202` | Independent analysis | `testClearAcceptsAddressZero` | ✅ | +| F-5 | Engine shadows token-local debt once set | — (was INFO, judge) | NOT-A-FINDING: CMTAT behaviour, out of scope; README already notes the empty read after clear | CMTAT `DebtEngineModule.sol:64-71` | `cmtat` | `testPoC_F5_EngineShadowsTokenLocalDebt` | integration | +| F-6 | Batches hit the EIP-7825 gas cap first | — (was INFO, judge) | NOT-A-FINDING: already documented | `src/DebtEngineBase.sol:23-29` | Independent analysis | v0.3.0 quality review H-1 | ✅ | +| F-7 | README RBAC role table omits `clearDebt` / `clearCreditEvents` | INFO (found by judge) | Confirmed; fixed | `README.md` role table | Agent judge | — | ✅ | +| AC-1 | Writer reachable without its hook | — | NOT-A-FINDING | `DebtEngineBase.sol:94-157` | `audit-access-control` | `testFuzz_OnlyAuthorizedCanWrite` | ✅ | +| AC-2 | Role separation bypass | — | NOT-A-FINDING | `DebtEngineAccessControl.sol:25-27` | `audit-access-control` | `test*ManagerCannot*` (4) | ✅ | +| AC-5 | Ownership lost by mistyped transfer | — | NOT-A-FINDING | `Ownable2Step` | `erc173-ownership` | `testTransferOwnershipIsTwoStep` | ✅ | +| AC-6 | Compromised admin/owner/manager rewrites records | — | NOT-A-FINDING | trusted actor | `cmtat-audit` | — | ✅ | +| MTX-1 | Non-forwarder spoofs the sender | — | NOT-A-FINDING | OZ `ERC2771Context.sol:55-65` | `openzeppelin-v5` | `testUntrustedCallerCannotSpoofSender` | ✅ | +| MTX-3 | `forwarder = address(0)` trusts a sender | — | NOT-A-FINDING | OZ `ERC2771Context` | `openzeppelin-v5` | — | ✅ | +| DATA-1 | Record written for `address(0)` | — | NOT-A-FINDING | `DebtEngineBase.sol:168,179` | Independent analysis | `testCannotSet*ForAddressZero` | ✅ | +| DATA-4 | Duplicate address in a batch | — | NOT-A-FINDING | batch setters | Independent analysis | `testDuplicateAddressInDebtBatchLastWriteWins` | ✅ | +| DOS-2 | Oversized strings | — | NOT-A-FINDING | trusted writer | Independent analysis | — | ✅ | +| INT-1 | Third party reads another token's record | — | NOT-A-FINDING | `debt(address)` | `cmtat` | `testDebtForCallerThroughTrustedForwarder` | ✅ | +| INT-2 | `IDebtEngine` mismatch with CMTAT v3.0.0 | — | NOT-A-FINDING | `DebtEngineBase` | `cmtat` | `testCanReturnCMTATDebt` | ✅ | +| STD-1 | Wrong ERC-165 advertisement | — | NOT-A-FINDING | both `supportsInterface` | `openzeppelin-v5` | `testSupportsInterface` (both) | ✅ | +| UPG-1 | Initializer / storage collision | — | NOT-A-FINDING | — | — | — | N/A | +| REE-1 | Reentrancy | — | NOT-A-FINDING | — | — | — | N/A | + +**Tally after the judge: 0 High, 0 Medium, 0 Low, 3 Info (F-1, F-3, F-4) + 1 documentation Info (F-7); 17 NOT-A-FINDING (14 initial + F-2, F-5, F-6).** Before the judge: 1 Low, 5 Info. No automated report (`4naly3er-report.md`) ships with the project, so no finding is a duplicate of one; the Slither and Aderyn reports in `doc/tools/v0.3.0/` do not report any of F-1..F-5. + +### F-1. Implicit-admin `hasRole` override breaks role grant / revoke bookkeeping — INFO (downgraded from LOW by the judge) + +- **Location:** `src/deployment/DebtEngineAccessControl.sol:41-53` (`hasRole`); executed by `lib/openzeppelin-contracts/contracts/access/AccessControl.sol:181-206` (`_grantRole`, `_revokeRole`, OpenZeppelin v5.5.0), reached from `grantRole` (`:120-122`), `revokeRole` (`:135-137`) and `renounceRole` (`:155-161`). +- **Identified by:** `openzeppelin-v5`. +- **Description:** `hasRole` returns `true` for any role when the account holds `DEFAULT_ADMIN_ROLE`. OpenZeppelin's `_grantRole` / `_revokeRole` use `hasRole` to decide whether membership changes, so for an admin: + - `grantRole(DEBT_MANAGER_ROLE, admin)` stores nothing, emits no `RoleGranted`, and does not enumerate the admin; + - `revokeRole(DEBT_MANAGER_ROLE, admin)` (or `renounceRole`) emits `RoleRevoked` although the admin keeps the power. + +Problematic code: + +```solidity +// src/deployment/DebtEngineAccessControl.sol:41-53 +function hasRole(bytes32 role, address account) + public + view + virtual + override(AccessControl, IAccessControl) + returns (bool) +{ + // The Default Admin has all roles + if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { // ◀ also consulted by _grantRole / _revokeRole + return true; + } + return AccessControl.hasRole(role, account); +} +``` + +```solidity +// lib/openzeppelin-contracts/contracts/access/AccessControl.sol:181-206 (OZ v5.5.0) +function _grantRole(bytes32 role, address account) internal virtual returns (bool) { + if (!hasRole(role, account)) { // ◀ true for an admin → grant skipped, no event + _roles[role].hasRole[account] = true; + emit RoleGranted(role, account, _msgSender()); + return true; + } else { + return false; + } +} +... +function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { + if (hasRole(role, account)) { // ◀ true for an admin → RoleRevoked emitted, power kept + _roles[role].hasRole[account] = false; + emit RoleRevoked(role, account, _msgSender()); + return true; + } else { + return false; + } +} +``` + +- **Impact:** no unauthorized access, and no record changes without an authorized key. Two operational consequences: + - **Monitoring is misled.** An indexer or a compliance dashboard that rebuilds role holders from events sees a `RoleRevoked` for an admin that still writes records (`testPoC_F1_RevokeRoleFromAdminEmitsButKeepsPower`), and never sees the "grant" an admin made to itself. + - **An admin handover can drop an intended role.** The usual sequence (grant the manager role to yourself, grant admin to a multisig, renounce admin) leaves the old admin with no manager role, because the first grant was a no-op (`testPoC_F1_AdminHandoverDropsSelfGrantedRole`). Operations stop until the new admin re-grants it. +- **Judge adjustment (LOW → INFO):** the grant side is already documented (README note on the super-admin: no `RoleGranted` event, admin not enumerated), only the trusted admin is affected, nothing is lost that a single re-grant by the new admin does not restore, and CMTAT v3.0.0 uses the same override. The undocumented parts — the misleading `RoleRevoked` and the handover trap — make it a documentation gap. Option C is the proportionate remedy; Option A remains available if exact role bookkeeping is wanted (the judge found no reentrancy window: the `onlyRole` check runs before the flag is set, no external call happens while it is set, a revert rolls the transient flag back, and TSTORE works in the constructor; it needs `pragma ^0.8.28`, a Cancun-or-later chain, and a rewrite of the README note, since revoking a role from an admin would then be a silent no-op instead). +- **Implemented (documentation, Option C):** README super-admin note extended with the revocation behaviour and the handover runbook; `hasRole` NatSpec (`src/deployment/DebtEngineAccessControl.sol:33-42`) now says grants to an admin are no-ops and revocations emit `RoleRevoked` without effect. `testF1_RunbookGrantAfterRenounceWorks` pins the runbook. +- **Precedent:** CMTAT's `AccessControlModule.hasRole` (`lib/CMTAT/contracts/modules/wrapper/security/AccessControlModule.sol:34-45`) uses the same override, so CMTAT tokens behave the same way. `cmtat-audit` records no prior finding on it. +- **Fix code — Proposed, not implemented** (it changes role-management behaviour and the minimum compiler; maintainer decision). Two options: + + **Option A (preferred): keep the super-admin semantics for checks, record explicit membership in bookkeeping.** Compiled and run in a scratch copy: the three `testPoC_F1_*` tests fail (as intended) and the other 133 pass, including `testImplicitAdminIsNotEnumerated`; +81 runtime bytes (9,190 → 9,271). It needs `pragma ^0.8.28` (transient value types). + + ```solidity + // src/deployment/DebtEngineAccessControl.sol + /// @dev Set only while `_grantRole` / `_revokeRole` run, so they record explicit membership. + bool private transient _explicitRolesOnly; + + function hasRole(bytes32 role, address account) + public view virtual override(AccessControl, IAccessControl) returns (bool) + { + // The Default Admin has all roles, except while role bookkeeping runs (see _grantRole / _revokeRole) + if (!_explicitRolesOnly && AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { + return true; + } + return AccessControl.hasRole(role, account); + } + + function _grantRole(bytes32 role, address account) internal virtual override returns (bool granted) { + _explicitRolesOnly = true; + granted = super._grantRole(role, account); + _explicitRolesOnly = false; + } + + function _revokeRole(bytes32 role, address account) internal virtual override returns (bool revoked) { + _explicitRolesOnly = true; + revoked = super._revokeRole(role, account); + _explicitRolesOnly = false; + } + ``` + + **Option B: drop the override and grant the admin in the hooks.** Standard `hasRole` (bookkeeping and enumeration exact), but `hasRole(DEBT_MANAGER_ROLE, admin)` becomes `false`, which diverges from CMTAT and from the current README; the hooks can no longer be a bare `onlyRole`: + + ```solidity + function _authorizeSetDebt() internal view virtual override { + if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender())) { + _checkRole(DEBT_MANAGER_ROLE); + } + } + ``` + + **Option C (no code): document the runbook.** Add to the README note on the super-admin: "Granting or revoking a manager role on an account that holds `DEFAULT_ADMIN_ROLE` has no effect: the grant is not recorded, and a revocation emits `RoleRevoked` while the account keeps the power. When handing admin over, renounce `DEFAULT_ADMIN_ROLE` first and have the new admin grant the manager role afterwards." `testF1_RunbookGrantAfterRenounceWorks` pins that sequence. + +### F-2. The immutable trusted forwarder can perform admin actions — NOT-A-FINDING (judge) + +- **Location:** `src/deployment/DebtEngineAccessControl.sol:18`, `src/deployment/DebtEngineOwnable.sol:20` (constructors), sender extraction in `lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol:55-65` (OZ v5.5.0). +- **Identified by:** `openzeppelin-v5`. +- **Description:** `_msgSender()` is used by every check, including `grantRole`, `revokeRole`, `renounceRole`, `transferOwnership` and `acceptOwnership`, not only by the data writers. The forwarder therefore controls role and ownership management for any signer it relays, and it cannot be rotated. + +```solidity +// lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol:55-61 +function _msgSender() internal view virtual override returns (address) { + uint256 calldataLength = msg.data.length; + uint256 contextSuffixLength = _contextSuffixLength(); + if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) { // ◀ any call, incl. grantRole + unchecked { + return address(bytes20(msg.data[calldataLength - contextSuffixLength:])); +``` + +- **Impact:** a compromised or buggy forwarder (or a forwarder that does not verify signatures) can grant itself `DEFAULT_ADMIN_ROLE` or start an ownership transfer (`testPoC_F2_*`). This is the documented trust assumption of ERC-2771, so not a vulnerability; the README says the forwarder is immutable but not that it reaches role management. +- **Judge adjustment (INFO → NOT-A-FINDING):** full trust in the forwarder is the ERC-2771 model, and the README already says a compromised forwarder means redeploying. The judge also advised against the optional per-selector `_msgSender` rule: two notions of the sender in one contract add risk. Dropped. +- **Implemented (documentation):** added to the README "Gasless support" note: "The forwarder is trusted for every function, including `grantRole`, `revokeRole`, `renounceRole` and ownership transfer. Use a forwarder that verifies EIP-712 signatures (e.g. OpenZeppelin `ERC2771Forwarder`), or deploy with `address(0)` when meta-transactions are not needed." + +### F-3. Renouncing the last admin freezes role management — INFO + +- **Location:** OZ `AccessControl.sol:155-161` (`renounceRole`), no `AccessControlDefaultAdminRules`. +- **Identified by:** `audit-access-control` (§A "Can the role be renounced?"). +- **Description / impact:** after the only `DEFAULT_ADMIN_ROLE` holder renounces, no role can be granted or revoked again (`testLastAdminRenounceFreezesRoles`); existing managers keep writing, and the registry is frozen once they renounce too. The README already says renouncing ownership freezes the Ownable variant; it says nothing for the RBAC one. +- **Implemented (documentation):** by design (a registry may be meant to freeze); sentence added to the README RBAC note: "If the last `DEFAULT_ADMIN_ROLE` holder renounces, roles can no longer be granted or revoked." Code alternative (Proposed, not compiled): inherit OpenZeppelin `AccessControlDefaultAdminRules` for a delayed two-step admin transfer; this changes the constructor and the ABI. + +### F-4. `clearDebt` / `clearCreditEvents` accept `address(0)` — INFO + +- **Location:** `src/DebtEngineBase.sol:146-157` (`clearDebt`, `clearCreditEvents`), `:188-202` (`_clearDebt`, `_clearCreditEvents`). +- **Identified by:** Independent analysis. + +```solidity +// src/DebtEngineBase.sol:188-192 +function _clearDebt(address smartContract_) internal virtual { + // ◀ no address(0) check, unlike _setDebt (:168) + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); +} +``` + +- **Impact:** none on state (nothing can be stored under `address(0)`); a `DebtCleared(address(0))` event could be emitted (PoC `testClearAcceptsAddressZero`, since inverted). The NatSpec already says clearing an unset record succeeds. +- **Fix code — Implemented** (after the audit, before release): `src/DebtEngineBase.sol:191-192` and `:202-203` (`_clearDebt`, `_clearCreditEvents`), so `clearDebt` / `clearCreditEvents` now revert with `SmartContractWithAddressZeroNotAllowed`, like the setters. Cost: +78 runtime bytes per deployment contract, about +28 gas per clear call. + + ```solidity + // src/DebtEngineBase.sol:191-196 + function _clearDebt(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + // same first line in _clearCreditEvents (:202-203) + ``` + + Verified by `testCannotClearAddressZero` (both variants, both clear functions), inverted from the PoC that asserted the old behaviour; with the two checks removed, it is the one test that fails. + +### F-5. Pointing a token at the engine hides the token's own debt — NOT-A-FINDING (judge) + +- **Location:** `lib/CMTAT/contracts/modules/wrapper/options/DebtEngineModule.sol:64-71` (CMTAT v3.0.0, `debt()`; `creditEvents()` at `:49-56` is identical). +- **Identified by:** `cmtat`. + +```solidity +// lib/CMTAT/contracts/modules/wrapper/options/DebtEngineModule.sol:64-71 +function debt() public view virtual override(DebtModule) returns(DebtInformation memory debtInformation_){ + DebtModuleStorage storage $ = _getDebtModuleStorage(); + if(address($._debtEngine) != address(0)){ + debtInformation_ = $._debtEngine.debt(); // ◀ engine answer even when it holds no record + } else { + debtInformation_ = DebtModule.debt(); + } +} +``` + +- **Impact:** a token with its own debt set through `DebtModule.setDebt` reports a zero struct as soon as `setDebtEngine(engine)` runs, until the engine holds a record for it; the same after `clearDebt` (`testPoC_F5_EngineShadowsTokenLocalDebt`). The token's `debt()` has no way to tell "unset" from "zero"; only `engine.hasDebt(token)` does. +- **Judge adjustment (INFO → NOT-A-FINDING):** the behaviour is CMTAT's `DebtEngineModule` (`lib/`, out of scope), and the README already says a token pointing at the engine reads an empty record after a clear. Kept as an integration note. +- **Fix:** no code fix in DebtEngine (the fallback rule is CMTAT's). Runbook for the README: "Write the token's record in the engine (`setDebt(token, …)`) before calling `setDebtEngine` on the token; after `clearDebt(token)`, the token reports an empty record until it is set again or the engine is removed from the token. Integrators should use `hasDebt(token)` to distinguish an empty record from no record." + +### F-6. Batches hit the per-transaction gas cap first — NOT-A-FINDING (judge: already documented) + +Already documented in `MAX_BATCH_SIZE`'s NatSpec (`src/DebtEngineBase.sol:23-29`) and the README (v0.3.0 quality review, H-1). Admin-only; an oversized batch reverts without effect. No further action. + +### F-7. README RBAC role table omits the clear functions — INFO (found by the judge) + +- **Location:** `README.md`, "DebtEngineAccessControl (RBAC)" role table. +- **Description:** `DEBT_MANAGER_ROLE` was described as "Can call `setDebt` and `setDebtBatch`" (same for credit events), contradicting the capability table just above it, which includes `clearDebt` / `clearCreditEvents`. An operator granting the role from that table would not know it also allows deleting records. +- **Implemented:** both rows now list the clear function. + +### NOT-A-FINDING dispositions + +- **AC-1** — all six writers pass `onlyDebtManager` / `onlyCreditEventsManager` (`DebtEngineBase.sol:94-157`); fuzzed over arbitrary callers in both variants (`testFuzz_OnlyAuthorizedCanWrite`), and earlier mutation runs showed removing any hook modifier fails the suite. +- **AC-2** — debt and credit-events hooks check different roles; four tests cover set and clear in both directions. +- **AC-5** — `Ownable2Step`; `transferOwnership(address(0))` cancels rather than renounces (documented, tested). +- **AC-6** — trusted actor (CMTA down-weights role-gated issues; keys must be protected). +- **MTX-1** — OZ appends-suffix check requires `isTrustedForwarder(msg.sender)`; `testUntrustedCallerCannotSpoofSender`. +- **MTX-3** — with `forwarder = address(0)`, `isTrustedForwarder` is true only for `msg.sender == address(0)`, which cannot occur. +- **DATA-1** — `_setDebt` / `_setCreditEvents` reject `address(0)` (`:168`, `:179`). +- **DATA-4** — last write wins and both events are emitted; documented by test. +- **DOS-2** — only trusted writers choose string sizes; the cost falls on them. +- **INT-1** — records are public by design (`debt(address)`). +- **INT-2** — the engine compiles against CMTAT v3.0.0 `IDebtEngine` and a real `CMTATStandaloneDebt` reads both records. +- **STD-1** — ERC-165 ids pinned in tests for both variants. +- **UPG-1 / REE-1** — not applicable (no proxy, no external call). + +## Invariant verification + +| Invariant | Holds | Evidence | +|---|---|---| +| I-1 only authorized accounts change records | ✅ | `testFuzz_OnlyAuthorizedCanWrite` (256 runs, both variants) | +| I-2 `hasDebt` ⇔ last write was a set | ✅ | `testFuzz_SetClearSequenceMatchesModel` (256 runs) | +| I-3 `debt()` = last record or zero struct | ✅ | same, plus `testFuzz_SetDebtRoundTrip` | +| I-4 no record under `address(0)` | ✅ | `testCannotSet*ForAddressZero`; clears too since the F-4 fix (`testCannotClearAddressZero`) | +| I-5 role separation | ✅ | `test*ManagerCannot*` | +| I-6 `_msgSender() == msg.sender` without forwarder | ✅ | `testUntrustedCallerCannotSpoofSender`, `testBaseMsgSenderIsMsgSender` | + +## Access control verification + +| Function | RBAC | Ownable | Tested | +|---|---|---|---| +| `setDebt`, `setDebtBatch`, `clearDebt` | `DEBT_MANAGER_ROLE` (or admin) | owner | ✅ | +| `setCreditEvents`, `setCreditEventsBatch`, `clearCreditEvents` | `CREDIT_EVENTS_MANAGER_ROLE` (or admin) | owner | ✅ | +| `grantRole` / `revokeRole` | `DEFAULT_ADMIN_ROLE` | — | ✅ (F-1 quirks) | +| `renounceRole` | self | — | ✅ | +| `transferOwnership` / `acceptOwnership` / `renounceOwnership` | — | owner / pending owner / owner | ✅ | +| Views | anyone | anyone | ✅ | + +## Recommendations summary + +| Priority | Item | Changes | Status | +|---|---|---|---| +| 1 | F-1: keep Option C (documented runbook), or adopt Option A for exact role bookkeeping | `src/deployment/DebtEngineAccessControl.sol` (`hasRole`, new `_grantRole` / `_revokeRole`) | Option C implemented (README, NatSpec); Option A proposed, compiled and tested in a scratch copy | +| 2 | F-3, F-7 and the forwarder note (F-2) | `README.md` | Implemented | +| 3 | F-4: zero-address check in `_clearDebt` / `_clearCreditEvents` | `src/DebtEngineBase.sol:192`, `:203` | Implemented | +| 4 | F-5: write the engine record before `setDebtEngine`; integrators use `hasDebt(token)` | `README.md` integration note | Proposed (text in F-5) | + +## Agent judge + +A separate agent re-checked every finding against the code and the README and ran the PoC suite (12/12 pass). Adjustments, all applied above: + +| ID | Verdict | Severity before → after | +|---|---|---| +| F-1 | Downgrade: grant side already documented, inherited CMTAT convention, trusted admin only | LOW → INFO | +| F-2 | Dismiss: ERC-2771 trust model, already implied by the README | INFO → NOT-A-FINDING | +| F-3 | Stands | INFO | +| F-4 | Stands | INFO | +| F-5 | Dismiss: CMTAT behaviour, out of scope, already noted in the README | INFO → NOT-A-FINDING | +| F-6 | Dismiss: already documented | INFO → NOT-A-FINDING | +| F-7 | New: README role table omits clear functions | INFO | +| NAFs | All 14 agreed | — | + +The judge confirmed that all 20 threats in `THREAT_MODEL.md` have a disposition here. + +## Review completeness + +**Setup (Step 0–1)** +- [x] Run options resolved (all four asked once by the entrypoint) and recorded at the top of `THREAT_MODEL.md` and `RESULT.md`. +- [x] Scope resolved to the five `src/` files; no out-of-scope file exists; the In-Scope column matches (F-5 marked "integration"). +- [x] Toolchain recorded: solc 0.8.33, optimizer 200, no `via_ir`, `prague`, Foundry 1.5.0, CMTAT v3.0.0, OZ v5.5.0. +- [x] Baseline `forge build` / `forge test`: 124 tests, no pre-existing failure. +- [x] Every in-scope contract read in full. Slither printers **not run** (`ModuleNotFoundError: No module named 'slither'`); call graph traced by hand in `THREAT_MODEL.md`; `AUDIT/slither-graph/` left empty. +- [x] Skills invoked and listed in each deliverable. + +**Threat model and test plan (Steps 2–3)** +- [x] 20 threats with IDs; trust model, actors, invariants, dependencies written. +- [x] SafeERC20 pass: N/A (no token interaction). Typo pass: no hit. Standardized views: `IDebtEngine` views and ERC-3643 `version()` are non-reverting. Selector completeness: all six writers gated, fuzzed. +- [x] `TEST_IMPROVEMENT.md` maps T-1..T-10 to threat IDs with priorities. + +**Tests (Steps 4–5)** +- [x] 12 tests in `test/DebtEngineThreatModel.t.sol`, two fuzz tests (256 runs, `bound()` on the sequence length); key invariants I-1..I-6 covered. +- [x] Negative tests assert the specific error (selector and arguments); the fuzz writer test uses bare `expectRevert()` for the six-writer sweep and then pins the specific error per variant. +- [x] Full suite run: 136 tests, 0 failures (after the documentation edits too). +- [x] `report-only`: N/A (`full` mode). + +**Findings (Step 5)** +- [x] Findings Summary Table first, closed by a tally (before and after the judge). +- [x] Every threat maps to a finding or a NOT-A-FINDING row (confirmed by the judge). +- [x] Every finding has a location, verbatim code where code is involved, fix code or doc text labelled Implemented / Proposed, and a PoC. +- [x] Cited lines re-verified; citations are for the audited commit `705208b`, with the one shift after this run's NatSpec edit noted (F-1). +- [x] Severity on the Code4rena scale; no automated report ships with the project, so no duplicate. + +**Judge and wrap-up (Steps 6–7)** +- [x] Agent judge run; adjustments recorded on each finding and in the table above. +- [x] `CLAUDE.md` (= `AGENTS.md`) updated in place at the project root (standing notes kept): `AUDIT/` and the new test file added, F-1 / F-2 security notes. +- [x] This checklist appended. diff --git a/AUDIT/TEST_IMPROVEMENT.md b/AUDIT/TEST_IMPROVEMENT.md new file mode 100644 index 0000000..df68ce7 --- /dev/null +++ b/AUDIT/TEST_IMPROVEMENT.md @@ -0,0 +1,43 @@ +# DebtEngine v0.3.0 — Test Improvement Plan + +Run options: `--mode full --scope all --out AUDIT/ --judge on` (see `THREAT_MODEL.md`). + +## Claude Skills Used + +| Skill | Purpose / Contribution | +|---|---| +| `sc-analyse-and-test-solidity` | Test categories and structure | +| `audit-access-control` | Negative tests per guard, role lifecycle | +| `openzeppelin-v5` | Role-bookkeeping and forwarder test cases | + +## Current coverage assessment + +Baseline at `705208b`: **124 tests**, all green (3 suites: shared suite run on both variants, Ownable/RBAC specifics, harness). `forge coverage` from the v0.3.0 quality review: `DebtEngineBase` 100% lines / branches / functions; only the `_msgData` overrides are unreached. + +Well covered: every guard with its exact error, set / batch / clear lifecycle, role separation for set and clear, batch boundaries (0, 500, 501, duplicates, length both ways), fuzzed write-then-read, forwarder relay / spoof, ERC-165, two-step ownership, CMTAT reading through the engine. + +Missing: + +| # | Test | Threat | Type | +|---|---|---|---| +| T-1 | Granting a manager role to an admin is a silent no-op (no event, not enumerated) | AC-3 | Unit (PoC) | +| T-2 | Revoking a manager role from an admin emits `RoleRevoked` but the admin keeps the power | AC-3 | Unit (PoC) | +| T-3 | Admin handover (grant new admin, renounce) drops the manager role the old admin "granted" itself; runbook that works | AC-3 | Integration (PoC) | +| T-4 | Last admin renounces: no role can be granted again, records frozen | AC-4 | Unit | +| T-5 | Trusted forwarder relaying a signer suffix can perform admin actions (`grantRole`) | MTX-2 | Unit (PoC) | +| T-6 | `clearDebt(address(0))` / `clearCreditEvents(address(0))` succeed and emit | DATA-2 | Unit | +| T-7 | Pointing a token at the engine hides the token's own `DebtModule` debt, before any engine record | DATA-3 | Integration (PoC, real `CMTATStandaloneDebt`) | +| T-8 | Any non-authorized caller is rejected by all six writers, both variants | AC-1 / I-1 | Fuzz | +| T-9 | Random set / clear sequences keep `hasDebt` and `debt()` equal to a model | I-2 / I-3 | Fuzz | +| T-10 | Forwarder relays `clearDebt` for an authorized signer | MTX-1 | Unit | + +## Implementation priority + +| Priority | Tests | Threats | Type | +|---|---|---|---| +| P1 | T-1, T-2, T-3 | AC-3 | PoC | +| P1 | T-8, T-9 | AC-1, I-1..I-3 | Fuzz | +| P2 | T-5, T-7 | MTX-2, DATA-3 | PoC | +| P3 | T-4, T-6, T-10 | AC-4, DATA-2, MTX-1 | Unit | + +All in one file, `test/DebtEngineThreatModel.t.sol`. diff --git a/AUDIT/THREAT_MODEL.md b/AUDIT/THREAT_MODEL.md new file mode 100644 index 0000000..43cd885 --- /dev/null +++ b/AUDIT/THREAT_MODEL.md @@ -0,0 +1,124 @@ +# DebtEngine v0.3.0 — Threat Model + +## Run options + +| Option | Value | Source | +|---|---|---| +| `--mode` | `full` (tests written to `test/`) | asked | +| `--scope` | `all` — `src/DebtEngineBase.sol`, `src/DebtEngineInvariantStorage.sol`, `src/modules/VersionModule.sol`, `src/deployment/DebtEngineAccessControl.sol`, `src/deployment/DebtEngineOwnable.sol` (no scope file; `lib/`, `test/` out of scope) | asked (`auto` → `all`) | +| `--out` | `AUDIT/` | asked | +| `--judge` | `on` | asked | + +Audited commit: `705208b` (branch `dev`). Toolchain: solc 0.8.33, optimizer 200 runs, legacy pipeline (no `via_ir`), `evm_version = prague`, Foundry 1.5.0. Dependencies: CMTAT v3.0.0 (`69eecc9`), OpenZeppelin Contracts v5.5.0 (`fcbae539`), forge-std v1.13.0. + +## Claude Skills Used + +| Skill | Purpose / Contribution | +|---|---| +| `sc-analyse-and-test` | Entrypoint: run options, ecosystem detection, dispatch | +| `sc-analyse-and-test-solidity` | Workflow and deliverable structure | +| `audit-access-control` | Role inventory, renounce / deployer-retention questions, selector-keyed completeness (§J) → AC-1..AC-6 | +| `cmtat-audit` | CMTA's down-weighting of role-gated issues (trusted admin); no prior finding on the implicit-admin `hasRole` override | +| `cmtat` | CMTAT `DebtEngineModule` delegation (`debt()` / `creditEvents()` forwarded to the engine when set) → INT-1, DATA-3 | +| `openzeppelin-v5` | `AccessControl._grantRole` / `_revokeRole` call the virtual `hasRole` → AC-3; `ERC2771Context` sender extraction → MTX-1..3 | +| `erc173-ownership` | Two-step transfer and `transferOwnership(address(0))` semantics → AC-5 | + +## Project overview + +DebtEngine is an external engine for CMTAT debt tokens. One deployed engine stores a `DebtInformation` record and a `CreditEvents` record per token address. A CMTAT token configured with `setDebtEngine(engine)` answers its own `debt()` / `creditEvents()` by calling the engine, which returns the record stored under `_msgSender()` (the token). Records are written, overwritten and deleted by privileged managers only. The engine holds no funds and makes no external calls. + +Two deployment contracts share the abstract `DebtEngineBase`: + +- `DebtEngineAccessControl` — OpenZeppelin `AccessControlEnumerable`; `DEBT_MANAGER_ROLE`, `CREDIT_EVENTS_MANAGER_ROLE`; `DEFAULT_ADMIN_ROLE` implicitly holds every role (`hasRole` override). +- `DebtEngineOwnable` — OpenZeppelin `Ownable2Step`; the owner does everything. + +Both inherit `ERC2771Context` with an immutable trusted forwarder (`address(0)` disables it). + +## Trust model and actors + +| Actor | Trust | Capabilities | +|---|---|---| +| `DEFAULT_ADMIN_ROLE` holder (RBAC) | Fully trusted | Every role implicitly; grant / revoke every role; renounce | +| `DEBT_MANAGER_ROLE` | Trusted for debt data | `setDebt`, `setDebtBatch`, `clearDebt` | +| `CREDIT_EVENTS_MANAGER_ROLE` | Trusted for credit data | `setCreditEvents`, `setCreditEventsBatch`, `clearCreditEvents` | +| Owner (Ownable) | Fully trusted | All six writers; two-step transfer; renounce | +| Trusted forwarder | Fully trusted, immutable | Can make the engine see any `_msgSender()` it appends | +| CMTAT token | Untrusted caller, reads only | `debt()` / `creditEvents()` for itself | +| Anyone | Untrusted | All views (`debt(address)`, `hasDebt`, …) | + +## Reachable attack surface (manual call graph) + +Slither could not run (`ModuleNotFoundError: No module named 'slither'`), so the call graph below was traced by hand; `AUDIT/slither-graph/` is empty. + +``` +External entry points Guard Internal path +setDebt(addr, info) ──► onlyDebtManager ─► _authorizeSetDebt ─► _setDebt ─► _debts, _debtSet, DebtSet +setDebtBatch(addrs, infos) ──► onlyDebtManager ─► length/size require ─► loop _setDebt +clearDebt(addr) ──► onlyDebtManager ─► _clearDebt ─► delete, DebtCleared +setCreditEvents / Batch / clearCreditEvents ──► onlyCreditEventsManager ─► _setCreditEvents / _clearCreditEvents +debt() / creditEvents() ──► none ─► _msgSender() (ERC-2771) ─► debt(addr) / creditEvents(addr) +debt(addr), creditEvents(addr), hasDebt, hasCreditEvents, version, MAX_BATCH_SIZE ──► none (views) +RBAC: grantRole / revokeRole ──► onlyRole(getRoleAdmin(role)) = DEFAULT_ADMIN (via overridden hasRole) ─► _grantRole / _revokeRole (call hasRole) +RBAC: renounceRole(role, self) ──► callerConfirmation == _msgSender() ─► _revokeRole (calls hasRole) +Ownable: transferOwnership / acceptOwnership / renounceOwnership ──► onlyOwner / pendingOwner +``` + +Every state-changing entry point of `DebtEngineBase` passes through one of the two hooks; no privileged function is reachable without them. + +## Attack surface analysis + +| ID | Threat | Severity (initial) | Component | +|---|---|---|---| +| AC-1 | A write function reachable without its authorization hook (selector completeness across set / batch / clear, both variants) | High | `DebtEngineBase.sol:94-157` | +| AC-2 | Role separation bypass: debt manager writes credit events or vice versa | Medium | `DebtEngineAccessControl.sol:25-27` | +| AC-3 | Implicit-admin `hasRole` override changes `_grantRole` / `_revokeRole` / `renounceRole` bookkeeping for admins (no-op grants, misleading revocations) | Low | `DebtEngineAccessControl.sol:41-53`, OZ `AccessControl.sol:181-206` | +| AC-4 | Last `DEFAULT_ADMIN_ROLE` holder renounces: roles can never be granted again | Low | OZ `AccessControl.renounceRole` | +| AC-5 | Ownership lost through a mistyped transfer or renounce | Low | `DebtEngineOwnable.sol` (Ownable2Step) | +| AC-6 | Compromised admin / owner / manager key rewrites or deletes records | High | trusted actor | +| MTX-1 | Non-forwarder spoofs `_msgSender()` by appending an address | High | `ERC2771Context._msgSender` | +| MTX-2 | Trusted forwarder compromised or able to relay arbitrary calls impersonates the admin; forwarder is immutable | Medium | constructors | +| MTX-3 | `forwarder = address(0)` makes some sender trusted | Low | `ERC2771Context` | +| DATA-1 | Record written for `address(0)` | Low | `_setDebt`, `_setCreditEvents` | +| DATA-2 | `clearDebt` / `clearCreditEvents` accept `address(0)` and unset records, emitting events for nothing | Info | `_clearDebt`, `_clearCreditEvents` | +| DATA-3 | Once a token points to the engine, the engine's record (or its absence) shadows the token's own `DebtModule` data | Low | CMTAT `DebtEngineModule.sol:49-71` | +| DATA-4 | Duplicate addresses in a batch: last write wins silently | Info | batch setters | +| DOS-1 | Batches above the per-transaction gas cap (EIP-7825) always revert | Info | `MAX_BATCH_SIZE` | +| DOS-2 | Unbounded strings make a write too expensive | Info | trusted writer | +| INT-1 | CMTAT reads the record of `msg.sender`; a third party reads another token's record | Info | `debt()`, `debt(address)` | +| INT-2 | `IDebtEngine` interface mismatch with CMTAT v3.0.0 | Medium | `DebtEngineBase` | +| STD-1 | ERC-165 advertises an interface not implemented, or misses one | Low | both `supportsInterface` | +| UPG-1 | Initializer front-running / storage collision | — | N/A: not upgradeable, constructor-only | +| REE-1 | Reentrancy | — | N/A: no external calls in the engine | + +## Critical findings summary (pre-test) + +No Critical or High issue is expected: the engine holds no value and every write is gated. The leads to confirm with tests are AC-3 (role bookkeeping with the implicit admin), DATA-3 (shadowing of token-local data) and the trust placed in the immutable forwarder (MTX-2). + +## Data flow + +``` +Issuer ops ──setDebt──► DebtEngine[_debts[token]] ◄──debt()── CMTAT token ◄──debt()── holder / integrator + ▲ │ (engine set → engine answer; +Relayer ──(forwarder + signer suffix)──┘ │ engine unset → token-local DebtModule) +``` + +## External dependencies and trust assumptions + +| Dependency | Version | Use | Risk | +|---|---|---|---| +| OpenZeppelin `AccessControlEnumerable`, `Ownable2Step`, `ERC2771Context`, `ERC165` | v5.5.0 | Access control, meta-tx, introspection | Audited library; the `hasRole` override changes its internal semantics (AC-3) | +| CMTAT `IDebtEngine`, `ICMTATDebt`, `ICMTATCreditEvents` | v3.0.0 | Interface and structs | Struct layout must match the token's version | +| Trusted forwarder | deployment choice | ERC-2771 | Fully trusted and immutable | + +## Invariants + +- I-1: only an authorized account (hook passes) can change `_debts`, `_creditEvents`, `_debtSet`, `_creditEventsSet`. +- I-2: `hasDebt(a)` is true iff the last write to `a` was a set (not a clear); same for credit events. +- I-3: `debt(a)` equals the last record set for `a`, or the zero struct after a clear / before any set. +- I-4: no record is ever stored under `address(0)`. +- I-5: a debt manager cannot change credit events and vice versa (RBAC). +- I-6: without the trusted forwarder, `_msgSender() == msg.sender`. + +## Threat disposition rule + +Every threat ID above receives an explicit outcome in `RESULT.md`: a numbered finding with severity, or `NOT-A-FINDING` with a reason. diff --git a/CHANGELOG.md b/CHANGELOG.md index d6319e0..7cd09ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,161 @@ Please follow https://changelog.md/ conventions. +## Type of changes + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +Reference: [keepachangelog.com/en/1.1.0/](https://keepachangelog.com/en/1.1.0/) + +Custom changelog tag + +- `breaking change`: breaking change regarding storage [ERC-7201](https://eips.ethereum.org/EIPS/eip-7201) namespace , as well as external engine +- `Dependencies` (npm package, openzeppelin,...) +- `Documentation` +- `Testing` + +## Checklist + +> Before a new release, perform the following tasks + +- Code: Update the version name in the `Version` module [./src/modules/VersionModule.sol](./src/modules/VersionModule.sol), constant `VERSION`, and the compatibility table in the [README](./README.md) +- Run linter + +> forge fmt + +- Run the tests + +> forge test + +- Documentation + - Perform a code coverage and update the files in the corresponding directory [./doc/coverage](./doc/coverage) + + > forge coverage --report lcov --report-file doc/coverage/lcov.info --no-match-coverage "test/|script/" && genhtml doc/coverage/lcov.info --branch-coverage --output-dir doc/coverage/coverage + + - Perform an audit with several audit tools (Aderyn and Slither), update the report in the release directory `./doc/tools//` (e.g. [./doc/tools/v0.3.0](./doc/tools/v0.3.0)) + + ```bash + slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-std|script" > doc/tools//slither-report.md + aderyn -x mocks --output doc/tools//aderyn-report.md + ``` + + - Update surya doc by running the 3 scripts in [./doc/script](./doc/script) (output in [./doc/surya](./doc/surya)) + + > bash doc/script/script_surya_graph.sh && bash doc/script/script_surya_inheritance.sh && bash doc/script/script_surya_report.sh + + - For each new release (not for release candidates), add the Hardhat and Foundry compilation files in [./doc/compilation](./doc/compilation) (see its README) + + > npx hardhat compile --force && forge build --force + + - Update changelog + +## v0.3.0 + +Branch: `dev` (not yet released, commit hash to be added on release) + +### Breaking change + +- Split the single `DebtEngine` contract into an abstract `DebtEngineBase` and two deployment contracts, `DebtEngineAccessControl` and `DebtEngineOwnable`; deploy one of them instead of `DebtEngine`. +- Replace the public `VERSION` constant with a `version()` function, provided by the new `VersionModule` (same pattern as CMTAT `BaseModule`); integrators reading `VERSION()` must call `version()` instead. +- Move `DEBT_MANAGER_ROLE` and `CREDIT_EVENTS_MANAGER_ROLE` from `DebtEngineInvariantStorage` to `DebtEngineAccessControl`. + +### Added + +- Add a Hardhat configuration (`hardhat.config.js`, Hardhat 2 with the Foundry remappings) to compile `src/` with the same settings as Foundry; `npm run compile:hardhat` +- Add Foundry deployment scripts: `script/DeployDebtEngine.s.sol` (either variant, optional manager roles, post-deployment checks) and `script/ConnectDebtEngine.s.sol` (connects a CMTAT v3.0.0 debt token; refuses when the engine holds no record for the token) +- Add `DebtEngineAccessControl` deployment variant (OpenZeppelin `AccessControlEnumerable`, role holders listable on-chain) +- Add `DebtEngineOwnable` deployment variant (OpenZeppelin `Ownable2Step`, two-step ownership transfer) +- Add `VersionModule` (`src/modules/VersionModule.sol`) exposing `version()` +- Add `DebtSet` and `CreditEventsSet` events on state changes +- Add zero-address validation on `smartContract_` parameter (`SmartContractWithAddressZeroNotAllowed`) +- Add `hasDebt(address)` and `hasCreditEvents(address)` view functions; they return whether a record is currently set +- Add `clearDebt(address)` and `clearCreditEvents(address)` to delete a record, with `DebtCleared` / `CreditEventsCleared` events + - Use: retire a token, or remove a record written to the wrong address; before this, a record could only be overwritten with an empty struct and `hasDebt` / `hasCreditEvents` stayed `true` forever. + - Effect: the record and its `has*` flag are deleted, so `hasDebt` / `hasCreditEvents` return `false` and a CMTAT token pointing at the engine reads an empty record, as before it was set; clearing an unset record succeeds and still emits the event. + - Access: gated by the same hooks as the setters (`DEBT_MANAGER_ROLE` / `CREDIT_EVENTS_MANAGER_ROLE`, or the owner); no new storage; runtime bytecode +617 bytes (`DebtEngineAccessControl` 8,573 → 9,190) and +587 bytes (`DebtEngineOwnable` 7,107 → 7,694). +- Add `MAX_BATCH_SIZE` (500) limit on `setDebtBatch` and `setCreditEventsBatch` (`BatchSizeTooLarge`) +- `DebtEngineOwnable` advertises ERC-173 (`0x7f5828d0`) and ERC-165 through `supportsInterface` + +### Changed + +- Refactor into abstract `DebtEngineBase` with pluggable authorization hooks (`_authorizeSetDebt`, `_authorizeSetCreditEvents`) +- Move ERC-2771 support from base to deployment contracts +- Declare the authorization hooks `internal view virtual` and implement every override with an empty body guarded by `onlyRole(...)` / `onlyOwner` instead of direct `_checkRole` / `_checkOwner` calls (no behaviour change) +- Change `DebtEngineInvariantStorage` to `abstract contract` +- Pin compiler settings in `foundry.toml`: solc `0.8.33`, optimizer (200 runs), EVM version `prague` +- Route every write through one internal function per record type, `_setDebt` and `_setCreditEvents`, which own the zero-address check, the storage write, the `has*` flag and the event. + - Each event now has a single emit site, so a future write path cannot forget it. + - Gas: single setters +34 gas (one internal call); batches about 670 gas cheaper per entry; deployment about 110k gas cheaper; runtime code 551 bytes smaller. +- Mark every public and external function of `DebtEngineBase`, and the `_msgSender` / `_msgData` / `_contextSuffixLength` overrides, `virtual` (no gas or size change) +- Use `require(condition, CustomError())` for all guards instead of `if (...) { revert ...; }`; revert data is unchanged (batch calls +13 gas, as `BatchSizeTooLarge` arguments are now built on the success path) +- Raise the minimum compiler to `pragma ^0.8.27`, required by `require` with a custom error on the legacy pipeline (0.8.26 fails to compile) + +### Fixed + +- `clearDebt` / `clearCreditEvents` now reject `address(0)` with `SmartContractWithAddressZeroNotAllowed`, like `setDebt` / `setCreditEvents` (finding F-4 of the security audit); previously they accepted it and emitted a `*Cleared` event for `address(0)` +- Fix NatSpec comments (`/*` to `/**`, self-referencing batch docs) +- Fix function modifier ordering (`internal view override`) + +### Removed + +- Remove redundant memory variables in getter functions +- Remove unused `ICMTATDebt` and `ICMTATCreditEvents` imports + +### Dependencies + +- Add npm dev dependencies `hardhat` (^2.29.2) and `@nomicfoundation/hardhat-foundry` (^1.2.1) +- Update CMTAT library (submodule) to v3.0.0 + +### Documentation + +- Add the v0.3.0 compilation files in `doc/compilation/v0.3.0/`: Hardhat and Foundry artifacts of `DebtEngineAccessControl` and `DebtEngineOwnable`, and their flattened sources (identical runtime bytecode across the three, metadata aside); restore the release-checklist step +- Add a deployment guide for CMTAT v3.0.0 debt tokens ([`doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md`](./doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md)): setup choices, roles on the engine and token side, deployment with both variants and with an upgradeable token, read workflow, operations, admin handover and troubleshooting +- Document that granting a manager role to an admin is a no-op and revoking one emits `RoleRevoked` without effect, with the admin-handover runbook (README, `hasRole` NatSpec) +- Document that the trusted forwarder is trusted for every function including role management, that renouncing the last admin freezes role management, and list the clear functions in the RBAC role table +- Add the Claude security audit report of v0.3.0: [`doc/tools/v0.3.0/CLAUDE_AUDIT.md`](./doc/tools/v0.3.0/CLAUDE_AUDIT.md) (0 Critical/High/Medium/Low, 4 Info) +- Document `hasRole` super-admin behavior in NatSpec and README +- Document ERC-2771 forwarder immutability in README +- Document the authorization-hook convention and a capability → role table per deployment variant in README +- Document which CMTAT version each DebtEngine release is compatible with and was tested against in README +- Document that `MAX_BATCH_SIZE` is a ceiling and that the mainnet per-transaction gas cap (EIP-7825) limits batches first (NatSpec and README) +- Surya scripts now write to `doc/surya` and can be run from any directory; diagrams and reports regenerated for the new contracts +- Move the tool reports to a per-release directory, `doc/tools/v0.3.0/` (Slither, new Aderyn report, code-quality review `CLAUDE_ANALYSIS.md`); remove the earlier draft AI reviews +- Refresh the static analysis and coverage for v0.3.0: Slither 0.11.6 (0 High / 0 Medium / 0 Low / 2 Info) and Aderyn 0.6.5 (0 High / 7 Low), each with a feedback file triaging every finding (nothing to fix), a new audit overview (`doc/tools/AUDIT_OVERVIEW.md`), and coverage regenerated for the production sources (94.94% lines, 100% branches) +- Add agent guide (`CLAUDE.md` / `AGENTS.md`) +- Adapt the release checklist to this project's commands and directories + +### Testing + +- Add `test/script/DeployScripts.t.sol` for both deployment scripts (defaults, managers, forwarder, Ownable, environment parsing, refusal of an empty record, guard reverts) +- Add `DeployGuideCMTATv3.0.0.t.sol`, which runs every step of the CMTAT v3.0.0 deployment guide against real `CMTATStandaloneDebt` and proxied `CMTATUpgradeableDebt` tokens +- Add `DebtEngineThreatModel.t.sol` from the security audit ([`CLAUDE_AUDIT.md`](./doc/tools/v0.3.0/CLAUDE_AUDIT.md)): proofs of concept for the role-bookkeeping behaviour of the implicit admin, the trusted forwarder and token-local debt shadowing, plus fuzz tests that every writer rejects unauthorized callers in both variants and that set / clear sequences match a model +- Split tests into a shared abstract suite (`DebtEngineBaseTest`) run against both deployment variants +- Add `version()` test +- Add `clearDebt` / `clearCreditEvents` tests in the shared suite (clear, independence from the other record type and other tokens, clear of an unset record, set after clear, unauthorized caller, CMTAT token reads an empty record) and role-separation tests for the RBAC variant +- Add role-separation tests (`DEBT_MANAGER_ROLE` cannot set credit events and vice versa) and a role-constant test for `DebtEngineAccessControl` +- Add role-enumeration, implicit-admin-not-enumerated and ERC-165 tests for `DebtEngineAccessControl` +- Add two-step ownership handover tests for `DebtEngineOwnable` +- Adapt the CMTAT deployment in the test setup to CMTAT v3.0.0 (`BaseModuleAttributes` renamed to `ExtraInformationAttributes`) +- Add batch-size tests: `BatchSizeTooLarge` above `MAX_BATCH_SIZE` and success at exactly `MAX_BATCH_SIZE`, for both batch setters +- Add batch edge-case tests: empty batches emit nothing, a duplicated address keeps the last write and emits twice, more addresses than records reverts with `InvalidInputLength` +- Add fuzz tests checking that what `setDebt` / `setCreditEvents` write is what the getters return +- Add ERC-2771 tests: a trusted forwarder relays an authorized signer, cannot relay an unauthorized one, and a non-forwarder cannot spoof the sender by appending an address +- Add ERC-165 / ERC-173 tests for `DebtEngineOwnable`, including `OwnershipTransferred` at deployment +- Add `DebtEngineHarness`, a test-only engine that overrides public functions (so removing `virtual` breaks the build) and covers the base `_msgSender()` + ## v0.2.0 +Commit: `f6fb806b5f9b2ed7987500bb48bf8ea16346e85b` + - Add ERC-2771 support ## v0.1.0 -- 🎉 first release! \ No newline at end of file +Commit: `272c97e7953834794df8e0f32346236e6de9c7cd` + +- first release! diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..401a698 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,126 @@ +# DebtEngine — Agent Guide + +> **Note — keep in sync:** `AGENTS.md` and `CLAUDE.md` must always be **identical**. Any edit to one must be applied verbatim to the other. + +> **Note — commit messages:** After each group of modifications or each feature added, always provide a **one-line GitHub commit message** (Conventional-Commits style, e.g. `feat: ...`, `fix: ...`, `docs: ...`, `test: ...`). +> +> **Never put `!` in a commit message** — not as the breaking-change marker (`feat!: ...`), not anywhere else. In an interactive bash, `!` inside double quotes triggers history expansion, so `git commit -m "feat!: ..."` aborts with `bash: !: unrecognized history modifier`. Signal a breaking change with an uppercase `BREAKING CHANGE:` line in the commit body instead, and keep the subject line free of `!`. +> +> **Always sign commits** — every commit must be signed with `-S`, both the commands you suggest to the user (`git commit -S -m "..."`) and any commit you make yourself. If signing fails (no key configured, agent locked, `gpg failed to sign the data`), stop and report it; never fall back to an unsigned commit or to `--no-gpg-sign`. + +> **Note — no tool names in the changelog:** never name an assistant tool, skill or slash command in `CHANGELOG.md`. The changelog records what changed in *this project*, for readers who have no idea what tooling produced it. A line ending "the `` skill gained the corresponding check" documents the author's toolbox rather than the release, and it rots independently of the repository — the tool can be renamed or deleted, leaving a dangling reference to something the reader could never have seen. Describe the change and its effect; if the tooling matters, record it in the audit or analysis report instead. +> +> This is about **tool identities, not the word "Claude"**: files committed to the repository — `CLAUDE.md`, `AGENTS.md`, `doc/tools//CLAUDE_ANALYSIS.md` — are cited freely, because a reader can open them. + +> **Note — do not hard-wrap prose in `CHANGELOG.md`:** one line per bullet or paragraph, and let the editor soft-wrap. Markdown collapses a single newline into a space, so a hard-wrapped bullet renders identically — the cost is invisible in the published changelog and paid entirely in the repository. Changing one word reflows every following line, so a one-word correction arrives as a multi-line diff in which a reviewer cannot see what actually changed; and because the wrap column depends on whoever wrote the entry, the file drifts into a mix of styles that reads as damage. Keep the line structure only where it is semantic: fenced code blocks, tables and blockquotes. + +> **Note — never break the code in place to test a test:** when you need to verify that a test actually catches a defect — mutation testing: delete an assert, flip a condition, drop a delivery — do it in a **throwaway copy of the repository**, never in the working tree. +> +> Editing source forces a rebuild, and if that run is interrupted — an OOM kill, a timeout, a cancelled command — the restored source and the stale build output **disagree**: `git status` reports a clean tree while `out/` and `cache/` hold artifacts built from the mutated code. Nothing surfaces that state, and restoring the source does not restore the build. It has already happened once in a sibling project, leaving compiled artifacts missing a safety check one step before a release tag. +> +> The procedure: `git worktree add /tmp/mut HEAD --detach`, copy across any uncommitted test files the mutation needs (a worktree is made from the last commit, so new tests are absent), mutate and run there, then `git worktree remove /tmp/mut`. If a mutation ever does run in the working tree, rebuild and **prove** recovery against a recorded build fingerprint rather than assuming it. + +> **Note — long changelog entries get sub-bullets:** past roughly three sentences, a bullet stops being scannable — the defect, its blast radius, the fix, the precedent and the caveat all run together, so a reader looking for any one of them has to parse all five. Lead with one sentence naming *what changed*, then one sub-bullet per distinct claim: impact, fix, behaviour-change warning, cost, migration note. A useful trigger is length — compare against the file's own median bullet and split anything several times longer, since that length almost always means several claims in one paragraph. Sub-bullets follow the same no-hard-wrap rule: one line each. + +> **Note — never reference documentation, tests or agent reports from production code:** NatSpec and comments in the production sources (`src/`) must not cite a documentation page (`doc/`, `*.md`, `README`), a test file or test name (`test/`, `*.t.sol`, `testFoo`, `invariant_...`), a mock file, a planning ID, or a report produced by an AI assistant (`doc/tools//CLAUDE_ANALYSIS.md`, `FEEDBACK.md`, `CLAUDE_ANALYSIS*.md`, `RESULT.md`, `THREAT_MODEL.md` or any other agent-written review, including its finding IDs), by path or by bare filename. +> +> Documentation paths move, tests are renamed, and agent reports are regenerated with IDs that restart at `-1` each release (so `CLAUDE_ANALYSIS.md D-1` names a different finding in every version). A stale pointer inside a deployed, verified contract cannot be fixed afterwards, and a reader on a block explorer has the source and nothing else. **Write the substance into the comment instead**: the conclusion and the warning, so the reader gets the whole point without the file. If the explanation is too long for NatSpec, the comment states the conclusion and the documentation carries the derivation, with no cross-reference in the code. +> +> - **Exception: tests.** `test/` is never deployed and exists to serve the suite, so a pointer to the page explaining what a test stands in for is useful and costs nothing. +> - **Exception: official audits by an audit company**, cited by **bare filename and finding ID** (e.g. `Halborn-2024-Q3.pdf` H-03, `OpenZeppelin-audit.md` M-2). An external audit is an immutable historical record, the bare filename survives the file being moved, and the ID gives a reviewer context a comment cannot restate. Never cite it by path. +> - **The audit exception does not cover AI-assisted reviews.** A report written with an AI assistant is a working document that is rewritten as the code changes, not a record; treat it like any other documentation. Agent guides (`CLAUDE.md` / `AGENTS.md`), changelogs and audit overviews may cite these reports freely: they are not deployed. +> - **The link between code and AI findings lives in [`doc/tools/CLAUDE_ANALYSIS_SUMMARY.md`](./doc/tools/CLAUDE_ANALYSIS_SUMMARY.md)**, next to the project's tool reports. Whenever an AI-assisted finding changes production code, or explains why it must not change, add an entry there instead of a citation in the comment: the `file:line` and symbol, the code line, the comment (before and after if a citation was removed), the finding with its **report, release, ID and title** (IDs restart each release), and the change applied. Keep the line numbers current when a symbol moves. + +## What this project is + +DebtEngine is an external engine for the [CMTAT](https://github.com/CMTA/CMTAT) security token: a single contract stores `debt` (`DebtInformation`) and `credit events` (`CreditEvents`) for many CMTAT token contracts, keyed by token address. It implements CMTAT's `IDebtEngine` interface; a CMTAT debt token calls `debt()` / `creditEvents()` and the engine answers for `_msgSender()`. Unaudited (see README). + +## Key concepts + +- **Abstract base + deployment variants:** `DebtEngineBase` holds all storage and logic; authorization is delegated to two hooks, `_authorizeSetDebt()` and `_authorizeSetCreditEvents()`, which must revert when the caller is not allowed (used by the `onlyDebtManager` / `onlyCreditEventsManager` modifiers). +- **`DebtEngineAccessControl`** (RBAC, OpenZeppelin `AccessControlEnumerable`): roles `DEBT_MANAGER_ROLE` and `CREDIT_EVENTS_MANAGER_ROLE`; `hasRole` is overridden so `DEFAULT_ADMIN_ROLE` implicitly holds every role (this implicit membership is not listed by `getRoleMember*`). Constructor rejects a zero `admin`. +- **`DebtEngineOwnable`** (OpenZeppelin `Ownable2Step`): the owner is the only writer for both debt and credit events; ownership transfer requires `acceptOwnership` by the new owner. +- **ERC-2771 meta-transactions:** only the deployment contracts inherit `ERC2771Context`; the base defines a virtual `_msgSender()` returning `msg.sender`. The forwarder is set in the constructor and is **immutable**; `address(0)` disables it. +- **Getters:** `debt()` / `creditEvents()` (for the caller), `debt(address)` / `creditEvents(address)`, and `hasDebt(address)` / `hasCreditEvents(address)`, which mean "currently set" (true after a set, false again after a clear) and distinguish "no record" from "set to empty". +- **Setters:** `setDebt`, `setCreditEvents`, `setDebtBatch`, `setCreditEventsBatch`; all writes go through `_setDebt` / `_setCreditEvents` (zero-address check, write, `has*` flag, event) — never write the mappings or emit `DebtSet` / `CreditEventsSet` anywhere else; batches capped by `MAX_BATCH_SIZE = 500` (a ceiling: the mainnet per-transaction gas cap binds first) and require equal array lengths. +- **Clear:** `clearDebt` / `clearCreditEvents` delete a record and its `has*` flag only through `_clearDebt` / `_clearCreditEvents`, which emit `DebtCleared` / `CreditEventsCleared`; gated by the same hooks as the setters; reject `address(0)` like the setters; clearing an unset record succeeds. +- **Errors** live in `DebtEngineInvariantStorage` (abstract). +- **Version:** `version()` comes from `VersionModule`, inherited by `DebtEngineBase` (there is no public `VERSION` getter). +- **Not upgradeable:** plain constructor deployment, no proxy. + +## File tree + +``` +src/ +├── DebtEngineBase.sol # abstract engine: storage, getters/setters, events, auth hooks +├── DebtEngineInvariantStorage.sol # abstract: custom errors +├── modules/ +│ └── VersionModule.sol # abstract: private VERSION constant + version() getter (CMTAT BaseModule pattern) +└── deployment/ + ├── DebtEngineAccessControl.sol # RBAC variant (AccessControlEnumerable + ERC2771Context) + └── DebtEngineOwnable.sol # single-owner variant (Ownable2Step + ERC2771Context) +test/ +├── DebtEngineBase.t.sol # abstract shared suite (DebtEngineBaseTest), incl. CMTATStandaloneDebt integration +├── DebtEngineAccessControl.t.sol # role-specific tests for the RBAC variant +├── DebtEngineOwnable.t.sol # owner-specific tests for the Ownable variant (incl. ERC-165 / ERC-173) +├── DebtEngineHarness.t.sol # test-only engine: proves public functions stay `virtual`, covers the base `_msgSender()` +├── DebtEngineThreatModel.t.sol # security-analysis tests: PoCs for AUDIT/RESULT.md findings, fuzzed access-control and set/clear model +├── DeployGuideCMTATv3.0.0.t.sol # runs every step of doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md against CMTAT v3.0.0 +└── script/DeployScripts.t.sol # tests for the deployment scripts +script/ +├── DeployDebtEngine.s.sol # deploy either variant (env: ENGINE_VARIANT, ENGINE_ADMIN, FORWARDER, DEBT_MANAGER, CREDIT_EVENTS_MANAGER) +└── ConnectDebtEngine.s.sol # token side: setDebtEngine (env: TOKEN, DEBT_ENGINE, ALLOW_EMPTY_RECORD); refuses an empty record +``` + +## Other important files + +- `CHANGELOG.md` — release notes, change-type tags and the pre-release checklist. +- `README.md` — data structures, interface, schemas, toolchain commands. +- `foundry.toml` — solc `0.8.33`, optimizer 200 runs, `evm_version = prague`. +- `hardhat.config.js` — Hardhat 2 compilation of `src/` only, same compiler settings as `foundry.toml` (keep them in sync), imports via the Foundry remappings (`@nomicfoundation/hardhat-foundry`); output in `artifacts/` and `cache_hardhat/` (git-ignored). +- `remappings.txt` — `CMTAT/` → `lib/CMTAT/contracts/`, `OZ/` → `lib/openzeppelin-contracts/contracts/`, `@openzeppelin/contracts-upgradeable/`. +- `doc/coverage/` — lcov + HTML coverage report. +- `doc/compilation/v/` — per-release Hardhat and Foundry artifacts and flattened sources of the two deployable contracts (see its README; added for releases, not release candidates). +- `doc/technical/guides/` — deployment guides (`DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md`); each step is run by a test, keep the two in sync. +- `doc/tools/AUDIT_OVERVIEW.md` — index of every analysis (static analysis, AI reviews, coverage) with their results. +- `doc/tools//` — tool reports per release: `slither-report.md` / `aderyn-report.md` with their `*-feedback.md` triage, the AI-assisted code-quality review `CLAUDE_ANALYSIS.md` and the published security audit `CLAUDE_AUDIT.md` (currently `doc/tools/v0.3.0/`). +- `doc/script/` — Surya scripts; output in `doc/surya/` (graph, inheritance, report). +- `AUDIT/` — working deliverables of the v0.3.0 security analysis (published version: `doc/tools/v0.3.0/CLAUDE_AUDIT.md`): `THREAT_MODEL.md` (actors, threat IDs, invariants), `TEST_IMPROVEMENT.md`, `RESULT.md` (findings with PoCs and fix code). +- `lib/` — git submodules (do not edit). +- `draft/` — local, git-ignored folder for working notes and scratch files (e.g. `FEEDBACK.md`, `INSTRUCTION.md`). Put drafts there, never at the root; never cite a `draft/` file from a committed file (code, docs, changelog), since readers of the repository cannot open it. + +## Dependencies (tested versions) + +- Foundry, solc `0.8.33` (sources use `pragma ^0.8.27`, the minimum for `require(bool, CustomError())` on the legacy pipeline) +- OpenZeppelin Contracts — submodule `lib/openzeppelin-contracts` (v5.x, commit `fcbae539`) +- OpenZeppelin Contracts Upgradeable — submodule v5.5.0 (tests, via CMTAT) +- CMTAT — submodule `lib/CMTAT` at tag `v3.0.0` (provides `IDebtEngine`, `ICMTATDebt`, and `CMTATStandaloneDebt` for tests) +- forge-std v1.13.0 +- npm dev deps: `hardhat` 2.29, `@nomicfoundation/hardhat-foundry` 1.2, `surya`, `prettier-plugin-solidity` + +## Common commands + +```bash +forge build +forge test +forge fmt # formatter (forge fmt --check in CI-style checks) +forge coverage --report lcov --report-file doc/coverage/lcov.info --no-match-coverage "test/|script/" && genhtml doc/coverage/lcov.info --branch-coverage --output-dir doc/coverage/coverage +forge test --gas-report +npm run compile:hardhat # Hardhat compilation of src/ (needs forge for the remappings) +forge script script/DeployDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast # omit --broadcast to simulate +forge script script/ConnectDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast +slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-std|script" > doc/tools/v0.3.0/slither-report.md # runs forge clean +aderyn -x mocks --output doc/tools/v0.3.0/aderyn-report.md +bash doc/script/script_surya_graph.sh && bash doc/script/script_surya_inheritance.sh && bash doc/script/script_surya_report.sh +``` + +## Conventions + +- **Versioning:** bump the private `VERSION` constant in `src/modules/VersionModule.sol`, the `testVersion` assertion in `test/DebtEngineBase.t.sol` and the README compatibility table; follow the checklist in `CHANGELOG.md`. +- **Changelog tags:** keepachangelog types plus `breaking change` (storage / external engine interface), `Dependencies`, `Documentation`, `Testing`. +- **Authorization hooks:** declared `internal view virtual` with no body in `DebtEngineBase`; every override keeps `internal view virtual override`, has an empty body and enforces the policy through the modifier (`onlyRole(ROLE)` / `onlyOwner`), never a bare `_checkRole` / `_checkOwner` call. Role constants live in the contract that enforces them (`DebtEngineAccessControl`), never in shared storage. The README access-control table (capability → role per variant) must be updated with any new hook. +- **New authorization policy:** add a deployment contract under `src/deployment/` that implements both `_authorize*` hooks and the `_msgSender` / `_msgData` / `_contextSuffixLength` overrides; add a test contract that extends `DebtEngineBaseTest`. +- **Security notes (see `doc/tools/v0.3.0/CLAUDE_AUDIT.md`):** an account holding `DEFAULT_ADMIN_ROLE` passes every role check, so granting it a manager role is a silent no-op and revoking one emits `RoleRevoked` without effect (F-1) — when handing admin over, renounce first and let the new admin grant manager roles; the trusted forwarder is trusted for every function, role management included (F-2). +- **Must not break:** the `IDebtEngine` interface (CMTAT calls it), zero-address checks, `MAX_BATCH_SIZE` and length checks on batches, event emission on every write. +- **Style:** NatSpec with `/** */`, section banners as in existing files; function attribute order visibility, mutability, `virtual`, `override`, modifiers (e.g. `internal view virtual override onlyOwner`); every public, external and overriding internal function is `virtual`; guards use `require(condition, CustomError(...))` (keep `if`/`revert` only where building the error arguments would cost an external call or storage read, with a comment saying so); every `if`/`for` body in braces; run `forge fmt` before committing. +- License: MPL-2.0 SPDX header on every source file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a037f33..25270e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,10 @@ # Contributing Guidelines -There are many ways to contribute to CMTAT Contracts. +There are many ways to contribute to DebtEngine Contracts. ## Opening an issue -You can [open an issue] to suggest a feature, a difficulty you have or report a minor bug. For serious bugs in an audited version please do not open an issue, instead refer to our [security policy] for appropriate steps. See [SECURITY.md](./SECURITY.MD). +You can [open an issue] to suggest a feature, a difficulty you have or report a minor bug. For serious bugs in an audited version please do not open an issue, instead refer to our [security policy] for appropriate steps. See [SECURITY.md](https://github.com/CMTA/CMTAT/blob/master/SECURITY.md) in CMTAT project. Before opening an issue, be sure to search through the existing open and closed issues, and consider posting a comment in one of those instead. diff --git a/README.md b/README.md index 13e5627..567fc77 100644 --- a/README.md +++ b/README.md @@ -2,214 +2,387 @@ > This project has not been audited yet, please use at your own risk. For any questions, please contact [admin@cmta.ch](mailto:admin@cmta.ch). -This repository includes the DebtEngine contract for the [CMTAT](https://github.com/CMTA/CMTAT) token. +DebtEngine is an external engine for [CMTAT](https://github.com/CMTA/CMTAT) debt tokens. It stores, for each token, the **debt information** of the instrument (issuer, guarantor, interest rate, par value, maturity, coupon frequency, day-count convention, currency, …) and its **credit events** (default, redemption, rating), and serves them to the token. -The *debtEngine* allows to define `debt` and `credit events` for several different contracts. +- **One engine, many tokens.** A single deployment holds a record per token address, so an issuer or a servicing agent maintains the data of every bond in one place. +- **Plugged into CMTAT.** A CMTAT debt token (`CMTATStandaloneDebt` or `CMTATUpgradeableDebt`) is connected with `setDebtEngine(engine)`; from then on its `debt()` and `creditEvents()` return the engine's record for that token. Holders and integrators keep calling the token. +- **Data, not compliance.** The engine never touches transfers, balances or funds; it only stores and returns information. +- **Two access-control versions, chosen at deployment.** `DebtEngineAccessControl` separates duties with a debt-manager and a credit-events-manager role (OpenZeppelin `AccessControlEnumerable`); `DebtEngineOwnable` gives one owner, typically a multisig, control of everything (`Ownable2Step`). Both support gasless transactions through an optional ERC-2771 forwarder. -A `debt` is defined with the following attributes +Version **0.3.0** is built and tested for CMTAT **v3.0.0** (see [Compatibility](#compatibility)). + +Start here: + +- [Deployment guide](./doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md): deploy the engine, connect a token and operate it, every step backed by a test. +- [Deployment scripts](#deployment): Foundry scripts for the engine and for connecting a token. +- [Audit and analysis overview](./doc/tools/AUDIT_OVERVIEW.md): static analysis, AI-assisted reviews and coverage. +- [CHANGELOG](./CHANGELOG.md): what changed in each release. + +## Data Structures + +A `debt` is represented as a `DebtInformation` struct composed of two parts: + +```solidity +struct DebtInformation { + DebtIdentifier debtIdentifier; + DebtInstrument debtInstrument; +} +``` + +**DebtIdentifier** — information on the issuer and other persons involved: + +```solidity +struct DebtIdentifier { + string issuerName; + string issuerDescription; + string guarantor; + string debtHolder; +} +``` + +**DebtInstrument** — information on the instrument: ```solidity -struct DebtBase { - uint256 interestRate; - uint256 parValue; - string guarantor; - string bondHolder; - string maturityDate; - string interestScheduleFormat; - string interestPaymentDate; - string dayCountConvention; - string businessDayConvention; - string publicHolidaysCalendar; - string issuanceDate; - string couponFrequency; +struct DebtInstrument { + uint256 interestRate; + uint256 parValue; + uint256 minimumDenomination; + string issuanceDate; + string maturityDate; + string couponPaymentFrequency; + string interestScheduleFormat; + string interestPaymentDate; + string dayCountConvention; + string businessDayConvention; + string currency; + address currencyContract; } ``` -A `creditEvents`is defined with the following attributes +A `creditEvents` is defined with the following attributes: ```solidity struct CreditEvents { - bool flagDefault; - bool flagRedeemed; - string rating; + bool flagDefault; + bool flagRedeemed; + string rating; } ``` -## How to include it +## Architecture -While it has been designed for the CMTAT, the debtEngine can be used with others contracts to define debt and credit events. +The DebtEngine uses a layered architecture: -For that, the only thing to do is to import in your contract the interface `IDebtEngine` which declares the two functions `debt` and `creditEvents`. +- **`DebtEngineBase`** (abstract) — contains all business logic, mappings, events, and authorization hooks. Does not depend on any specific access control mechanism or meta-transaction standard. +- **Deployment contracts** — concrete contracts that wire in access control and ERC-2771 support: + - **`DebtEngineAccessControl`** — uses OpenZeppelin `AccessControlEnumerable` (RBAC, role holders listable on-chain) with granular `DEBT_MANAGER_ROLE` and `CREDIT_EVENTS_MANAGER_ROLE`. + - **`DebtEngineOwnable`** — uses OpenZeppelin `Ownable2Step` (single owner controls everything; two-step ownership transfer). -This interface can be found in [CMTAT/contracts/interfaces/engine/IDebtEngine.sol](https://github.com/CMTA/CMTAT/blob/master/contracts/interfaces/engine/IDebtEngine.sol) +## Functions + +| Function | Visibility | Access | Description | +| --- | --- | --- | --- | +| `debt()` | External | Public | Returns debt for the caller's contract | +| `debt(address)` | Public | Public | Returns debt for a specific contract | +| `creditEvents()` | External | Public | Returns credit events for the caller's contract | +| `creditEvents(address)` | Public | Public | Returns credit events for a specific contract | +| `hasDebt(address)` | External | Public | Returns true if a debt record is currently set (false again after `clearDebt`) | +| `hasCreditEvents(address)` | External | Public | Returns true if credit events are currently set (false again after `clearCreditEvents`) | +| `setDebt(address, DebtInformation)` | External | Authorized | Set debt for a contract | +| `setCreditEvents(address, CreditEvents)` | External | Authorized | Set credit events for a contract | +| `setDebtBatch(address[], DebtInformation[])` | External | Authorized | Set debt for multiple contracts (at most `MAX_BATCH_SIZE`) | +| `setCreditEventsBatch(address[], CreditEvents[])` | External | Authorized | Set credit events for multiple contracts (at most `MAX_BATCH_SIZE`) | +| `clearDebt(address)` | External | Authorized | Delete the debt record of a contract; `hasDebt` returns false and `debt` returns the zero struct | +| `clearCreditEvents(address)` | External | Authorized | Delete the credit events of a contract; `hasCreditEvents` returns false and `creditEvents` returns the zero struct | +| `MAX_BATCH_SIZE()` | Public | Public | Hard ceiling on batch entries (500) | +| `version()` | Public | Public | Contract version (`"0.3.0"`) | +| `supportsInterface(bytes4)` | Public | Public | ERC-165: `IAccessControlEnumerable` / `IAccessControl` (RBAC variant), ERC-173 (Ownable variant), ERC-165 | + +All public and external functions are `virtual`. Every write goes through one internal function per record type (`_setDebt`, `_setCreditEvents`), which rejects `address(0)`, stores the record, sets the `has*` flag and emits the event. Every delete goes through `_clearDebt` / `_clearCreditEvents`, which rejects `address(0)`, removes the record and its `has*` flag and emits the `*Cleared` event; clearing a contract that has no record succeeds and still emits the event. A CMTAT token pointing at the engine reads an empty record after a clear, the same as before its record was set. + +> **Batch size in practice:** `MAX_BATCH_SIZE` is a ceiling, not a target. Each entry writes its whole struct to storage. In the test suite a debt record with typical strings costs about 400k gas and a short credit-events record about 71k, so under the Ethereum mainnet per-transaction cap of 16,777,216 gas (EIP-7825) a batch holds roughly 40 debt records or 230 credit-events records. Estimate gas for your actual data before sending a batch. + +## Events + +| Event | Emitted when | +| --- | --- | +| `DebtSet(address indexed smartContract)` | Debt is set or updated for a contract | +| `CreditEventsSet(address indexed smartContract)` | Credit events are set or updated for a contract | +| `DebtCleared(address indexed smartContract)` | The debt record of a contract is deleted | +| `CreditEventsCleared(address indexed smartContract)` | The credit events of a contract are deleted | + +## Access Control + +Authorization is pluggable via two `internal view virtual` hooks (`_authorizeSetDebt` and `_authorizeSetCreditEvents`) declared without a body in `DebtEngineBase`: the base decides **what** is protected, each deployment contract decides **who** may do it. Each override has an empty body and carries the check in its modifier (`onlyRole(...)` or `onlyOwner`), which resolves the caller through `_msgSender()` (ERC-2771 aware). + +| Capability | Functions | Hook | `DebtEngineAccessControl` | `DebtEngineOwnable` | +| --- | --- | --- | --- | --- | +| Debt management | `setDebt`, `setDebtBatch`, `clearDebt` | `_authorizeSetDebt` | `DEBT_MANAGER_ROLE` (or `DEFAULT_ADMIN_ROLE`) | owner | +| Credit-events management | `setCreditEvents`, `setCreditEventsBatch`, `clearCreditEvents` | `_authorizeSetCreditEvents` | `CREDIT_EVENTS_MANAGER_ROLE` (or `DEFAULT_ADMIN_ROLE`) | owner | + +The variant is chosen at deployment: the two contracts are not interchangeable at a deployed address, and the policy cannot be swapped afterwards. The pattern makes access control pluggable, not more decentralised: a single admin or owner key can still rewrite every debt and credit-event record. + +### DebtEngineAccessControl (RBAC) + +| Role | Permissions | +| --- | --- | +| `DEFAULT_ADMIN_ROLE` | Implicitly holds all roles. Can grant/revoke roles. | +| `DEBT_MANAGER_ROLE` | Can call `setDebt`, `setDebtBatch` and `clearDebt` | +| `CREDIT_EVENTS_MANAGER_ROLE` | Can call `setCreditEvents`, `setCreditEventsBatch` and `clearCreditEvents` | + +> **Note:** The `DEFAULT_ADMIN_ROLE` is a super-admin. Any account holding this role is treated as holding every role implicitly. This implicit membership is not recorded: `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` (from `AccessControlEnumerable`) do not list the admin under `DEBT_MANAGER_ROLE` or `CREDIT_EVENTS_MANAGER_ROLE`, and no `RoleGranted` event is emitted for it, so tools listing role holders will not show the admin. Role separation therefore constrains operators, never the admin. +> +> Granting or revoking a manager role on an account that holds `DEFAULT_ADMIN_ROLE` has no effect: the grant is not recorded, and a revocation (or `renounceRole`) emits `RoleRevoked` while the account keeps the power. When handing admin over, renounce `DEFAULT_ADMIN_ROLE` first and have the new admin grant the manager role afterwards. +> +> If the last `DEFAULT_ADMIN_ROLE` holder renounces, roles can no longer be granted or revoked, and only existing managers can still write records. +> +> **Admin handover** is a plain role change, with no delay and no acceptance step: (1) the current admin calls `grantRole(DEFAULT_ADMIN_ROLE, newAdmin)`; (2) check that `newAdmin` is correct and controlled, e.g. by having it perform an admin action; (3) only then does the old admin call `renounceRole(DEFAULT_ADMIN_ROLE, oldAdmin)`. Doing step 3 before step 1, or granting to a mistyped address and then renouncing, leaves the contract without an admin. If the old admin should stay a manager, the new admin grants it the manager role after step 3 (a grant made before would be lost). Full runbook: [deployment guide, section 8](./doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md). + +### DebtEngineOwnable (Single Owner) + +The owner can call all restricted functions. Ownership transfer is two-step (`Ownable2Step`): `transferOwnership` only records a `pendingOwner`, and control moves when that address calls `acceptOwnership`, so a mistyped address cannot take over the contract. Ownership can also be permanently renounced via `renounceOwnership`. Deviation from ERC-173 (inherited from OpenZeppelin): `transferOwnership(address(0))` does not renounce ownership, it only cancels a pending transfer; use `renounceOwnership` to renounce. Renouncing freezes every debt and credit-events record permanently. + +Every hook collapses to `onlyOwner`, so this variant cannot separate duties (e.g. let one operator manage debt but not credit events); use `DebtEngineAccessControl` when that is required. + +## Compatibility + +| DebtEngine | On-chain version (getter) | CMTAT | Tested against (submodules) | OpenZeppelin | +| --- | --- | --- | --- | --- | +| **v0.3.0** (current, unaudited) | `"0.3.0"` (`version()`) | v3.0.0 | CMTAT v3.0.0 (audited) | v5.5.0 | +| **v0.2.0** (unaudited) | `"0.2.0"` (`VERSION()`) | v2.5 | CMTAT v2.5.0-rc0 | v5.0.2 | +| **v0.1.0** (unaudited) | `"0.1.0"` (`VERSION()`) | v2.5 | CMTAT v2.5.0-rc0 | v5.0.2 | + +- **Use DebtEngine v0.3.0 for a CMTAT v3.0.0 token.** v0.1.0 and v0.2.0 are only for CMTAT v2.5. +- **v0.3.0 and CMTAT v2.x are not compatible**, in either direction. CMTAT v3 rewrote the engine interface: v2.5's `IDebtEngine` returns `IDebtGlobal.DebtBase`, while v3's extends `ICMTATDebt` / `ICMTATCreditEvents` and returns `DebtInformation`, which has different structs and fields. +- **Which CMTAT tokens can use it:** only deployments that include CMTAT's `DebtEngineModule` (e.g. `CMTATStandaloneDebt` / `CMTATUpgradeableDebt`) can be pointed at a DebtEngine. +- **One engine serves many tokens.** The token calls `debt()` / `creditEvents()` on the engine, and the engine answers with the record stored under the calling token's address. +- **The v0.3.0 test suite deploys a real `CMTATStandaloneDebt` from the pinned CMTAT v3.0.0 submodule** and checks that the token returns the debt and credit events stored in the engine. +- **Other CMTAT v3 releases are not supported by v0.3.0:** only CMTAT v3.0.0 is tested. Before using a later CMTAT release, pin the `lib/CMTAT` submodule to it and run the full test suite (including `test/DeployGuideCMTATv3.0.0.t.sol`, which deploys real CMTAT debt tokens). + +Step-by-step deployment with a CMTAT v3.0.0 debt token (standalone or upgradeable), validated by `test/DeployGuideCMTATv3.0.0.t.sol`: [doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md](./doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md). + +## How to include it + +While it has been designed for the CMTAT, the DebtEngine can be used with other contracts to define debt and credit events. + +Import the `IDebtEngine` interface which declares the `debt` and `creditEvents` functions: ```solidity -interface IDebtEngine is IDebtGlobal { - function debt() external view returns(IDebtGlobal.DebtBase memory); - function creditEvents() external view returns(IDebtGlobal.CreditEvents memory); +interface IDebtEngine is ICMTATDebt, ICMTATCreditEvents { + // Inherits debt() and creditEvents() from parent interfaces } ``` +This interface can be found in [CMTAT/contracts/interfaces/engine/IDebtEngine.sol](https://github.com/CMTA/CMTAT/blob/master/contracts/interfaces/engine/IDebtEngine.sol) + ## Schema ### Inheritance -![surya_inheritance_DebtEngine.sol](./doc/surya/surya_inheritance/surya_inheritance_DebtEngine.sol.png) +#### DebtEngineAccessControl + +![surya_inheritance_DebtEngineAccessControl.sol](./doc/surya/surya_inheritance/surya_inheritance_DebtEngineAccessControl.sol.png) + +#### DebtEngineOwnable + +![surya_inheritance_DebtEngineOwnable.sol](./doc/surya/surya_inheritance/surya_inheritance_DebtEngineOwnable.sol.png) ### Graph -![surya_graph_DebtEngine.sol](./doc/surya/surya_graph/surya_graph_DebtEngine.sol.png) +#### DebtEngineAccessControl + +![surya_graph_DebtEngineAccessControl.sol](./doc/surya/surya_graph/surya_graph_DebtEngineAccessControl.sol.png) + +#### DebtEngineOwnable + +![surya_graph_DebtEngineOwnable.sol](./doc/surya/surya_graph/surya_graph_DebtEngineOwnable.sol.png) ## Surya Description Report ### Contracts Description Table -| Contract | Type | Bases | | | -| :------------: | :------------------: | :----------------------------------------------------: | :------------: | :-----------: | -| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | -| | | | | | -| **DebtEngine** | Implementation | IDebtEngine, AccessControl, DebtEngineInvariantStorage | | | -| └ | | Public ❗️ | 🛑 | NO❗️ | -| └ | debt | External ❗️ | | NO❗️ | -| └ | debt | Public ❗️ | | NO❗️ | -| └ | creditEvents | External ❗️ | | NO❗️ | -| └ | creditEvents | Public ❗️ | | NO❗️ | -| └ | setDebt | External ❗️ | 🛑 | onlyRole | -| └ | setCreditEvents | External ❗️ | 🛑 | onlyRole | -| └ | setCreditEventsBatch | External ❗️ | 🛑 | onlyRole | -| └ | setDebtsBatch | External ❗️ | 🛑 | onlyRole | -| └ | hasRole | Public ❗️ | | NO❗️ | +#### DebtEngineBase + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **DebtEngineBase** | Implementation | IDebtEngine, DebtEngineInvariantStorage, VersionModule ||| +| └ | debt | External ❗️ | |NO❗️ | +| └ | debt | Public ❗️ | |NO❗️ | +| └ | creditEvents | External ❗️ | |NO❗️ | +| └ | creditEvents | Public ❗️ | |NO❗️ | +| └ | hasDebt | External ❗️ | |NO❗️ | +| └ | hasCreditEvents | External ❗️ | |NO❗️ | +| └ | setDebt | External ❗️ | 🛑 | onlyDebtManager | +| └ | setCreditEvents | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | setCreditEventsBatch | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | setDebtBatch | External ❗️ | 🛑 | onlyDebtManager | +| └ | clearDebt | External ❗️ | 🛑 | onlyDebtManager | +| └ | clearCreditEvents | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | _setDebt | Internal 🔒 | 🛑 | | +| └ | _setCreditEvents | Internal 🔒 | 🛑 | | +| └ | _clearDebt | Internal 🔒 | 🛑 | | +| └ | _clearCreditEvents | Internal 🔒 | 🛑 | | +| └ | _authorizeSetDebt | Internal 🔒 | | | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | | +| └ | _msgSender | Internal 🔒 | | | + +#### VersionModule + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **VersionModule** | Implementation | ||| +| └ | version | Public ❗️ | |NO❗️ | + +#### DebtEngineAccessControl + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **DebtEngineAccessControl** | Implementation | DebtEngineBase, AccessControlEnumerable, ERC2771Context ||| +| └ | | Public ❗️ | 🛑 | ERC2771Context | +| └ | _authorizeSetDebt | Internal 🔒 | | onlyRole | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | onlyRole | +| └ | hasRole | Public ❗️ | |NO❗️ | +| └ | _msgSender | Internal 🔒 | | | +| └ | _msgData | Internal 🔒 | | | +| └ | _contextSuffixLength | Internal 🔒 | | | + +#### DebtEngineOwnable + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **DebtEngineOwnable** | Implementation | DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 ||| +| └ | | Public ❗️ | 🛑 | ERC2771Context Ownable | +| └ | supportsInterface | Public ❗️ | |NO❗️ | +| └ | _authorizeSetDebt | Internal 🔒 | | onlyOwner | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | onlyOwner | +| └ | _msgSender | Internal 🔒 | | | +| └ | _msgData | Internal 🔒 | | | +| └ | _contextSuffixLength | Internal 🔒 | | | ### Legend -| Symbol | Meaning | -| :----: | ------------------------- | -| 🛑 | Function can modify state | -| 💵 | Function is payable | - +| Symbol | Meaning | +|:--------:|-----------| +| 🛑 | Function can modify state | +| 💵 | Function is payable | +Full reports: [./doc/surya/surya_report](./doc/surya/surya_report) ## Gasless support (ERC-2771) -The DebtEngine supports client-side gasless transactions using the [Gas Station Network](https://docs.opengsn.org/#the-problem) (GSN) pattern, the main open standard for transfering fee payment to another account than that of the transaction issuer. The contract uses the OpenZeppelin contract `ERC2771ContextUpgradeable`, which allows a contract to get the original client with `_msgSender()` instead of the fee payer given by `msg.sender` while allowing upgrades on the main contract (see *Deployment via a proxy* above). +The deployment contracts (`DebtEngineAccessControl` and `DebtEngineOwnable`) support client-side gasless transactions using the [Gas Station Network](https://docs.opengsn.org/#the-problem) (GSN) pattern, the main open standard for transferring fee payment to another account than that of the transaction issuer. The contracts use the OpenZeppelin `ERC2771Context` contract, which allows a contract to get the original client with `_msgSender()` instead of the fee payer given by `msg.sender`. -At deployment, the parameter `forwarder` inside the constructor has to be set with the defined address of the forwarder. Please note that the forwarder can not be changed after deployment. +The abstract base (`DebtEngineBase`) does not depend on `ERC2771Context` directly — it defines a virtual `_msgSender()` that returns `msg.sender` by default. The deployment contracts override this with `ERC2771Context._msgSender()`. -Please see the OpenGSN [documentation](https://docs.opengsn.org/contracts/#receiving-a-relayed-call) for more details on what is done to support GSN in the contract. +At deployment, the parameter `forwarder` inside the constructor has to be set with the address of the forwarder. +> **Important:** The trusted forwarder address is **immutable** — it is set once at construction time and cannot be changed afterward. If the forwarder contract is compromised or needs to be rotated, a new DebtEngine must be deployed. The forwarder is trusted for every function, including `grantRole`, `revokeRole`, `renounceRole` and ownership transfer: use a forwarder that verifies EIP-712 signatures (e.g. OpenZeppelin `ERC2771Forwarder`). Set the forwarder to `address(0)` to disable meta-transaction support entirely. +Please see the OpenGSN [documentation](https://docs.opengsn.org/contracts/#receiving-a-relayed-call) for more details on what is done to support GSN in the contract. ## Dependencies The toolchain includes the following components, where the versions are the latest ones that we tested: - Foundry -- Solidity 0.8.26 (via solc-js) -- OpenZeppelin Contracts (submodule) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.2) +- Solidity 0.8.27+ (sources use `require(condition, CustomError())`; tested with solc 0.8.33) +- OpenZeppelin Contracts (submodule) v5.x - Tests - - [CMTAT v2.5.0-rc0](https://github.com/CMTA/CMTAT/releases/tag/v2.5.0-rc0) - - OpenZeppelin Contracts Upgradeable(submodule) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/releases/tag/v5.0.2) + - [CMTAT v3.0.0](https://github.com/CMTA/CMTAT) + - OpenZeppelin Contracts Upgradeable (submodule) v5.x -The CMTAT contracts and the OpenZeppelin library are included as a submodule of the present repository. +The CMTAT contracts and the OpenZeppelin library are included as submodules of the present repository. ## Tools -### Prettier +### Format ```bash -npx prettier --write --plugin=prettier-plugin-solidity 'src/**/*.sol' +forge fmt ``` -### Slither - -```bash -slither . --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-std" > slither-report.md -``` - -### Surya - -See [./doc/script](./doc/script) - -### Foundry - -Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust. - -Foundry consists of: +### Static analysis -- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). -- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. -- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. -- **Chisel**: Fast, utilitarian, and verbose solidity REPL. +Reports and their triage are listed in [doc/tools/AUDIT_OVERVIEW.md](./doc/tools/AUDIT_OVERVIEW.md). -#### Documentation +| Version | Slither | Aderyn | +|---|---|---| +| v0.3.0 | [report](./doc/tools/v0.3.0/slither-report.md) · [feedback](./doc/tools/v0.3.0/slither-report-feedback.md) — 0 High / 0 Medium / 0 Low / 2 Info, nothing to fix | [report](./doc/tools/v0.3.0/aderyn-report.md) · [feedback](./doc/tools/v0.3.0/aderyn-report-feedback.md) — 0 High / 7 Low, nothing to fix | -[https://book.getfoundry.sh/](https://book.getfoundry.sh/) - -#### Usage - -##### Coverage +#### Slither ```bash -$ forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage +slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-std|script" > doc/tools/v0.3.0/slither-report.md ``` -##### Gas report +`--compile-force-framework foundry` is needed because the repository also has a `hardhat.config.js`. Slither runs `forge clean` before compiling. If the local `slither` cannot start (e.g. a user install for an older Python), `uvx --from slither-analyzer slither ...` runs it in an isolated environment. + +#### Aderyn ```bash -$ forge test --gas-report +aderyn -x mocks --output doc/tools/v0.3.0/aderyn-report.md ``` -##### Build +### Surya -```shell -$ forge build -``` +Run the 3 scripts in [./doc/script](./doc/script); the output is written to [./doc/surya](./doc/surya). -##### Test +### Hardhat -```shell -$ forge test +`hardhat.config.js` compiles `src/` with Hardhat 2 and the same settings as `foundry.toml` (solc 0.8.33, optimizer 200 runs, `prague`). Imports are resolved from the Foundry remappings by `@nomicfoundation/hardhat-foundry`, so `forge` must be installed. Tests and scripts stay in Foundry. + +```bash +npm install +npm run compile:hardhat # artifacts in artifacts/, cache in cache_hardhat/ ``` -##### Format +The runtime bytecode is identical to Foundry's except for the trailing metadata hash. -```shell -$ forge fmt -``` +### Deployment -##### Gas Snapshots +Two Foundry scripts, configured with environment variables (see the [deployment guide](./doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md#deployment-scripts)): -```shell -$ forge snapshot +```bash +# Deploy the engine (ENGINE_VARIANT=access-control|ownable, ENGINE_ADMIN, FORWARDER, DEBT_MANAGER, CREDIT_EVENTS_MANAGER) +forge script script/DeployDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast +# Connect a CMTAT v3.0.0 debt token (TOKEN, DEBT_ENGINE); refuses if the engine has no record for the token +forge script script/ConnectDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast ``` -##### Anvil +### Foundry + +#### Build ```shell -$ anvil +forge build ``` -##### Deploy +#### Test ```shell -$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key +forge test ``` -##### Cast +#### Coverage -```shell -$ cast +```bash +forge coverage --report lcov --report-file doc/coverage/lcov.info --no-match-coverage "test/|script/" && genhtml doc/coverage/lcov.info --branch-coverage --output-dir doc/coverage/coverage ``` -##### Help +#### Gas report -```shell -$ forge --help -$ anvil --help -$ cast --help +```bash +forge test --gas-report ``` ## Intellectual property -The code is copyright (c) Capital Market and Technology Association, 2018-2024, and is released under [Mozilla Public License 2.0](https://github.com/CMTA/CMTAT/blob/master/LICENSE.md). - +The code is copyright (c) Capital Market and Technology Association, 2018-2026, and is released under [Mozilla Public License 2.0](https://github.com/CMTA/CMTAT/blob/master/LICENSE.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..d932a2d --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,6 @@ +# Security Policy + +## Reporting a Vulnerability + +To report a security vulnerability in this project, please see instruction in [CMTA/CMTAT/SECURITY.md](https://github.com/CMTA/CMTAT/blob/master/SECURITY.md) + diff --git a/doc/compilation/README.md b/doc/compilation/README.md new file mode 100644 index 0000000..eaa65bc --- /dev/null +++ b/doc/compilation/README.md @@ -0,0 +1,48 @@ +# Compilation files + +Compiled artifacts of the two deployable contracts, `DebtEngineAccessControl` and `DebtEngineOwnable`, kept for each release so that a deployment can be reproduced or verified without rebuilding. Added for every release, not for release candidates. + +## Layout + +``` +doc/compilation/ +└── v/ + ├── hardhat/deployment/.sol/.json # Hardhat artifact (ABI, bytecode, deployedBytecode, link references) + ├── hardhat/deployment/.sol/.dbg.json # Hardhat debug pointer (the build-info file it names is not kept) + ├── foundry/deployment/.sol/.json # Foundry artifact (ABI, bytecode, method identifiers, solc metadata) + └── flatten/Flatten.sol # single-file source from `forge flatten`, for explorer verification +``` + +The layout follows CMTAT's `doc/hardhat-compilation/v/` (artifacts under `deployment/`, flattened sources under `flatten/`), with a Foundry folder added next to the Hardhat one. + +## v0.3.0 + +| | | +|---|---| +| Sources | `src/` of v0.3.0, including the F-4 fix (zero-address check in `_clearDebt` / `_clearCreditEvents`) | +| Compiler | solc 0.8.33, optimizer enabled, 200 runs, `evm_version = prague`, legacy pipeline (no `via_ir`) — identical in `foundry.toml` and `hardhat.config.js` | +| Tools | Foundry 1.5.0 (`forge build --force`), Hardhat 2.29.2 (`npx hardhat compile --force`) | +| Dependencies | CMTAT v3.0.0, OpenZeppelin Contracts v5.5.0 | + +| Contract | Runtime size | Hardhat = Foundry | Flattened = Foundry | +|---|---|---|---| +| `DebtEngineAccessControl` | 9,268 bytes | ✅ | ✅ | +| `DebtEngineOwnable` | 7,772 bytes | ✅ | ✅ | + +"=" means identical runtime bytecode once the trailing CBOR metadata is removed. The metadata hash differs between the three because it encodes the source paths, which are not the same in a Hardhat build, a Foundry build and a flattened file. + +## Regenerating + +```bash +V=v0.3.0 # the release version +npx hardhat compile --force +forge build --force +for c in DebtEngineAccessControl DebtEngineOwnable; do + mkdir -p doc/compilation/$V/hardhat/deployment/$c.sol doc/compilation/$V/foundry/deployment/$c.sol doc/compilation/$V/flatten + cp artifacts/src/deployment/$c.sol/$c.json artifacts/src/deployment/$c.sol/$c.dbg.json doc/compilation/$V/hardhat/deployment/$c.sol/ + cp out/$c.sol/$c.json doc/compilation/$V/foundry/deployment/$c.sol/ + forge flatten src/deployment/$c.sol -o doc/compilation/$V/flatten/${c}Flatten.sol +done +``` + +Then check the sizes against `forge build --sizes` and that the Hardhat and Foundry runtime bytecode match without metadata. diff --git a/doc/compilation/v0.3.0/flatten/DebtEngineAccessControlFlatten.sol b/doc/compilation/v0.3.0/flatten/DebtEngineAccessControlFlatten.sol new file mode 100644 index 0000000..a820031 --- /dev/null +++ b/doc/compilation/v0.3.0/flatten/DebtEngineAccessControlFlatten.sol @@ -0,0 +1,4949 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity >=0.4.16 >=0.8.4 ^0.8.20 ^0.8.24 ^0.8.27; + +// lib/openzeppelin-contracts/contracts/utils/Comparators.sol + +// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol) + +/** + * @dev Provides a set of functions to compare values. + * + * _Available since v5.1._ + */ +library Comparators { + function lt(uint256 a, uint256 b) internal pure returns (bool) { + return a < b; + } + + function gt(uint256 a, uint256 b) internal pure returns (bool) { + return a > b; + } +} + +// lib/openzeppelin-contracts/contracts/utils/Context.sol + +// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) + +/** + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract Context { + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes calldata) { + return msg.data; + } + + function _contextSuffixLength() internal view virtual returns (uint256) { + return 0; + } +} + +// src/DebtEngineInvariantStorage.sol + +abstract contract DebtEngineInvariantStorage { + error AdminWithAddressZeroNotAllowed(); + error BatchSizeTooLarge(uint256 size, uint256 maxSize); + error InvalidInputLength(); + error SmartContractWithAddressZeroNotAllowed(); +} + +// lib/openzeppelin-contracts/contracts/access/IAccessControl.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol) + +/** + * @dev External interface of AccessControl declared to support ERC-165 detection. + */ +interface IAccessControl { + /** + * @dev The `account` is missing a role. + */ + error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); + + /** + * @dev The caller of a function is not the expected one. + * + * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. + */ + error AccessControlBadConfirmation(); + + /** + * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` + * + * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite + * {RoleAdminChanged} not being emitted to signal this. + */ + event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); + + /** + * @dev Emitted when `account` is granted `role`. + * + * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role). + * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}. + */ + event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); + + /** + * @dev Emitted when `account` is revoked `role`. + * + * `sender` is the account that originated the contract call: + * - if using `revokeRole`, it is the admin role bearer + * - if using `renounceRole`, it is the role bearer (i.e. `account`) + */ + event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); + + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) external view returns (bool); + + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {AccessControl-_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) external view returns (bytes32); + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function grantRole(bytes32 role, address account) external; + + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function revokeRole(bytes32 role, address account) external; + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been granted `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `callerConfirmation`. + */ + function renounceRole(bytes32 role, address callerConfirmation) external; +} + +// lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol) + +/** + * @dev Interface of the ERC-165 standard, as defined in the + * https://eips.ethereum.org/EIPS/eip-165[ERC]. + * + * Implementers can declare support of contract interfaces, which can then be + * queried by others ({ERC165Checker}). + * + * For an implementation, see {ERC165}. + */ +interface IERC165 { + /** + * @dev Returns true if this contract implements the interface defined by + * `interfaceId`. See the corresponding + * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] + * to learn more about how these ids are created. + * + * This function call must use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool); +} + +// lib/openzeppelin-contracts/contracts/utils/Panic.sol + +// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol) + +/** + * @dev Helper library for emitting standardized panic codes. + * + * ```solidity + * contract Example { + * using Panic for uint256; + * + * // Use any of the declared internal constants + * function foo() { Panic.GENERIC.panic(); } + * + * // Alternatively + * function foo() { Panic.panic(Panic.GENERIC); } + * } + * ``` + * + * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. + * + * _Available since v5.1._ + */ +// slither-disable-next-line unused-state +library Panic { + /// @dev generic / unspecified error + uint256 internal constant GENERIC = 0x00; + /// @dev used by the assert() builtin + uint256 internal constant ASSERT = 0x01; + /// @dev arithmetic underflow or overflow + uint256 internal constant UNDER_OVERFLOW = 0x11; + /// @dev division or modulo by zero + uint256 internal constant DIVISION_BY_ZERO = 0x12; + /// @dev enum conversion error + uint256 internal constant ENUM_CONVERSION_ERROR = 0x21; + /// @dev invalid encoding in storage + uint256 internal constant STORAGE_ENCODING_ERROR = 0x22; + /// @dev empty array pop + uint256 internal constant EMPTY_ARRAY_POP = 0x31; + /// @dev array out of bounds access + uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32; + /// @dev resource error (too large allocation or too large array) + uint256 internal constant RESOURCE_ERROR = 0x41; + /// @dev calling invalid internal function + uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51; + + /// @dev Reverts with a panic code. Recommended to use with + /// the internal constants with predefined codes. + function panic(uint256 code) internal pure { + assembly ("memory-safe") { + mstore(0x00, 0x4e487b71) + mstore(0x20, code) + revert(0x1c, 0x24) + } + } +} + +// lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol + +// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol) +// This file was procedurally generated from scripts/generate/templates/SafeCast.js. + +/** + * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow + * checks. + * + * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can + * easily result in undesired exploitation or bugs, since developers usually + * assume that overflows raise errors. `SafeCast` restores this intuition by + * reverting the transaction when such an operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeCast { + /** + * @dev Value doesn't fit in an uint of `bits` size. + */ + error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); + + /** + * @dev An int value doesn't fit in an uint of `bits` size. + */ + error SafeCastOverflowedIntToUint(int256 value); + + /** + * @dev Value doesn't fit in an int of `bits` size. + */ + error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); + + /** + * @dev An uint value doesn't fit in an int of `bits` size. + */ + error SafeCastOverflowedUintToInt(uint256 value); + + /** + * @dev Returns the downcasted uint248 from uint256, reverting on + * overflow (when the input is greater than largest uint248). + * + * Counterpart to Solidity's `uint248` operator. + * + * Requirements: + * + * - input must fit into 248 bits + */ + function toUint248(uint256 value) internal pure returns (uint248) { + if (value > type(uint248).max) { + revert SafeCastOverflowedUintDowncast(248, value); + } + return uint248(value); + } + + /** + * @dev Returns the downcasted uint240 from uint256, reverting on + * overflow (when the input is greater than largest uint240). + * + * Counterpart to Solidity's `uint240` operator. + * + * Requirements: + * + * - input must fit into 240 bits + */ + function toUint240(uint256 value) internal pure returns (uint240) { + if (value > type(uint240).max) { + revert SafeCastOverflowedUintDowncast(240, value); + } + return uint240(value); + } + + /** + * @dev Returns the downcasted uint232 from uint256, reverting on + * overflow (when the input is greater than largest uint232). + * + * Counterpart to Solidity's `uint232` operator. + * + * Requirements: + * + * - input must fit into 232 bits + */ + function toUint232(uint256 value) internal pure returns (uint232) { + if (value > type(uint232).max) { + revert SafeCastOverflowedUintDowncast(232, value); + } + return uint232(value); + } + + /** + * @dev Returns the downcasted uint224 from uint256, reverting on + * overflow (when the input is greater than largest uint224). + * + * Counterpart to Solidity's `uint224` operator. + * + * Requirements: + * + * - input must fit into 224 bits + */ + function toUint224(uint256 value) internal pure returns (uint224) { + if (value > type(uint224).max) { + revert SafeCastOverflowedUintDowncast(224, value); + } + return uint224(value); + } + + /** + * @dev Returns the downcasted uint216 from uint256, reverting on + * overflow (when the input is greater than largest uint216). + * + * Counterpart to Solidity's `uint216` operator. + * + * Requirements: + * + * - input must fit into 216 bits + */ + function toUint216(uint256 value) internal pure returns (uint216) { + if (value > type(uint216).max) { + revert SafeCastOverflowedUintDowncast(216, value); + } + return uint216(value); + } + + /** + * @dev Returns the downcasted uint208 from uint256, reverting on + * overflow (when the input is greater than largest uint208). + * + * Counterpart to Solidity's `uint208` operator. + * + * Requirements: + * + * - input must fit into 208 bits + */ + function toUint208(uint256 value) internal pure returns (uint208) { + if (value > type(uint208).max) { + revert SafeCastOverflowedUintDowncast(208, value); + } + return uint208(value); + } + + /** + * @dev Returns the downcasted uint200 from uint256, reverting on + * overflow (when the input is greater than largest uint200). + * + * Counterpart to Solidity's `uint200` operator. + * + * Requirements: + * + * - input must fit into 200 bits + */ + function toUint200(uint256 value) internal pure returns (uint200) { + if (value > type(uint200).max) { + revert SafeCastOverflowedUintDowncast(200, value); + } + return uint200(value); + } + + /** + * @dev Returns the downcasted uint192 from uint256, reverting on + * overflow (when the input is greater than largest uint192). + * + * Counterpart to Solidity's `uint192` operator. + * + * Requirements: + * + * - input must fit into 192 bits + */ + function toUint192(uint256 value) internal pure returns (uint192) { + if (value > type(uint192).max) { + revert SafeCastOverflowedUintDowncast(192, value); + } + return uint192(value); + } + + /** + * @dev Returns the downcasted uint184 from uint256, reverting on + * overflow (when the input is greater than largest uint184). + * + * Counterpart to Solidity's `uint184` operator. + * + * Requirements: + * + * - input must fit into 184 bits + */ + function toUint184(uint256 value) internal pure returns (uint184) { + if (value > type(uint184).max) { + revert SafeCastOverflowedUintDowncast(184, value); + } + return uint184(value); + } + + /** + * @dev Returns the downcasted uint176 from uint256, reverting on + * overflow (when the input is greater than largest uint176). + * + * Counterpart to Solidity's `uint176` operator. + * + * Requirements: + * + * - input must fit into 176 bits + */ + function toUint176(uint256 value) internal pure returns (uint176) { + if (value > type(uint176).max) { + revert SafeCastOverflowedUintDowncast(176, value); + } + return uint176(value); + } + + /** + * @dev Returns the downcasted uint168 from uint256, reverting on + * overflow (when the input is greater than largest uint168). + * + * Counterpart to Solidity's `uint168` operator. + * + * Requirements: + * + * - input must fit into 168 bits + */ + function toUint168(uint256 value) internal pure returns (uint168) { + if (value > type(uint168).max) { + revert SafeCastOverflowedUintDowncast(168, value); + } + return uint168(value); + } + + /** + * @dev Returns the downcasted uint160 from uint256, reverting on + * overflow (when the input is greater than largest uint160). + * + * Counterpart to Solidity's `uint160` operator. + * + * Requirements: + * + * - input must fit into 160 bits + */ + function toUint160(uint256 value) internal pure returns (uint160) { + if (value > type(uint160).max) { + revert SafeCastOverflowedUintDowncast(160, value); + } + return uint160(value); + } + + /** + * @dev Returns the downcasted uint152 from uint256, reverting on + * overflow (when the input is greater than largest uint152). + * + * Counterpart to Solidity's `uint152` operator. + * + * Requirements: + * + * - input must fit into 152 bits + */ + function toUint152(uint256 value) internal pure returns (uint152) { + if (value > type(uint152).max) { + revert SafeCastOverflowedUintDowncast(152, value); + } + return uint152(value); + } + + /** + * @dev Returns the downcasted uint144 from uint256, reverting on + * overflow (when the input is greater than largest uint144). + * + * Counterpart to Solidity's `uint144` operator. + * + * Requirements: + * + * - input must fit into 144 bits + */ + function toUint144(uint256 value) internal pure returns (uint144) { + if (value > type(uint144).max) { + revert SafeCastOverflowedUintDowncast(144, value); + } + return uint144(value); + } + + /** + * @dev Returns the downcasted uint136 from uint256, reverting on + * overflow (when the input is greater than largest uint136). + * + * Counterpart to Solidity's `uint136` operator. + * + * Requirements: + * + * - input must fit into 136 bits + */ + function toUint136(uint256 value) internal pure returns (uint136) { + if (value > type(uint136).max) { + revert SafeCastOverflowedUintDowncast(136, value); + } + return uint136(value); + } + + /** + * @dev Returns the downcasted uint128 from uint256, reverting on + * overflow (when the input is greater than largest uint128). + * + * Counterpart to Solidity's `uint128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + */ + function toUint128(uint256 value) internal pure returns (uint128) { + if (value > type(uint128).max) { + revert SafeCastOverflowedUintDowncast(128, value); + } + return uint128(value); + } + + /** + * @dev Returns the downcasted uint120 from uint256, reverting on + * overflow (when the input is greater than largest uint120). + * + * Counterpart to Solidity's `uint120` operator. + * + * Requirements: + * + * - input must fit into 120 bits + */ + function toUint120(uint256 value) internal pure returns (uint120) { + if (value > type(uint120).max) { + revert SafeCastOverflowedUintDowncast(120, value); + } + return uint120(value); + } + + /** + * @dev Returns the downcasted uint112 from uint256, reverting on + * overflow (when the input is greater than largest uint112). + * + * Counterpart to Solidity's `uint112` operator. + * + * Requirements: + * + * - input must fit into 112 bits + */ + function toUint112(uint256 value) internal pure returns (uint112) { + if (value > type(uint112).max) { + revert SafeCastOverflowedUintDowncast(112, value); + } + return uint112(value); + } + + /** + * @dev Returns the downcasted uint104 from uint256, reverting on + * overflow (when the input is greater than largest uint104). + * + * Counterpart to Solidity's `uint104` operator. + * + * Requirements: + * + * - input must fit into 104 bits + */ + function toUint104(uint256 value) internal pure returns (uint104) { + if (value > type(uint104).max) { + revert SafeCastOverflowedUintDowncast(104, value); + } + return uint104(value); + } + + /** + * @dev Returns the downcasted uint96 from uint256, reverting on + * overflow (when the input is greater than largest uint96). + * + * Counterpart to Solidity's `uint96` operator. + * + * Requirements: + * + * - input must fit into 96 bits + */ + function toUint96(uint256 value) internal pure returns (uint96) { + if (value > type(uint96).max) { + revert SafeCastOverflowedUintDowncast(96, value); + } + return uint96(value); + } + + /** + * @dev Returns the downcasted uint88 from uint256, reverting on + * overflow (when the input is greater than largest uint88). + * + * Counterpart to Solidity's `uint88` operator. + * + * Requirements: + * + * - input must fit into 88 bits + */ + function toUint88(uint256 value) internal pure returns (uint88) { + if (value > type(uint88).max) { + revert SafeCastOverflowedUintDowncast(88, value); + } + return uint88(value); + } + + /** + * @dev Returns the downcasted uint80 from uint256, reverting on + * overflow (when the input is greater than largest uint80). + * + * Counterpart to Solidity's `uint80` operator. + * + * Requirements: + * + * - input must fit into 80 bits + */ + function toUint80(uint256 value) internal pure returns (uint80) { + if (value > type(uint80).max) { + revert SafeCastOverflowedUintDowncast(80, value); + } + return uint80(value); + } + + /** + * @dev Returns the downcasted uint72 from uint256, reverting on + * overflow (when the input is greater than largest uint72). + * + * Counterpart to Solidity's `uint72` operator. + * + * Requirements: + * + * - input must fit into 72 bits + */ + function toUint72(uint256 value) internal pure returns (uint72) { + if (value > type(uint72).max) { + revert SafeCastOverflowedUintDowncast(72, value); + } + return uint72(value); + } + + /** + * @dev Returns the downcasted uint64 from uint256, reverting on + * overflow (when the input is greater than largest uint64). + * + * Counterpart to Solidity's `uint64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + */ + function toUint64(uint256 value) internal pure returns (uint64) { + if (value > type(uint64).max) { + revert SafeCastOverflowedUintDowncast(64, value); + } + return uint64(value); + } + + /** + * @dev Returns the downcasted uint56 from uint256, reverting on + * overflow (when the input is greater than largest uint56). + * + * Counterpart to Solidity's `uint56` operator. + * + * Requirements: + * + * - input must fit into 56 bits + */ + function toUint56(uint256 value) internal pure returns (uint56) { + if (value > type(uint56).max) { + revert SafeCastOverflowedUintDowncast(56, value); + } + return uint56(value); + } + + /** + * @dev Returns the downcasted uint48 from uint256, reverting on + * overflow (when the input is greater than largest uint48). + * + * Counterpart to Solidity's `uint48` operator. + * + * Requirements: + * + * - input must fit into 48 bits + */ + function toUint48(uint256 value) internal pure returns (uint48) { + if (value > type(uint48).max) { + revert SafeCastOverflowedUintDowncast(48, value); + } + return uint48(value); + } + + /** + * @dev Returns the downcasted uint40 from uint256, reverting on + * overflow (when the input is greater than largest uint40). + * + * Counterpart to Solidity's `uint40` operator. + * + * Requirements: + * + * - input must fit into 40 bits + */ + function toUint40(uint256 value) internal pure returns (uint40) { + if (value > type(uint40).max) { + revert SafeCastOverflowedUintDowncast(40, value); + } + return uint40(value); + } + + /** + * @dev Returns the downcasted uint32 from uint256, reverting on + * overflow (when the input is greater than largest uint32). + * + * Counterpart to Solidity's `uint32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + */ + function toUint32(uint256 value) internal pure returns (uint32) { + if (value > type(uint32).max) { + revert SafeCastOverflowedUintDowncast(32, value); + } + return uint32(value); + } + + /** + * @dev Returns the downcasted uint24 from uint256, reverting on + * overflow (when the input is greater than largest uint24). + * + * Counterpart to Solidity's `uint24` operator. + * + * Requirements: + * + * - input must fit into 24 bits + */ + function toUint24(uint256 value) internal pure returns (uint24) { + if (value > type(uint24).max) { + revert SafeCastOverflowedUintDowncast(24, value); + } + return uint24(value); + } + + /** + * @dev Returns the downcasted uint16 from uint256, reverting on + * overflow (when the input is greater than largest uint16). + * + * Counterpart to Solidity's `uint16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + */ + function toUint16(uint256 value) internal pure returns (uint16) { + if (value > type(uint16).max) { + revert SafeCastOverflowedUintDowncast(16, value); + } + return uint16(value); + } + + /** + * @dev Returns the downcasted uint8 from uint256, reverting on + * overflow (when the input is greater than largest uint8). + * + * Counterpart to Solidity's `uint8` operator. + * + * Requirements: + * + * - input must fit into 8 bits + */ + function toUint8(uint256 value) internal pure returns (uint8) { + if (value > type(uint8).max) { + revert SafeCastOverflowedUintDowncast(8, value); + } + return uint8(value); + } + + /** + * @dev Converts a signed int256 into an unsigned uint256. + * + * Requirements: + * + * - input must be greater than or equal to 0. + */ + function toUint256(int256 value) internal pure returns (uint256) { + if (value < 0) { + revert SafeCastOverflowedIntToUint(value); + } + return uint256(value); + } + + /** + * @dev Returns the downcasted int248 from int256, reverting on + * overflow (when the input is less than smallest int248 or + * greater than largest int248). + * + * Counterpart to Solidity's `int248` operator. + * + * Requirements: + * + * - input must fit into 248 bits + */ + function toInt248(int256 value) internal pure returns (int248 downcasted) { + downcasted = int248(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(248, value); + } + } + + /** + * @dev Returns the downcasted int240 from int256, reverting on + * overflow (when the input is less than smallest int240 or + * greater than largest int240). + * + * Counterpart to Solidity's `int240` operator. + * + * Requirements: + * + * - input must fit into 240 bits + */ + function toInt240(int256 value) internal pure returns (int240 downcasted) { + downcasted = int240(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(240, value); + } + } + + /** + * @dev Returns the downcasted int232 from int256, reverting on + * overflow (when the input is less than smallest int232 or + * greater than largest int232). + * + * Counterpart to Solidity's `int232` operator. + * + * Requirements: + * + * - input must fit into 232 bits + */ + function toInt232(int256 value) internal pure returns (int232 downcasted) { + downcasted = int232(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(232, value); + } + } + + /** + * @dev Returns the downcasted int224 from int256, reverting on + * overflow (when the input is less than smallest int224 or + * greater than largest int224). + * + * Counterpart to Solidity's `int224` operator. + * + * Requirements: + * + * - input must fit into 224 bits + */ + function toInt224(int256 value) internal pure returns (int224 downcasted) { + downcasted = int224(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(224, value); + } + } + + /** + * @dev Returns the downcasted int216 from int256, reverting on + * overflow (when the input is less than smallest int216 or + * greater than largest int216). + * + * Counterpart to Solidity's `int216` operator. + * + * Requirements: + * + * - input must fit into 216 bits + */ + function toInt216(int256 value) internal pure returns (int216 downcasted) { + downcasted = int216(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(216, value); + } + } + + /** + * @dev Returns the downcasted int208 from int256, reverting on + * overflow (when the input is less than smallest int208 or + * greater than largest int208). + * + * Counterpart to Solidity's `int208` operator. + * + * Requirements: + * + * - input must fit into 208 bits + */ + function toInt208(int256 value) internal pure returns (int208 downcasted) { + downcasted = int208(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(208, value); + } + } + + /** + * @dev Returns the downcasted int200 from int256, reverting on + * overflow (when the input is less than smallest int200 or + * greater than largest int200). + * + * Counterpart to Solidity's `int200` operator. + * + * Requirements: + * + * - input must fit into 200 bits + */ + function toInt200(int256 value) internal pure returns (int200 downcasted) { + downcasted = int200(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(200, value); + } + } + + /** + * @dev Returns the downcasted int192 from int256, reverting on + * overflow (when the input is less than smallest int192 or + * greater than largest int192). + * + * Counterpart to Solidity's `int192` operator. + * + * Requirements: + * + * - input must fit into 192 bits + */ + function toInt192(int256 value) internal pure returns (int192 downcasted) { + downcasted = int192(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(192, value); + } + } + + /** + * @dev Returns the downcasted int184 from int256, reverting on + * overflow (when the input is less than smallest int184 or + * greater than largest int184). + * + * Counterpart to Solidity's `int184` operator. + * + * Requirements: + * + * - input must fit into 184 bits + */ + function toInt184(int256 value) internal pure returns (int184 downcasted) { + downcasted = int184(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(184, value); + } + } + + /** + * @dev Returns the downcasted int176 from int256, reverting on + * overflow (when the input is less than smallest int176 or + * greater than largest int176). + * + * Counterpart to Solidity's `int176` operator. + * + * Requirements: + * + * - input must fit into 176 bits + */ + function toInt176(int256 value) internal pure returns (int176 downcasted) { + downcasted = int176(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(176, value); + } + } + + /** + * @dev Returns the downcasted int168 from int256, reverting on + * overflow (when the input is less than smallest int168 or + * greater than largest int168). + * + * Counterpart to Solidity's `int168` operator. + * + * Requirements: + * + * - input must fit into 168 bits + */ + function toInt168(int256 value) internal pure returns (int168 downcasted) { + downcasted = int168(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(168, value); + } + } + + /** + * @dev Returns the downcasted int160 from int256, reverting on + * overflow (when the input is less than smallest int160 or + * greater than largest int160). + * + * Counterpart to Solidity's `int160` operator. + * + * Requirements: + * + * - input must fit into 160 bits + */ + function toInt160(int256 value) internal pure returns (int160 downcasted) { + downcasted = int160(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(160, value); + } + } + + /** + * @dev Returns the downcasted int152 from int256, reverting on + * overflow (when the input is less than smallest int152 or + * greater than largest int152). + * + * Counterpart to Solidity's `int152` operator. + * + * Requirements: + * + * - input must fit into 152 bits + */ + function toInt152(int256 value) internal pure returns (int152 downcasted) { + downcasted = int152(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(152, value); + } + } + + /** + * @dev Returns the downcasted int144 from int256, reverting on + * overflow (when the input is less than smallest int144 or + * greater than largest int144). + * + * Counterpart to Solidity's `int144` operator. + * + * Requirements: + * + * - input must fit into 144 bits + */ + function toInt144(int256 value) internal pure returns (int144 downcasted) { + downcasted = int144(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(144, value); + } + } + + /** + * @dev Returns the downcasted int136 from int256, reverting on + * overflow (when the input is less than smallest int136 or + * greater than largest int136). + * + * Counterpart to Solidity's `int136` operator. + * + * Requirements: + * + * - input must fit into 136 bits + */ + function toInt136(int256 value) internal pure returns (int136 downcasted) { + downcasted = int136(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(136, value); + } + } + + /** + * @dev Returns the downcasted int128 from int256, reverting on + * overflow (when the input is less than smallest int128 or + * greater than largest int128). + * + * Counterpart to Solidity's `int128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + */ + function toInt128(int256 value) internal pure returns (int128 downcasted) { + downcasted = int128(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(128, value); + } + } + + /** + * @dev Returns the downcasted int120 from int256, reverting on + * overflow (when the input is less than smallest int120 or + * greater than largest int120). + * + * Counterpart to Solidity's `int120` operator. + * + * Requirements: + * + * - input must fit into 120 bits + */ + function toInt120(int256 value) internal pure returns (int120 downcasted) { + downcasted = int120(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(120, value); + } + } + + /** + * @dev Returns the downcasted int112 from int256, reverting on + * overflow (when the input is less than smallest int112 or + * greater than largest int112). + * + * Counterpart to Solidity's `int112` operator. + * + * Requirements: + * + * - input must fit into 112 bits + */ + function toInt112(int256 value) internal pure returns (int112 downcasted) { + downcasted = int112(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(112, value); + } + } + + /** + * @dev Returns the downcasted int104 from int256, reverting on + * overflow (when the input is less than smallest int104 or + * greater than largest int104). + * + * Counterpart to Solidity's `int104` operator. + * + * Requirements: + * + * - input must fit into 104 bits + */ + function toInt104(int256 value) internal pure returns (int104 downcasted) { + downcasted = int104(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(104, value); + } + } + + /** + * @dev Returns the downcasted int96 from int256, reverting on + * overflow (when the input is less than smallest int96 or + * greater than largest int96). + * + * Counterpart to Solidity's `int96` operator. + * + * Requirements: + * + * - input must fit into 96 bits + */ + function toInt96(int256 value) internal pure returns (int96 downcasted) { + downcasted = int96(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(96, value); + } + } + + /** + * @dev Returns the downcasted int88 from int256, reverting on + * overflow (when the input is less than smallest int88 or + * greater than largest int88). + * + * Counterpart to Solidity's `int88` operator. + * + * Requirements: + * + * - input must fit into 88 bits + */ + function toInt88(int256 value) internal pure returns (int88 downcasted) { + downcasted = int88(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(88, value); + } + } + + /** + * @dev Returns the downcasted int80 from int256, reverting on + * overflow (when the input is less than smallest int80 or + * greater than largest int80). + * + * Counterpart to Solidity's `int80` operator. + * + * Requirements: + * + * - input must fit into 80 bits + */ + function toInt80(int256 value) internal pure returns (int80 downcasted) { + downcasted = int80(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(80, value); + } + } + + /** + * @dev Returns the downcasted int72 from int256, reverting on + * overflow (when the input is less than smallest int72 or + * greater than largest int72). + * + * Counterpart to Solidity's `int72` operator. + * + * Requirements: + * + * - input must fit into 72 bits + */ + function toInt72(int256 value) internal pure returns (int72 downcasted) { + downcasted = int72(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(72, value); + } + } + + /** + * @dev Returns the downcasted int64 from int256, reverting on + * overflow (when the input is less than smallest int64 or + * greater than largest int64). + * + * Counterpart to Solidity's `int64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + */ + function toInt64(int256 value) internal pure returns (int64 downcasted) { + downcasted = int64(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(64, value); + } + } + + /** + * @dev Returns the downcasted int56 from int256, reverting on + * overflow (when the input is less than smallest int56 or + * greater than largest int56). + * + * Counterpart to Solidity's `int56` operator. + * + * Requirements: + * + * - input must fit into 56 bits + */ + function toInt56(int256 value) internal pure returns (int56 downcasted) { + downcasted = int56(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(56, value); + } + } + + /** + * @dev Returns the downcasted int48 from int256, reverting on + * overflow (when the input is less than smallest int48 or + * greater than largest int48). + * + * Counterpart to Solidity's `int48` operator. + * + * Requirements: + * + * - input must fit into 48 bits + */ + function toInt48(int256 value) internal pure returns (int48 downcasted) { + downcasted = int48(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(48, value); + } + } + + /** + * @dev Returns the downcasted int40 from int256, reverting on + * overflow (when the input is less than smallest int40 or + * greater than largest int40). + * + * Counterpart to Solidity's `int40` operator. + * + * Requirements: + * + * - input must fit into 40 bits + */ + function toInt40(int256 value) internal pure returns (int40 downcasted) { + downcasted = int40(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(40, value); + } + } + + /** + * @dev Returns the downcasted int32 from int256, reverting on + * overflow (when the input is less than smallest int32 or + * greater than largest int32). + * + * Counterpart to Solidity's `int32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + */ + function toInt32(int256 value) internal pure returns (int32 downcasted) { + downcasted = int32(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(32, value); + } + } + + /** + * @dev Returns the downcasted int24 from int256, reverting on + * overflow (when the input is less than smallest int24 or + * greater than largest int24). + * + * Counterpart to Solidity's `int24` operator. + * + * Requirements: + * + * - input must fit into 24 bits + */ + function toInt24(int256 value) internal pure returns (int24 downcasted) { + downcasted = int24(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(24, value); + } + } + + /** + * @dev Returns the downcasted int16 from int256, reverting on + * overflow (when the input is less than smallest int16 or + * greater than largest int16). + * + * Counterpart to Solidity's `int16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + */ + function toInt16(int256 value) internal pure returns (int16 downcasted) { + downcasted = int16(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(16, value); + } + } + + /** + * @dev Returns the downcasted int8 from int256, reverting on + * overflow (when the input is less than smallest int8 or + * greater than largest int8). + * + * Counterpart to Solidity's `int8` operator. + * + * Requirements: + * + * - input must fit into 8 bits + */ + function toInt8(int256 value) internal pure returns (int8 downcasted) { + downcasted = int8(value); + if (downcasted != value) { + revert SafeCastOverflowedIntDowncast(8, value); + } + } + + /** + * @dev Converts an unsigned uint256 into a signed int256. + * + * Requirements: + * + * - input must be less than or equal to maxInt256. + */ + function toInt256(uint256 value) internal pure returns (int256) { + // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive + if (value > uint256(type(int256).max)) { + revert SafeCastOverflowedUintToInt(value); + } + return int256(value); + } + + /** + * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump. + */ + function toUint(bool b) internal pure returns (uint256 u) { + assembly ("memory-safe") { + u := iszero(iszero(b)) + } + } +} + +// lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (utils/SlotDerivation.sol) +// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js. + +/** + * @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots + * corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by + * the solidity language / compiler. + * + * See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.]. + * + * Example usage: + * ```solidity + * contract Example { + * // Add the library methods + * using StorageSlot for bytes32; + * using SlotDerivation for *; + * + * // Declare a namespace + * string private constant _NAMESPACE = ""; // eg. OpenZeppelin.Slot + * + * function setValueInNamespace(uint256 key, address newValue) internal { + * _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue; + * } + * + * function getValueInNamespace(uint256 key) internal view returns (address) { + * return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value; + * } + * } + * ``` + * + * TIP: Consider using this library along with {StorageSlot}. + * + * NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking + * upgrade safety will ignore the slots accessed through this library. + * + * _Available since v5.1._ + */ +library SlotDerivation { + /** + * @dev Derive an ERC-7201 slot from a string (namespace). + */ + function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) { + assembly ("memory-safe") { + mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1)) + slot := and(keccak256(0x00, 0x20), not(0xff)) + } + } + + /** + * @dev Add an offset to a slot to get the n-th element of a structure or an array. + */ + function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) { + unchecked { + return bytes32(uint256(slot) + pos); + } + } + + /** + * @dev Derive the location of the first element in an array from the slot where the length is stored. + */ + function deriveArray(bytes32 slot) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, slot) + result := keccak256(0x00, 0x20) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, and(key, shr(96, not(0)))) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, iszero(iszero(key))) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + let length := mload(key) + let begin := add(key, 0x20) + let end := add(begin, length) + let cache := mload(end) + mstore(end, slot) + result := keccak256(begin, add(length, 0x20)) + mstore(end, cache) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + */ + function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) { + assembly ("memory-safe") { + let length := mload(key) + let begin := add(key, 0x20) + let end := add(begin, length) + let cache := mload(end) + mstore(end, slot) + result := keccak256(begin, add(length, 0x20)) + mstore(end, cache) + } + } +} + +// lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol + +// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol) +// This file was procedurally generated from scripts/generate/templates/StorageSlot.js. + +/** + * @dev Library for reading and writing primitive types to specific storage slots. + * + * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. + * This library helps with reading and writing to such slots without the need for inline assembly. + * + * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. + * + * Example usage to set ERC-1967 implementation slot: + * ```solidity + * contract ERC1967 { + * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. + * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + * + * function _getImplementation() internal view returns (address) { + * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; + * } + * + * function _setImplementation(address newImplementation) internal { + * require(newImplementation.code.length > 0); + * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; + * } + * } + * ``` + * + * TIP: Consider using this library along with {SlotDerivation}. + */ +library StorageSlot { + struct AddressSlot { + address value; + } + + struct BooleanSlot { + bool value; + } + + struct Bytes32Slot { + bytes32 value; + } + + struct Uint256Slot { + uint256 value; + } + + struct Int256Slot { + int256 value; + } + + struct StringSlot { + string value; + } + + struct BytesSlot { + bytes value; + } + + /** + * @dev Returns an `AddressSlot` with member `value` located at `slot`. + */ + function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns a `BooleanSlot` with member `value` located at `slot`. + */ + function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns a `Bytes32Slot` with member `value` located at `slot`. + */ + function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns a `Uint256Slot` with member `value` located at `slot`. + */ + function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns a `Int256Slot` with member `value` located at `slot`. + */ + function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns a `StringSlot` with member `value` located at `slot`. + */ + function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns an `StringSlot` representation of the string storage pointer `store`. + */ + function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { + assembly ("memory-safe") { + r.slot := store.slot + } + } + + /** + * @dev Returns a `BytesSlot` with member `value` located at `slot`. + */ + function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { + assembly ("memory-safe") { + r.slot := slot + } + } + + /** + * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. + */ + function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { + assembly ("memory-safe") { + r.slot := store.slot + } + } +} + +// src/modules/VersionModule.sol + +abstract contract VersionModule { + /* ============ State Variables ============ */ + /** + * @dev + * Get the current version of the smart contract + */ + string private constant VERSION = "0.3.0"; + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + /** + * @notice Returns the current version of the smart contract + */ + function version() public view virtual returns (string memory) { + return VERSION; + } +} + +// lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol + +/** +* @title IERC1643 Document Management +* @dev Part of the ERC1400 Security Token Standards +* Contrary to the original specification, use a struct Document to represent a Document +*/ +interface IERC1643 { + /// @dev Struct used to represent a document and its metadata. + struct Document { + // URI of the off-chain document (e.g., IPFS, HTTPS) + string uri; + // Hash of the document content + bytes32 documentHash; + // Timestamp of the last on-chain modification (set by the smart contract) + uint256 lastModified; + } + + // Document Management + /** + * @notice Retrieves a document by its registered name. + * @param name The unique name used to identify the document. + * @return document The associated document's metadata (URI, hash, timestamp). + */ + function getDocument(string memory name) external view returns (Document memory document); + /** + * @notice Returns the list of all document names registered in the contract. + * @return documentNames_ An array of strings representing all document identifiers. + */ + function getAllDocuments() external view returns (string[] memory documentNames_); +} + +// lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol) + +/** + * @dev Implementation of the {IERC165} interface. + * + * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check + * for the additional interface id that will be supported. For example: + * + * ```solidity + * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); + * } + * ``` + */ +abstract contract ERC165 is IERC165 { + /// @inheritdoc IERC165 + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { + return interfaceId == type(IERC165).interfaceId; + } +} + +// lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (metatx/ERC2771Context.sol) + +/** + * @dev Context variant with ERC-2771 support. + * + * WARNING: Avoid using this pattern in contracts that rely on a specific calldata length as they'll + * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC-2771 + * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected + * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive` + * function only accessible if `msg.data.length == 0`. + * + * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption. + * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender} + * recovery. + */ +abstract contract ERC2771Context is Context { + /// @custom:oz-upgrades-unsafe-allow state-variable-immutable + address private immutable _trustedForwarder; + + /** + * @dev Initializes the contract with a trusted forwarder, which will be able to + * invoke functions on this contract on behalf of other accounts. + * + * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}. + */ + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(address trustedForwarder_) { + _trustedForwarder = trustedForwarder_; + } + + /** + * @dev Returns the address of the trusted forwarder. + */ + function trustedForwarder() public view virtual returns (address) { + return _trustedForwarder; + } + + /** + * @dev Indicates whether any particular address is the trusted forwarder. + */ + function isTrustedForwarder(address forwarder) public view virtual returns (bool) { + return forwarder == trustedForwarder(); + } + + /** + * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever + * a call is not performed by the trusted forwarder or the calldata length is less than + * 20 bytes (an address length). + */ + function _msgSender() internal view virtual override returns (address) { + uint256 calldataLength = msg.data.length; + uint256 contextSuffixLength = _contextSuffixLength(); + if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) { + unchecked { + return address(bytes20(msg.data[calldataLength - contextSuffixLength:])); + } + } else { + return super._msgSender(); + } + } + + /** + * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever + * a call is not performed by the trusted forwarder or the calldata length is less than + * 20 bytes (an address length). + */ + function _msgData() internal view virtual override returns (bytes calldata) { + uint256 calldataLength = msg.data.length; + uint256 contextSuffixLength = _contextSuffixLength(); + if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) { + unchecked { + return msg.data[:calldataLength - contextSuffixLength]; + } + } else { + return super._msgData(); + } + } + + /** + * @dev ERC-2771 specifies the context as being a single address (20 bytes). + */ + function _contextSuffixLength() internal view virtual override returns (uint256) { + return 20; + } +} + +// lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (access/extensions/IAccessControlEnumerable.sol) + +/** + * @dev External interface of AccessControlEnumerable declared to support ERC-165 detection. + */ +interface IAccessControlEnumerable is IAccessControl { + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) external view returns (address); + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) external view returns (uint256); +} + +// lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol + +interface IERC1643CMTAT { + struct DocumentInfo { + string name; + string uri; + bytes32 documentHash; + } +} + + +// lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol + +/** +* The issuer must be able to “deactivate” the smart contract, to prevent execution of transactions on +* the distributed ledger. +* Contrary to the “burn” function, the “deactivateContract” function +* affects all tokens in issuance, and not only some of them. +* +* a) This function is necessary to allow the issuer to carry out certain corporate actions +* (e.g. share splits, reverse splits or mergers), which +* require that all existing tokens are either canceled or immobilized and decoupled from the shares +* (i.e. the tokens no longer represent shares). +* +* b) The “deactivateContract” function can also be used if the issuer decides that it no longer wishes +* to have its shares issued in the form of ledger-based securities +* +* The “deactivateContract” function does not delete the smart contract’s +* storage and code, i.e. tokens are not burned by the function, however it permanently and +* irreversibly deactivates the smart contract (unless a proxy is used). +* +*/ +interface ICMTATDeactivate { + /** + * @notice Emitted when the contract is permanently deactivated. + * @param account The address that performed the deactivation. + */ + event Deactivated(address account); + + /* + * @notice Permanently deactivates the contract. + * @dev + * This action is irreversible — once executed, the contract cannot be reactivated. + * Requirements: + * - The contract MUST be paused before deactivation is allowed. + * Emits a {Deactivated} event. + * WARNING: Use with caution. This action permanently disables core contract functionality. + */ + function deactivateContract() external; + + /** + * @notice Returns whether the contract has been permanently deactivated. + * @return isDeactivated A boolean indicating the deactivation status. + * @dev Returns `true` if `deactivateContract()` has been successfully called. + */ + function deactivated() external view returns (bool isDeactivated) ; +} + +/** +* @title ICMTATBase - Core Tokenization Metadata Interface as part of CMTAT specification +* @notice Defines base properties and metadata structure for a tokenized asset. +* @dev Includes token ID, terms (using IERC1643-compliant document), and a general information field. +*/ +interface ICMTATBase { + /* ============ Struct ============ */ + /* + * @dev A reference to (e.g. in the form of an Internet address) or a hash of the tokenization terms + */ + struct Terms { + string name; + IERC1643.Document doc; + } + /* ============ Events ============ */ + /** + * @notice Emitted when the general information field is updated. + * @param newInformation The newly assigned metadata or descriptive text. + */ + event Information( + string newInformation + ); + /** + * @notice Emitted when new tokenization terms are set. + * @param newTerm The new Terms structure containing name and document reference. + */ + event Term(Terms newTerm); + + /** + * @notice Emitted when the token ID is set or updated. + * @param newTokenIdIndexed The token ID (indexed for filtering). + * @param newTokenId The full token ID string. + */ + event TokenId(string indexed newTokenIdIndexed, string newTokenId); + + /* ============ View Functions ============ */ + + /* + * @notice return tokenization tokenId + */ + function tokenId() external view returns (string memory tokenId_); + /* + * @notice returns tokenization terms + */ + function terms() external view returns (Terms memory terms_); + + /* + * @notice returns information field + */ + function information() external view returns (string memory information_); + + /* ============ Write Functions ============ */ + /** + * @notice Sets a new tokenization token ID. + * @param tokenId_ The token ID string to assign to the tokenized asset. + */ + function setTokenId( + string calldata tokenId_ + ) external ; + + /** + * @notice Sets new tokenization terms using a document reference. + * @param terms_ The `DocumentInfo` structure referencing the terms document (name + URI + hash). + */ + function setTerms(IERC1643CMTAT.DocumentInfo calldata terms_) external; + + /** + * @notice Sets or updates the general information field. + * @param information_ A string describing token attributes, usage, or metadata URI. + */ + function setInformation( + string calldata information_ + ) external; +} + +interface ICMTATCreditEvents { + /** + * @notice Returns credit events + */ + function creditEvents() external view returns(CreditEvents memory creditEvents_); + + struct CreditEvents { + bool flagDefault; + bool flagRedeemed; + string rating; + } +} +/** +* @notice interface to represent debt tokens +*/ +interface ICMTATDebt { + struct DebtInformation { + DebtIdentifier debtIdentifier; + DebtInstrument debtInstrument; + } + /** + * @dev Information on the issuer and other persons involved + */ + struct DebtIdentifier { + string issuerName; + string issuerDescription; + string guarantor; + string debtHolder; + } + /** + * dev Information on the Instruments + */ + struct DebtInstrument { + // uint256 + uint256 interestRate; + uint256 parValue; + uint256 minimumDenomination; + // string + string issuanceDate; + string maturityDate; + string couponPaymentFrequency; + /* + * Interest schedule format (if any). The purpose of the interest schedule is to set, in the parameters of the smart + * contract, the dates on which the interest payments accrue. + * - Format A: start date/end date/period + * - Format B: start date/end date/day of period (e.g. quarter or year) + * - Format C: date 1/date 2/date 3/…. + */ + string interestScheduleFormat; + /* + * - Format A: period (indicating the period between the accrual date for the interest payment and the date on + * which the payment is scheduled to be made) + * - Format B: specific date + */ + string interestPaymentDate; + string dayCountConvention; + string businessDayConvention; + string currency; + // address + address currencyContract; + } + /** + * @notice Returns debt information + */ + function debt() external view returns(DebtInformation memory debtInformation_); +} + +// lib/openzeppelin-contracts/contracts/utils/math/Math.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (utils/math/Math.sol) + +/** + * @dev Standard math utilities missing in the Solidity language. + */ +library Math { + enum Rounding { + Floor, // Toward negative infinity + Ceil, // Toward positive infinity + Trunc, // Toward zero + Expand // Away from zero + } + + /** + * @dev Return the 512-bit addition of two uint256. + * + * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low. + */ + function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) { + assembly ("memory-safe") { + low := add(a, b) + high := lt(low, a) + } + } + + /** + * @dev Return the 512-bit multiplication of two uint256. + * + * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low. + */ + function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) { + // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use + // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 + // variables such that product = high * 2²⁵⁶ + low. + assembly ("memory-safe") { + let mm := mulmod(a, b, not(0)) + low := mul(a, b) + high := sub(sub(mm, low), lt(mm, low)) + } + } + + /** + * @dev Returns the addition of two unsigned integers, with a success flag (no overflow). + */ + function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { + unchecked { + uint256 c = a + b; + success = c >= a; + result = c * SafeCast.toUint(success); + } + } + + /** + * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow). + */ + function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { + unchecked { + uint256 c = a - b; + success = c <= a; + result = c * SafeCast.toUint(success); + } + } + + /** + * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow). + */ + function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { + unchecked { + uint256 c = a * b; + assembly ("memory-safe") { + // Only true when the multiplication doesn't overflow + // (c / a == b) || (a == 0) + success := or(eq(div(c, a), b), iszero(a)) + } + // equivalent to: success ? c : 0 + result = c * SafeCast.toUint(success); + } + } + + /** + * @dev Returns the division of two unsigned integers, with a success flag (no division by zero). + */ + function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { + unchecked { + success = b > 0; + assembly ("memory-safe") { + // The `DIV` opcode returns zero when the denominator is 0. + result := div(a, b) + } + } + } + + /** + * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero). + */ + function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { + unchecked { + success = b > 0; + assembly ("memory-safe") { + // The `MOD` opcode returns zero when the denominator is 0. + result := mod(a, b) + } + } + } + + /** + * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing. + */ + function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) { + (bool success, uint256 result) = tryAdd(a, b); + return ternary(success, result, type(uint256).max); + } + + /** + * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing. + */ + function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) { + (, uint256 result) = trySub(a, b); + return result; + } + + /** + * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing. + */ + function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) { + (bool success, uint256 result) = tryMul(a, b); + return ternary(success, result, type(uint256).max); + } + + /** + * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant. + * + * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone. + * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute + * one branch when needed, making this function more expensive. + */ + function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) { + unchecked { + // branchless ternary works because: + // b ^ (a ^ b) == a + // b ^ 0 == b + return b ^ ((a ^ b) * SafeCast.toUint(condition)); + } + } + + /** + * @dev Returns the largest of two numbers. + */ + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return ternary(a > b, a, b); + } + + /** + * @dev Returns the smallest of two numbers. + */ + function min(uint256 a, uint256 b) internal pure returns (uint256) { + return ternary(a < b, a, b); + } + + /** + * @dev Returns the average of two numbers. The result is rounded towards + * zero. + */ + function average(uint256 a, uint256 b) internal pure returns (uint256) { + // (a + b) / 2 can overflow. + return (a & b) + (a ^ b) / 2; + } + + /** + * @dev Returns the ceiling of the division of two numbers. + * + * This differs from standard division with `/` in that it rounds towards infinity instead + * of rounding towards zero. + */ + function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { + if (b == 0) { + // Guarantee the same behavior as in a regular Solidity division. + Panic.panic(Panic.DIVISION_BY_ZERO); + } + + // The following calculation ensures accurate ceiling division without overflow. + // Since a is non-zero, (a - 1) / b will not overflow. + // The largest possible result occurs when (a - 1) / b is type(uint256).max, + // but the largest value we can obtain is type(uint256).max - 1, which happens + // when a = type(uint256).max and b = 1. + unchecked { + return SafeCast.toUint(a > 0) * ((a - 1) / b + 1); + } + } + + /** + * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or + * denominator == 0. + * + * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by + * Uniswap Labs also under MIT license. + */ + function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { + unchecked { + (uint256 high, uint256 low) = mul512(x, y); + + // Handle non-overflow cases, 256 by 256 division. + if (high == 0) { + // Solidity will revert if denominator == 0, unlike the div opcode on its own. + // The surrounding unchecked block does not change this fact. + // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. + return low / denominator; + } + + // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0. + if (denominator <= high) { + Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW)); + } + + /////////////////////////////////////////////// + // 512 by 256 division. + /////////////////////////////////////////////// + + // Make division exact by subtracting the remainder from [high low]. + uint256 remainder; + assembly ("memory-safe") { + // Compute remainder using mulmod. + remainder := mulmod(x, y, denominator) + + // Subtract 256 bit number from 512 bit number. + high := sub(high, gt(remainder, low)) + low := sub(low, remainder) + } + + // Factor powers of two out of denominator and compute largest power of two divisor of denominator. + // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. + + uint256 twos = denominator & (0 - denominator); + assembly ("memory-safe") { + // Divide denominator by twos. + denominator := div(denominator, twos) + + // Divide [high low] by twos. + low := div(low, twos) + + // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one. + twos := add(div(sub(0, twos), twos), 1) + } + + // Shift in bits from high into low. + low |= high * twos; + + // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such + // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for + // four bits. That is, denominator * inv ≡ 1 mod 2⁴. + uint256 inverse = (3 * denominator) ^ 2; + + // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also + // works in modular arithmetic, doubling the correct bits in each step. + inverse *= 2 - denominator * inverse; // inverse mod 2⁸ + inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶ + inverse *= 2 - denominator * inverse; // inverse mod 2³² + inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴ + inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸ + inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶ + + // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. + // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is + // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high + // is no longer required. + result = low * inverse; + return result; + } + } + + /** + * @dev Calculates x * y / denominator with full precision, following the selected rounding direction. + */ + function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { + return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0); + } + + /** + * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256. + */ + function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) { + unchecked { + (uint256 high, uint256 low) = mul512(x, y); + if (high >= 1 << n) { + Panic.panic(Panic.UNDER_OVERFLOW); + } + return (high << (256 - n)) | (low >> n); + } + } + + /** + * @dev Calculates x * y >> n with full precision, following the selected rounding direction. + */ + function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) { + return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0); + } + + /** + * @dev Calculate the modular multiplicative inverse of a number in Z/nZ. + * + * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0. + * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible. + * + * If the input value is not inversible, 0 is returned. + * + * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the + * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}. + */ + function invMod(uint256 a, uint256 n) internal pure returns (uint256) { + unchecked { + if (n == 0) return 0; + + // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version) + // Used to compute integers x and y such that: ax + ny = gcd(a, n). + // When the gcd is 1, then the inverse of a modulo n exists and it's x. + // ax + ny = 1 + // ax = 1 + (-y)n + // ax ≡ 1 (mod n) # x is the inverse of a modulo n + + // If the remainder is 0 the gcd is n right away. + uint256 remainder = a % n; + uint256 gcd = n; + + // Therefore the initial coefficients are: + // ax + ny = gcd(a, n) = n + // 0a + 1n = n + int256 x = 0; + int256 y = 1; + + while (remainder != 0) { + uint256 quotient = gcd / remainder; + + (gcd, remainder) = ( + // The old remainder is the next gcd to try. + remainder, + // Compute the next remainder. + // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd + // where gcd is at most n (capped to type(uint256).max) + gcd - remainder * quotient + ); + + (x, y) = ( + // Increment the coefficient of a. + y, + // Decrement the coefficient of n. + // Can overflow, but the result is casted to uint256 so that the + // next value of y is "wrapped around" to a value between 0 and n - 1. + x - y * int256(quotient) + ); + } + + if (gcd != 1) return 0; // No inverse exists. + return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative. + } + } + + /** + * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`. + * + * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is + * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that + * `a**(p-2)` is the modular multiplicative inverse of a in Fp. + * + * NOTE: this function does NOT check that `p` is a prime greater than `2`. + */ + function invModPrime(uint256 a, uint256 p) internal view returns (uint256) { + unchecked { + return Math.modExp(a, p - 2, p); + } + } + + /** + * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m) + * + * Requirements: + * - modulus can't be zero + * - underlying staticcall to precompile must succeed + * + * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make + * sure the chain you're using it on supports the precompiled contract for modular exponentiation + * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, + * the underlying function will succeed given the lack of a revert, but the result may be incorrectly + * interpreted as 0. + */ + function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) { + (bool success, uint256 result) = tryModExp(b, e, m); + if (!success) { + Panic.panic(Panic.DIVISION_BY_ZERO); + } + return result; + } + + /** + * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m). + * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying + * to operate modulo 0 or if the underlying precompile reverted. + * + * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain + * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in + * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack + * of a revert, but the result may be incorrectly interpreted as 0. + */ + function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) { + if (m == 0) return (false, 0); + assembly ("memory-safe") { + let ptr := mload(0x40) + // | Offset | Content | Content (Hex) | + // |-----------|------------|--------------------------------------------------------------------| + // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 | + // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 | + // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 | + // | 0x60:0x7f | value of b | 0x<.............................................................b> | + // | 0x80:0x9f | value of e | 0x<.............................................................e> | + // | 0xa0:0xbf | value of m | 0x<.............................................................m> | + mstore(ptr, 0x20) + mstore(add(ptr, 0x20), 0x20) + mstore(add(ptr, 0x40), 0x20) + mstore(add(ptr, 0x60), b) + mstore(add(ptr, 0x80), e) + mstore(add(ptr, 0xa0), m) + + // Given the result < m, it's guaranteed to fit in 32 bytes, + // so we can use the memory scratch space located at offset 0. + success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20) + result := mload(0x00) + } + } + + /** + * @dev Variant of {modExp} that supports inputs of arbitrary length. + */ + function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) { + (bool success, bytes memory result) = tryModExp(b, e, m); + if (!success) { + Panic.panic(Panic.DIVISION_BY_ZERO); + } + return result; + } + + /** + * @dev Variant of {tryModExp} that supports inputs of arbitrary length. + */ + function tryModExp( + bytes memory b, + bytes memory e, + bytes memory m + ) internal view returns (bool success, bytes memory result) { + if (_zeroBytes(m)) return (false, new bytes(0)); + + uint256 mLen = m.length; + + // Encode call args in result and move the free memory pointer + result = abi.encodePacked(b.length, e.length, mLen, b, e, m); + + assembly ("memory-safe") { + let dataPtr := add(result, 0x20) + // Write result on top of args to avoid allocating extra memory. + success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen) + // Overwrite the length. + // result.length > returndatasize() is guaranteed because returndatasize() == m.length + mstore(result, mLen) + // Set the memory pointer after the returned data. + mstore(0x40, add(dataPtr, mLen)) + } + } + + /** + * @dev Returns whether the provided byte array is zero. + */ + function _zeroBytes(bytes memory byteArray) private pure returns (bool) { + for (uint256 i = 0; i < byteArray.length; ++i) { + if (byteArray[i] != 0) { + return false; + } + } + return true; + } + + /** + * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded + * towards zero. + * + * This method is based on Newton's method for computing square roots; the algorithm is restricted to only + * using integer operations. + */ + function sqrt(uint256 a) internal pure returns (uint256) { + unchecked { + // Take care of easy edge cases when a == 0 or a == 1 + if (a <= 1) { + return a; + } + + // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a + // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between + // the current value as `ε_n = | x_n - sqrt(a) |`. + // + // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root + // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is + // bigger than any uint256. + // + // By noticing that + // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)` + // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar + // to the msb function. + uint256 aa = a; + uint256 xn = 1; + + if (aa >= (1 << 128)) { + aa >>= 128; + xn <<= 64; + } + if (aa >= (1 << 64)) { + aa >>= 64; + xn <<= 32; + } + if (aa >= (1 << 32)) { + aa >>= 32; + xn <<= 16; + } + if (aa >= (1 << 16)) { + aa >>= 16; + xn <<= 8; + } + if (aa >= (1 << 8)) { + aa >>= 8; + xn <<= 4; + } + if (aa >= (1 << 4)) { + aa >>= 4; + xn <<= 2; + } + if (aa >= (1 << 2)) { + xn <<= 1; + } + + // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1). + // + // We can refine our estimation by noticing that the middle of that interval minimizes the error. + // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2). + // This is going to be our x_0 (and ε_0) + xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2) + + // From here, Newton's method give us: + // x_{n+1} = (x_n + a / x_n) / 2 + // + // One should note that: + // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a + // = ((x_n² + a) / (2 * x_n))² - a + // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a + // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²) + // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²) + // = (x_n² - a)² / (2 * x_n)² + // = ((x_n² - a) / (2 * x_n))² + // ≥ 0 + // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n + // + // This gives us the proof of quadratic convergence of the sequence: + // ε_{n+1} = | x_{n+1} - sqrt(a) | + // = | (x_n + a / x_n) / 2 - sqrt(a) | + // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) | + // = | (x_n - sqrt(a))² / (2 * x_n) | + // = | ε_n² / (2 * x_n) | + // = ε_n² / | (2 * x_n) | + // + // For the first iteration, we have a special case where x_0 is known: + // ε_1 = ε_0² / | (2 * x_0) | + // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2))) + // ≤ 2**(2*e-4) / (3 * 2**(e-1)) + // ≤ 2**(e-3) / 3 + // ≤ 2**(e-3-log2(3)) + // ≤ 2**(e-4.5) + // + // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n: + // ε_{n+1} = ε_n² / | (2 * x_n) | + // ≤ (2**(e-k))² / (2 * 2**(e-1)) + // ≤ 2**(2*e-2*k) / 2**e + // ≤ 2**(e-2*k) + xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above + xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5 + xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9 + xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18 + xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36 + xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72 + + // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision + // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either + // sqrt(a) or sqrt(a) + 1. + return xn - SafeCast.toUint(xn > a / xn); + } + } + + /** + * @dev Calculates sqrt(a), following the selected rounding direction. + */ + function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { + unchecked { + uint256 result = sqrt(a); + return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a); + } + } + + /** + * @dev Return the log in base 2 of a positive value rounded towards zero. + * Returns 0 if given 0. + */ + function log2(uint256 x) internal pure returns (uint256 r) { + // If value has upper 128 bits set, log2 result is at least 128 + r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7; + // If upper 64 bits of 128-bit half set, add 64 to result + r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6; + // If upper 32 bits of 64-bit half set, add 32 to result + r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5; + // If upper 16 bits of 32-bit half set, add 16 to result + r |= SafeCast.toUint((x >> r) > 0xffff) << 4; + // If upper 8 bits of 16-bit half set, add 8 to result + r |= SafeCast.toUint((x >> r) > 0xff) << 3; + // If upper 4 bits of 8-bit half set, add 4 to result + r |= SafeCast.toUint((x >> r) > 0xf) << 2; + + // Shifts value right by the current result and use it as an index into this lookup table: + // + // | x (4 bits) | index | table[index] = MSB position | + // |------------|---------|-----------------------------| + // | 0000 | 0 | table[0] = 0 | + // | 0001 | 1 | table[1] = 0 | + // | 0010 | 2 | table[2] = 1 | + // | 0011 | 3 | table[3] = 1 | + // | 0100 | 4 | table[4] = 2 | + // | 0101 | 5 | table[5] = 2 | + // | 0110 | 6 | table[6] = 2 | + // | 0111 | 7 | table[7] = 2 | + // | 1000 | 8 | table[8] = 3 | + // | 1001 | 9 | table[9] = 3 | + // | 1010 | 10 | table[10] = 3 | + // | 1011 | 11 | table[11] = 3 | + // | 1100 | 12 | table[12] = 3 | + // | 1101 | 13 | table[13] = 3 | + // | 1110 | 14 | table[14] = 3 | + // | 1111 | 15 | table[15] = 3 | + // + // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes. + assembly ("memory-safe") { + r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000)) + } + } + + /** + * @dev Return the log in base 2, following the selected rounding direction, of a positive value. + * Returns 0 if given 0. + */ + function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { + unchecked { + uint256 result = log2(value); + return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value); + } + } + + /** + * @dev Return the log in base 10 of a positive value rounded towards zero. + * Returns 0 if given 0. + */ + function log10(uint256 value) internal pure returns (uint256) { + uint256 result = 0; + unchecked { + if (value >= 10 ** 64) { + value /= 10 ** 64; + result += 64; + } + if (value >= 10 ** 32) { + value /= 10 ** 32; + result += 32; + } + if (value >= 10 ** 16) { + value /= 10 ** 16; + result += 16; + } + if (value >= 10 ** 8) { + value /= 10 ** 8; + result += 8; + } + if (value >= 10 ** 4) { + value /= 10 ** 4; + result += 4; + } + if (value >= 10 ** 2) { + value /= 10 ** 2; + result += 2; + } + if (value >= 10 ** 1) { + result += 1; + } + } + return result; + } + + /** + * @dev Return the log in base 10, following the selected rounding direction, of a positive value. + * Returns 0 if given 0. + */ + function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { + unchecked { + uint256 result = log10(value); + return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value); + } + } + + /** + * @dev Return the log in base 256 of a positive value rounded towards zero. + * Returns 0 if given 0. + * + * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. + */ + function log256(uint256 x) internal pure returns (uint256 r) { + // If value has upper 128 bits set, log2 result is at least 128 + r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7; + // If upper 64 bits of 128-bit half set, add 64 to result + r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6; + // If upper 32 bits of 64-bit half set, add 32 to result + r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5; + // If upper 16 bits of 32-bit half set, add 16 to result + r |= SafeCast.toUint((x >> r) > 0xffff) << 4; + // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8 + return (r >> 3) | SafeCast.toUint((x >> r) > 0xff); + } + + /** + * @dev Return the log in base 256, following the selected rounding direction, of a positive value. + * Returns 0 if given 0. + */ + function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { + unchecked { + uint256 result = log256(value); + return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value); + } + } + + /** + * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. + */ + function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { + return uint8(rounding) % 2 == 1; + } + + /** + * @dev Counts the number of leading zero bits in a uint256. + */ + function clz(uint256 x) internal pure returns (uint256) { + return ternary(x == 0, 256, 255 - log2(x)); + } +} + +// lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol + +/* +* @dev minimum interface to define a DebtEngine +*/ +interface IDebtEngine is ICMTATDebt, ICMTATCreditEvents { + // nothing more +} + +// lib/openzeppelin-contracts/contracts/access/AccessControl.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol) + +/** + * @dev Contract module that allows children to implement role-based access + * control mechanisms. This is a lightweight version that doesn't allow enumerating role + * members except through off-chain means by accessing the contract event logs. Some + * applications may benefit from on-chain enumerability, for those cases see + * {AccessControlEnumerable}. + * + * Roles are referred to by their `bytes32` identifier. These should be exposed + * in the external API and be unique. The best way to achieve this is by + * using `public constant` hash digests: + * + * ```solidity + * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); + * ``` + * + * Roles can be used to represent a set of permissions. To restrict access to a + * function call, use {hasRole}: + * + * ```solidity + * function foo() public { + * require(hasRole(MY_ROLE, msg.sender)); + * ... + * } + * ``` + * + * Roles can be granted and revoked dynamically via the {grantRole} and + * {revokeRole} functions. Each role has an associated admin role, and only + * accounts that have a role's admin role can call {grantRole} and {revokeRole}. + * + * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means + * that only accounts with this role will be able to grant or revoke other + * roles. More complex role relationships can be created by using + * {_setRoleAdmin}. + * + * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to + * grant and revoke this role. Extra precautions should be taken to secure + * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} + * to enforce additional security measures for this role. + */ +abstract contract AccessControl is Context, IAccessControl, ERC165 { + struct RoleData { + mapping(address account => bool) hasRole; + bytes32 adminRole; + } + + mapping(bytes32 role => RoleData) private _roles; + + bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; + + /** + * @dev Modifier that checks that an account has a specific role. Reverts + * with an {AccessControlUnauthorizedAccount} error including the required role. + */ + modifier onlyRole(bytes32 role) { + _checkRole(role); + _; + } + + /// @inheritdoc IERC165 + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); + } + + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) public view virtual returns (bool) { + return _roles[role].hasRole[account]; + } + + /** + * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` + * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. + */ + function _checkRole(bytes32 role) internal view virtual { + _checkRole(role, _msgSender()); + } + + /** + * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` + * is missing `role`. + */ + function _checkRole(bytes32 role, address account) internal view virtual { + if (!hasRole(role, account)) { + revert AccessControlUnauthorizedAccount(account, role); + } + } + + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { + return _roles[role].adminRole; + } + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + * + * May emit a {RoleGranted} event. + */ + function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { + _grantRole(role, account); + } + + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + * + * May emit a {RoleRevoked} event. + */ + function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { + _revokeRole(role, account); + } + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been revoked `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `callerConfirmation`. + * + * May emit a {RoleRevoked} event. + */ + function renounceRole(bytes32 role, address callerConfirmation) public virtual { + if (callerConfirmation != _msgSender()) { + revert AccessControlBadConfirmation(); + } + + _revokeRole(role, callerConfirmation); + } + + /** + * @dev Sets `adminRole` as ``role``'s admin role. + * + * Emits a {RoleAdminChanged} event. + */ + function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { + bytes32 previousAdminRole = getRoleAdmin(role); + _roles[role].adminRole = adminRole; + emit RoleAdminChanged(role, previousAdminRole, adminRole); + } + + /** + * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. + * + * Internal function without access restriction. + * + * May emit a {RoleGranted} event. + */ + function _grantRole(bytes32 role, address account) internal virtual returns (bool) { + if (!hasRole(role, account)) { + _roles[role].hasRole[account] = true; + emit RoleGranted(role, account, _msgSender()); + return true; + } else { + return false; + } + } + + /** + * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked. + * + * Internal function without access restriction. + * + * May emit a {RoleRevoked} event. + */ + function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { + if (hasRole(role, account)) { + _roles[role].hasRole[account] = false; + emit RoleRevoked(role, account, _msgSender()); + return true; + } else { + return false; + } + } +} + +// lib/openzeppelin-contracts/contracts/utils/Arrays.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (utils/Arrays.sol) +// This file was procedurally generated from scripts/generate/templates/Arrays.js. + +/** + * @dev Collection of functions related to array types. + */ +library Arrays { + using SlotDerivation for bytes32; + using StorageSlot for bytes32; + + /** + * @dev Sort an array of uint256 (in memory) following the provided comparator function. + * + * This function does the sorting "in place", meaning that it overrides the input. The object is returned for + * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array. + * + * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the + * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful + * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may + * consume more gas than is available in a block, leading to potential DoS. + * + * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way. + */ + function sort( + uint256[] memory array, + function(uint256, uint256) pure returns (bool) comp + ) internal pure returns (uint256[] memory) { + _quickSort(_begin(array), _end(array), comp); + return array; + } + + /** + * @dev Variant of {sort} that sorts an array of uint256 in increasing order. + */ + function sort(uint256[] memory array) internal pure returns (uint256[] memory) { + sort(array, Comparators.lt); + return array; + } + + /** + * @dev Sort an array of address (in memory) following the provided comparator function. + * + * This function does the sorting "in place", meaning that it overrides the input. The object is returned for + * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array. + * + * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the + * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful + * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may + * consume more gas than is available in a block, leading to potential DoS. + * + * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way. + */ + function sort( + address[] memory array, + function(address, address) pure returns (bool) comp + ) internal pure returns (address[] memory) { + sort(_castToUint256Array(array), _castToUint256Comp(comp)); + return array; + } + + /** + * @dev Variant of {sort} that sorts an array of address in increasing order. + */ + function sort(address[] memory array) internal pure returns (address[] memory) { + sort(_castToUint256Array(array), Comparators.lt); + return array; + } + + /** + * @dev Sort an array of bytes32 (in memory) following the provided comparator function. + * + * This function does the sorting "in place", meaning that it overrides the input. The object is returned for + * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array. + * + * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the + * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful + * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may + * consume more gas than is available in a block, leading to potential DoS. + * + * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way. + */ + function sort( + bytes32[] memory array, + function(bytes32, bytes32) pure returns (bool) comp + ) internal pure returns (bytes32[] memory) { + sort(_castToUint256Array(array), _castToUint256Comp(comp)); + return array; + } + + /** + * @dev Variant of {sort} that sorts an array of bytes32 in increasing order. + */ + function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) { + sort(_castToUint256Array(array), Comparators.lt); + return array; + } + + /** + * @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops + * at end (exclusive). Sorting follows the `comp` comparator. + * + * Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls. + * + * IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should + * be used only if the limits are within a memory array. + */ + function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure { + unchecked { + if (end - begin < 0x40) return; + + // Use first element as pivot + uint256 pivot = _mload(begin); + // Position where the pivot should be at the end of the loop + uint256 pos = begin; + + for (uint256 it = begin + 0x20; it < end; it += 0x20) { + if (comp(_mload(it), pivot)) { + // If the value stored at the iterator's position comes before the pivot, we increment the + // position of the pivot and move the value there. + pos += 0x20; + _swap(pos, it); + } + } + + _swap(begin, pos); // Swap pivot into place + _quickSort(begin, pos, comp); // Sort the left side of the pivot + _quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot + } + } + + /** + * @dev Pointer to the memory location of the first element of `array`. + */ + function _begin(uint256[] memory array) private pure returns (uint256 ptr) { + assembly ("memory-safe") { + ptr := add(array, 0x20) + } + } + + /** + * @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word + * that comes just after the last element of the array. + */ + function _end(uint256[] memory array) private pure returns (uint256 ptr) { + unchecked { + return _begin(array) + array.length * 0x20; + } + } + + /** + * @dev Load memory word (as a uint256) at location `ptr`. + */ + function _mload(uint256 ptr) private pure returns (uint256 value) { + assembly { + value := mload(ptr) + } + } + + /** + * @dev Swaps the elements memory location `ptr1` and `ptr2`. + */ + function _swap(uint256 ptr1, uint256 ptr2) private pure { + assembly { + let value1 := mload(ptr1) + let value2 := mload(ptr2) + mstore(ptr1, value2) + mstore(ptr2, value1) + } + } + + /// @dev Helper: low level cast address memory array to uint256 memory array + function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) { + assembly { + output := input + } + } + + /// @dev Helper: low level cast bytes32 memory array to uint256 memory array + function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) { + assembly { + output := input + } + } + + /// @dev Helper: low level cast address comp function to uint256 comp function + function _castToUint256Comp( + function(address, address) pure returns (bool) input + ) private pure returns (function(uint256, uint256) pure returns (bool) output) { + assembly { + output := input + } + } + + /// @dev Helper: low level cast bytes32 comp function to uint256 comp function + function _castToUint256Comp( + function(bytes32, bytes32) pure returns (bool) input + ) private pure returns (function(uint256, uint256) pure returns (bool) output) { + assembly { + output := input + } + } + + /** + * @dev Searches a sorted `array` and returns the first index that contains + * a value greater or equal to `element`. If no such index exists (i.e. all + * values in the array are strictly less than `element`), the array length is + * returned. Time complexity O(log n). + * + * NOTE: The `array` is expected to be sorted in ascending order, and to + * contain no repeated elements. + * + * IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks + * support for repeated elements in the array. The {lowerBound} function should + * be used instead. + */ + function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { + uint256 low = 0; + uint256 high = array.length; + + if (high == 0) { + return 0; + } + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds towards zero (it does integer division with truncation). + if (unsafeAccess(array, mid).value > element) { + high = mid; + } else { + low = mid + 1; + } + } + + // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. + if (low > 0 && unsafeAccess(array, low - 1).value == element) { + return low - 1; + } else { + return low; + } + } + + /** + * @dev Searches an `array` sorted in ascending order and returns the first + * index that contains a value greater or equal than `element`. If no such index + * exists (i.e. all values in the array are strictly less than `element`), the array + * length is returned. Time complexity O(log n). + * + * See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound]. + */ + function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) { + uint256 low = 0; + uint256 high = array.length; + + if (high == 0) { + return 0; + } + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds towards zero (it does integer division with truncation). + if (unsafeAccess(array, mid).value < element) { + // this cannot overflow because mid < high + unchecked { + low = mid + 1; + } + } else { + high = mid; + } + } + + return low; + } + + /** + * @dev Searches an `array` sorted in ascending order and returns the first + * index that contains a value strictly greater than `element`. If no such index + * exists (i.e. all values in the array are strictly less than `element`), the array + * length is returned. Time complexity O(log n). + * + * See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound]. + */ + function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { + uint256 low = 0; + uint256 high = array.length; + + if (high == 0) { + return 0; + } + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds towards zero (it does integer division with truncation). + if (unsafeAccess(array, mid).value > element) { + high = mid; + } else { + // this cannot overflow because mid < high + unchecked { + low = mid + 1; + } + } + } + + return low; + } + + /** + * @dev Same as {lowerBound}, but with an array in memory. + */ + function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) { + uint256 low = 0; + uint256 high = array.length; + + if (high == 0) { + return 0; + } + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds towards zero (it does integer division with truncation). + if (unsafeMemoryAccess(array, mid) < element) { + // this cannot overflow because mid < high + unchecked { + low = mid + 1; + } + } else { + high = mid; + } + } + + return low; + } + + /** + * @dev Same as {upperBound}, but with an array in memory. + */ + function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) { + uint256 low = 0; + uint256 high = array.length; + + if (high == 0) { + return 0; + } + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds towards zero (it does integer division with truncation). + if (unsafeMemoryAccess(array, mid) > element) { + high = mid; + } else { + // this cannot overflow because mid < high + unchecked { + low = mid + 1; + } + } + } + + return low; + } + + /** + * @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new address array in + * memory. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(address[] memory array, uint256 start) internal pure returns (address[] memory) { + return slice(array, start, array.length); + } + + /** + * @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new address array in + * memory. The `end` argument is truncated to the length of the `array`. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(address[] memory array, uint256 start, uint256 end) internal pure returns (address[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // allocate and copy + address[] memory result = new address[](end - start); + assembly ("memory-safe") { + mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + } + + return result; + } + + /** + * @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new bytes32 array in + * memory. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(bytes32[] memory array, uint256 start) internal pure returns (bytes32[] memory) { + return slice(array, start, array.length); + } + + /** + * @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new bytes32 array in + * memory. The `end` argument is truncated to the length of the `array`. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(bytes32[] memory array, uint256 start, uint256 end) internal pure returns (bytes32[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // allocate and copy + bytes32[] memory result = new bytes32[](end - start); + assembly ("memory-safe") { + mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + } + + return result; + } + + /** + * @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new uint256 array in + * memory. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(uint256[] memory array, uint256 start) internal pure returns (uint256[] memory) { + return slice(array, start, array.length); + } + + /** + * @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new uint256 array in + * memory. The `end` argument is truncated to the length of the `array`. + * + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`] + */ + function slice(uint256[] memory array, uint256 start, uint256 end) internal pure returns (uint256[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // allocate and copy + uint256[] memory result = new uint256[](end - start); + assembly ("memory-safe") { + mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + } + + return result; + } + + /** + * @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(address[] memory array, uint256 start) internal pure returns (address[] memory) { + return splice(array, start, array.length); + } + + /** + * @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The + * `end` argument is truncated to the length of the `array`. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(address[] memory array, uint256 start, uint256 end) internal pure returns (address[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // move and resize + assembly ("memory-safe") { + mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + mstore(array, sub(end, start)) + } + + return array; + } + + /** + * @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(bytes32[] memory array, uint256 start) internal pure returns (bytes32[] memory) { + return splice(array, start, array.length); + } + + /** + * @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The + * `end` argument is truncated to the length of the `array`. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(bytes32[] memory array, uint256 start, uint256 end) internal pure returns (bytes32[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // move and resize + assembly ("memory-safe") { + mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + mstore(array, sub(end, start)) + } + + return array; + } + + /** + * @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(uint256[] memory array, uint256 start) internal pure returns (uint256[] memory) { + return splice(array, start, array.length); + } + + /** + * @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array. The + * `end` argument is truncated to the length of the `array`. + * + * NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead. + * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice[Javascript's `Array.splice`] + */ + function splice(uint256[] memory array, uint256 start, uint256 end) internal pure returns (uint256[] memory) { + // sanitize + end = Math.min(end, array.length); + start = Math.min(start, end); + + // move and resize + assembly ("memory-safe") { + mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20)) + mstore(array, sub(end, start)) + } + + return array; + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { + bytes32 slot; + assembly ("memory-safe") { + slot := arr.slot + } + return slot.deriveArray().offset(pos).getAddressSlot(); + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { + bytes32 slot; + assembly ("memory-safe") { + slot := arr.slot + } + return slot.deriveArray().offset(pos).getBytes32Slot(); + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { + bytes32 slot; + assembly ("memory-safe") { + slot := arr.slot + } + return slot.deriveArray().offset(pos).getUint256Slot(); + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeAccess(bytes[] storage arr, uint256 pos) internal pure returns (StorageSlot.BytesSlot storage) { + bytes32 slot; + assembly ("memory-safe") { + slot := arr.slot + } + return slot.deriveArray().offset(pos).getBytesSlot(); + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeAccess(string[] storage arr, uint256 pos) internal pure returns (StorageSlot.StringSlot storage) { + bytes32 slot; + assembly ("memory-safe") { + slot := arr.slot + } + return slot.deriveArray().offset(pos).getStringSlot(); + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { + assembly { + res := mload(add(add(arr, 0x20), mul(pos, 0x20))) + } + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) { + assembly { + res := mload(add(add(arr, 0x20), mul(pos, 0x20))) + } + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { + assembly { + res := mload(add(add(arr, 0x20), mul(pos, 0x20))) + } + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeMemoryAccess(bytes[] memory arr, uint256 pos) internal pure returns (bytes memory res) { + assembly { + res := mload(add(add(arr, 0x20), mul(pos, 0x20))) + } + } + + /** + * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. + * + * WARNING: Only use if you are certain `pos` is lower than the array length. + */ + function unsafeMemoryAccess(string[] memory arr, uint256 pos) internal pure returns (string memory res) { + assembly { + res := mload(add(add(arr, 0x20), mul(pos, 0x20))) + } + } + + /** + * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden. + * + * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased. + */ + function unsafeSetLength(address[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } + + /** + * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden. + * + * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased. + */ + function unsafeSetLength(bytes32[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } + + /** + * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden. + * + * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased. + */ + function unsafeSetLength(uint256[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } + + /** + * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden. + * + * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased. + */ + function unsafeSetLength(bytes[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } + + /** + * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden. + * + * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased. + */ + function unsafeSetLength(string[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } +} + +// src/DebtEngineBase.sol + +abstract contract DebtEngineBase is IDebtEngine, DebtEngineInvariantStorage, VersionModule { + // Events + event DebtSet(address indexed smartContract); + event CreditEventsSet(address indexed smartContract); + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + // Mapping of debts and credit events to specific smart contracts + mapping(address => DebtInformation) private _debts; + mapping(address => CreditEvents) private _creditEvents; + + // Track whether debt/credit events have been explicitly set + mapping(address => bool) private _debtSet; + mapping(address => bool) private _creditEventsSet; + + /** + * @notice Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`. + * @dev A hard ceiling, not a recommended batch size. Every entry writes its whole struct to storage, + * so on a network with a per-transaction gas cap (Ethereum mainnet: 2^24 gas since EIP-7825) a batch + * of realistic records runs out of gas long before this limit. Size batches from a gas estimate. + */ + uint256 public constant MAX_BATCH_SIZE = 500; + + modifier onlyDebtManager() { + _authorizeSetDebt(); + _; + } + + modifier onlyCreditEventsManager() { + _authorizeSetCreditEvents(); + _; + } + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /* ============ USER-FACING FUNCTIONS ============ */ + /** + * @notice Function to get the debt for the sender's smart contract + */ + function debt() external view virtual returns (DebtInformation memory) { + return debt(_msgSender()); + } + + /** + * @notice Function to get the debt for a specific smart contract + */ + function debt(address smartContract_) public view virtual returns (DebtInformation memory) { + return _debts[smartContract_]; + } + + /** + * @notice Function to get the credit events for the sender's smart contract + */ + function creditEvents() external view virtual returns (CreditEvents memory) { + return creditEvents(_msgSender()); + } + + /** + * @notice Function to get the credit events for a specific smart contract + */ + function creditEvents(address smartContract_) public view virtual returns (CreditEvents memory) { + return _creditEvents[smartContract_]; + } + + /** + * @notice Returns true if a debt record is currently set for the given smart contract + * @dev True after {setDebt} / {setDebtBatch}, false again after {clearDebt}. + */ + function hasDebt(address smartContract_) external view virtual returns (bool) { + return _debtSet[smartContract_]; + } + + /** + * @notice Returns true if credit events are currently set for the given smart contract + * @dev True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}. + */ + function hasCreditEvents(address smartContract_) external view virtual returns (bool) { + return _creditEventsSet[smartContract_]; + } + + /* ============ RESTRICTED-FACING FUNCTIONS ============ */ + /** + * @notice Function to set the debt for a given smart contract + */ + function setDebt(address smartContract_, DebtInformation calldata debt_) external virtual onlyDebtManager { + _setDebt(smartContract_, debt_); + } + + /** + * @notice Function to set the credit events for a given smart contract + */ + function setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) + external + virtual + onlyCreditEventsManager + { + _setCreditEvents(smartContract_, creditEvents_); + } + + /** + * @notice Batch version of {setCreditEvents} + */ + function setCreditEventsBatch(address[] calldata smartContracts, CreditEvents[] calldata creditEventsList) + external + virtual + onlyCreditEventsManager + { + require(smartContracts.length == creditEventsList.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setCreditEvents(smartContracts[i], creditEventsList[i]); + } + } + + /** + * @notice Batch version of {setDebt} + */ + function setDebtBatch(address[] calldata smartContracts, DebtInformation[] calldata debts) + external + virtual + onlyDebtManager + { + require(smartContracts.length == debts.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setDebt(smartContracts[i], debts[i]); + } + } + + /** + * @notice Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards + * and `debt(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {DebtCleared}. + */ + function clearDebt(address smartContract_) external virtual onlyDebtManager { + _clearDebt(smartContract_); + } + + /** + * @notice Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards + * and `creditEvents(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {CreditEventsCleared}. + */ + function clearCreditEvents(address smartContract_) external virtual onlyCreditEventsManager { + _clearCreditEvents(smartContract_); + } + + /*////////////////////////////////////////////////////////////// + INTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /** + * @dev Single write path for debt: rejects `address(0)`, stores the record, marks it as set + * and emits {DebtSet}. Every public setter goes through it, so none can skip a step. + */ + function _setDebt(address smartContract_, DebtInformation calldata debt_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _debts[smartContract_] = debt_; + _debtSet[smartContract_] = true; + emit DebtSet(smartContract_); + } + + /** + * @dev Single write path for credit events: rejects `address(0)`, stores the record, marks it + * as set and emits {CreditEventsSet}. Every public setter goes through it. + */ + function _setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _creditEvents[smartContract_] = creditEvents_; + _creditEventsSet[smartContract_] = true; + emit CreditEventsSet(smartContract_); + } + + /** + * @dev Single delete path for debt: rejects `address(0)` (as `_setDebt` does), removes the record + * and its "set" flag, emits {DebtCleared}. + */ + function _clearDebt(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + + /** + * @dev Single delete path for credit events: rejects `address(0)` (as `_setCreditEvents` does), + * removes the record and its "set" flag, emits {CreditEventsCleared}. + */ + function _clearCreditEvents(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _creditEvents[smartContract_]; + delete _creditEventsSet[smartContract_]; + emit CreditEventsCleared(smartContract_); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + /** + * @notice Authorization hook invoked before any debt change (`setDebt`, `setDebtBatch`, `clearDebt`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetDebt() internal view virtual; + + /** + * @notice Authorization hook invoked before any credit-events change (`setCreditEvents`, `setCreditEventsBatch`, + * `clearCreditEvents`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetCreditEvents() internal view virtual; + + /* ============ CONTEXT ============ */ + + /** + * @dev Returns the sender of the transaction. + * Can be overridden to support meta-transactions (ERC2771). + */ + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } +} + +// lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (utils/structs/EnumerableSet.sol) +// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. + +/** + * @dev Library for managing + * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive + * types. + * + * Sets have the following properties: + * + * - Elements are added, removed, and checked for existence in constant time + * (O(1)). + * - Elements are enumerated in O(n). No guarantees are made on the ordering. + * - Set can be cleared (all elements removed) in O(n). + * + * ```solidity + * contract Example { + * // Add the library methods + * using EnumerableSet for EnumerableSet.AddressSet; + * + * // Declare a set state variable + * EnumerableSet.AddressSet private mySet; + * } + * ``` + * + * The following types are supported: + * + * - `bytes32` (`Bytes32Set`) since v3.3.0 + * - `address` (`AddressSet`) since v3.3.0 + * - `uint256` (`UintSet`) since v3.3.0 + * - `string` (`StringSet`) since v5.4.0 + * - `bytes` (`BytesSet`) since v5.4.0 + * + * [WARNING] + * ==== + * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure + * unusable. + * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. + * + * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an + * array of EnumerableSet. + * ==== + */ +library EnumerableSet { + // To implement this library for multiple types with as little code + // repetition as possible, we write it in terms of a generic Set type with + // bytes32 values. + // The Set implementation uses private functions, and user-facing + // implementations (such as AddressSet) are just wrappers around the + // underlying Set. + // This means that we can only create new EnumerableSets for types that fit + // in bytes32. + + struct Set { + // Storage of set values + bytes32[] _values; + // Position is the index of the value in the `values` array plus 1. + // Position 0 is used to mean a value is not in the set. + mapping(bytes32 value => uint256) _positions; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function _add(Set storage set, bytes32 value) private returns (bool) { + if (!_contains(set, value)) { + set._values.push(value); + // The value is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + set._positions[value] = set._values.length; + return true; + } else { + return false; + } + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function _remove(Set storage set, bytes32 value) private returns (bool) { + // We cache the value's position to prevent multiple reads from the same storage slot + uint256 position = set._positions[value]; + + if (position != 0) { + // Equivalent to contains(set, value) + // To delete an element from the _values array in O(1), we swap the element to delete with the last one in + // the array, and then remove the last element (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 valueIndex = position - 1; + uint256 lastIndex = set._values.length - 1; + + if (valueIndex != lastIndex) { + bytes32 lastValue = set._values[lastIndex]; + + // Move the lastValue to the index where the value to delete is + set._values[valueIndex] = lastValue; + // Update the tracked position of the lastValue (that was just moved) + set._positions[lastValue] = position; + } + + // Delete the slot where the moved value was stored + set._values.pop(); + + // Delete the tracked position for the deleted slot + delete set._positions[value]; + + return true; + } else { + return false; + } + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: This function has an unbounded cost that scales with set size. Developers should keep in mind that + * using it may render the function uncallable if the set grows to the point where clearing it consumes too much + * gas to fit in a block. + */ + function _clear(Set storage set) private { + uint256 len = _length(set); + for (uint256 i = 0; i < len; ++i) { + delete set._positions[set._values[i]]; + } + Arrays.unsafeSetLength(set._values, 0); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function _contains(Set storage set, bytes32 value) private view returns (bool) { + return set._positions[value] != 0; + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function _length(Set storage set) private view returns (uint256) { + return set._values.length; + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function _at(Set storage set, uint256 index) private view returns (bytes32) { + return set._values[index]; + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function _values(Set storage set) private view returns (bytes32[] memory) { + return set._values; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function _values(Set storage set, uint256 start, uint256 end) private view returns (bytes32[] memory) { + unchecked { + end = Math.min(end, _length(set)); + start = Math.min(start, end); + + uint256 len = end - start; + bytes32[] memory result = new bytes32[](len); + for (uint256 i = 0; i < len; ++i) { + result[i] = Arrays.unsafeAccess(set._values, start + i).value; + } + return result; + } + } + + // Bytes32Set + + struct Bytes32Set { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { + return _add(set._inner, value); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { + return _remove(set._inner, value); + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the + * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block. + */ + function clear(Bytes32Set storage set) internal { + _clear(set._inner); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { + return _contains(set._inner, value); + } + + /** + * @dev Returns the number of values in the set. O(1). + */ + function length(Bytes32Set storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { + return _at(set._inner, index); + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { + bytes32[] memory store = _values(set._inner); + bytes32[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(Bytes32Set storage set, uint256 start, uint256 end) internal view returns (bytes32[] memory) { + bytes32[] memory store = _values(set._inner, start, end); + bytes32[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + // AddressSet + + struct AddressSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(AddressSet storage set, address value) internal returns (bool) { + return _add(set._inner, bytes32(uint256(uint160(value)))); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(AddressSet storage set, address value) internal returns (bool) { + return _remove(set._inner, bytes32(uint256(uint160(value)))); + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the + * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block. + */ + function clear(AddressSet storage set) internal { + _clear(set._inner); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(AddressSet storage set, address value) internal view returns (bool) { + return _contains(set._inner, bytes32(uint256(uint160(value)))); + } + + /** + * @dev Returns the number of values in the set. O(1). + */ + function length(AddressSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(AddressSet storage set, uint256 index) internal view returns (address) { + return address(uint160(uint256(_at(set._inner, index)))); + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(AddressSet storage set) internal view returns (address[] memory) { + bytes32[] memory store = _values(set._inner); + address[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(AddressSet storage set, uint256 start, uint256 end) internal view returns (address[] memory) { + bytes32[] memory store = _values(set._inner, start, end); + address[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + // UintSet + + struct UintSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(UintSet storage set, uint256 value) internal returns (bool) { + return _add(set._inner, bytes32(value)); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(UintSet storage set, uint256 value) internal returns (bool) { + return _remove(set._inner, bytes32(value)); + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the + * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block. + */ + function clear(UintSet storage set) internal { + _clear(set._inner); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(UintSet storage set, uint256 value) internal view returns (bool) { + return _contains(set._inner, bytes32(value)); + } + + /** + * @dev Returns the number of values in the set. O(1). + */ + function length(UintSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(UintSet storage set, uint256 index) internal view returns (uint256) { + return uint256(_at(set._inner, index)); + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(UintSet storage set) internal view returns (uint256[] memory) { + bytes32[] memory store = _values(set._inner); + uint256[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(UintSet storage set, uint256 start, uint256 end) internal view returns (uint256[] memory) { + bytes32[] memory store = _values(set._inner, start, end); + uint256[] memory result; + + assembly ("memory-safe") { + result := store + } + + return result; + } + + struct StringSet { + // Storage of set values + string[] _values; + // Position is the index of the value in the `values` array plus 1. + // Position 0 is used to mean a value is not in the set. + mapping(string value => uint256) _positions; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(StringSet storage set, string memory value) internal returns (bool) { + if (!contains(set, value)) { + set._values.push(value); + // The value is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + set._positions[value] = set._values.length; + return true; + } else { + return false; + } + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(StringSet storage set, string memory value) internal returns (bool) { + // We cache the value's position to prevent multiple reads from the same storage slot + uint256 position = set._positions[value]; + + if (position != 0) { + // Equivalent to contains(set, value) + // To delete an element from the _values array in O(1), we swap the element to delete with the last one in + // the array, and then remove the last element (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 valueIndex = position - 1; + uint256 lastIndex = set._values.length - 1; + + if (valueIndex != lastIndex) { + string memory lastValue = set._values[lastIndex]; + + // Move the lastValue to the index where the value to delete is + set._values[valueIndex] = lastValue; + // Update the tracked position of the lastValue (that was just moved) + set._positions[lastValue] = position; + } + + // Delete the slot where the moved value was stored + set._values.pop(); + + // Delete the tracked position for the deleted slot + delete set._positions[value]; + + return true; + } else { + return false; + } + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the + * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block. + */ + function clear(StringSet storage set) internal { + uint256 len = length(set); + for (uint256 i = 0; i < len; ++i) { + delete set._positions[set._values[i]]; + } + Arrays.unsafeSetLength(set._values, 0); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(StringSet storage set, string memory value) internal view returns (bool) { + return set._positions[value] != 0; + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function length(StringSet storage set) internal view returns (uint256) { + return set._values.length; + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(StringSet storage set, uint256 index) internal view returns (string memory) { + return set._values[index]; + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(StringSet storage set) internal view returns (string[] memory) { + return set._values; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(StringSet storage set, uint256 start, uint256 end) internal view returns (string[] memory) { + unchecked { + end = Math.min(end, length(set)); + start = Math.min(start, end); + + uint256 len = end - start; + string[] memory result = new string[](len); + for (uint256 i = 0; i < len; ++i) { + result[i] = Arrays.unsafeAccess(set._values, start + i).value; + } + return result; + } + } + + struct BytesSet { + // Storage of set values + bytes[] _values; + // Position is the index of the value in the `values` array plus 1. + // Position 0 is used to mean a value is not in the set. + mapping(bytes value => uint256) _positions; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(BytesSet storage set, bytes memory value) internal returns (bool) { + if (!contains(set, value)) { + set._values.push(value); + // The value is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + set._positions[value] = set._values.length; + return true; + } else { + return false; + } + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(BytesSet storage set, bytes memory value) internal returns (bool) { + // We cache the value's position to prevent multiple reads from the same storage slot + uint256 position = set._positions[value]; + + if (position != 0) { + // Equivalent to contains(set, value) + // To delete an element from the _values array in O(1), we swap the element to delete with the last one in + // the array, and then remove the last element (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 valueIndex = position - 1; + uint256 lastIndex = set._values.length - 1; + + if (valueIndex != lastIndex) { + bytes memory lastValue = set._values[lastIndex]; + + // Move the lastValue to the index where the value to delete is + set._values[valueIndex] = lastValue; + // Update the tracked position of the lastValue (that was just moved) + set._positions[lastValue] = position; + } + + // Delete the slot where the moved value was stored + set._values.pop(); + + // Delete the tracked position for the deleted slot + delete set._positions[value]; + + return true; + } else { + return false; + } + } + + /** + * @dev Removes all the values from a set. O(n). + * + * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the + * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block. + */ + function clear(BytesSet storage set) internal { + uint256 len = length(set); + for (uint256 i = 0; i < len; ++i) { + delete set._positions[set._values[i]]; + } + Arrays.unsafeSetLength(set._values, 0); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(BytesSet storage set, bytes memory value) internal view returns (bool) { + return set._positions[value] != 0; + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function length(BytesSet storage set) internal view returns (uint256) { + return set._values.length; + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(BytesSet storage set, uint256 index) internal view returns (bytes memory) { + return set._values[index]; + } + + /** + * @dev Return the entire set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(BytesSet storage set) internal view returns (bytes[] memory) { + return set._values; + } + + /** + * @dev Return a slice of the set in an array + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function values(BytesSet storage set, uint256 start, uint256 end) internal view returns (bytes[] memory) { + unchecked { + end = Math.min(end, length(set)); + start = Math.min(start, end); + + uint256 len = end - start; + bytes[] memory result = new bytes[](len); + for (uint256 i = 0; i < len; ++i) { + result[i] = Arrays.unsafeAccess(set._values, start + i).value; + } + return result; + } + } +} + +// lib/openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (access/extensions/AccessControlEnumerable.sol) + +/** + * @dev Extension of {AccessControl} that allows enumerating the members of each role. + */ +abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { + using EnumerableSet for EnumerableSet.AddressSet; + + mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers; + + /// @inheritdoc IERC165 + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); + } + + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) { + return _roleMembers[role].at(index); + } + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) { + return _roleMembers[role].length(); + } + + /** + * @dev Return all accounts that have `role` + * + * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that + * this function has an unbounded cost, and using it as part of a state-changing function may render the function + * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. + */ + function getRoleMembers(bytes32 role) public view virtual returns (address[] memory) { + return _roleMembers[role].values(); + } + + /** + * @dev Overload {AccessControl-_grantRole} to track enumerable memberships + */ + function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { + bool granted = super._grantRole(role, account); + if (granted) { + _roleMembers[role].add(account); + } + return granted; + } + + /** + * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships + */ + function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { + bool revoked = super._revokeRole(role, account); + if (revoked) { + _roleMembers[role].remove(account); + } + return revoked; + } +} + +// src/deployment/DebtEngineAccessControl.sol + +/** + * @notice DebtEngine deployment with role-based access control. + * @dev Uses `AccessControlEnumerable` so role holders can be listed on-chain. + * `DEBT_MANAGER_ROLE` gates debt changes, `CREDIT_EVENTS_MANAGER_ROLE` gates credit-events changes. + */ +contract DebtEngineAccessControl is DebtEngineBase, AccessControlEnumerable, ERC2771Context { + bytes32 public constant CREDIT_EVENTS_MANAGER_ROLE = keccak256("CREDIT_EVENTS_MANAGER_ROLE"); + bytes32 public constant DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE"); + + constructor(address admin, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) { + require(admin != address(0), AdminWithAddressZeroNotAllowed()); + _grantRole(DEFAULT_ADMIN_ROLE, admin); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + function _authorizeSetDebt() internal view virtual override onlyRole(DEBT_MANAGER_ROLE) {} + + function _authorizeSetCreditEvents() internal view virtual override onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {} + + /* ============ ACCESS CONTROL ============ */ + + /** + * @dev Returns `true` if `account` has been granted `role`. + * + * NOTE: The `DEFAULT_ADMIN_ROLE` is treated as a super-admin role. + * Any account holding `DEFAULT_ADMIN_ROLE` is considered to hold every role, + * even if it was not explicitly granted via `grantRole`. + * This means `hasRole(ANY_ROLE, admin)` returns `true` for the admin. + * `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` will NOT reflect + * this implicit membership: the admin is not listed as a holder of the other roles. + * Because OpenZeppelin's `_grantRole` / `_revokeRole` consult this function, granting a role to an admin + * is a no-op, and revoking or renouncing one emits `RoleRevoked` while the admin keeps the power. + */ + function hasRole(bytes32 role, address account) + public + view + virtual + override(AccessControl, IAccessControl) + returns (bool) + { + // The Default Admin has all roles + if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { + return true; + } + return AccessControl.hasRole(role, account); + } + + /*////////////////////////////////////////////////////////////// + ERC2771 + //////////////////////////////////////////////////////////////*/ + + function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) { + return ERC2771Context._msgSender(); + } + + function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) { + return ERC2771Context._msgData(); + } + + function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) { + return ERC2771Context._contextSuffixLength(); + } +} diff --git a/doc/compilation/v0.3.0/flatten/DebtEngineOwnableFlatten.sol b/doc/compilation/v0.3.0/flatten/DebtEngineOwnableFlatten.sol new file mode 100644 index 0000000..eec3a96 --- /dev/null +++ b/doc/compilation/v0.3.0/flatten/DebtEngineOwnableFlatten.sol @@ -0,0 +1,878 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity >=0.4.16 ^0.8.20 ^0.8.27; + +// lib/openzeppelin-contracts/contracts/utils/Context.sol + +// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) + +/** + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract Context { + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes calldata) { + return msg.data; + } + + function _contextSuffixLength() internal view virtual returns (uint256) { + return 0; + } +} + +// src/DebtEngineInvariantStorage.sol + +abstract contract DebtEngineInvariantStorage { + error AdminWithAddressZeroNotAllowed(); + error BatchSizeTooLarge(uint256 size, uint256 maxSize); + error InvalidInputLength(); + error SmartContractWithAddressZeroNotAllowed(); +} + +// lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol) + +/** + * @dev Interface of the ERC-165 standard, as defined in the + * https://eips.ethereum.org/EIPS/eip-165[ERC]. + * + * Implementers can declare support of contract interfaces, which can then be + * queried by others ({ERC165Checker}). + * + * For an implementation, see {ERC165}. + */ +interface IERC165 { + /** + * @dev Returns true if this contract implements the interface defined by + * `interfaceId`. See the corresponding + * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] + * to learn more about how these ids are created. + * + * This function call must use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool); +} + +// src/modules/VersionModule.sol + +abstract contract VersionModule { + /* ============ State Variables ============ */ + /** + * @dev + * Get the current version of the smart contract + */ + string private constant VERSION = "0.3.0"; + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + /** + * @notice Returns the current version of the smart contract + */ + function version() public view virtual returns (string memory) { + return VERSION; + } +} + +// lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol + +/** +* @title IERC1643 Document Management +* @dev Part of the ERC1400 Security Token Standards +* Contrary to the original specification, use a struct Document to represent a Document +*/ +interface IERC1643 { + /// @dev Struct used to represent a document and its metadata. + struct Document { + // URI of the off-chain document (e.g., IPFS, HTTPS) + string uri; + // Hash of the document content + bytes32 documentHash; + // Timestamp of the last on-chain modification (set by the smart contract) + uint256 lastModified; + } + + // Document Management + /** + * @notice Retrieves a document by its registered name. + * @param name The unique name used to identify the document. + * @return document The associated document's metadata (URI, hash, timestamp). + */ + function getDocument(string memory name) external view returns (Document memory document); + /** + * @notice Returns the list of all document names registered in the contract. + * @return documentNames_ An array of strings representing all document identifiers. + */ + function getAllDocuments() external view returns (string[] memory documentNames_); +} + +// lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol + +// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol) + +/** + * @dev Implementation of the {IERC165} interface. + * + * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check + * for the additional interface id that will be supported. For example: + * + * ```solidity + * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); + * } + * ``` + */ +abstract contract ERC165 is IERC165 { + /// @inheritdoc IERC165 + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { + return interfaceId == type(IERC165).interfaceId; + } +} + +// lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol + +// OpenZeppelin Contracts (last updated v5.5.0) (metatx/ERC2771Context.sol) + +/** + * @dev Context variant with ERC-2771 support. + * + * WARNING: Avoid using this pattern in contracts that rely on a specific calldata length as they'll + * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC-2771 + * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected + * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive` + * function only accessible if `msg.data.length == 0`. + * + * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption. + * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender} + * recovery. + */ +abstract contract ERC2771Context is Context { + /// @custom:oz-upgrades-unsafe-allow state-variable-immutable + address private immutable _trustedForwarder; + + /** + * @dev Initializes the contract with a trusted forwarder, which will be able to + * invoke functions on this contract on behalf of other accounts. + * + * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}. + */ + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(address trustedForwarder_) { + _trustedForwarder = trustedForwarder_; + } + + /** + * @dev Returns the address of the trusted forwarder. + */ + function trustedForwarder() public view virtual returns (address) { + return _trustedForwarder; + } + + /** + * @dev Indicates whether any particular address is the trusted forwarder. + */ + function isTrustedForwarder(address forwarder) public view virtual returns (bool) { + return forwarder == trustedForwarder(); + } + + /** + * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever + * a call is not performed by the trusted forwarder or the calldata length is less than + * 20 bytes (an address length). + */ + function _msgSender() internal view virtual override returns (address) { + uint256 calldataLength = msg.data.length; + uint256 contextSuffixLength = _contextSuffixLength(); + if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) { + unchecked { + return address(bytes20(msg.data[calldataLength - contextSuffixLength:])); + } + } else { + return super._msgSender(); + } + } + + /** + * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever + * a call is not performed by the trusted forwarder or the calldata length is less than + * 20 bytes (an address length). + */ + function _msgData() internal view virtual override returns (bytes calldata) { + uint256 calldataLength = msg.data.length; + uint256 contextSuffixLength = _contextSuffixLength(); + if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) { + unchecked { + return msg.data[:calldataLength - contextSuffixLength]; + } + } else { + return super._msgData(); + } + } + + /** + * @dev ERC-2771 specifies the context as being a single address (20 bytes). + */ + function _contextSuffixLength() internal view virtual override returns (uint256) { + return 20; + } +} + +// lib/openzeppelin-contracts/contracts/access/Ownable.sol + +// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * The initial owner is set to the address provided by the deployer. This can + * later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +abstract contract Ownable is Context { + address private _owner; + + /** + * @dev The caller account is not authorized to perform an operation. + */ + error OwnableUnauthorizedAccount(address account); + + /** + * @dev The owner is not a valid owner account. (eg. `address(0)`) + */ + error OwnableInvalidOwner(address owner); + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Initializes the contract setting the address provided by the deployer as the initial owner. + */ + constructor(address initialOwner) { + if (initialOwner == address(0)) { + revert OwnableInvalidOwner(address(0)); + } + _transferOwnership(initialOwner); + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + _checkOwner(); + _; + } + + /** + * @dev Returns the address of the current owner. + */ + function owner() public view virtual returns (address) { + return _owner; + } + + /** + * @dev Throws if the sender is not the owner. + */ + function _checkOwner() internal view virtual { + if (owner() != _msgSender()) { + revert OwnableUnauthorizedAccount(_msgSender()); + } + } + + /** + * @dev Leaves the contract without owner. It will not be possible to call + * `onlyOwner` functions. Can only be called by the current owner. + * + * NOTE: Renouncing ownership will leave the contract without an owner, + * thereby disabling any functionality that is only available to the owner. + */ + function renounceOwnership() public virtual onlyOwner { + _transferOwnership(address(0)); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) public virtual onlyOwner { + if (newOwner == address(0)) { + revert OwnableInvalidOwner(address(0)); + } + _transferOwnership(newOwner); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Internal function without access restriction. + */ + function _transferOwnership(address newOwner) internal virtual { + address oldOwner = _owner; + _owner = newOwner; + emit OwnershipTransferred(oldOwner, newOwner); + } +} + +// lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol + +interface IERC1643CMTAT { + struct DocumentInfo { + string name; + string uri; + bytes32 documentHash; + } +} + + +// lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol + +/** +* The issuer must be able to “deactivate” the smart contract, to prevent execution of transactions on +* the distributed ledger. +* Contrary to the “burn” function, the “deactivateContract” function +* affects all tokens in issuance, and not only some of them. +* +* a) This function is necessary to allow the issuer to carry out certain corporate actions +* (e.g. share splits, reverse splits or mergers), which +* require that all existing tokens are either canceled or immobilized and decoupled from the shares +* (i.e. the tokens no longer represent shares). +* +* b) The “deactivateContract” function can also be used if the issuer decides that it no longer wishes +* to have its shares issued in the form of ledger-based securities +* +* The “deactivateContract” function does not delete the smart contract’s +* storage and code, i.e. tokens are not burned by the function, however it permanently and +* irreversibly deactivates the smart contract (unless a proxy is used). +* +*/ +interface ICMTATDeactivate { + /** + * @notice Emitted when the contract is permanently deactivated. + * @param account The address that performed the deactivation. + */ + event Deactivated(address account); + + /* + * @notice Permanently deactivates the contract. + * @dev + * This action is irreversible — once executed, the contract cannot be reactivated. + * Requirements: + * - The contract MUST be paused before deactivation is allowed. + * Emits a {Deactivated} event. + * WARNING: Use with caution. This action permanently disables core contract functionality. + */ + function deactivateContract() external; + + /** + * @notice Returns whether the contract has been permanently deactivated. + * @return isDeactivated A boolean indicating the deactivation status. + * @dev Returns `true` if `deactivateContract()` has been successfully called. + */ + function deactivated() external view returns (bool isDeactivated) ; +} + +/** +* @title ICMTATBase - Core Tokenization Metadata Interface as part of CMTAT specification +* @notice Defines base properties and metadata structure for a tokenized asset. +* @dev Includes token ID, terms (using IERC1643-compliant document), and a general information field. +*/ +interface ICMTATBase { + /* ============ Struct ============ */ + /* + * @dev A reference to (e.g. in the form of an Internet address) or a hash of the tokenization terms + */ + struct Terms { + string name; + IERC1643.Document doc; + } + /* ============ Events ============ */ + /** + * @notice Emitted when the general information field is updated. + * @param newInformation The newly assigned metadata or descriptive text. + */ + event Information( + string newInformation + ); + /** + * @notice Emitted when new tokenization terms are set. + * @param newTerm The new Terms structure containing name and document reference. + */ + event Term(Terms newTerm); + + /** + * @notice Emitted when the token ID is set or updated. + * @param newTokenIdIndexed The token ID (indexed for filtering). + * @param newTokenId The full token ID string. + */ + event TokenId(string indexed newTokenIdIndexed, string newTokenId); + + /* ============ View Functions ============ */ + + /* + * @notice return tokenization tokenId + */ + function tokenId() external view returns (string memory tokenId_); + /* + * @notice returns tokenization terms + */ + function terms() external view returns (Terms memory terms_); + + /* + * @notice returns information field + */ + function information() external view returns (string memory information_); + + /* ============ Write Functions ============ */ + /** + * @notice Sets a new tokenization token ID. + * @param tokenId_ The token ID string to assign to the tokenized asset. + */ + function setTokenId( + string calldata tokenId_ + ) external ; + + /** + * @notice Sets new tokenization terms using a document reference. + * @param terms_ The `DocumentInfo` structure referencing the terms document (name + URI + hash). + */ + function setTerms(IERC1643CMTAT.DocumentInfo calldata terms_) external; + + /** + * @notice Sets or updates the general information field. + * @param information_ A string describing token attributes, usage, or metadata URI. + */ + function setInformation( + string calldata information_ + ) external; +} + +interface ICMTATCreditEvents { + /** + * @notice Returns credit events + */ + function creditEvents() external view returns(CreditEvents memory creditEvents_); + + struct CreditEvents { + bool flagDefault; + bool flagRedeemed; + string rating; + } +} +/** +* @notice interface to represent debt tokens +*/ +interface ICMTATDebt { + struct DebtInformation { + DebtIdentifier debtIdentifier; + DebtInstrument debtInstrument; + } + /** + * @dev Information on the issuer and other persons involved + */ + struct DebtIdentifier { + string issuerName; + string issuerDescription; + string guarantor; + string debtHolder; + } + /** + * dev Information on the Instruments + */ + struct DebtInstrument { + // uint256 + uint256 interestRate; + uint256 parValue; + uint256 minimumDenomination; + // string + string issuanceDate; + string maturityDate; + string couponPaymentFrequency; + /* + * Interest schedule format (if any). The purpose of the interest schedule is to set, in the parameters of the smart + * contract, the dates on which the interest payments accrue. + * - Format A: start date/end date/period + * - Format B: start date/end date/day of period (e.g. quarter or year) + * - Format C: date 1/date 2/date 3/…. + */ + string interestScheduleFormat; + /* + * - Format A: period (indicating the period between the accrual date for the interest payment and the date on + * which the payment is scheduled to be made) + * - Format B: specific date + */ + string interestPaymentDate; + string dayCountConvention; + string businessDayConvention; + string currency; + // address + address currencyContract; + } + /** + * @notice Returns debt information + */ + function debt() external view returns(DebtInformation memory debtInformation_); +} + +// lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol + +// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol) + +/** + * @dev Contract module which provides access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * This extension of the {Ownable} contract includes a two-step mechanism to transfer + * ownership, where the new owner must call {acceptOwnership} in order to replace the + * old one. This can help prevent common mistakes, such as transfers of ownership to + * incorrect accounts, or to contracts that are unable to interact with the + * permission system. + * + * The initial owner is specified at deployment time in the constructor for `Ownable`. This + * can later be changed with {transferOwnership} and {acceptOwnership}. + * + * This module is used through inheritance. It will make available all functions + * from parent (Ownable). + */ +abstract contract Ownable2Step is Ownable { + address private _pendingOwner; + + event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Returns the address of the pending owner. + */ + function pendingOwner() public view virtual returns (address) { + return _pendingOwner; + } + + /** + * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. + * Can only be called by the current owner. + * + * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer. + */ + function transferOwnership(address newOwner) public virtual override onlyOwner { + _pendingOwner = newOwner; + emit OwnershipTransferStarted(owner(), newOwner); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. + * Internal function without access restriction. + */ + function _transferOwnership(address newOwner) internal virtual override { + delete _pendingOwner; + super._transferOwnership(newOwner); + } + + /** + * @dev The new owner accepts the ownership transfer. + */ + function acceptOwnership() public virtual { + address sender = _msgSender(); + if (pendingOwner() != sender) { + revert OwnableUnauthorizedAccount(sender); + } + _transferOwnership(sender); + } +} + +// lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol + +/* +* @dev minimum interface to define a DebtEngine +*/ +interface IDebtEngine is ICMTATDebt, ICMTATCreditEvents { + // nothing more +} + +// src/DebtEngineBase.sol + +abstract contract DebtEngineBase is IDebtEngine, DebtEngineInvariantStorage, VersionModule { + // Events + event DebtSet(address indexed smartContract); + event CreditEventsSet(address indexed smartContract); + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + // Mapping of debts and credit events to specific smart contracts + mapping(address => DebtInformation) private _debts; + mapping(address => CreditEvents) private _creditEvents; + + // Track whether debt/credit events have been explicitly set + mapping(address => bool) private _debtSet; + mapping(address => bool) private _creditEventsSet; + + /** + * @notice Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`. + * @dev A hard ceiling, not a recommended batch size. Every entry writes its whole struct to storage, + * so on a network with a per-transaction gas cap (Ethereum mainnet: 2^24 gas since EIP-7825) a batch + * of realistic records runs out of gas long before this limit. Size batches from a gas estimate. + */ + uint256 public constant MAX_BATCH_SIZE = 500; + + modifier onlyDebtManager() { + _authorizeSetDebt(); + _; + } + + modifier onlyCreditEventsManager() { + _authorizeSetCreditEvents(); + _; + } + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /* ============ USER-FACING FUNCTIONS ============ */ + /** + * @notice Function to get the debt for the sender's smart contract + */ + function debt() external view virtual returns (DebtInformation memory) { + return debt(_msgSender()); + } + + /** + * @notice Function to get the debt for a specific smart contract + */ + function debt(address smartContract_) public view virtual returns (DebtInformation memory) { + return _debts[smartContract_]; + } + + /** + * @notice Function to get the credit events for the sender's smart contract + */ + function creditEvents() external view virtual returns (CreditEvents memory) { + return creditEvents(_msgSender()); + } + + /** + * @notice Function to get the credit events for a specific smart contract + */ + function creditEvents(address smartContract_) public view virtual returns (CreditEvents memory) { + return _creditEvents[smartContract_]; + } + + /** + * @notice Returns true if a debt record is currently set for the given smart contract + * @dev True after {setDebt} / {setDebtBatch}, false again after {clearDebt}. + */ + function hasDebt(address smartContract_) external view virtual returns (bool) { + return _debtSet[smartContract_]; + } + + /** + * @notice Returns true if credit events are currently set for the given smart contract + * @dev True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}. + */ + function hasCreditEvents(address smartContract_) external view virtual returns (bool) { + return _creditEventsSet[smartContract_]; + } + + /* ============ RESTRICTED-FACING FUNCTIONS ============ */ + /** + * @notice Function to set the debt for a given smart contract + */ + function setDebt(address smartContract_, DebtInformation calldata debt_) external virtual onlyDebtManager { + _setDebt(smartContract_, debt_); + } + + /** + * @notice Function to set the credit events for a given smart contract + */ + function setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) + external + virtual + onlyCreditEventsManager + { + _setCreditEvents(smartContract_, creditEvents_); + } + + /** + * @notice Batch version of {setCreditEvents} + */ + function setCreditEventsBatch(address[] calldata smartContracts, CreditEvents[] calldata creditEventsList) + external + virtual + onlyCreditEventsManager + { + require(smartContracts.length == creditEventsList.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setCreditEvents(smartContracts[i], creditEventsList[i]); + } + } + + /** + * @notice Batch version of {setDebt} + */ + function setDebtBatch(address[] calldata smartContracts, DebtInformation[] calldata debts) + external + virtual + onlyDebtManager + { + require(smartContracts.length == debts.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setDebt(smartContracts[i], debts[i]); + } + } + + /** + * @notice Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards + * and `debt(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {DebtCleared}. + */ + function clearDebt(address smartContract_) external virtual onlyDebtManager { + _clearDebt(smartContract_); + } + + /** + * @notice Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards + * and `creditEvents(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {CreditEventsCleared}. + */ + function clearCreditEvents(address smartContract_) external virtual onlyCreditEventsManager { + _clearCreditEvents(smartContract_); + } + + /*////////////////////////////////////////////////////////////// + INTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /** + * @dev Single write path for debt: rejects `address(0)`, stores the record, marks it as set + * and emits {DebtSet}. Every public setter goes through it, so none can skip a step. + */ + function _setDebt(address smartContract_, DebtInformation calldata debt_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _debts[smartContract_] = debt_; + _debtSet[smartContract_] = true; + emit DebtSet(smartContract_); + } + + /** + * @dev Single write path for credit events: rejects `address(0)`, stores the record, marks it + * as set and emits {CreditEventsSet}. Every public setter goes through it. + */ + function _setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _creditEvents[smartContract_] = creditEvents_; + _creditEventsSet[smartContract_] = true; + emit CreditEventsSet(smartContract_); + } + + /** + * @dev Single delete path for debt: rejects `address(0)` (as `_setDebt` does), removes the record + * and its "set" flag, emits {DebtCleared}. + */ + function _clearDebt(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + + /** + * @dev Single delete path for credit events: rejects `address(0)` (as `_setCreditEvents` does), + * removes the record and its "set" flag, emits {CreditEventsCleared}. + */ + function _clearCreditEvents(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _creditEvents[smartContract_]; + delete _creditEventsSet[smartContract_]; + emit CreditEventsCleared(smartContract_); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + /** + * @notice Authorization hook invoked before any debt change (`setDebt`, `setDebtBatch`, `clearDebt`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetDebt() internal view virtual; + + /** + * @notice Authorization hook invoked before any credit-events change (`setCreditEvents`, `setCreditEventsBatch`, + * `clearCreditEvents`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetCreditEvents() internal view virtual; + + /* ============ CONTEXT ============ */ + + /** + * @dev Returns the sender of the transaction. + * Can be overridden to support meta-transactions (ERC2771). + */ + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } +} + +// src/deployment/DebtEngineOwnable.sol + +/** + * @notice DebtEngine deployment where a single owner manages both debt and credit events. + * @dev Ownership transfer is two-step (`transferOwnership` then `acceptOwnership` by the new owner). + * Every authorization hook collapses to `onlyOwner`, so this variant cannot separate duties. + * Advertises ERC-173 (contract ownership) through ERC-165. + */ +contract DebtEngineOwnable is DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 { + /// @dev ERC-165 identifier of the ERC-173 interface (`owner()` ^ `transferOwnership(address)`). + bytes4 private constant ERC173_INTERFACE_ID = 0x7f5828d0; + + constructor(address owner, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) Ownable(owner) {} + + /* ============ ERC-165 ============ */ + + /** + * @inheritdoc ERC165 + * @dev Returns true for ERC-173 and ERC-165. + */ + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return interfaceId == ERC173_INTERFACE_ID || super.supportsInterface(interfaceId); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + function _authorizeSetDebt() internal view virtual override onlyOwner {} + + function _authorizeSetCreditEvents() internal view virtual override onlyOwner {} + + /*////////////////////////////////////////////////////////////// + ERC2771 + //////////////////////////////////////////////////////////////*/ + + function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) { + return ERC2771Context._msgSender(); + } + + function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) { + return ERC2771Context._msgData(); + } + + function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) { + return ERC2771Context._contextSuffixLength(); + } +} diff --git a/doc/compilation/v0.3.0/foundry/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json b/doc/compilation/v0.3.0/foundry/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json new file mode 100644 index 0000000..3be1e56 --- /dev/null +++ b/doc/compilation/v0.3.0/foundry/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json @@ -0,0 +1 @@ +{"abi":[{"type":"constructor","inputs":[{"name":"admin","type":"address","internalType":"address"},{"name":"forwarderIrrevocable","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"CREDIT_EVENTS_MANAGER_ROLE","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"DEBT_MANAGER_ROLE","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"DEFAULT_ADMIN_ROLE","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"MAX_BATCH_SIZE","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"clearCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"clearDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"creditEvents","inputs":[],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"stateMutability":"view"},{"type":"function","name":"creditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"stateMutability":"view"},{"type":"function","name":"debt","inputs":[],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"stateMutability":"view"},{"type":"function","name":"debt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"stateMutability":"view"},{"type":"function","name":"getRoleAdmin","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"getRoleMember","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"index","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"getRoleMemberCount","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getRoleMembers","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"","type":"address[]","internalType":"address[]"}],"stateMutability":"view"},{"type":"function","name":"grantRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"hasCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"hasDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"hasRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"isTrustedForwarder","inputs":[{"name":"forwarder","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"renounceRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"callerConfirmation","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"},{"name":"creditEvents_","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCreditEventsBatch","inputs":[{"name":"smartContracts","type":"address[]","internalType":"address[]"},{"name":"creditEventsList","type":"tuple[]","internalType":"struct ICMTATCreditEvents.CreditEvents[]","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"},{"name":"debt_","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDebtBatch","inputs":[{"name":"smartContracts","type":"address[]","internalType":"address[]"},{"name":"debts","type":"tuple[]","internalType":"struct ICMTATDebt.DebtInformation[]","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"supportsInterface","inputs":[{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"trustedForwarder","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"type":"event","name":"CreditEventsCleared","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"CreditEventsSet","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"DebtCleared","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"DebtSet","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"previousAdminRole","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"newAdminRole","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"account","type":"address","indexed":true,"internalType":"address"},{"name":"sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"account","type":"address","indexed":true,"internalType":"address"},{"name":"sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"AccessControlBadConfirmation","inputs":[]},{"type":"error","name":"AccessControlUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"},{"name":"neededRole","type":"bytes32","internalType":"bytes32"}]},{"type":"error","name":"AdminWithAddressZeroNotAllowed","inputs":[]},{"type":"error","name":"BatchSizeTooLarge","inputs":[{"name":"size","type":"uint256","internalType":"uint256"},{"name":"maxSize","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"InvalidInputLength","inputs":[]},{"type":"error","name":"SmartContractWithAddressZeroNotAllowed","inputs":[]}],"bytecode":{"object":"0x60a060405234801561000f575f5ffd5b5060405161277d38038061277d83398101604081905261002e91610293565b6001600160a01b03808216608052821661005b5760405163f2b08d8760e01b815260040160405180910390fd5b6100655f8361006d565b505050610323565b5f8061007984846100a3565b9050801561009a575f8481526005602052604090206100989084610135565b505b90505b92915050565b5f6100ae8383610149565b61012e575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556100e66101ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161009d565b505f61009d565b5f61009a836001600160a01b0384166101c8565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff16156101905750600161009d565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff1661009a565b5f6101c361020d565b905090565b5f81815260018301602052604081205461012e57508154600181810184555f84815260208082209093018490558454848252828601909352604090209190915561009d565b5f366014808210801590610225575061022533610253565b1561024b5761023836828403815f6102c4565b610241916102eb565b60601c9250505090565b339250505090565b5f61025d60805190565b6001600160a01b0316826001600160a01b0316149050919050565b80516001600160a01b038116811461028e575f5ffd5b919050565b5f5f604083850312156102a4575f5ffd5b6102ad83610278565b91506102bb60208401610278565b90509250929050565b5f5f858511156102d2575f5ffd5b838611156102de575f5ffd5b5050820193919092039150565b80356001600160601b0319811690601484101561031c576001600160601b0319601485900360031b81901b82161691505b5092915050565b6080516124346103495f395f81816102b30152818161031001526114d701526124345ff3fe608060405234801561000f575f5ffd5b50600436106101bb575f3560e01c806396c3e905116100f3578063b05e5a4111610093578063cfdbf2541161006e578063cfdbf25414610468578063d547741f14610471578063ef67350314610484578063f423aa6c14610497575f5ffd5b8063b05e5a411461042f578063c41a71ff14610442578063ca15c87314610455575f5ffd5b8063a1de54de116100ce578063a1de54de146103ce578063a217fddf146103f5578063a3246ad3146103fc578063a65682021461041c575f5ffd5b806396c3e9051461039557806399db0828146103a85780639b6c56ec146103bb575f5ffd5b806354fd4d501161015e5780637da0a877116101395780637da0a8771461030e5780638a42115f146103485780639010d07c1461036f57806391d1485414610382575f5ffd5b806354fd4d501461027c578063572b6c05146102a3578063591236f7146102e3575f5ffd5b80632f2ff15d116101995780632f2ff15d1461022c57806336568abe14610241578063498de65c1461025457806350101d8414610267575f5ffd5b806301ffc9a7146101bf5780630dca59c1146101e7578063248a9ca3146101fc575b5f5ffd5b6101d26101cd36600461194e565b6104c2565b60405190151581526020015b60405180910390f35b6101ef6104ec565b6040516101de91906119a3565b61021e61020a366004611b4e565b5f9081526004602052604090206001015490565b6040519081526020016101de565b61023f61023a366004611b79565b610504565b005b61023f61024f366004611b79565b61052e565b61023f610262366004611ba7565b610576565b61026f61058a565b6040516101de9190611bc2565b60408051808201825260058152640302e332e360dc1b602082015290516101de9190611bfc565b6101d26102b1366004611ba7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6101d26102f1366004611ba7565b6001600160a01b03165f9081526003602052604090205460ff1690565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016101de565b61021e7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f81565b61033061037d366004611c0e565b6105b0565b6101d2610390366004611b79565b6105ce565b61023f6103a3366004611ba7565b61063f565b61023f6103b6366004611c2e565b610650565b6101ef6103c9366004611ba7565b610666565b61021e7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f834781565b61021e5f81565b61040f61040a366004611b4e565b610da8565b6040516101de9190611c76565b61023f61042a366004611cc1565b610dc1565b61023f61043d366004611d51565b610dd3565b61023f610450366004611d51565b610e9c565b61021e610463366004611b4e565b610f59565b61021e6101f481565b61023f61047f366004611b79565b610f6f565b61026f610492366004611ba7565b610f93565b6101d26104a5366004611ba7565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b03198216635a05180f60e01b14806104e657506104e682611086565b92915050565b6104f461185f565b6104ff6103c96110ba565b905090565b5f8281526004602052604090206001015461051e816110c3565b61052883836110d4565b50505050565b6105366110ba565b6001600160a01b0316816001600160a01b0316146105675760405163334bd91960e11b815260040160405180910390fd5b6105718282611107565b505050565b61057e611132565b6105878161115c565b50565b60408051606080820183525f8083526020830152918101919091526104ff6104926110ba565b5f8281526005602052604081206105c790836112ab565b9392505050565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff1615610615575060016104e6565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff166105c7565b6106476112b6565b610587816112e0565b6106586112b6565b6106628282611381565b5050565b61066e61185f565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906106a890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490611dbd565b801561071f5780601f106106f65761010080835404028352916020019161071f565b820191905f5260205f20905b81548152906001019060200180831161070257829003601f168201915b5050505050815260200160018201805461073890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461076490611dbd565b80156107af5780601f10610786576101008083540402835291602001916107af565b820191905f5260205f20905b81548152906001019060200180831161079257829003601f168201915b505050505081526020016002820180546107c890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546107f490611dbd565b801561083f5780601f106108165761010080835404028352916020019161083f565b820191905f5260205f20905b81548152906001019060200180831161082257829003601f168201915b5050505050815260200160038201805461085890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461088490611dbd565b80156108cf5780601f106108a6576101008083540402835291602001916108cf565b820191905f5260205f20905b8154815290600101906020018083116108b257829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461091a90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461094690611dbd565b80156109915780601f1061096857610100808354040283529160200191610991565b820191905f5260205f20905b81548152906001019060200180831161097457829003601f168201915b505050505081526020016004820180546109aa90611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546109d690611dbd565b8015610a215780601f106109f857610100808354040283529160200191610a21565b820191905f5260205f20905b815481529060010190602001808311610a0457829003601f168201915b50505050508152602001600582018054610a3a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6690611dbd565b8015610ab15780601f10610a8857610100808354040283529160200191610ab1565b820191905f5260205f20905b815481529060010190602001808311610a9457829003601f168201915b50505050508152602001600682018054610aca90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610af690611dbd565b8015610b415780601f10610b1857610100808354040283529160200191610b41565b820191905f5260205f20905b815481529060010190602001808311610b2457829003601f168201915b50505050508152602001600782018054610b5a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8690611dbd565b8015610bd15780601f10610ba857610100808354040283529160200191610bd1565b820191905f5260205f20905b815481529060010190602001808311610bb457829003601f168201915b50505050508152602001600882018054610bea90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1690611dbd565b8015610c615780601f10610c3857610100808354040283529160200191610c61565b820191905f5260205f20905b815481529060010190602001808311610c4457829003601f168201915b50505050508152602001600982018054610c7a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca690611dbd565b8015610cf15780601f10610cc857610100808354040283529160200191610cf1565b820191905f5260205f20905b815481529060010190602001808311610cd457829003601f168201915b50505050508152602001600a82018054610d0a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3690611dbd565b8015610d815780601f10610d5857610100808354040283529160200191610d81565b820191905f5260205f20905b815481529060010190602001808311610d6457829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b5f8181526005602052604090206060906104e690611419565b610dc9611132565b6106628282611425565b610ddb611132565b828114610dfb57604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610e2d5760405162ef8cfb60e11b8152600481019290925260248201526044015b60405180910390fd5b505f90505b83811015610e9557610e8d858583818110610e4f57610e4f611df5565b9050602002016020810190610e649190611ba7565b848484818110610e7657610e76611df5565b9050602002810190610e889190611e09565b611425565b600101610e32565b5050505050565b610ea46112b6565b828114610ec457604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610ef15760405162ef8cfb60e11b815260048101929092526024820152604401610e24565b505f90505b83811015610e9557610f51858583818110610f1357610f13611df5565b9050602002016020810190610f289190611ba7565b848484818110610f3a57610f3a611df5565b9050602002810190610f4c9190611e27565b611381565b600101610ef6565b5f8181526005602052604081206104e6906114bd565b5f82815260046020526040902060010154610f89816110c3565b6105288383611107565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610fff90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461102b90611dbd565b80156110765780601f1061104d57610100808354040283529160200191611076565b820191905f5260205f20905b81548152906001019060200180831161105957829003601f168201915b5050505050815250509050919050565b5f6001600160e01b03198216637965db0b60e01b14806104e657506301ffc9a760e01b6001600160e01b03198316146104e6565b5f6104ff6114c6565b610587816110cf6110ba565b611535565b5f5f6110e0848461156e565b905080156105c7575f8481526005602052604090206110ff9084611600565b509392505050565b5f5f6111138484611614565b905080156105c7575f8481526005602052604090206110ff908461169d565b7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f610587816110c3565b6001600160a01b038116611183576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526020819052604081209081816111a78282611908565b6111b4600183015f611908565b6111c1600283015f611908565b6111ce600383015f611908565b50505f600483018181556005840182905560068401829055906111f46007850182611908565b611201600483015f611908565b61120e600583015f611908565b61121b600683015f611908565b611228600783015f611908565b611235600883015f611908565b611242600983015f611908565b61124f600a83015f611908565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b5f6105c783836116b1565b7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f8347610587816110c3565b6001600160a01b038116611307576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff19168155919061133790830182611908565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b0382166113a8576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906113cb8282611fc1565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b60605f6105c7836116d7565b6001600160a01b03821661144c576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061146f8282612220565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f6104e6825490565b5f36601480821080159061150257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156115285761151536828403815f612364565b61151e9161238b565b60601c9250505090565b339250505090565b505090565b61153f82826105ce565b6106625760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e24565b5f61157983836105ce565b6115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556115b16110ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104e6565b505f6104e6565b5f6105c7836001600160a01b038416611730565b5f61161f83836105ce565b156115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191690556116556110ba565b6001600160a01b0316826001600160a01b0316847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45060016104e6565b5f6105c7836001600160a01b038416611775565b5f825f0182815481106116c6576116c6611df5565b905f5260205f200154905092915050565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561172457602002820191905f5260205f20905b815481526020019060010190808311611710575b50505050509050919050565b5f8181526001830160205260408120546115f957508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556104e6565b5f818152600183016020526040812054801561184f575f6117976001836123cb565b85549091505f906117aa906001906123cb565b9050808214611809575f865f0182815481106117c8576117c8611df5565b905f5260205f200154905080875f0184815481106117e8576117e8611df5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061181a5761181a6123ea565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506104e6565b5f9150506104e6565b5092915050565b60405180604001604052806118956040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016119036040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b50805461191490611dbd565b5f825580601f10611923575050565b601f0160209004905f5260205f209061058791905f5b80821115611530575f81840155600101611939565b5f6020828403121561195e575f5ffd5b81356001600160e01b0319811681146105c7575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526119c760e0850182611975565b90506020820151605f198583030160808601526119e48282611975565b9150506040820151605f198583030160a0860152611a028282611975565b91505060608201519150605f198482030160c0850152611a228183611975565b9150506020840151601f1984830301604085015280518252602081015160208301526040810151604083015260608101516101806060840152611a69610180840182611975565b905060808201518382036080850152611a828282611975565b91505060a082015183820360a0850152611a9c8282611975565b91505060c082015183820360c0850152611ab68282611975565b91505060e082015183820360e0850152611ad08282611975565b915050610100820151838203610100850152611aec8282611975565b915050610120820151838203610120850152611b088282611975565b915050610140820151838203610140850152611b248282611975565b9150506101608201519150611b456101608401836001600160a01b03169052565b95945050505050565b5f60208284031215611b5e575f5ffd5b5035919050565b6001600160a01b0381168114610587575f5ffd5b5f5f60408385031215611b8a575f5ffd5b823591506020830135611b9c81611b65565b809150509250929050565b5f60208284031215611bb7575f5ffd5b81356105c781611b65565b602081528151151560208201526020820151151560408201525f6040830151606080840152611bf46080840182611975565b949350505050565b602081525f6105c76020830184611975565b5f5f60408385031215611c1f575f5ffd5b50508035926020909101359150565b5f5f60408385031215611c3f575f5ffd5b8235611c4a81611b65565b9150602083013567ffffffffffffffff811115611c65575f5ffd5b830160608186031215611b9c575f5ffd5b602080825282518282018190525f918401906040840190835b81811015611cb65783516001600160a01b0316835260209384019390920191600101611c8f565b509095945050505050565b5f5f60408385031215611cd2575f5ffd5b8235611cdd81611b65565b9150602083013567ffffffffffffffff811115611cf8575f5ffd5b830160408186031215611b9c575f5ffd5b5f5f83601f840112611d19575f5ffd5b50813567ffffffffffffffff811115611d30575f5ffd5b6020830191508360208260051b8501011115611d4a575f5ffd5b9250929050565b5f5f5f5f60408587031215611d64575f5ffd5b843567ffffffffffffffff811115611d7a575f5ffd5b611d8687828801611d09565b909550935050602085013567ffffffffffffffff811115611da5575f5ffd5b611db187828801611d09565b95989497509550505050565b600181811c90821680611dd157607f821691505b602082108103611def57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e19833603018112611e1d575f5ffd5b9190910192915050565b5f8235605e19833603018112611e1d575f5ffd5b5f813580151581146104e6575f5ffd5b5f5f8335601e19843603018112611e60575f5ffd5b83018035915067ffffffffffffffff821115611e7a575f5ffd5b602001915036819003821315611d4a575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610571578282111561057157805f5260205f20601f840160051c6020851015611ecd57505f5b90810190601f840160051c035f5b81811015611ef0575f83820155600101611edb565b505050505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611f2457611f24611e8e565b611f3883611f328354611dbd565b83611ea2565b5f601f841160018114611f64575f8515611f525750838201355b611f5c8682611ef8565b845550610e95565b5f83815260208120601f198716915b82811015611f935786850135825560209485019460019092019101611f73565b5086821015611faf575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611fca82611e3b565b1515815460ff821691508160ff19821617835561ff00611fec60208601611e3b565b151560081b168261ffff198316171783555050600181016120106040840184611e4b565b67ffffffffffffffff81111561202857612028611e8e565b61203c816120368554611dbd565b85611ea2565b5f601f821160018114612068575f83156120565750838201355b6120608482611ef8565b8655506120bf565b5f85815260208120601f198516915b828110156120975786850135825560209485019460019092019101612077565b50848210156120b3575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e19833603018112611e1d575f5ffd5b5f81356104e681611b65565b81358155602082013560018201556040820135600282015561210e6060830183611e4b565b61211c818360038601611f0c565b505061212b6080830183611e4b565b612139818360048601611f0c565b505061214860a0830183611e4b565b612156818360058601611f0c565b505061216560c0830183611e4b565b612173818360068601611f0c565b505061218260e0830183611e4b565b612190818360078601611f0c565b50506121a0610100830183611e4b565b6121ae818360088601611f0c565b50506121be610120830183611e4b565b6121cc818360098601611f0c565b50506121dc610140830183611e4b565b6121ea8183600a8601611f0c565b50506106626121fc61016084016120dd565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112612233575f5ffd5b820161223f8180611e4b565b67ffffffffffffffff81111561225757612257611e8e565b61226b816122658654611dbd565b86611ea2565b5f601f821160018114612297575f83156122855750838201355b61228f8482611ef8565b8755506122ee565b5f86815260208120601f198516915b828110156122c657868501358255602094850194600190920191016122a6565b50848210156122e2575f1960f88660031b161c19848701351681555b505060018360011b0186555b505050506122ff6020820182611e4b565b61230d818360018701611f0c565b505061231c6040820182611e4b565b61232a818360028701611f0c565b50506123396060820182611e4b565b9150612349828260038601611f0c565b505061066261235b60208401846120c8565b600483016120e9565b5f5f85851115612372575f5ffd5b8386111561237e575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611858576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b818103818111156104e657634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603160045260245ffdfea2646970667358221220ce0bdd8eff27754ac3d992b6e61e0cfb0689db07efe7e020a867d468b345261664736f6c63430008210033","sourceMap":"605:2630:104:-:0;;;882:220;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;1500:37:78;;;;;994:19:104;::::1;986:62;;;;-1:-1:-1::0;;;986:62:104::1;;;;;;;;;;;;1058:37;2241:4:70;1089:5:104::0;1058:10:::1;:37::i;:::-;;882:220:::0;;605:2630;;2777:257:74;2863:4;;2894:31;2911:4;2917:7;2894:16;:31::i;:::-;2879:46;;2939:7;2935:69;;;2962:18;;;;:12;:18;;;;;:31;;2985:7;2962:22;:31::i;:::-;;2935:69;3020:7;-1:-1:-1;2777:257:74;;;;;:::o;6155:316:70:-;6232:4;6253:22;6261:4;6267:7;6253;:22::i;:::-;6248:217;;6291:12;;;;:6;:12;;;;;;;;-1:-1:-1;;;;;6291:29:70;;;;;;;;;:36;;-1:-1:-1;;6291:36:70;6323:4;6291:36;;;6373:12;:10;:12::i;:::-;-1:-1:-1;;;;;6346:40:70;6364:7;-1:-1:-1;;;;;6346:40:70;6358:4;6346:40;;;;;;;;;;-1:-1:-1;6407:4:70;6400:11;;6248:217;-1:-1:-1;6449:5:70;6442:12;;11418:150:99;11488:4;11511:50;11516:3;-1:-1:-1;;;;;11536:23:99;;11511:4;:50::i;2190:371:104:-;-1:-1:-1;;;;;2930:29:70;;2347:4:104;2930:29:70;;;:12;;:29;:12;:29;;;;;2410:92:104;;;-1:-1:-1;2487:4:104;2480:11;;2410:92;2907:4:70;2930:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;2930:29:70;;;;;;;;;;;;2518:36:104;2830:136:70;2741:163:104;2844:7;2870:27;:25;:27::i;:::-;2863:34;;2741:163;:::o;2497:406:99:-;2560:4;5197:21;;;:14;;;:21;;;;;;2576:321;;-1:-1:-1;2618:23:99;;;;;;;;:11;:23;;;;;;;;;;;;;2800:18;;2776:21;;;:14;;;:21;;;;;;:42;;;;2832:11;;2206:471:78;2268:7;2312:8;3567:2;2403:37;;;;;;:71;;-1:-1:-1;2444:30:78;2463:10;2444:18;:30::i;:::-;2399:272;;;2541:47;:8;2550:36;;;2541:8;;:47;:::i;:::-;2533:56;;;:::i;:::-;2525:65;;2518:72;;;;2206:471;:::o;2399:272::-;735:10:89;2635:25:78;;;;2206:471;:::o;1832:137::-;1908:4;1944:18;1707:17;;;1624:107;1944:18;-1:-1:-1;;;;;1931:31:78;:9;-1:-1:-1;;;;;1931:31:78;;1924:38;;1832:137;;;:::o;14:177:114:-;93:13;;-1:-1:-1;;;;;135:31:114;;125:42;;115:70;;181:1;178;171:12;115:70;14:177;;;:::o;196:293::-;275:6;283;336:2;324:9;315:7;311:23;307:32;304:52;;;352:1;349;342:12;304:52;375:40;405:9;375:40;:::i;:::-;365:50;;434:49;479:2;468:9;464:18;434:49;:::i;:::-;424:59;;196:293;;;;;:::o;494:331::-;599:9;610;652:8;640:10;637:24;634:44;;;674:1;671;664:12;634:44;703:6;693:8;690:20;687:40;;;723:1;720;713:12;687:40;-1:-1:-1;;749:23:114;;;794:25;;;;;-1:-1:-1;494:331:114:o;830:350::-;951:19;;-1:-1:-1;;;;;;988:32:114;;;1040:2;1032:11;;1029:145;;;-1:-1:-1;;;;;;1102:2:114;1098:12;;;1095:1;1091:20;1087:50;;;1079:59;;1075:89;;-1:-1:-1;1029:145:114;;830:350;;;;:::o;:::-;605:2630:104;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f5ffd5b50600436106101bb575f3560e01c806396c3e905116100f3578063b05e5a4111610093578063cfdbf2541161006e578063cfdbf25414610468578063d547741f14610471578063ef67350314610484578063f423aa6c14610497575f5ffd5b8063b05e5a411461042f578063c41a71ff14610442578063ca15c87314610455575f5ffd5b8063a1de54de116100ce578063a1de54de146103ce578063a217fddf146103f5578063a3246ad3146103fc578063a65682021461041c575f5ffd5b806396c3e9051461039557806399db0828146103a85780639b6c56ec146103bb575f5ffd5b806354fd4d501161015e5780637da0a877116101395780637da0a8771461030e5780638a42115f146103485780639010d07c1461036f57806391d1485414610382575f5ffd5b806354fd4d501461027c578063572b6c05146102a3578063591236f7146102e3575f5ffd5b80632f2ff15d116101995780632f2ff15d1461022c57806336568abe14610241578063498de65c1461025457806350101d8414610267575f5ffd5b806301ffc9a7146101bf5780630dca59c1146101e7578063248a9ca3146101fc575b5f5ffd5b6101d26101cd36600461194e565b6104c2565b60405190151581526020015b60405180910390f35b6101ef6104ec565b6040516101de91906119a3565b61021e61020a366004611b4e565b5f9081526004602052604090206001015490565b6040519081526020016101de565b61023f61023a366004611b79565b610504565b005b61023f61024f366004611b79565b61052e565b61023f610262366004611ba7565b610576565b61026f61058a565b6040516101de9190611bc2565b60408051808201825260058152640302e332e360dc1b602082015290516101de9190611bfc565b6101d26102b1366004611ba7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6101d26102f1366004611ba7565b6001600160a01b03165f9081526003602052604090205460ff1690565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016101de565b61021e7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f81565b61033061037d366004611c0e565b6105b0565b6101d2610390366004611b79565b6105ce565b61023f6103a3366004611ba7565b61063f565b61023f6103b6366004611c2e565b610650565b6101ef6103c9366004611ba7565b610666565b61021e7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f834781565b61021e5f81565b61040f61040a366004611b4e565b610da8565b6040516101de9190611c76565b61023f61042a366004611cc1565b610dc1565b61023f61043d366004611d51565b610dd3565b61023f610450366004611d51565b610e9c565b61021e610463366004611b4e565b610f59565b61021e6101f481565b61023f61047f366004611b79565b610f6f565b61026f610492366004611ba7565b610f93565b6101d26104a5366004611ba7565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b03198216635a05180f60e01b14806104e657506104e682611086565b92915050565b6104f461185f565b6104ff6103c96110ba565b905090565b5f8281526004602052604090206001015461051e816110c3565b61052883836110d4565b50505050565b6105366110ba565b6001600160a01b0316816001600160a01b0316146105675760405163334bd91960e11b815260040160405180910390fd5b6105718282611107565b505050565b61057e611132565b6105878161115c565b50565b60408051606080820183525f8083526020830152918101919091526104ff6104926110ba565b5f8281526005602052604081206105c790836112ab565b9392505050565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff1615610615575060016104e6565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff166105c7565b6106476112b6565b610587816112e0565b6106586112b6565b6106628282611381565b5050565b61066e61185f565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906106a890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490611dbd565b801561071f5780601f106106f65761010080835404028352916020019161071f565b820191905f5260205f20905b81548152906001019060200180831161070257829003601f168201915b5050505050815260200160018201805461073890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461076490611dbd565b80156107af5780601f10610786576101008083540402835291602001916107af565b820191905f5260205f20905b81548152906001019060200180831161079257829003601f168201915b505050505081526020016002820180546107c890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546107f490611dbd565b801561083f5780601f106108165761010080835404028352916020019161083f565b820191905f5260205f20905b81548152906001019060200180831161082257829003601f168201915b5050505050815260200160038201805461085890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461088490611dbd565b80156108cf5780601f106108a6576101008083540402835291602001916108cf565b820191905f5260205f20905b8154815290600101906020018083116108b257829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461091a90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461094690611dbd565b80156109915780601f1061096857610100808354040283529160200191610991565b820191905f5260205f20905b81548152906001019060200180831161097457829003601f168201915b505050505081526020016004820180546109aa90611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546109d690611dbd565b8015610a215780601f106109f857610100808354040283529160200191610a21565b820191905f5260205f20905b815481529060010190602001808311610a0457829003601f168201915b50505050508152602001600582018054610a3a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6690611dbd565b8015610ab15780601f10610a8857610100808354040283529160200191610ab1565b820191905f5260205f20905b815481529060010190602001808311610a9457829003601f168201915b50505050508152602001600682018054610aca90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610af690611dbd565b8015610b415780601f10610b1857610100808354040283529160200191610b41565b820191905f5260205f20905b815481529060010190602001808311610b2457829003601f168201915b50505050508152602001600782018054610b5a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8690611dbd565b8015610bd15780601f10610ba857610100808354040283529160200191610bd1565b820191905f5260205f20905b815481529060010190602001808311610bb457829003601f168201915b50505050508152602001600882018054610bea90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1690611dbd565b8015610c615780601f10610c3857610100808354040283529160200191610c61565b820191905f5260205f20905b815481529060010190602001808311610c4457829003601f168201915b50505050508152602001600982018054610c7a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca690611dbd565b8015610cf15780601f10610cc857610100808354040283529160200191610cf1565b820191905f5260205f20905b815481529060010190602001808311610cd457829003601f168201915b50505050508152602001600a82018054610d0a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3690611dbd565b8015610d815780601f10610d5857610100808354040283529160200191610d81565b820191905f5260205f20905b815481529060010190602001808311610d6457829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b5f8181526005602052604090206060906104e690611419565b610dc9611132565b6106628282611425565b610ddb611132565b828114610dfb57604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610e2d5760405162ef8cfb60e11b8152600481019290925260248201526044015b60405180910390fd5b505f90505b83811015610e9557610e8d858583818110610e4f57610e4f611df5565b9050602002016020810190610e649190611ba7565b848484818110610e7657610e76611df5565b9050602002810190610e889190611e09565b611425565b600101610e32565b5050505050565b610ea46112b6565b828114610ec457604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610ef15760405162ef8cfb60e11b815260048101929092526024820152604401610e24565b505f90505b83811015610e9557610f51858583818110610f1357610f13611df5565b9050602002016020810190610f289190611ba7565b848484818110610f3a57610f3a611df5565b9050602002810190610f4c9190611e27565b611381565b600101610ef6565b5f8181526005602052604081206104e6906114bd565b5f82815260046020526040902060010154610f89816110c3565b6105288383611107565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610fff90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461102b90611dbd565b80156110765780601f1061104d57610100808354040283529160200191611076565b820191905f5260205f20905b81548152906001019060200180831161105957829003601f168201915b5050505050815250509050919050565b5f6001600160e01b03198216637965db0b60e01b14806104e657506301ffc9a760e01b6001600160e01b03198316146104e6565b5f6104ff6114c6565b610587816110cf6110ba565b611535565b5f5f6110e0848461156e565b905080156105c7575f8481526005602052604090206110ff9084611600565b509392505050565b5f5f6111138484611614565b905080156105c7575f8481526005602052604090206110ff908461169d565b7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f610587816110c3565b6001600160a01b038116611183576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526020819052604081209081816111a78282611908565b6111b4600183015f611908565b6111c1600283015f611908565b6111ce600383015f611908565b50505f600483018181556005840182905560068401829055906111f46007850182611908565b611201600483015f611908565b61120e600583015f611908565b61121b600683015f611908565b611228600783015f611908565b611235600883015f611908565b611242600983015f611908565b61124f600a83015f611908565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b5f6105c783836116b1565b7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f8347610587816110c3565b6001600160a01b038116611307576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff19168155919061133790830182611908565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b0382166113a8576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906113cb8282611fc1565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b60605f6105c7836116d7565b6001600160a01b03821661144c576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061146f8282612220565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f6104e6825490565b5f36601480821080159061150257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156115285761151536828403815f612364565b61151e9161238b565b60601c9250505090565b339250505090565b505090565b61153f82826105ce565b6106625760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e24565b5f61157983836105ce565b6115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556115b16110ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104e6565b505f6104e6565b5f6105c7836001600160a01b038416611730565b5f61161f83836105ce565b156115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191690556116556110ba565b6001600160a01b0316826001600160a01b0316847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45060016104e6565b5f6105c7836001600160a01b038416611775565b5f825f0182815481106116c6576116c6611df5565b905f5260205f200154905092915050565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561172457602002820191905f5260205f20905b815481526020019060010190808311611710575b50505050509050919050565b5f8181526001830160205260408120546115f957508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556104e6565b5f818152600183016020526040812054801561184f575f6117976001836123cb565b85549091505f906117aa906001906123cb565b9050808214611809575f865f0182815481106117c8576117c8611df5565b905f5260205f200154905080875f0184815481106117e8576117e8611df5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061181a5761181a6123ea565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506104e6565b5f9150506104e6565b5092915050565b60405180604001604052806118956040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016119036040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b50805461191490611dbd565b5f825580601f10611923575050565b601f0160209004905f5260205f209061058791905f5b80821115611530575f81840155600101611939565b5f6020828403121561195e575f5ffd5b81356001600160e01b0319811681146105c7575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526119c760e0850182611975565b90506020820151605f198583030160808601526119e48282611975565b9150506040820151605f198583030160a0860152611a028282611975565b91505060608201519150605f198482030160c0850152611a228183611975565b9150506020840151601f1984830301604085015280518252602081015160208301526040810151604083015260608101516101806060840152611a69610180840182611975565b905060808201518382036080850152611a828282611975565b91505060a082015183820360a0850152611a9c8282611975565b91505060c082015183820360c0850152611ab68282611975565b91505060e082015183820360e0850152611ad08282611975565b915050610100820151838203610100850152611aec8282611975565b915050610120820151838203610120850152611b088282611975565b915050610140820151838203610140850152611b248282611975565b9150506101608201519150611b456101608401836001600160a01b03169052565b95945050505050565b5f60208284031215611b5e575f5ffd5b5035919050565b6001600160a01b0381168114610587575f5ffd5b5f5f60408385031215611b8a575f5ffd5b823591506020830135611b9c81611b65565b809150509250929050565b5f60208284031215611bb7575f5ffd5b81356105c781611b65565b602081528151151560208201526020820151151560408201525f6040830151606080840152611bf46080840182611975565b949350505050565b602081525f6105c76020830184611975565b5f5f60408385031215611c1f575f5ffd5b50508035926020909101359150565b5f5f60408385031215611c3f575f5ffd5b8235611c4a81611b65565b9150602083013567ffffffffffffffff811115611c65575f5ffd5b830160608186031215611b9c575f5ffd5b602080825282518282018190525f918401906040840190835b81811015611cb65783516001600160a01b0316835260209384019390920191600101611c8f565b509095945050505050565b5f5f60408385031215611cd2575f5ffd5b8235611cdd81611b65565b9150602083013567ffffffffffffffff811115611cf8575f5ffd5b830160408186031215611b9c575f5ffd5b5f5f83601f840112611d19575f5ffd5b50813567ffffffffffffffff811115611d30575f5ffd5b6020830191508360208260051b8501011115611d4a575f5ffd5b9250929050565b5f5f5f5f60408587031215611d64575f5ffd5b843567ffffffffffffffff811115611d7a575f5ffd5b611d8687828801611d09565b909550935050602085013567ffffffffffffffff811115611da5575f5ffd5b611db187828801611d09565b95989497509550505050565b600181811c90821680611dd157607f821691505b602082108103611def57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e19833603018112611e1d575f5ffd5b9190910192915050565b5f8235605e19833603018112611e1d575f5ffd5b5f813580151581146104e6575f5ffd5b5f5f8335601e19843603018112611e60575f5ffd5b83018035915067ffffffffffffffff821115611e7a575f5ffd5b602001915036819003821315611d4a575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610571578282111561057157805f5260205f20601f840160051c6020851015611ecd57505f5b90810190601f840160051c035f5b81811015611ef0575f83820155600101611edb565b505050505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611f2457611f24611e8e565b611f3883611f328354611dbd565b83611ea2565b5f601f841160018114611f64575f8515611f525750838201355b611f5c8682611ef8565b845550610e95565b5f83815260208120601f198716915b82811015611f935786850135825560209485019460019092019101611f73565b5086821015611faf575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611fca82611e3b565b1515815460ff821691508160ff19821617835561ff00611fec60208601611e3b565b151560081b168261ffff198316171783555050600181016120106040840184611e4b565b67ffffffffffffffff81111561202857612028611e8e565b61203c816120368554611dbd565b85611ea2565b5f601f821160018114612068575f83156120565750838201355b6120608482611ef8565b8655506120bf565b5f85815260208120601f198516915b828110156120975786850135825560209485019460019092019101612077565b50848210156120b3575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e19833603018112611e1d575f5ffd5b5f81356104e681611b65565b81358155602082013560018201556040820135600282015561210e6060830183611e4b565b61211c818360038601611f0c565b505061212b6080830183611e4b565b612139818360048601611f0c565b505061214860a0830183611e4b565b612156818360058601611f0c565b505061216560c0830183611e4b565b612173818360068601611f0c565b505061218260e0830183611e4b565b612190818360078601611f0c565b50506121a0610100830183611e4b565b6121ae818360088601611f0c565b50506121be610120830183611e4b565b6121cc818360098601611f0c565b50506121dc610140830183611e4b565b6121ea8183600a8601611f0c565b50506106626121fc61016084016120dd565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112612233575f5ffd5b820161223f8180611e4b565b67ffffffffffffffff81111561225757612257611e8e565b61226b816122658654611dbd565b86611ea2565b5f601f821160018114612297575f83156122855750838201355b61228f8482611ef8565b8755506122ee565b5f86815260208120601f198516915b828110156122c657868501358255602094850194600190920191016122a6565b50848210156122e2575f1960f88660031b161c19848701351681555b505060018360011b0186555b505050506122ff6020820182611e4b565b61230d818360018701611f0c565b505061231c6040820182611e4b565b61232a818360028701611f0c565b50506123396060820182611e4b565b9150612349828260038601611f0c565b505061066261235b60208401846120c8565b600483016120e9565b5f5f85851115612372575f5ffd5b8386111561237e575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611858576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b818103818111156104e657634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603160045260245ffdfea2646970667358221220ce0bdd8eff27754ac3d992b6e61e0cfb0689db07efe7e020a867d468b345261664736f6c63430008210033","sourceMap":"605:2630:104:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;758:212:74;;;;;;:::i;:::-;;:::i;:::-;;;470:14:114;;463:22;445:41;;433:2;418:18;758:212:74;;;;;;;;1953:113:102;;;:::i;:::-;;;;;;;:::i;3786:120:70:-;;;;;;:::i;:::-;3851:7;3877:12;;;:6;:12;;;;;:22;;;;3786:120;;;;4194:25:114;;;4182:2;4167:18;3786:120:70;4048:177:114;4202:136:70;;;;;;:::i;:::-;;:::i;:::-;;5304:245;;;;;;:::i;:::-;;:::i;5601:119:102:-;;;;;;:::i;:::-;;:::i;2398:126::-;;;:::i;:::-;;;;;;;:::i;554:94:106:-;634:7;;;;;;;;;;;-1:-1:-1;;;634:7:106;;;;554:94;;;;634:7;554:94;:::i;1832:137:78:-;;;;;;:::i;:::-;1707:17;-1:-1:-1;;;;;1931:31:78;;;;;;;1832:137;3315:142:102;;;;;;:::i;:::-;-1:-1:-1;;;;;3418:32:102;3395:4;3418:32;;;:16;:32;;;;;;;;;3315:142;1624:107:78;1707:17;1624:107;;;-1:-1:-1;;;;;5884:32:114;;;5866:51;;5854:2;5839:18;1624:107:78;5720:203:114;801:74:104;;845:30;801:74;;1555:142:74;;;;;;:::i;:::-;;:::i;2190:371:104:-;;;;;;:::i;:::-;;:::i;6122:143:102:-;;;;;;:::i;:::-;;:::i;3862:219::-;;;;;;:::i;:::-;;:::i;2158:137::-;;;;;;:::i;:::-;;:::i;703:92:104:-;;756:39;703:92;;2196:49:70;;2241:4;2196:49;;2539:136:74;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;3610:154:102:-;;;;;;:::i;:::-;;:::i;4748:477::-;;;;;;:::i;:::-;;:::i;4153:531::-;;;;;;:::i;:::-;;:::i;1865:131:74:-;;;;;;:::i;:::-;;:::i;1385:44:102:-;;1426:3;1385:44;;4618:138:70;;;;;;:::i;:::-;;:::i;2625:149:102:-;;;;;;:::i;:::-;;:::i;2969:126::-;;;;;;:::i;:::-;-1:-1:-1;;;;;3064:24:102;3041:4;3064:24;;;:8;:24;;;;;;;;;2969:126;758:212:74;843:4;-1:-1:-1;;;;;;866:57:74;;-1:-1:-1;;;866:57:74;;:97;;;927:36;951:11;927:23;:36::i;:::-;859:104;758:212;-1:-1:-1;;758:212:74:o;1953:113:102:-;2000:22;;:::i;:::-;2041:18;2046:12;:10;:12::i;2041:18::-;2034:25;;1953:113;:::o;4202:136:70:-;3851:7;3877:12;;;:6;:12;;;;;:22;;;2473:16;2484:4;2473:10;:16::i;:::-;4306:25:::1;4317:4;4323:7;4306:10;:25::i;:::-;;4202:136:::0;;;:::o;5304:245::-;5419:12;:10;:12::i;:::-;-1:-1:-1;;;;;5397:34:70;:18;-1:-1:-1;;;;;5397:34:70;;5393:102;;5454:30;;-1:-1:-1;;;5454:30:70;;;;;;;;;;;5393:102;5505:37;5517:4;5523:18;5505:11;:37::i;:::-;;5304:245;;:::o;5601:119:102:-;1473:19;:17;:19::i;:::-;5687:26:::1;5698:14;5687:10;:26::i;:::-;5601:119:::0;:::o;2398:126::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;2491:26:102;2504:12;:10;:12::i;1555:142:74:-;1636:7;1662:18;;;:12;:18;;;;;:28;;1684:5;1662:21;:28::i;:::-;1655:35;1555:142;-1:-1:-1;;;1555:142:74:o;2190:371:104:-;-1:-1:-1;;;;;2930:29:70;;2347:4:104;2930:29:70;;;:12;;:29;:12;:29;;;;;2410:92:104;;;-1:-1:-1;2487:4:104;2480:11;;2410:92;2907:4:70;2930:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;2930:29:70;;;;;;;;;;;;2518:36:104;2830:136:70;6122:143:102;1561:27;:25;:27::i;:::-;6224:34:::1;6243:14;6224:18;:34::i;3862:219::-:0;1561:27;:25;:27::i;:::-;4027:47:::1;4044:14;4060:13;4027:16;:47::i;:::-;3862:219:::0;;:::o;2158:137::-;2225:22;;:::i;:::-;-1:-1:-1;;;;;2266:22:102;;:6;:22;;;;;;;;;;;;2259:29;;;;;;;;;;;;;;;;;2266:22;;2259:29;;2266:22;;2259:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;2259:29:102;;;-1:-1:-1;;2259:29:102;;;;;;-1:-1:-1;;;;;2259:29:102;;;;;;;;-1:-1:-1;2259:29:102;2158:137;-1:-1:-1;;2158:137:102:o;2539:136:74:-;2641:18;;;;:12;:18;;;;;2606:16;;2641:27;;:25;:27::i;3610:154:102:-;1473:19;:17;:19::i;:::-;3726:31:::1;3735:14;3751:5;3726:8;:31::i;4748:477::-:0;1473:19;:17;:19::i;:::-;4918:37;;::::1;4910:68;;;;-1:-1:-1::0;;;4910:68:102::1;;;;;;;;;;;;4996:14:::0;1426:3:::1;4996:39:::0;;::::1;;4988:106;;;::::0;-1:-1:-1;;;4988:106:102;;::::1;::::0;::::1;10656:25:114::0;;;;10697:18;;;10690:34;10629:18;;4988:106:102::1;;;;;;;;;-1:-1:-1::0;5110:9:102::1;::::0;-1:-1:-1;5105:114:102::1;5125:25:::0;;::::1;5105:114;;;5171:37;5180:14;;5195:1;5180:17;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;5199:5;;5205:1;5199:8;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;5171;:37::i;:::-;5152:3;;5105:114;;;;4748:477:::0;;;;:::o;4153:531::-;1561:27;:25;:27::i;:::-;4347:48;;::::1;4339:79;;;;-1:-1:-1::0;;;4339:79:102::1;;;;;;;;;;;;4436:14:::0;1426:3:::1;4436:39:::0;;::::1;;4428:106;;;::::0;-1:-1:-1;;;4428:106:102;;::::1;::::0;::::1;10656:25:114::0;;;;10697:18;;;10690:34;10629:18;;4428:106:102::1;10482:248:114::0;4428:106:102::1;-1:-1:-1::0;4550:9:102::1;::::0;-1:-1:-1;4545:133:102::1;4565:25:::0;;::::1;4545:133;;;4611:56;4628:14;;4643:1;4628:17;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;4647:16;;4664:1;4647:19;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;4611:16;:56::i;:::-;4592:3;;4545:133;;1865:131:74::0;1936:7;1962:18;;;:12;:18;;;;;:27;;:25;:27::i;4618:138:70:-;3851:7;3877:12;;;:6;:12;;;;;:22;;;2473:16;2484:4;2473:10;:16::i;:::-;4723:26:::1;4735:4;4741:7;4723:11;:26::i;2625:149:102:-:0;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2738:29:102;;;;;;:13;:29;;;;;;;;;2731:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2625:149;;;:::o;2541:202:70:-;2626:4;-1:-1:-1;;;;;;2649:47:70;;-1:-1:-1;;;2649:47:70;;:87;;-1:-1:-1;;;;;;;;;;829:40:95;;;2700:36:70;730:146:95;2741:163:104;2844:7;2870:27;:25;:27::i;3175:103:70:-;3241:30;3252:4;3258:12;:10;:12::i;:::-;3241:10;:30::i;2777:257:74:-;2863:4;2879:12;2894:31;2911:4;2917:7;2894:16;:31::i;:::-;2879:46;;2939:7;2935:69;;;2962:18;;;;:12;:18;;;;;:31;;2985:7;2962:22;:31::i;:::-;;3020:7;2777:257;-1:-1:-1;;;2777:257:74:o;3137:262::-;3224:4;3240:12;3255:32;3273:4;3279:7;3255:17;:32::i;:::-;3240:47;;3301:7;3297:72;;;3324:18;;;;:12;:18;;;;;:34;;3350:7;3324:25;:34::i;1165:90:104:-;845:30;2473:16:70;2484:4;2473:10;:16::i;7690:279:102:-;-1:-1:-1;;;;;7769:28:102;;7761:79;;;;-1:-1:-1;;;7761:79:102;;;;;;;;;;;;-1:-1:-1;;;;;7857:22:102;;:6;:22;;;;;;;;;;;;:6;7850:29;7857:22;:6;7850:29;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;-1:-1:-1;;7850:29:102;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;-1:-1:-1;7850:29:102;;;;-1:-1:-1;;;;;;7850:29:102;;;-1:-1:-1;;;;;;;7896:24:102;;7850:29;7896:24;;;:8;:24;;;;;;7889:31;;-1:-1:-1;;7889:31:102;;;7935:27;;;7850:29;7935:27;7690:279;:::o;13073:156:99:-;13147:7;13197:22;13201:3;13213:5;13197:3;:22::i;1261:107:104:-;756:39;2473:16:70;2484:4;2473:10;:16::i;8167:310:102:-;-1:-1:-1;;;;;8254:28:102;;8246:79;;;;-1:-1:-1;;;8246:79:102;;;;;;;;;;;;-1:-1:-1;;;;;8342:29:102;;;;;;:13;:29;;;;;;;8335:36;;-1:-1:-1;;8335:36:102;;;8342:29;;8335:36;;;;8342:29;8335:36;:::i;:::-;-1:-1:-1;;;;;;;8388:32:102;;;;;;:16;:32;;;;;;8381:39;;-1:-1:-1;;8381:39:102;;;8435:35;;;8388:32;8435:35;8167:310;:::o;7167:350::-;-1:-1:-1;;;;;7289:28:102;;7281:79;;;;-1:-1:-1;;;7281:79:102;;;;;;;;;;;;-1:-1:-1;;;;;7370:29:102;;;;;;:13;:29;;;;;7402:13;;7370:45;7402:13;7370:29;:45;:::i;:::-;-1:-1:-1;;;;;;;7425:32:102;;;;;;:16;:32;;;;;;:39;;-1:-1:-1;;7425:39:102;7460:4;7425:39;;;7479:31;;;7425:32;7479:31;7167:350;;:::o;13769:273:99:-;13832:16;13860:22;13885:19;13893:3;13885:7;:19::i;6660:306:102:-;-1:-1:-1;;;;;6769:28:102;;6761:79;;;;-1:-1:-1;;;6761:79:102;;;;;;;;;;;;-1:-1:-1;;;;;6850:22:102;;:6;:22;;;;;;;;;;6875:5;;6850:30;6875:5;6850:22;:30;:::i;:::-;-1:-1:-1;;;;;;;6890:24:102;;;;;;:8;:24;;;;;;:31;;-1:-1:-1;;6890:31:102;6917:4;6890:31;;;6936:23;;;6890:24;6936:23;6660:306;;:::o;12616:115:99:-;12679:7;12705:19;12713:3;5393:18;;5311:107;2206:471:78;2268:7;2312:8;3567:2;2403:37;;;;;;:71;;-1:-1:-1;1707:17:78;-1:-1:-1;;;;;1931:31:78;2463:10;1931:31;2444:30;2399:272;;;2541:47;:8;2550:36;;;2541:8;;:47;:::i;:::-;2533:56;;;:::i;:::-;2525:65;;2518:72;;;;2206:471;:::o;2399:272::-;735:10:89;2635:25:78;;;;2206:471;:::o;2399:272::-;2277:400;;2206:471;:::o;3408:197:70:-;3496:22;3504:4;3510:7;3496;:22::i;:::-;3491:108;;3541:47;;-1:-1:-1;;;3541:47:70;;-1:-1:-1;;;;;22779:32:114;;3541:47:70;;;22761:51:114;22828:18;;;22821:34;;;22734:18;;3541:47:70;22587:274:114;6155:316:70;6232:4;6253:22;6261:4;6267:7;6253;:22::i;:::-;6248:217;;6291:12;;;;:6;:12;;;;;;;;-1:-1:-1;;;;;6291:29:70;;;;;;;;;:36;;-1:-1:-1;;6291:36:70;6323:4;6291:36;;;6373:12;:10;:12::i;:::-;-1:-1:-1;;;;;6346:40:70;6364:7;-1:-1:-1;;;;;6346:40:70;6358:4;6346:40;;;;;;;;;;-1:-1:-1;6407:4:70;6400:11;;6248:217;-1:-1:-1;6449:5:70;6442:12;;11418:150:99;11488:4;11511:50;11516:3;-1:-1:-1;;;;;11536:23:99;;11511:4;:50::i;6708:317:70:-;6786:4;6806:22;6814:4;6820:7;6806;:22::i;:::-;6802:217;;;6876:5;6844:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;6844:29:70;;;;;;;;;:37;;-1:-1:-1;;6844:37:70;;;6927:12;:10;:12::i;:::-;-1:-1:-1;;;;;6900:40:70;6918:7;-1:-1:-1;;;;;6900:40:70;6912:4;6900:40;;;;;;;;;;-1:-1:-1;6961:4:70;6954:11;;11736:156:99;11809:4;11832:53;11840:3;-1:-1:-1;;;;;11860:23:99;;11832:7;:53::i;5760:118::-;5827:7;5853:3;:11;;5865:5;5853:18;;;;;;;;:::i;:::-;;;;;;;;;5846:25;;5760:118;;;;:::o;6418:109::-;6474:16;6509:3;:11;;6502:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6418:109;;;:::o;2497:406::-;2560:4;5197:21;;;:14;;;:21;;;;;;2576:321;;-1:-1:-1;2618:23:99;;;;;;;;:11;:23;;;;;;;;;;;;;2800:18;;2776:21;;;:14;;;:21;;;;;;:42;;;;2832:11;;3071:1368;3137:4;3266:21;;;:14;;;:21;;;;;;3302:13;;3298:1135;;3669:18;3690:12;3701:1;3690:8;:12;:::i;:::-;3736:18;;3669:33;;-1:-1:-1;3716:17:99;;3736:22;;3757:1;;3736:22;:::i;:::-;3716:42;;3791:9;3777:10;:23;3773:378;;3820:17;3840:3;:11;;3852:9;3840:22;;;;;;;;:::i;:::-;;;;;;;;;3820:42;;3987:9;3961:3;:11;;3973:10;3961:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;4100:25;;;:14;;;:25;;;;;:36;;;3773:378;4229:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;4332:3;:14;;:21;4347:5;4332:21;;;;;;;;;;;4325:28;;;4375:4;4368:11;;;;;;;3298:1135;4417:5;4410:12;;;;;3298:1135;3143:1296;3071:1368;;;;:::o;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;:::i;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14:286:114;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:114;;209:43;;199:71;;266:1;263;256:12;497:289;539:3;577:5;571:12;604:6;599:3;592:19;660:6;653:4;646:5;642:16;635:4;630:3;626:14;620:47;712:1;705:4;696:6;691:3;687:16;683:27;676:38;775:4;768:2;764:7;759:2;751:6;747:15;743:29;738:3;734:39;730:50;723:57;;;497:289;;;;:::o;900:2912::-;1093:2;1082:9;1075:21;1056:4;1131:6;1125:13;1174:4;1169:2;1158:9;1154:18;1147:32;1216:12;1210:19;1265:4;1260:2;1249:9;1245:18;1238:32;1293:54;1342:3;1331:9;1327:19;1311:14;1293:54;:::i;:::-;1279:68;;1402:2;1388:12;1384:21;1378:28;1476:2;1472:7;1460:9;1452:6;1448:22;1444:36;1437:4;1426:9;1422:20;1415:66;1504:41;1538:6;1522:14;1504:41;:::i;:::-;1490:55;;;1600:4;1586:12;1582:23;1576:30;1675:2;1671:7;1659:9;1651:6;1647:22;1643:36;1637:3;1626:9;1622:19;1615:65;1703:41;1737:6;1721:14;1703:41;:::i;:::-;1689:55;;;1799:2;1785:12;1781:21;1775:28;1753:50;;1872:2;1868:7;1856:9;1848:6;1844:22;1840:36;1834:3;1823:9;1819:19;1812:65;1897:41;1931:6;1915:14;1897:41;:::i;:::-;1886:52;;;1987:2;1979:6;1975:15;1969:22;2058:2;2054:7;2042:9;2037:3;2033:19;2029:33;2022:4;2011:9;2007:20;2000:63;2090:14;2084:21;2079:3;2072:34;2162:2;2146:14;2142:23;2136:30;2131:2;2126:3;2122:12;2115:52;2225:4;2209:14;2205:25;2199:32;2192:4;2187:3;2183:14;2176:56;2289:2;2273:14;2269:23;2263:30;2323:6;2318:2;2313:3;2309:12;2302:28;2353:51;2396:6;2391:3;2387:16;2371:14;2353:51;:::i;:::-;2339:65;;2461:4;2445:14;2441:25;2435:32;2511:3;2503:6;2499:16;2492:4;2487:3;2483:14;2476:40;2539:41;2573:6;2557:14;2539:41;:::i;:::-;2525:55;;;2637:3;2621:14;2617:24;2611:31;2685:3;2677:6;2673:16;2667:3;2662;2658:13;2651:39;2713:41;2747:6;2731:14;2713:41;:::i;:::-;2699:55;;;2811:3;2795:14;2791:24;2785:31;2859:3;2851:6;2847:16;2841:3;2836;2832:13;2825:39;2887:41;2921:6;2905:14;2887:41;:::i;:::-;2873:55;;;2986:3;2970:14;2966:24;2960:31;3034:3;3026:6;3022:16;3016:3;3011;3007:13;3000:39;3062:42;3097:6;3080:15;3062:42;:::i;:::-;3048:56;;;3162:6;3146:14;3142:27;3136:34;3216:3;3208:6;3204:16;3195:6;3190:3;3186:16;3179:42;3244;3279:6;3262:15;3244:42;:::i;:::-;3230:56;;;3344:6;3328:14;3324:27;3318:34;3398:3;3390:6;3386:16;3377:6;3372:3;3368:16;3361:42;3427;3462:6;3445:15;3427:42;:::i;:::-;3412:57;;;3527:6;3511:14;3507:27;3501:34;3582:3;3573:7;3569:17;3560:6;3555:3;3551:16;3544:43;3611;3646:7;3629:15;3611:43;:::i;:::-;3596:58;;;3712:6;3696:14;3692:27;3686:34;3663:57;;3729:53;3774:6;3769:3;3765:16;3748:15;-1:-1:-1;;;;;857:31:114;845:44;;791:104;3729:53;3799:7;900:2912;-1:-1:-1;;;;;900:2912:114:o;3817:226::-;3876:6;3929:2;3917:9;3908:7;3904:23;3900:32;3897:52;;;3945:1;3942;3935:12;3897:52;-1:-1:-1;3990:23:114;;3817:226;-1:-1:-1;3817:226:114:o;4230:131::-;-1:-1:-1;;;;;4305:31:114;;4295:42;;4285:70;;4351:1;4348;4341:12;4366:367;4434:6;4442;4495:2;4483:9;4474:7;4470:23;4466:32;4463:52;;;4511:1;4508;4501:12;4463:52;4556:23;;;-1:-1:-1;4655:2:114;4640:18;;4627:32;4668:33;4627:32;4668:33;:::i;:::-;4720:7;4710:17;;;4366:367;;;;;:::o;4738:247::-;4797:6;4850:2;4838:9;4829:7;4825:23;4821:32;4818:52;;;4866:1;4863;4856:12;4818:52;4905:9;4892:23;4924:31;4949:5;4924:31;:::i;4990:500::-;5177:2;5166:9;5159:21;5236:6;5230:13;5223:21;5216:29;5211:2;5200:9;5196:18;5189:57;5314:2;5306:6;5302:15;5296:22;5289:30;5282:38;5277:2;5266:9;5262:18;5255:66;5140:4;5368:2;5360:6;5356:15;5350:22;5410:4;5403;5392:9;5388:20;5381:34;5432:52;5479:3;5468:9;5464:19;5450:12;5432:52;:::i;:::-;5424:60;4990:500;-1:-1:-1;;;;4990:500:114:o;5495:220::-;5644:2;5633:9;5626:21;5607:4;5664:45;5705:2;5694:9;5690:18;5682:6;5664:45;:::i;5928:294::-;5996:6;6004;6057:2;6045:9;6036:7;6032:23;6028:32;6025:52;;;6073:1;6070;6063:12;6025:52;-1:-1:-1;;6118:23:114;;;6212:2;6197:18;;;6184:32;;-1:-1:-1;5928:294:114:o;6227:525::-;6326:6;6334;6387:2;6375:9;6366:7;6362:23;6358:32;6355:52;;;6403:1;6400;6393:12;6355:52;6442:9;6429:23;6461:31;6486:5;6461:31;:::i;:::-;6511:5;-1:-1:-1;6567:2:114;6552:18;;6539:32;6594:18;6583:30;;6580:50;;;6626:1;6623;6616:12;6580:50;6649:22;;6705:2;6687:16;;;6683:25;6680:45;;;6721:1;6718;6711:12;6757:637;6947:2;6959:21;;;7029:13;;6932:18;;;7051:22;;;6899:4;;7130:15;;;7104:2;7089:18;;;6899:4;7173:195;7187:6;7184:1;7181:13;7173:195;;;7252:13;;-1:-1:-1;;;;;7248:39:114;7236:52;;7317:2;7343:15;;;;7308:12;;;;7284:1;7202:9;7173:195;;;-1:-1:-1;7385:3:114;;6757:637;-1:-1:-1;;;;;6757:637:114:o;7399:528::-;7501:6;7509;7562:2;7550:9;7541:7;7537:23;7533:32;7530:52;;;7578:1;7575;7568:12;7530:52;7617:9;7604:23;7636:31;7661:5;7636:31;:::i;:::-;7686:5;-1:-1:-1;7742:2:114;7727:18;;7714:32;7769:18;7758:30;;7755:50;;;7801:1;7798;7791:12;7755:50;7824:22;;7880:2;7862:16;;;7858:25;7855:45;;;7896:1;7893;7886:12;7932:367;7995:8;8005:6;8059:3;8052:4;8044:6;8040:17;8036:27;8026:55;;8077:1;8074;8067:12;8026:55;-1:-1:-1;8100:20:114;;8143:18;8132:30;;8129:50;;;8175:1;8172;8165:12;8129:50;8212:4;8204:6;8200:17;8188:29;;8272:3;8265:4;8255:6;8252:1;8248:14;8240:6;8236:27;8232:38;8229:47;8226:67;;;8289:1;8286;8279:12;8226:67;7932:367;;;;;:::o;8304:802::-;8460:6;8468;8476;8484;8537:2;8525:9;8516:7;8512:23;8508:32;8505:52;;;8553:1;8550;8543:12;8505:52;8593:9;8580:23;8626:18;8618:6;8615:30;8612:50;;;8658:1;8655;8648:12;8612:50;8697:70;8759:7;8750:6;8739:9;8735:22;8697:70;:::i;:::-;8786:8;;-1:-1:-1;8671:96:114;-1:-1:-1;;8874:2:114;8859:18;;8846:32;8903:18;8890:32;;8887:52;;;8935:1;8932;8925:12;8887:52;8974:72;9038:7;9027:8;9016:9;9012:24;8974:72;:::i;:::-;8304:802;;;;-1:-1:-1;9065:8:114;-1:-1:-1;;;;8304:802:114:o;10097:380::-;10176:1;10172:12;;;;10219;;;10240:61;;10294:4;10286:6;10282:17;10272:27;;10240:61;10347:2;10339:6;10336:14;10316:18;10313:38;10310:161;;10393:10;10388:3;10384:20;10381:1;10374:31;10428:4;10425:1;10418:15;10456:4;10453:1;10446:15;10310:161;;10097:380;;;:::o;10735:127::-;10796:10;10791:3;10787:20;10784:1;10777:31;10827:4;10824:1;10817:15;10851:4;10848:1;10841:15;10867:331;10967:4;11025:11;11012:25;11119:2;11115:7;11104:8;11088:14;11084:29;11080:43;11060:18;11056:68;11046:96;;11138:1;11135;11128:12;11046:96;11159:33;;;;;10867:331;-1:-1:-1;;10867:331:114:o;11203:328::-;11300:4;11358:11;11345:25;11452:2;11448:7;11437:8;11421:14;11417:29;11413:43;11393:18;11389:68;11379:96;;11471:1;11468;11461:12;11536:202;11578:11;11630:3;11617:17;11677:5;11670:13;11663:21;11656:5;11653:32;11643:60;;11699:1;11696;11689:12;11743:516;11815:4;11821:6;11881:11;11868:25;11975:2;11971:7;11960:8;11944:14;11940:29;11936:43;11916:18;11912:68;11902:96;;11994:1;11991;11984:12;11902:96;12021:33;;12073:20;;;-1:-1:-1;12116:18:114;12105:30;;12102:50;;;12148:1;12145;12138:12;12102:50;12181:4;12169:17;;-1:-1:-1;12212:14:114;12208:27;;;12198:38;;12195:58;;;12249:1;12246;12239:12;12264:127;12325:10;12320:3;12316:20;12313:1;12306:31;12356:4;12353:1;12346:15;12380:4;12377:1;12370:15;12522:692;12624:2;12619:3;12616:11;12613:595;;;12661:10;12656:3;12653:19;12650:548;;;12713:5;12710:1;12703:16;12761:4;12758:1;12748:18;12826:2;12814:10;12810:19;12807:1;12803:27;12865:4;12853:10;12850:20;12847:45;;;-1:-1:-1;12889:1:114;12847:45;12928:23;;;;12998:2;12989:12;;12986:1;12982:20;12978:39;13043:1;13061:123;13075:2;13072:1;13069:9;13061:123;;;13164:1;13143:19;;;13136:30;13093:1;13086:9;13061:123;;;13065:3;;;12522:692;;;:::o;13219:166::-;-1:-1:-1;;13347:1:114;13343:11;;;13339:24;13335:29;13325:40;13371:1;13367:11;;;;13322:57;;13219:166::o;13390:1182::-;13498:18;13493:3;13490:27;13487:53;;;13520:18;;:::i;:::-;13549:94;13639:3;13599:38;13631:4;13625:11;13599:38;:::i;:::-;13593:4;13549:94;:::i;:::-;13669:1;13694:2;13689:3;13686:11;13711:1;13706:608;;;;14358:1;14375:3;14372:93;;;-1:-1:-1;14431:19:114;;;14418:33;14372:93;14491:64;14551:3;14544:5;14491:64;:::i;:::-;14485:4;14478:78;;13679:887;;13706:608;12469:1;12462:14;;;12506:4;12493:18;;-1:-1:-1;;13742:17:114;;;13857:229;13871:7;13868:1;13865:14;13857:229;;;13960:19;;;13947:33;13932:49;;14067:4;14052:20;;;;14020:1;14008:14;;;;13887:12;13857:229;;;13861:3;14114;14105:7;14102:16;14099:159;;;14238:1;14234:6;14228:3;14222;14219:1;14215:11;14211:21;14207:34;14203:39;14190:9;14185:3;14181:19;14168:33;14164:79;14156:6;14149:95;14099:159;;;14301:1;14295:3;14292:1;14288:11;14284:19;14278:4;14271:33;13679:887;;13390:1182;;;:::o;14577:1825::-;14747:31;14772:5;14747:31;:::i;:::-;14740:39;14733:47;14805:4;14799:11;14837:3;14833:2;14829:12;14819:22;;14885:2;14878:3;14874:8;14870:2;14866:17;14863:25;14857:4;14850:39;15013:5;14968:40;15004:2;14997:5;14993:14;14968:40;:::i;:::-;14961:48;14954:56;14951:1;14947:64;14943:76;14938:2;14929:5;14925:10;14921:2;14917:19;14914:27;14911:109;14905:4;14898:123;;;15058:1;15052:4;15048:12;15103:59;15158:2;15151:5;15147:14;15140:5;15103:59;:::i;:::-;15192:18;15177:13;15174:37;15171:63;;;15214:18;;:::i;:::-;15243:116;15345:13;15299:44;15331:10;15325:17;15299:44;:::i;:::-;15287:10;15243:116;:::i;:::-;15385:1;15420:2;15405:13;15402:21;15437:1;15432:672;;;;16150:1;16167:13;16164:113;;;-1:-1:-1;16235:27:114;;;16222:41;16164:113;16309:76;16371:13;16362:7;16309:76;:::i;:::-;16297:10;16290:96;;15395:1001;;15432:672;12469:1;12462:14;;;12506:4;12493:18;;-1:-1:-1;;15468:27:114;;;15599:233;15613:7;15610:1;15607:14;15599:233;;;15700:27;;;15687:41;15672:57;;15815:2;15800:18;;;;15768:1;15756:14;;;;15629:10;15599:233;;;15603:3;15860:13;15851:7;15848:26;15845:187;;;16012:1;16008:6;16002:3;15986:13;15983:1;15979:21;15975:31;15971:44;15967:49;15954:9;15941:11;15937:27;15924:41;15920:97;15912:6;15905:113;15845:187;;;16091:1;16075:13;16072:1;16068:21;16064:29;16052:10;16045:49;15395:1001;;;;;;14577:1825;;:::o;16407:319::-;16494:4;16552:11;16539:25;16646:3;16642:8;16631;16615:14;16611:29;16607:44;16587:18;16583:69;16573:97;;16666:1;16663;16656:12;16731:176;16776:11;16828:3;16815:17;16841:31;16866:5;16841:31;:::i;17111:2277::-;17267:19;;17295:21;;17385:2;17374:14;;17361:28;17415:1;17405:12;;17398:29;17496:2;17485:14;;17472:28;17526:1;17516:12;;17509:29;17581:59;17636:2;17625:14;;17280:5;17581:59;:::i;:::-;17649:99;17734:13;17721:11;17717:1;17711:4;17707:12;17649:99;:::i;:::-;;;17793:60;17848:3;17841:5;17837:15;17830:5;17793:60;:::i;:::-;17862:101;17949:13;17934;17930:1;17924:4;17920:12;17862:101;:::i;:::-;;;18008:60;18063:3;18056:5;18052:15;18045:5;18008:60;:::i;:::-;18077:101;18164:13;18149;18145:1;18139:4;18135:12;18077:101;:::i;:::-;;;18223:60;18278:3;18271:5;18267:15;18260:5;18223:60;:::i;:::-;18292:101;18379:13;18364;18360:1;18354:4;18350:12;18292:101;:::i;:::-;;;18438:60;18493:3;18486:5;18482:15;18475:5;18438:60;:::i;:::-;18507:101;18594:13;18579;18575:1;18569:4;18565:12;18507:101;:::i;:::-;;;18655:60;18710:3;18703:5;18699:15;18692:5;18655:60;:::i;:::-;18724:103;18812:14;18796;18792:1;18786:4;18782:12;18724:103;:::i;:::-;;;18874:60;18929:3;18922:5;18918:15;18911:5;18874:60;:::i;:::-;18943:103;19031:14;19015;19011:1;19005:4;19001:12;18943:103;:::i;:::-;;;19093:60;19148:3;19141:5;19137:15;19130:5;19093:60;:::i;:::-;19162:104;19251:14;19235;19230:2;19224:4;19220:13;19162:104;:::i;:::-;;;19275:107;19337:44;19376:3;19369:5;19365:15;19337:44;:::i;:::-;19332:2;19326:4;19322:13;17015:11;;-1:-1:-1;;;;;;17011:54:114;-1:-1:-1;;;;;17067:31:114;;;;17008:91;;;;16995:105;;16912:194;19393:2474;19584:5;19571:19;19669:3;19665:8;19657:5;19641:14;19637:26;19633:41;19613:18;19609:66;19599:94;;19689:1;19686;19679:12;19599:94;19714:30;;19787:48;19714:30;;19787:48;:::i;:::-;19865:18;19850:13;19847:37;19844:63;;;19887:18;;:::i;:::-;19916:104;20006:13;19966:38;19998:4;19992:11;19966:38;:::i;:::-;19960:4;19916:104;:::i;:::-;20046:1;20081:2;20066:13;20063:21;20098:1;20093:664;;;;20803:1;20820:13;20817:113;;;-1:-1:-1;20888:27:114;;;20875:41;20817:113;20956:76;21018:13;21009:7;20956:76;:::i;:::-;20950:4;20943:90;;20056:987;;20093:664;12469:1;12462:14;;;12506:4;12493:18;;-1:-1:-1;;20129:27:114;;;20254:237;20268:7;20265:1;20262:14;20254:237;;;20357:27;;;20344:41;20329:57;;20472:4;20457:20;;;;20425:1;20413:14;;;;20284:12;20254:237;;;20258:3;20519:13;20510:7;20507:26;20504:187;;;20671:1;20667:6;20661:3;20645:13;20642:1;20638:21;20634:31;20630:44;20626:49;20613:9;20600:11;20596:27;20583:41;20579:97;20571:6;20564:113;20504:187;;;20744:1;20728:13;20725:1;20721:21;20717:29;20711:4;20704:43;20056:987;;;;;21088:57;21141:2;21135:4;21131:13;21125:4;21088:57;:::i;:::-;21154:101;21241:13;21226;21222:1;21216:4;21212:12;21154:101;:::i;:::-;;;21300:57;21353:2;21347:4;21343:13;21337:4;21300:57;:::i;:::-;21366:101;21453:13;21438;21434:1;21428:4;21424:12;21366:101;:::i;:::-;;;21512:57;21565:2;21559:4;21555:13;21549:4;21512:57;:::i;:::-;21476:93;;21578:101;21665:13;21650;21646:1;21640:4;21636:12;21578:101;:::i;:::-;;;21688:173;21786:74;21856:2;21849:5;21845:14;21838:5;21786:74;:::i;:::-;21782:1;21776:4;21772:12;21688:173;:::i;21872:331::-;21977:9;21988;22030:8;22018:10;22015:24;22012:44;;;22052:1;22049;22042:12;22012:44;22081:6;22071:8;22068:20;22065:40;;;22101:1;22098;22091:12;22065:40;-1:-1:-1;;22127:23:114;;;22172:25;;;;;-1:-1:-1;21872:331:114:o;22208:374::-;22329:19;;-1:-1:-1;;22366:40:114;;;22426:2;22418:11;;22415:161;;;-1:-1:-1;;22488:2:114;22484:12;;;;22481:1;22477:20;22473:58;;;22465:67;22461:105;;;;22208:374;-1:-1:-1;;22208:374:114:o;22866:225::-;22933:9;;;22954:11;;;22951:134;;;23007:10;23002:3;22998:20;22995:1;22988:31;23042:4;23039:1;23032:15;23070:4;23067:1;23060:15;23096:127;23157:10;23152:3;23148:20;23145:1;23138:31;23188:4;23185:1;23178:15;23212:4;23209:1;23202:15","linkReferences":{},"immutableReferences":{"47386":[{"start":691,"length":32},{"start":784,"length":32},{"start":5335,"length":32}]}},"methodIdentifiers":{"CREDIT_EVENTS_MANAGER_ROLE()":"a1de54de","DEBT_MANAGER_ROLE()":"8a42115f","DEFAULT_ADMIN_ROLE()":"a217fddf","MAX_BATCH_SIZE()":"cfdbf254","clearCreditEvents(address)":"96c3e905","clearDebt(address)":"498de65c","creditEvents()":"50101d84","creditEvents(address)":"ef673503","debt()":"0dca59c1","debt(address)":"9b6c56ec","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","getRoleMembers(bytes32)":"a3246ad3","grantRole(bytes32,address)":"2f2ff15d","hasCreditEvents(address)":"591236f7","hasDebt(address)":"f423aa6c","hasRole(bytes32,address)":"91d14854","isTrustedForwarder(address)":"572b6c05","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setCreditEvents(address,(bool,bool,string))":"99db0828","setCreditEventsBatch(address[],(bool,bool,string)[])":"c41a71ff","setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))":"a6568202","setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])":"b05e5a41","supportsInterface(bytes4)":"01ffc9a7","trustedForwarder()":"7da0a877","version()":"54fd4d50"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.33+commit.64118f21\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"forwarderIrrevocable\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AdminWithAddressZeroNotAllowed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSize\",\"type\":\"uint256\"}],\"name\":\"BatchSizeTooLarge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInputLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SmartContractWithAddressZeroNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"CreditEventsCleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"CreditEventsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"DebtCleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"DebtSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CREDIT_EVENTS_MANAGER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEBT_MANAGER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_BATCH_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"clearCreditEvents\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"clearDebt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"creditEvents\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"creditEvents\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debt\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"debt\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMembers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"hasCreditEvents\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"hasDebt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"creditEvents_\",\"type\":\"tuple\"}],\"name\":\"setCreditEvents\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"smartContracts\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents[]\",\"name\":\"creditEventsList\",\"type\":\"tuple[]\"}],\"name\":\"setCreditEventsBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"},{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"debt_\",\"type\":\"tuple\"}],\"name\":\"setDebt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"smartContracts\",\"type\":\"address[]\"},{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation[]\",\"name\":\"debts\",\"type\":\"tuple[]\"}],\"name\":\"setDebtBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"trustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Uses `AccessControlEnumerable` so role holders can be listed on-chain. `DEBT_MANAGER_ROLE` gates debt changes, `CREDIT_EVENTS_MANAGER_ROLE` gates credit-events changes.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted to signal this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call. This account bears the admin role (for the granted role). Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"clearCreditEvents(address)\":{\"details\":\"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {CreditEventsCleared}.\"},\"clearDebt(address)\":{\"details\":\"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {DebtCleared}.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"getRoleMembers(bytes32)\":{\"details\":\"Return all accounts that have `role` WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-changing function may render the function uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasCreditEvents(address)\":{\"details\":\"True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}.\"},\"hasDebt(address)\":{\"details\":\"True after {setDebt} / {setDebtBatch}, false again after {clearDebt}.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`. NOTE: The `DEFAULT_ADMIN_ROLE` is treated as a super-admin role. Any account holding `DEFAULT_ADMIN_ROLE` is considered to hold every role, even if it was not explicitly granted via `grantRole`. This means `hasRole(ANY_ROLE, admin)` returns `true` for the admin. `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` will NOT reflect this implicit membership: the admin is not listed as a holder of the other roles. Because OpenZeppelin's `_grantRole` / `_revokeRole` consult this function, granting a role to an admin is a no-op, and revoking or renouncing one emits `RoleRevoked` while the admin keeps the power.\"},\"isTrustedForwarder(address)\":{\"details\":\"Indicates whether any particular address is the trusted forwarder.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"trustedForwarder()\":{\"details\":\"Returns the address of the trusted forwarder.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"MAX_BATCH_SIZE()\":{\"notice\":\"Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`.\"},\"clearCreditEvents(address)\":{\"notice\":\"Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards and `creditEvents(smartContract_)` returns the zero struct, as before any record was set.\"},\"clearDebt(address)\":{\"notice\":\"Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards and `debt(smartContract_)` returns the zero struct, as before any record was set.\"},\"creditEvents()\":{\"notice\":\"Function to get the credit events for the sender's smart contract\"},\"creditEvents(address)\":{\"notice\":\"Function to get the credit events for a specific smart contract\"},\"debt()\":{\"notice\":\"Function to get the debt for the sender's smart contract\"},\"debt(address)\":{\"notice\":\"Function to get the debt for a specific smart contract\"},\"hasCreditEvents(address)\":{\"notice\":\"Returns true if credit events are currently set for the given smart contract\"},\"hasDebt(address)\":{\"notice\":\"Returns true if a debt record is currently set for the given smart contract\"},\"setCreditEvents(address,(bool,bool,string))\":{\"notice\":\"Function to set the credit events for a given smart contract\"},\"setCreditEventsBatch(address[],(bool,bool,string)[])\":{\"notice\":\"Batch version of {setCreditEvents}\"},\"setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))\":{\"notice\":\"Function to set the debt for a given smart contract\"},\"setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])\":{\"notice\":\"Batch version of {setDebt}\"},\"version()\":{\"notice\":\"Returns the current version of the smart contract\"}},\"notice\":\"DebtEngine deployment with role-based access control.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/deployment/DebtEngineAccessControl.sol\":\"DebtEngineAccessControl\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":CMTAT/=lib/CMTAT/contracts/\",\":OZ/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/CMTAT/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol\":{\"keccak256\":\"0x4e9ef9c96644bcd2159ea688cc2d6a8068a14282acc2b8d54615b99412961d79\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://7ea2cea23c7cf68a9ef1110ed6bee0aa5eba44365d58975c084545ede2c09c2b\",\"dweb:/ipfs/QmepuGYcv4zfxFFsPnCpBVzgCZq1HgPXqM49hbj7FDEyN1\"]},\"lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol\":{\"keccak256\":\"0xbb5ff9d854285182f0f305f13b37fcd54dd41e00d3d80a33b75639e2d8fc9c62\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://da1ffcafac20656e609e5e9a6aff665ba55a01036fe79b13cc22d475f9fa35dd\",\"dweb:/ipfs/QmNaQ286Dx3RX3hFq6M4Q8HSMsyNSjSX6fr5bruCTRMNVk\"]},\"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol\":{\"keccak256\":\"0x46f2908dcf2c2d5eac125837ab1ac76cc11c7ecc394041a59738ea4acaf072fa\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://de5a7fbe0b4970131fc545b4a198b49fa05cfaa104a471e97a64aa6b8630ac51\",\"dweb:/ipfs/Qmf6LiKNBQwFyxCbiiS4nLHXu4ydfzV9hQsXmJ9Qz43Rkc\"]},\"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol\":{\"keccak256\":\"0x86256da854b013551350056894193d38cd932f0de3cf5cd9ca964f40b35f396d\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://8851f89021a74c2712b2f78d30ce1012435106e70fac4ae9cb1d1e89c95ec2ae\",\"dweb:/ipfs/QmWJ4fwdyAPuVeXtddvV4sz5qwohNzZNJaBWkBseNLtTp6\"]},\"lib/openzeppelin-contracts/contracts/access/AccessControl.sol\":{\"keccak256\":\"0x1a6b4f6b7798ab80929d491b89d5427a9b3338c0fd1acd0ba325f69c6f1646af\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7bb7f346c12a14dc622bc105ce3c47202fbc89f4b153a28a63bb68193297330c\",\"dweb:/ipfs/QmagwF8P3bUBXwdo159ueEnY9dLSvEWwK24kk2op58egwG\"]},\"lib/openzeppelin-contracts/contracts/access/IAccessControl.sol\":{\"keccak256\":\"0xbff9f59c84e5337689161ce7641c0ef8e872d6a7536fbc1f5133f128887aba3c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b308f882e796f7b79c9502deacb0a62983035c6f6f4e962b319ba6a1f4a77d3d\",\"dweb:/ipfs/QmaWCW7ahEQqFjwhSUhV7Ae7WhfNvzSpE7DQ58hvEooqPL\"]},\"lib/openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol\":{\"keccak256\":\"0xbae499c224def4d252ee766288a178769529a16ab26670a2761fd405b98c2ba0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7bc24842026d827fa4a9091b4464846c280f86162521a7c16e6388ce11fced8d\",\"dweb:/ipfs/QmRtwbSbzb66Wt8Y37ocVLqckdxuSkZGNF5bHwhj9AAS5L\"]},\"lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol\":{\"keccak256\":\"0xbc97d8c0d67d4d7eba1e662f0a8671712ace9e060ab03af547c4bb321aec1d8c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://890d156f50630d52c7be57d7e0499132d6fd92b2e1365b81531f4463b3304377\",\"dweb:/ipfs/QmUHe9uL1ciePH2pQg7wdrgTAFRZWjcpBEAg8V1UNtXutd\"]},\"lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol\":{\"keccak256\":\"0xfdb17e982a8744014f1804df7cacdd01f1423d19d79645da61def434eb17e4f3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4b626c1803f1bd5739859d1fe12bedb8c2c964a1f93e70d6f8c3c031d338d4e3\",\"dweb:/ipfs/QmacvfA17VWEhUApA4NykdWRC1koBXqvUdgCH13ZahmRxm\"]},\"lib/openzeppelin-contracts/contracts/utils/Arrays.sol\":{\"keccak256\":\"0xb39dfb53ef5d795f546d30a68d9e20d5ba7dd8ba1d5f80dbdc5b7f6a8574896c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://848083a136ad5f7aee5a7a70c4486c3e420cfb2723d67a6556a0117fd2fe2924\",\"dweb:/ipfs/QmP4WrY2oTtd2QXaFdupwRWXCh5kMVTsnfs27h2nspiACA\"]},\"lib/openzeppelin-contracts/contracts/utils/Comparators.sol\":{\"keccak256\":\"0x302eecd8cf323b4690e3494a7d960b3cbce077032ab8ef655b323cdd136cec58\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://49ba706f1bc476d68fe6c1fad75517acea4e9e275be0989b548e292eb3a3eacd\",\"dweb:/ipfs/QmeBpvcdGWzWMKTQESUCEhHgnEQYYATVwPxLMxa6vMT7jC\"]},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"lib/openzeppelin-contracts/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol\":{\"keccak256\":\"0x94045fd4f268edf2b2d01ef119268548c320366d6f5294ad30c1b8f9d4f5225f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://edfda81f426f8948b3834115c21e83c48180e6db0d2a8cd2debb2185ed349337\",\"dweb:/ipfs/QmdYZneFyDAux1BuWQxLAdqtABrGS2k9WYCa7C9dvpKkWv\"]},\"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0x2d9dc2fe26180f74c11c13663647d38e259e45f95eb88f57b61d2160b0109d3e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://81233d1f98060113d9922180bb0f14f8335856fe9f339134b09335e9f678c377\",\"dweb:/ipfs/QmWh6R35SarhAn4z2wH8SU456jJSYL2FgucfTFgbHJJN4E\"]},\"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x09e3f1c72d4c5cbe8e2644ab7313f8f7177533ae2f4c24cdcbbeaf520a73734c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://93208401215d539fa2d81626b207c1f611def7883d0e447b3b5969ebaa7b3c2c\",\"dweb:/ipfs/QmXPxDnQPx8LAweX5ZJqEcwkvs59kP4c64VVDG1Jjq1mef\"]},\"lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b1d578337048cad08c1c03041cca5978eff5428aa130c781b271ad9e5566e1f8\",\"dweb:/ipfs/QmPFKL2r9CBsMwmUqqdcFPfHZB2qcs9g1HDrPxzWSxomvy\"]},\"lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol\":{\"keccak256\":\"0x888e5cd820c31a19a584a4189dc535c8af239fc54eb5bea23f5c79ef2e27bab0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cc1ae0b5459bd403927363df9ec6df7c6904c1efcfc50891f8fbcff521c3976a\",\"dweb:/ipfs/QmSZekdFmP23rhWhSbfTAycbfcbAPcQax2RSVGuvGnMYhv\"]},\"src/DebtEngineBase.sol\":{\"keccak256\":\"0xcb2c0df8aacabdae4bc12f223941c5bde6af0cabbc3ba2731f7599351f44a372\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://04e85235c2169904352d6ea2001839db1da854eda3db21dd6e5bb6a314ee2991\",\"dweb:/ipfs/QmTkELnwfZbj39SM3req9j6cVDCmsshmCmizhsngNHsJh8\"]},\"src/DebtEngineInvariantStorage.sol\":{\"keccak256\":\"0xa72f3f1948d4a8121010bca782043fcb5247a082699fd1408874bf0a93a6792e\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://0e319e26710df1afd43d8f35c23f3e84ef39dae1b976a77fa02b9b78137e39d6\",\"dweb:/ipfs/QmUauq9LnoseQx5HYz8tvw9GvYEWXzphVteaRJs2tJvT4X\"]},\"src/deployment/DebtEngineAccessControl.sol\":{\"keccak256\":\"0x355e495d17edd17103592e9cb475d562daf8a060b5805f25b6f65c373f21bbd3\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://4fae218e9c59e4a8ae6f13f2a37d70fb7083f4df18e07285c1fd6a8f3788259c\",\"dweb:/ipfs/Qma7ZbdAaLyUXAQwikaKr5ozhs5ixbVgph7wgFLrfc2gSU\"]},\"src/modules/VersionModule.sol\":{\"keccak256\":\"0x998f6230b54d2ea7b3348609d84bccf9351569e66cfaf1db56b0d9e8da3a68ac\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://2affbe7c1539ab8c5e5ce98e4d0b63f9b300daa6f1df5c109b8a94ae547585e9\",\"dweb:/ipfs/QmRsHjz2ExGaGwiZenNF1eKnd1Cef3hLxe2riKoPTiNMda\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.33+commit.64118f21"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"forwarderIrrevocable","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"type":"error","name":"AccessControlBadConfirmation"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"type":"error","name":"AccessControlUnauthorizedAccount"},{"inputs":[],"type":"error","name":"AdminWithAddressZeroNotAllowed"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"maxSize","type":"uint256"}],"type":"error","name":"BatchSizeTooLarge"},{"inputs":[],"type":"error","name":"InvalidInputLength"},{"inputs":[],"type":"error","name":"SmartContractWithAddressZeroNotAllowed"},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"CreditEventsCleared","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"CreditEventsSet","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"DebtCleared","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"DebtSet","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"previousAdminRole","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"newAdminRole","type":"bytes32","indexed":true}],"type":"event","name":"RoleAdminChanged","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32","indexed":true},{"internalType":"address","name":"account","type":"address","indexed":true},{"internalType":"address","name":"sender","type":"address","indexed":true}],"type":"event","name":"RoleGranted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32","indexed":true},{"internalType":"address","name":"account","type":"address","indexed":true},{"internalType":"address","name":"sender","type":"address","indexed":true}],"type":"event","name":"RoleRevoked","anonymous":false},{"inputs":[],"stateMutability":"view","type":"function","name":"CREDIT_EVENTS_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"DEBT_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"MAX_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"clearCreditEvents"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"clearDebt"},{"inputs":[],"stateMutability":"view","type":"function","name":"creditEvents","outputs":[{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"creditEvents","outputs":[{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}]},{"inputs":[],"stateMutability":"view","type":"function","name":"debt","outputs":[{"internalType":"struct ICMTATDebt.DebtInformation","name":"","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"debt","outputs":[{"internalType":"struct ICMTATDebt.DebtInformation","name":"","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function","name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getRoleMembers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"grantRole"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"hasCreditEvents","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"hasDebt","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"stateMutability":"view","type":"function","name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"stateMutability":"view","type":"function","name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"renounceRole"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"revokeRole"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"},{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"creditEvents_","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}],"stateMutability":"nonpayable","type":"function","name":"setCreditEvents"},{"inputs":[{"internalType":"address[]","name":"smartContracts","type":"address[]"},{"internalType":"struct ICMTATCreditEvents.CreditEvents[]","name":"creditEventsList","type":"tuple[]","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}],"stateMutability":"nonpayable","type":"function","name":"setCreditEventsBatch"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"},{"internalType":"struct ICMTATDebt.DebtInformation","name":"debt_","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}],"stateMutability":"nonpayable","type":"function","name":"setDebt"},{"inputs":[{"internalType":"address[]","name":"smartContracts","type":"address[]"},{"internalType":"struct ICMTATDebt.DebtInformation[]","name":"debts","type":"tuple[]","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}],"stateMutability":"nonpayable","type":"function","name":"setDebtBatch"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"stateMutability":"view","type":"function","name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"version","outputs":[{"internalType":"string","name":"","type":"string"}]}],"devdoc":{"kind":"dev","methods":{"clearCreditEvents(address)":{"details":"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {CreditEventsCleared}."},"clearDebt(address)":{"details":"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {DebtCleared}."},"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"getRoleMembers(bytes32)":{"details":"Return all accounts that have `role` WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-changing function may render the function uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasCreditEvents(address)":{"details":"True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}."},"hasDebt(address)":{"details":"True after {setDebt} / {setDebtBatch}, false again after {clearDebt}."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`. NOTE: The `DEFAULT_ADMIN_ROLE` is treated as a super-admin role. Any account holding `DEFAULT_ADMIN_ROLE` is considered to hold every role, even if it was not explicitly granted via `grantRole`. This means `hasRole(ANY_ROLE, admin)` returns `true` for the admin. `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` will NOT reflect this implicit membership: the admin is not listed as a holder of the other roles. Because OpenZeppelin's `_grantRole` / `_revokeRole` consult this function, granting a role to an admin is a no-op, and revoking or renouncing one emits `RoleRevoked` while the admin keeps the power."},"isTrustedForwarder(address)":{"details":"Indicates whether any particular address is the trusted forwarder."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas."},"trustedForwarder()":{"details":"Returns the address of the trusted forwarder."}},"version":1},"userdoc":{"kind":"user","methods":{"MAX_BATCH_SIZE()":{"notice":"Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`."},"clearCreditEvents(address)":{"notice":"Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards and `creditEvents(smartContract_)` returns the zero struct, as before any record was set."},"clearDebt(address)":{"notice":"Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards and `debt(smartContract_)` returns the zero struct, as before any record was set."},"creditEvents()":{"notice":"Function to get the credit events for the sender's smart contract"},"creditEvents(address)":{"notice":"Function to get the credit events for a specific smart contract"},"debt()":{"notice":"Function to get the debt for the sender's smart contract"},"debt(address)":{"notice":"Function to get the debt for a specific smart contract"},"hasCreditEvents(address)":{"notice":"Returns true if credit events are currently set for the given smart contract"},"hasDebt(address)":{"notice":"Returns true if a debt record is currently set for the given smart contract"},"setCreditEvents(address,(bool,bool,string))":{"notice":"Function to set the credit events for a given smart contract"},"setCreditEventsBatch(address[],(bool,bool,string)[])":{"notice":"Batch version of {setCreditEvents}"},"setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))":{"notice":"Function to set the debt for a given smart contract"},"setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])":{"notice":"Batch version of {setDebt}"},"version()":{"notice":"Returns the current version of the smart contract"}},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","CMTAT/=lib/CMTAT/contracts/","OZ/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/CMTAT/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/deployment/DebtEngineAccessControl.sol":"DebtEngineAccessControl"},"evmVersion":"prague","libraries":{}},"sources":{"lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol":{"keccak256":"0x4e9ef9c96644bcd2159ea688cc2d6a8068a14282acc2b8d54615b99412961d79","urls":["bzz-raw://7ea2cea23c7cf68a9ef1110ed6bee0aa5eba44365d58975c084545ede2c09c2b","dweb:/ipfs/QmepuGYcv4zfxFFsPnCpBVzgCZq1HgPXqM49hbj7FDEyN1"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol":{"keccak256":"0xbb5ff9d854285182f0f305f13b37fcd54dd41e00d3d80a33b75639e2d8fc9c62","urls":["bzz-raw://da1ffcafac20656e609e5e9a6aff665ba55a01036fe79b13cc22d475f9fa35dd","dweb:/ipfs/QmNaQ286Dx3RX3hFq6M4Q8HSMsyNSjSX6fr5bruCTRMNVk"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol":{"keccak256":"0x46f2908dcf2c2d5eac125837ab1ac76cc11c7ecc394041a59738ea4acaf072fa","urls":["bzz-raw://de5a7fbe0b4970131fc545b4a198b49fa05cfaa104a471e97a64aa6b8630ac51","dweb:/ipfs/Qmf6LiKNBQwFyxCbiiS4nLHXu4ydfzV9hQsXmJ9Qz43Rkc"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol":{"keccak256":"0x86256da854b013551350056894193d38cd932f0de3cf5cd9ca964f40b35f396d","urls":["bzz-raw://8851f89021a74c2712b2f78d30ce1012435106e70fac4ae9cb1d1e89c95ec2ae","dweb:/ipfs/QmWJ4fwdyAPuVeXtddvV4sz5qwohNzZNJaBWkBseNLtTp6"],"license":"MPL-2.0"},"lib/openzeppelin-contracts/contracts/access/AccessControl.sol":{"keccak256":"0x1a6b4f6b7798ab80929d491b89d5427a9b3338c0fd1acd0ba325f69c6f1646af","urls":["bzz-raw://7bb7f346c12a14dc622bc105ce3c47202fbc89f4b153a28a63bb68193297330c","dweb:/ipfs/QmagwF8P3bUBXwdo159ueEnY9dLSvEWwK24kk2op58egwG"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/access/IAccessControl.sol":{"keccak256":"0xbff9f59c84e5337689161ce7641c0ef8e872d6a7536fbc1f5133f128887aba3c","urls":["bzz-raw://b308f882e796f7b79c9502deacb0a62983035c6f6f4e962b319ba6a1f4a77d3d","dweb:/ipfs/QmaWCW7ahEQqFjwhSUhV7Ae7WhfNvzSpE7DQ58hvEooqPL"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol":{"keccak256":"0xbae499c224def4d252ee766288a178769529a16ab26670a2761fd405b98c2ba0","urls":["bzz-raw://7bc24842026d827fa4a9091b4464846c280f86162521a7c16e6388ce11fced8d","dweb:/ipfs/QmRtwbSbzb66Wt8Y37ocVLqckdxuSkZGNF5bHwhj9AAS5L"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol":{"keccak256":"0xbc97d8c0d67d4d7eba1e662f0a8671712ace9e060ab03af547c4bb321aec1d8c","urls":["bzz-raw://890d156f50630d52c7be57d7e0499132d6fd92b2e1365b81531f4463b3304377","dweb:/ipfs/QmUHe9uL1ciePH2pQg7wdrgTAFRZWjcpBEAg8V1UNtXutd"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol":{"keccak256":"0xfdb17e982a8744014f1804df7cacdd01f1423d19d79645da61def434eb17e4f3","urls":["bzz-raw://4b626c1803f1bd5739859d1fe12bedb8c2c964a1f93e70d6f8c3c031d338d4e3","dweb:/ipfs/QmacvfA17VWEhUApA4NykdWRC1koBXqvUdgCH13ZahmRxm"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/Arrays.sol":{"keccak256":"0xb39dfb53ef5d795f546d30a68d9e20d5ba7dd8ba1d5f80dbdc5b7f6a8574896c","urls":["bzz-raw://848083a136ad5f7aee5a7a70c4486c3e420cfb2723d67a6556a0117fd2fe2924","dweb:/ipfs/QmP4WrY2oTtd2QXaFdupwRWXCh5kMVTsnfs27h2nspiACA"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/Comparators.sol":{"keccak256":"0x302eecd8cf323b4690e3494a7d960b3cbce077032ab8ef655b323cdd136cec58","urls":["bzz-raw://49ba706f1bc476d68fe6c1fad75517acea4e9e275be0989b548e292eb3a3eacd","dweb:/ipfs/QmeBpvcdGWzWMKTQESUCEhHgnEQYYATVwPxLMxa6vMT7jC"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/Context.sol":{"keccak256":"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2","urls":["bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12","dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/Panic.sol":{"keccak256":"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a","urls":["bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a","dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol":{"keccak256":"0x94045fd4f268edf2b2d01ef119268548c320366d6f5294ad30c1b8f9d4f5225f","urls":["bzz-raw://edfda81f426f8948b3834115c21e83c48180e6db0d2a8cd2debb2185ed349337","dweb:/ipfs/QmdYZneFyDAux1BuWQxLAdqtABrGS2k9WYCa7C9dvpKkWv"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol":{"keccak256":"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97","urls":["bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b","dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol":{"keccak256":"0x2d9dc2fe26180f74c11c13663647d38e259e45f95eb88f57b61d2160b0109d3e","urls":["bzz-raw://81233d1f98060113d9922180bb0f14f8335856fe9f339134b09335e9f678c377","dweb:/ipfs/QmWh6R35SarhAn4z2wH8SU456jJSYL2FgucfTFgbHJJN4E"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol":{"keccak256":"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c","urls":["bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617","dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/math/Math.sol":{"keccak256":"0x09e3f1c72d4c5cbe8e2644ab7313f8f7177533ae2f4c24cdcbbeaf520a73734c","urls":["bzz-raw://93208401215d539fa2d81626b207c1f611def7883d0e447b3b5969ebaa7b3c2c","dweb:/ipfs/QmXPxDnQPx8LAweX5ZJqEcwkvs59kP4c64VVDG1Jjq1mef"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol":{"keccak256":"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54","urls":["bzz-raw://b1d578337048cad08c1c03041cca5978eff5428aa130c781b271ad9e5566e1f8","dweb:/ipfs/QmPFKL2r9CBsMwmUqqdcFPfHZB2qcs9g1HDrPxzWSxomvy"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol":{"keccak256":"0x888e5cd820c31a19a584a4189dc535c8af239fc54eb5bea23f5c79ef2e27bab0","urls":["bzz-raw://cc1ae0b5459bd403927363df9ec6df7c6904c1efcfc50891f8fbcff521c3976a","dweb:/ipfs/QmSZekdFmP23rhWhSbfTAycbfcbAPcQax2RSVGuvGnMYhv"],"license":"MIT"},"src/DebtEngineBase.sol":{"keccak256":"0xcb2c0df8aacabdae4bc12f223941c5bde6af0cabbc3ba2731f7599351f44a372","urls":["bzz-raw://04e85235c2169904352d6ea2001839db1da854eda3db21dd6e5bb6a314ee2991","dweb:/ipfs/QmTkELnwfZbj39SM3req9j6cVDCmsshmCmizhsngNHsJh8"],"license":"MPL-2.0"},"src/DebtEngineInvariantStorage.sol":{"keccak256":"0xa72f3f1948d4a8121010bca782043fcb5247a082699fd1408874bf0a93a6792e","urls":["bzz-raw://0e319e26710df1afd43d8f35c23f3e84ef39dae1b976a77fa02b9b78137e39d6","dweb:/ipfs/QmUauq9LnoseQx5HYz8tvw9GvYEWXzphVteaRJs2tJvT4X"],"license":"MPL-2.0"},"src/deployment/DebtEngineAccessControl.sol":{"keccak256":"0x355e495d17edd17103592e9cb475d562daf8a060b5805f25b6f65c373f21bbd3","urls":["bzz-raw://4fae218e9c59e4a8ae6f13f2a37d70fb7083f4df18e07285c1fd6a8f3788259c","dweb:/ipfs/Qma7ZbdAaLyUXAQwikaKr5ozhs5ixbVgph7wgFLrfc2gSU"],"license":"MPL-2.0"},"src/modules/VersionModule.sol":{"keccak256":"0x998f6230b54d2ea7b3348609d84bccf9351569e66cfaf1db56b0d9e8da3a68ac","urls":["bzz-raw://2affbe7c1539ab8c5e5ce98e4d0b63f9b300daa6f1df5c109b8a94ae547585e9","dweb:/ipfs/QmRsHjz2ExGaGwiZenNF1eKnd1Cef3hLxe2riKoPTiNMda"],"license":"MPL-2.0"}},"version":1},"id":104} \ No newline at end of file diff --git a/doc/compilation/v0.3.0/foundry/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json b/doc/compilation/v0.3.0/foundry/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json new file mode 100644 index 0000000..7ee0771 --- /dev/null +++ b/doc/compilation/v0.3.0/foundry/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json @@ -0,0 +1 @@ +{"abi":[{"type":"constructor","inputs":[{"name":"owner","type":"address","internalType":"address"},{"name":"forwarderIrrevocable","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"MAX_BATCH_SIZE","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"acceptOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"clearCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"clearDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"creditEvents","inputs":[],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"stateMutability":"view"},{"type":"function","name":"creditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"stateMutability":"view"},{"type":"function","name":"debt","inputs":[],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"stateMutability":"view"},{"type":"function","name":"debt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"stateMutability":"view"},{"type":"function","name":"hasCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"hasDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"isTrustedForwarder","inputs":[{"name":"forwarder","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"pendingOwner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCreditEvents","inputs":[{"name":"smartContract_","type":"address","internalType":"address"},{"name":"creditEvents_","type":"tuple","internalType":"struct ICMTATCreditEvents.CreditEvents","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCreditEventsBatch","inputs":[{"name":"smartContracts","type":"address[]","internalType":"address[]"},{"name":"creditEventsList","type":"tuple[]","internalType":"struct ICMTATCreditEvents.CreditEvents[]","components":[{"name":"flagDefault","type":"bool","internalType":"bool"},{"name":"flagRedeemed","type":"bool","internalType":"bool"},{"name":"rating","type":"string","internalType":"string"}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDebt","inputs":[{"name":"smartContract_","type":"address","internalType":"address"},{"name":"debt_","type":"tuple","internalType":"struct ICMTATDebt.DebtInformation","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDebtBatch","inputs":[{"name":"smartContracts","type":"address[]","internalType":"address[]"},{"name":"debts","type":"tuple[]","internalType":"struct ICMTATDebt.DebtInformation[]","components":[{"name":"debtIdentifier","type":"tuple","internalType":"struct ICMTATDebt.DebtIdentifier","components":[{"name":"issuerName","type":"string","internalType":"string"},{"name":"issuerDescription","type":"string","internalType":"string"},{"name":"guarantor","type":"string","internalType":"string"},{"name":"debtHolder","type":"string","internalType":"string"}]},{"name":"debtInstrument","type":"tuple","internalType":"struct ICMTATDebt.DebtInstrument","components":[{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"parValue","type":"uint256","internalType":"uint256"},{"name":"minimumDenomination","type":"uint256","internalType":"uint256"},{"name":"issuanceDate","type":"string","internalType":"string"},{"name":"maturityDate","type":"string","internalType":"string"},{"name":"couponPaymentFrequency","type":"string","internalType":"string"},{"name":"interestScheduleFormat","type":"string","internalType":"string"},{"name":"interestPaymentDate","type":"string","internalType":"string"},{"name":"dayCountConvention","type":"string","internalType":"string"},{"name":"businessDayConvention","type":"string","internalType":"string"},{"name":"currency","type":"string","internalType":"string"},{"name":"currencyContract","type":"address","internalType":"address"}]}]}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"supportsInterface","inputs":[{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"trustedForwarder","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"type":"event","name":"CreditEventsCleared","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"CreditEventsSet","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"DebtCleared","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"DebtSet","inputs":[{"name":"smartContract","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"AdminWithAddressZeroNotAllowed","inputs":[]},{"type":"error","name":"BatchSizeTooLarge","inputs":[{"name":"size","type":"uint256","internalType":"uint256"},{"name":"maxSize","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"InvalidInputLength","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"name":"owner","type":"address","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"SmartContractWithAddressZeroNotAllowed","inputs":[]}],"bytecode":{"object":"0x60a060405234801561000f575f5ffd5b50604051611fb6380380611fb683398101604081905261002e91610103565b80826001600160a01b03811661005d57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100668161007b565b506001600160a01b0316608052506101349050565b600580546001600160a01b031916905561009481610097565b50565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b80516001600160a01b03811681146100fe575f5ffd5b919050565b5f5f60408385031215610114575f5ffd5b61011d836100e8565b915061012b602084016100e8565b90509250929050565b608051611e5c61015a5f395f81816101df0152818161024c015261129b0152611e5c5ff3fe608060405234801561000f575f5ffd5b506004361061013d575f3560e01c806396c3e905116100b4578063c41a71ff11610079578063c41a71ff146102f4578063cfdbf25414610307578063e30c39781461031e578063ef6735031461032f578063f2fde38b14610342578063f423aa6c14610355575f5ffd5b806396c3e9051461029557806399db0828146102a85780639b6c56ec146102bb578063a6568202146102ce578063b05e5a41146102e1575f5ffd5b8063572b6c0511610105578063572b6c05146101cf578063591236f71461020f578063715018a61461023a57806379ba5097146102425780637da0a8771461024a5780638da5cb5b14610284575f5ffd5b806301ffc9a7146101415780630dca59c114610169578063498de65c1461017e57806350101d841461019357806354fd4d50146101a8575b5f5ffd5b61015461014f366004611439565b610380565b60405190151581526020015b60405180910390f35b6101716103b6565b6040516101609190611495565b61019161018c366004611654565b6103ce565b005b61019b6103e2565b604051610160919061166f565b60408051808201825260058152640302e332e360dc1b6020820152905161016091906116a9565b6101546101dd366004611654565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b61015461021d366004611654565b6001600160a01b03165f9081526003602052604090205460ff1690565b610191610408565b61019161041b565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610160565b6004546001600160a01b031661026c565b6101916102a3366004611654565b610482565b6101916102b63660046116bb565b610493565b6101716102c9366004611654565b6104a9565b6101916102dc36600461170e565b610beb565b6101916102ef36600461179e565b610bfd565b61019161030236600461179e565b610cc1565b6103106101f481565b604051908152602001610160565b6005546001600160a01b031661026c565b61019b61033d366004611654565b610d7e565b610191610350366004611654565b610e71565b610154610363366004611654565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b031982166307f5828d60e41b14806103b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6103be61134a565b6103c96102c9610ee2565b905090565b6103d6610eeb565b6103df81610ef3565b50565b60408051606080820183525f8083526020830152918101919091526103c961033d610ee2565b610410611042565b6104195f6110a0565b565b5f610424610ee2565b9050806001600160a01b03166104426005546001600160a01b031690565b6001600160a01b0316146104795760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6103df816110a0565b61048a610eeb565b6103df816110b9565b61049b610eeb565b6104a5828261115a565b5050565b6104b161134a565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906104eb9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105179061180a565b80156105625780601f1061053957610100808354040283529160200191610562565b820191905f5260205f20905b81548152906001019060200180831161054557829003601f168201915b5050505050815260200160018201805461057b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061180a565b80156105f25780601f106105c9576101008083540402835291602001916105f2565b820191905f5260205f20905b8154815290600101906020018083116105d557829003601f168201915b5050505050815260200160028201805461060b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106379061180a565b80156106825780601f1061065957610100808354040283529160200191610682565b820191905f5260205f20905b81548152906001019060200180831161066557829003601f168201915b5050505050815260200160038201805461069b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106c79061180a565b80156107125780601f106106e957610100808354040283529160200191610712565b820191905f5260205f20905b8154815290600101906020018083116106f557829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461075d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546107899061180a565b80156107d45780601f106107ab576101008083540402835291602001916107d4565b820191905f5260205f20905b8154815290600101906020018083116107b757829003601f168201915b505050505081526020016004820180546107ed9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108199061180a565b80156108645780601f1061083b57610100808354040283529160200191610864565b820191905f5260205f20905b81548152906001019060200180831161084757829003601f168201915b5050505050815260200160058201805461087d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108a99061180a565b80156108f45780601f106108cb576101008083540402835291602001916108f4565b820191905f5260205f20905b8154815290600101906020018083116108d757829003601f168201915b5050505050815260200160068201805461090d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109399061180a565b80156109845780601f1061095b57610100808354040283529160200191610984565b820191905f5260205f20905b81548152906001019060200180831161096757829003601f168201915b5050505050815260200160078201805461099d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109c99061180a565b8015610a145780601f106109eb57610100808354040283529160200191610a14565b820191905f5260205f20905b8154815290600101906020018083116109f757829003601f168201915b50505050508152602001600882018054610a2d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a599061180a565b8015610aa45780601f10610a7b57610100808354040283529160200191610aa4565b820191905f5260205f20905b815481529060010190602001808311610a8757829003601f168201915b50505050508152602001600982018054610abd9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae99061180a565b8015610b345780601f10610b0b57610100808354040283529160200191610b34565b820191905f5260205f20905b815481529060010190602001808311610b1757829003601f168201915b50505050508152602001600a82018054610b4d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b799061180a565b8015610bc45780601f10610b9b57610100808354040283529160200191610bc4565b820191905f5260205f20905b815481529060010190602001808311610ba757829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b610bf3610eeb565b6104a582826111f2565b610c05610eeb565b828114610c2557604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610c525760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610cb2858583818110610c7457610c74611842565b9050602002016020810190610c899190611654565b848484818110610c9b57610c9b611842565b9050602002810190610cad9190611856565b6111f2565b600101610c57565b5050505050565b610cc9610eeb565b828114610ce957604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610d165760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610d76858583818110610d3857610d38611842565b9050602002016020810190610d4d9190611654565b848484818110610d5f57610d5f611842565b9050602002810190610d719190611874565b61115a565b600101610d1b565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610dea9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610e169061180a565b8015610e615780601f10610e3857610100808354040283529160200191610e61565b820191905f5260205f20905b815481529060010190602001808311610e4457829003601f168201915b5050505050815250509050919050565b610e79611042565b600580546001600160a01b0383166001600160a01b03199091168117909155610eaa6004546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f6103c961128a565b610419611042565b6001600160a01b038116610f1a576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f908152602081905260408120908181610f3e82826113f3565b610f4b600183015f6113f3565b610f58600283015f6113f3565b610f65600383015f6113f3565b50505f60048301818155600584018290556006840182905590610f8b60078501826113f3565b610f98600483015f6113f3565b610fa5600583015f6113f3565b610fb2600683015f6113f3565b610fbf600783015f6113f3565b610fcc600883015f6113f3565b610fd9600983015f6113f3565b610fe6600a83015f6113f3565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b61104a610ee2565b6001600160a01b03166110656004546001600160a01b031690565b6001600160a01b0316146104195761107b610ee2565b60405163118cdaa760e01b81526001600160a01b039091166004820152602401610470565b600580546001600160a01b03191690556103df816112f9565b6001600160a01b0381166110e0576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff191681559190611110908301826113f3565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b038216611181576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906111a48282611a0f565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b6001600160a01b038216611219576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061123c8282611c6e565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f3660148082108015906112c657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156112ec576112d936828403815f611db2565b6112e291611dd9565b60601c9250505090565b339250505090565b505090565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60405180604001604052806113806040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016113ee6040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b5080546113ff9061180a565b5f825580601f1061140e575050565b601f0160209004905f5260205f20906103df91905f5b808211156112f4575f81840155600101611424565b5f60208284031215611449575f5ffd5b81356001600160e01b031981168114611460575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526114b960e0850182611467565b90506020820151605f198583030160808601526114d68282611467565b9150506040820151605f198583030160a08601526114f48282611467565b91505060608201519150605f198482030160c08501526115148183611467565b9150506020840151601f198483030160408501528051825260208101516020830152604081015160408301526060810151610180606084015261155b610180840182611467565b9050608082015183820360808501526115748282611467565b91505060a082015183820360a085015261158e8282611467565b91505060c082015183820360c08501526115a88282611467565b91505060e082015183820360e08501526115c28282611467565b9150506101008201518382036101008501526115de8282611467565b9150506101208201518382036101208501526115fa8282611467565b9150506101408201518382036101408501526116168282611467565b91505061016082015191506116376101608401836001600160a01b03169052565b95945050505050565b6001600160a01b03811681146103df575f5ffd5b5f60208284031215611664575f5ffd5b813561146081611640565b602081528151151560208201526020820151151560408201525f60408301516060808401526116a16080840182611467565b949350505050565b602081525f6114606020830184611467565b5f5f604083850312156116cc575f5ffd5b82356116d781611640565b9150602083013567ffffffffffffffff8111156116f2575f5ffd5b830160608186031215611703575f5ffd5b809150509250929050565b5f5f6040838503121561171f575f5ffd5b823561172a81611640565b9150602083013567ffffffffffffffff811115611745575f5ffd5b830160408186031215611703575f5ffd5b5f5f83601f840112611766575f5ffd5b50813567ffffffffffffffff81111561177d575f5ffd5b6020830191508360208260051b8501011115611797575f5ffd5b9250929050565b5f5f5f5f604085870312156117b1575f5ffd5b843567ffffffffffffffff8111156117c7575f5ffd5b6117d387828801611756565b909550935050602085013567ffffffffffffffff8111156117f2575f5ffd5b6117fe87828801611756565b95989497509550505050565b600181811c9082168061181e57607f821691505b60208210810361183c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e1983360301811261186a575f5ffd5b9190910192915050565b5f8235605e1983360301811261186a575f5ffd5b5f813580151581146103b0575f5ffd5b5f5f8335601e198436030181126118ad575f5ffd5b83018035915067ffffffffffffffff8211156118c7575f5ffd5b602001915036819003821315611797575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115611941578282111561194157805f5260205f20601f840160051c602085101561191a57505f5b90810190601f840160051c035f5b8181101561193d575f83820155600101611928565b5050505b505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611972576119726118db565b61198683611980835461180a565b836118ef565b5f601f8411600181146119b2575f85156119a05750838201355b6119aa8682611946565b845550610cba565b5f83815260208120601f198716915b828110156119e157868501358255602094850194600190920191016119c1565b50868210156119fd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611a1882611888565b1515815460ff821691508160ff19821617835561ff00611a3a60208601611888565b151560081b168261ffff19831617178355505060018101611a5e6040840184611898565b67ffffffffffffffff811115611a7657611a766118db565b611a8a81611a84855461180a565b856118ef565b5f601f821160018114611ab6575f8315611aa45750838201355b611aae8482611946565b865550611b0d565b5f85815260208120601f198516915b82811015611ae55786850135825560209485019460019092019101611ac5565b5084821015611b01575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e1983360301811261186a575f5ffd5b5f81356103b081611640565b813581556020820135600182015560408201356002820155611b5c6060830183611898565b611b6a81836003860161195a565b5050611b796080830183611898565b611b8781836004860161195a565b5050611b9660a0830183611898565b611ba481836005860161195a565b5050611bb360c0830183611898565b611bc181836006860161195a565b5050611bd060e0830183611898565b611bde81836007860161195a565b5050611bee610100830183611898565b611bfc81836008860161195a565b5050611c0c610120830183611898565b611c1a81836009860161195a565b5050611c2a610140830183611898565b611c388183600a860161195a565b50506104a5611c4a6101608401611b2b565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112611c81575f5ffd5b8201611c8d8180611898565b67ffffffffffffffff811115611ca557611ca56118db565b611cb981611cb3865461180a565b866118ef565b5f601f821160018114611ce5575f8315611cd35750838201355b611cdd8482611946565b875550611d3c565b5f86815260208120601f198516915b82811015611d145786850135825560209485019460019092019101611cf4565b5084821015611d30575f1960f88660031b161c19848701351681555b505060018360011b0186555b50505050611d4d6020820182611898565b611d5b81836001870161195a565b5050611d6a6040820182611898565b611d7881836002870161195a565b5050611d876060820182611898565b9150611d9782826003860161195a565b50506104a5611da96020840184611b16565b60048301611b37565b5f5f85851115611dc0575f5ffd5b83861115611dcc575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611e1f576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea2646970667358221220682b301021631ea5464b64824ef1a80abc78f97fb251fdbc09e60e28bd2b316764736f6c63430008210033","sourceMap":"704:1591:105:-:0;;;957:111;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1029:20;1059:5;-1:-1:-1;;;;;1273:26:72;;1269:95;;1322:31;;-1:-1:-1;;;1322:31:72;;1350:1;1322:31;;;640:51:114;613:18;;1322:31:72;;;;;;;1269:95;1373:32;1392:12;1373:18;:32::i;:::-;-1:-1:-1;;;;;;1500:37:78;;;-1:-1:-1;704:1591:105;;-1:-1:-1;704:1591:105;2011:153:73;2100:13;2093:20;;-1:-1:-1;;;;;;2093:20:73;;;2123:34;2148:8;2123:24;:34::i;:::-;2011:153;:::o;2912:187:72:-;3004:6;;;-1:-1:-1;;;;;3020:17:72;;;-1:-1:-1;;;;;;3020:17:72;;;;;;;3052:40;;3004:6;;;3020:17;3004:6;;3052:40;;2985:16;;3052:40;2975:124;2912:187;:::o;14:177:114:-;93:13;;-1:-1:-1;;;;;135:31:114;;125:42;;115:70;;181:1;178;171:12;115:70;14:177;;;:::o;196:293::-;275:6;283;336:2;324:9;315:7;311:23;307:32;304:52;;;352:1;349;342:12;304:52;375:40;405:9;375:40;:::i;:::-;365:50;;434:49;479:2;468:9;464:18;434:49;:::i;:::-;424:59;;196:293;;;;;:::o;494:203::-;704:1591:105;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f5ffd5b506004361061013d575f3560e01c806396c3e905116100b4578063c41a71ff11610079578063c41a71ff146102f4578063cfdbf25414610307578063e30c39781461031e578063ef6735031461032f578063f2fde38b14610342578063f423aa6c14610355575f5ffd5b806396c3e9051461029557806399db0828146102a85780639b6c56ec146102bb578063a6568202146102ce578063b05e5a41146102e1575f5ffd5b8063572b6c0511610105578063572b6c05146101cf578063591236f71461020f578063715018a61461023a57806379ba5097146102425780637da0a8771461024a5780638da5cb5b14610284575f5ffd5b806301ffc9a7146101415780630dca59c114610169578063498de65c1461017e57806350101d841461019357806354fd4d50146101a8575b5f5ffd5b61015461014f366004611439565b610380565b60405190151581526020015b60405180910390f35b6101716103b6565b6040516101609190611495565b61019161018c366004611654565b6103ce565b005b61019b6103e2565b604051610160919061166f565b60408051808201825260058152640302e332e360dc1b6020820152905161016091906116a9565b6101546101dd366004611654565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b61015461021d366004611654565b6001600160a01b03165f9081526003602052604090205460ff1690565b610191610408565b61019161041b565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610160565b6004546001600160a01b031661026c565b6101916102a3366004611654565b610482565b6101916102b63660046116bb565b610493565b6101716102c9366004611654565b6104a9565b6101916102dc36600461170e565b610beb565b6101916102ef36600461179e565b610bfd565b61019161030236600461179e565b610cc1565b6103106101f481565b604051908152602001610160565b6005546001600160a01b031661026c565b61019b61033d366004611654565b610d7e565b610191610350366004611654565b610e71565b610154610363366004611654565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b031982166307f5828d60e41b14806103b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6103be61134a565b6103c96102c9610ee2565b905090565b6103d6610eeb565b6103df81610ef3565b50565b60408051606080820183525f8083526020830152918101919091526103c961033d610ee2565b610410611042565b6104195f6110a0565b565b5f610424610ee2565b9050806001600160a01b03166104426005546001600160a01b031690565b6001600160a01b0316146104795760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6103df816110a0565b61048a610eeb565b6103df816110b9565b61049b610eeb565b6104a5828261115a565b5050565b6104b161134a565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906104eb9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105179061180a565b80156105625780601f1061053957610100808354040283529160200191610562565b820191905f5260205f20905b81548152906001019060200180831161054557829003601f168201915b5050505050815260200160018201805461057b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061180a565b80156105f25780601f106105c9576101008083540402835291602001916105f2565b820191905f5260205f20905b8154815290600101906020018083116105d557829003601f168201915b5050505050815260200160028201805461060b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106379061180a565b80156106825780601f1061065957610100808354040283529160200191610682565b820191905f5260205f20905b81548152906001019060200180831161066557829003601f168201915b5050505050815260200160038201805461069b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106c79061180a565b80156107125780601f106106e957610100808354040283529160200191610712565b820191905f5260205f20905b8154815290600101906020018083116106f557829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461075d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546107899061180a565b80156107d45780601f106107ab576101008083540402835291602001916107d4565b820191905f5260205f20905b8154815290600101906020018083116107b757829003601f168201915b505050505081526020016004820180546107ed9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108199061180a565b80156108645780601f1061083b57610100808354040283529160200191610864565b820191905f5260205f20905b81548152906001019060200180831161084757829003601f168201915b5050505050815260200160058201805461087d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108a99061180a565b80156108f45780601f106108cb576101008083540402835291602001916108f4565b820191905f5260205f20905b8154815290600101906020018083116108d757829003601f168201915b5050505050815260200160068201805461090d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109399061180a565b80156109845780601f1061095b57610100808354040283529160200191610984565b820191905f5260205f20905b81548152906001019060200180831161096757829003601f168201915b5050505050815260200160078201805461099d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109c99061180a565b8015610a145780601f106109eb57610100808354040283529160200191610a14565b820191905f5260205f20905b8154815290600101906020018083116109f757829003601f168201915b50505050508152602001600882018054610a2d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a599061180a565b8015610aa45780601f10610a7b57610100808354040283529160200191610aa4565b820191905f5260205f20905b815481529060010190602001808311610a8757829003601f168201915b50505050508152602001600982018054610abd9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae99061180a565b8015610b345780601f10610b0b57610100808354040283529160200191610b34565b820191905f5260205f20905b815481529060010190602001808311610b1757829003601f168201915b50505050508152602001600a82018054610b4d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b799061180a565b8015610bc45780601f10610b9b57610100808354040283529160200191610bc4565b820191905f5260205f20905b815481529060010190602001808311610ba757829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b610bf3610eeb565b6104a582826111f2565b610c05610eeb565b828114610c2557604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610c525760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610cb2858583818110610c7457610c74611842565b9050602002016020810190610c899190611654565b848484818110610c9b57610c9b611842565b9050602002810190610cad9190611856565b6111f2565b600101610c57565b5050505050565b610cc9610eeb565b828114610ce957604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610d165760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610d76858583818110610d3857610d38611842565b9050602002016020810190610d4d9190611654565b848484818110610d5f57610d5f611842565b9050602002810190610d719190611874565b61115a565b600101610d1b565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610dea9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610e169061180a565b8015610e615780601f10610e3857610100808354040283529160200191610e61565b820191905f5260205f20905b815481529060010190602001808311610e4457829003601f168201915b5050505050815250509050919050565b610e79611042565b600580546001600160a01b0383166001600160a01b03199091168117909155610eaa6004546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f6103c961128a565b610419611042565b6001600160a01b038116610f1a576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f908152602081905260408120908181610f3e82826113f3565b610f4b600183015f6113f3565b610f58600283015f6113f3565b610f65600383015f6113f3565b50505f60048301818155600584018290556006840182905590610f8b60078501826113f3565b610f98600483015f6113f3565b610fa5600583015f6113f3565b610fb2600683015f6113f3565b610fbf600783015f6113f3565b610fcc600883015f6113f3565b610fd9600983015f6113f3565b610fe6600a83015f6113f3565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b61104a610ee2565b6001600160a01b03166110656004546001600160a01b031690565b6001600160a01b0316146104195761107b610ee2565b60405163118cdaa760e01b81526001600160a01b039091166004820152602401610470565b600580546001600160a01b03191690556103df816112f9565b6001600160a01b0381166110e0576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff191681559190611110908301826113f3565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b038216611181576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906111a48282611a0f565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b6001600160a01b038216611219576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061123c8282611c6e565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f3660148082108015906112c657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156112ec576112d936828403815f611db2565b6112e291611dd9565b60601c9250505090565b339250505090565b505090565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60405180604001604052806113806040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016113ee6040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b5080546113ff9061180a565b5f825580601f1061140e575050565b601f0160209004905f5260205f20906103df91905f5b808211156112f4575f81840155600101611424565b5f60208284031215611449575f5ffd5b81356001600160e01b031981168114611460575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526114b960e0850182611467565b90506020820151605f198583030160808601526114d68282611467565b9150506040820151605f198583030160a08601526114f48282611467565b91505060608201519150605f198482030160c08501526115148183611467565b9150506020840151601f198483030160408501528051825260208101516020830152604081015160408301526060810151610180606084015261155b610180840182611467565b9050608082015183820360808501526115748282611467565b91505060a082015183820360a085015261158e8282611467565b91505060c082015183820360c08501526115a88282611467565b91505060e082015183820360e08501526115c28282611467565b9150506101008201518382036101008501526115de8282611467565b9150506101208201518382036101208501526115fa8282611467565b9150506101408201518382036101408501526116168282611467565b91505061016082015191506116376101608401836001600160a01b03169052565b95945050505050565b6001600160a01b03811681146103df575f5ffd5b5f60208284031215611664575f5ffd5b813561146081611640565b602081528151151560208201526020820151151560408201525f60408301516060808401526116a16080840182611467565b949350505050565b602081525f6114606020830184611467565b5f5f604083850312156116cc575f5ffd5b82356116d781611640565b9150602083013567ffffffffffffffff8111156116f2575f5ffd5b830160608186031215611703575f5ffd5b809150509250929050565b5f5f6040838503121561171f575f5ffd5b823561172a81611640565b9150602083013567ffffffffffffffff811115611745575f5ffd5b830160408186031215611703575f5ffd5b5f5f83601f840112611766575f5ffd5b50813567ffffffffffffffff81111561177d575f5ffd5b6020830191508360208260051b8501011115611797575f5ffd5b9250929050565b5f5f5f5f604085870312156117b1575f5ffd5b843567ffffffffffffffff8111156117c7575f5ffd5b6117d387828801611756565b909550935050602085013567ffffffffffffffff8111156117f2575f5ffd5b6117fe87828801611756565b95989497509550505050565b600181811c9082168061181e57607f821691505b60208210810361183c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e1983360301811261186a575f5ffd5b9190910192915050565b5f8235605e1983360301811261186a575f5ffd5b5f813580151581146103b0575f5ffd5b5f5f8335601e198436030181126118ad575f5ffd5b83018035915067ffffffffffffffff8211156118c7575f5ffd5b602001915036819003821315611797575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115611941578282111561194157805f5260205f20601f840160051c602085101561191a57505f5b90810190601f840160051c035f5b8181101561193d575f83820155600101611928565b5050505b505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611972576119726118db565b61198683611980835461180a565b836118ef565b5f601f8411600181146119b2575f85156119a05750838201355b6119aa8682611946565b845550610cba565b5f83815260208120601f198716915b828110156119e157868501358255602094850194600190920191016119c1565b50868210156119fd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611a1882611888565b1515815460ff821691508160ff19821617835561ff00611a3a60208601611888565b151560081b168261ffff19831617178355505060018101611a5e6040840184611898565b67ffffffffffffffff811115611a7657611a766118db565b611a8a81611a84855461180a565b856118ef565b5f601f821160018114611ab6575f8315611aa45750838201355b611aae8482611946565b865550611b0d565b5f85815260208120601f198516915b82811015611ae55786850135825560209485019460019092019101611ac5565b5084821015611b01575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e1983360301811261186a575f5ffd5b5f81356103b081611640565b813581556020820135600182015560408201356002820155611b5c6060830183611898565b611b6a81836003860161195a565b5050611b796080830183611898565b611b8781836004860161195a565b5050611b9660a0830183611898565b611ba481836005860161195a565b5050611bb360c0830183611898565b611bc181836006860161195a565b5050611bd060e0830183611898565b611bde81836007860161195a565b5050611bee610100830183611898565b611bfc81836008860161195a565b5050611c0c610120830183611898565b611c1a81836009860161195a565b5050611c2a610140830183611898565b611c388183600a860161195a565b50506104a5611c4a6101608401611b2b565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112611c81575f5ffd5b8201611c8d8180611898565b67ffffffffffffffff811115611ca557611ca56118db565b611cb981611cb3865461180a565b866118ef565b5f601f821160018114611ce5575f8315611cd35750838201355b611cdd8482611946565b875550611d3c565b5f86815260208120601f198516915b82811015611d145786850135825560209485019460019092019101611cf4565b5084821015611d30575f1960f88660031b161c19848701351681555b505060018360011b0186555b50505050611d4d6020820182611898565b611d5b81836001870161195a565b5050611d6a6040820182611898565b611d7881836002870161195a565b5050611d876060820182611898565b9150611d9782826003860161195a565b50506104a5611da96020840184611b16565b60048301611b37565b5f5f85851115611dc0575f5ffd5b83861115611dcc575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611e1f576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea2646970667358221220682b301021631ea5464b64824ef1a80abc78f97fb251fdbc09e60e28bd2b316764736f6c63430008210033","sourceMap":"704:1591:105:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1211:189;;;;;;:::i;:::-;;:::i;:::-;;;470:14:114;;463:22;445:41;;433:2;418:18;1211:189:105;;;;;;;;1953:113:102;;;:::i;:::-;;;;;;;:::i;5601:119::-;;;;;;:::i;:::-;;:::i;:::-;;2398:126;;;:::i;:::-;;;;;;;:::i;554:94:106:-;634:7;;;;;;;;;;;-1:-1:-1;;;634:7:106;;;;554:94;;;;634:7;554:94;:::i;1832:137:78:-;;;;;;:::i;:::-;1707:17;-1:-1:-1;;;;;1931:31:78;;;;;;;1832:137;3315:142:102;;;;;;:::i;:::-;-1:-1:-1;;;;;3418:32:102;3395:4;3418:32;;;:16;:32;;;;;;;;;3315:142;2293:101:72;;;:::i;2244:229:73:-;;;:::i;1624:107:78:-;1707:17;1624:107;;;-1:-1:-1;;;;;5099:32:114;;;5081:51;;5069:2;5054:18;1624:107:78;4935:203:114;1638:85:72;1710:6;;-1:-1:-1;;;;;1710:6:72;1638:85;;6122:143:102;;;;;;:::i;:::-;;:::i;3862:219::-;;;;;;:::i;:::-;;:::i;2158:137::-;;;;;;:::i;:::-;;:::i;3610:154::-;;;;;;:::i;:::-;;:::i;4748:477::-;;;;;;:::i;:::-;;:::i;4153:531::-;;;;;;:::i;:::-;;:::i;1385:44::-;;1426:3;1385:44;;;;;8335:25:114;;;8323:2;8308:18;1385:44:102;8189:177:114;1232:99:73;1311:13;;-1:-1:-1;;;;;1311:13:73;1232:99;;2625:149:102;;;;;;:::i;:::-;;:::i;1649:178:73:-;;;;;;:::i;:::-;;:::i;2969:126:102:-;;;;;;:::i;:::-;-1:-1:-1;;;;;3064:24:102;3041:4;3064:24;;;:8;:24;;;;;;;;;2969:126;1211:189:105;1296:4;-1:-1:-1;;;;;;1319:34:105;;-1:-1:-1;;;1319:34:105;;:74;;-1:-1:-1;;;;;;;;;;829:40:95;;;1357:36:105;1312:81;1211:189;-1:-1:-1;;1211:189:105:o;1953:113:102:-;2000:22;;:::i;:::-;2041:18;2046:12;:10;:12::i;2041:18::-;2034:25;;1953:113;:::o;5601:119::-;1473:19;:17;:19::i;:::-;5687:26:::1;5698:14;5687:10;:26::i;:::-;5601:119:::0;:::o;2398:126::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;2491:26:102;2504:12;:10;:12::i;2293:101:72:-;1531:13;:11;:13::i;:::-;2357:30:::1;2384:1;2357:18;:30::i;:::-;2293:101::o:0;2244:229:73:-;2296:14;2313:12;:10;:12::i;:::-;2296:29;;2357:6;-1:-1:-1;;;;;2339:24:73;:14;1311:13;;-1:-1:-1;;;;;1311:13:73;;1232:99;2339:14;-1:-1:-1;;;;;2339:24:73;;2335:96;;2386:34;;-1:-1:-1;;;2386:34:73;;-1:-1:-1;;;;;5099:32:114;;2386:34:73;;;5081:51:114;5054:18;;2386:34:73;;;;;;;;2335:96;2440:26;2459:6;2440:18;:26::i;6122:143:102:-;1561:27;:25;:27::i;:::-;6224:34:::1;6243:14;6224:18;:34::i;3862:219::-:0;1561:27;:25;:27::i;:::-;4027:47:::1;4044:14;4060:13;4027:16;:47::i;:::-;3862:219:::0;;:::o;2158:137::-;2225:22;;:::i;:::-;-1:-1:-1;;;;;2266:22:102;;:6;:22;;;;;;;;;;;;2259:29;;;;;;;;;;;;;;;;;2266:22;;2259:29;;2266:22;;2259:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;2259:29:102;;;-1:-1:-1;;2259:29:102;;;;;;-1:-1:-1;;;;;2259:29:102;;;;;;;;-1:-1:-1;2259:29:102;2158:137;-1:-1:-1;;2158:137:102:o;3610:154::-;1473:19;:17;:19::i;:::-;3726:31:::1;3735:14;3751:5;3726:8;:31::i;4748:477::-:0;1473:19;:17;:19::i;:::-;4918:37;;::::1;4910:68;;;;-1:-1:-1::0;;;4910:68:102::1;;;;;;;;;;;;4996:14:::0;1426:3:::1;4996:39:::0;;::::1;;4988:106;;;::::0;-1:-1:-1;;;4988:106:102;;::::1;::::0;::::1;8930:25:114::0;;;;8971:18;;;8964:34;8903:18;;4988:106:102::1;8756:248:114::0;4988:106:102::1;-1:-1:-1::0;5110:9:102::1;::::0;-1:-1:-1;5105:114:102::1;5125:25:::0;;::::1;5105:114;;;5171:37;5180:14;;5195:1;5180:17;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;5199:5;;5205:1;5199:8;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;5171;:37::i;:::-;5152:3;;5105:114;;;;4748:477:::0;;;;:::o;4153:531::-;1561:27;:25;:27::i;:::-;4347:48;;::::1;4339:79;;;;-1:-1:-1::0;;;4339:79:102::1;;;;;;;;;;;;4436:14:::0;1426:3:::1;4436:39:::0;;::::1;;4428:106;;;::::0;-1:-1:-1;;;4428:106:102;;::::1;::::0;::::1;8930:25:114::0;;;;8971:18;;;8964:34;8903:18;;4428:106:102::1;8756:248:114::0;4428:106:102::1;-1:-1:-1::0;4550:9:102::1;::::0;-1:-1:-1;4545:133:102::1;4565:25:::0;;::::1;4545:133;;;4611:56;4628:14;;4643:1;4628:17;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;4647:16;;4664:1;4647:19;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;4611:16;:56::i;:::-;4592:3;;4545:133;;2625:149:::0;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2738:29:102;;;;;;:13;:29;;;;;;;;;2731:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2625:149;;;:::o;1649:178:73:-;1531:13:72;:11;:13::i;:::-;1738::73::1;:24:::0;;-1:-1:-1;;;;;1738:24:73;::::1;-1:-1:-1::0;;;;;;1738:24:73;;::::1;::::0;::::1;::::0;;;1802:7:::1;1710:6:72::0;;-1:-1:-1;;;;;1710:6:72;;1638:85;1802:7:73::1;-1:-1:-1::0;;;;;1777:43:73::1;;;;;;;;;;;1649:178:::0;:::o;1801:163:105:-;1904:7;1930:27;:25;:27::i;1463:72::-;1531:13:72;:11;:13::i;7690:279:102:-;-1:-1:-1;;;;;7769:28:102;;7761:79;;;;-1:-1:-1;;;7761:79:102;;;;;;;;;;;;-1:-1:-1;;;;;7857:22:102;;:6;:22;;;;;;;;;;;;:6;7850:29;7857:22;:6;7850:29;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;-1:-1:-1;;7850:29:102;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;-1:-1:-1;7850:29:102;;;;-1:-1:-1;;;;;;7850:29:102;;;-1:-1:-1;;;;;;;7896:24:102;;7850:29;7896:24;;;:8;:24;;;;;;7889:31;;-1:-1:-1;;7889:31:102;;;7935:27;;;7850:29;7935:27;7690:279;:::o;1796:162:72:-;1866:12;:10;:12::i;:::-;-1:-1:-1;;;;;1855:23:72;:7;1710:6;;-1:-1:-1;;;;;1710:6:72;;1638:85;1855:7;-1:-1:-1;;;;;1855:23:72;;1851:101;;1928:12;:10;:12::i;:::-;1901:40;;-1:-1:-1;;;1901:40:72;;-1:-1:-1;;;;;5099:32:114;;;1901:40:72;;;5081:51:114;5054:18;;1901:40:72;4935:203:114;2011:153:73;2100:13;2093:20;;-1:-1:-1;;;;;;2093:20:73;;;2123:34;2148:8;2123:24;:34::i;8167:310:102:-;-1:-1:-1;;;;;8254:28:102;;8246:79;;;;-1:-1:-1;;;8246:79:102;;;;;;;;;;;;-1:-1:-1;;;;;8342:29:102;;;;;;:13;:29;;;;;;;8335:36;;-1:-1:-1;;8335:36:102;;;8342:29;;8335:36;;;;8342:29;8335:36;:::i;:::-;-1:-1:-1;;;;;;;8388:32:102;;;;;;:16;:32;;;;;;8381:39;;-1:-1:-1;;8381:39:102;;;8435:35;;;8388:32;8435:35;8167:310;:::o;7167:350::-;-1:-1:-1;;;;;7289:28:102;;7281:79;;;;-1:-1:-1;;;7281:79:102;;;;;;;;;;;;-1:-1:-1;;;;;7370:29:102;;;;;;:13;:29;;;;;7402:13;;7370:45;7402:13;7370:29;:45;:::i;:::-;-1:-1:-1;;;;;;;7425:32:102;;;;;;:16;:32;;;;;;:39;;-1:-1:-1;;7425:39:102;7460:4;7425:39;;;7479:31;;;7425:32;7479:31;7167:350;;:::o;6660:306::-;-1:-1:-1;;;;;6769:28:102;;6761:79;;;;-1:-1:-1;;;6761:79:102;;;;;;;;;;;;-1:-1:-1;;;;;6850:22:102;;:6;:22;;;;;;;;;;6875:5;;6850:30;6875:5;6850:22;:30;:::i;:::-;-1:-1:-1;;;;;;;6890:24:102;;;;;;:8;:24;;;;;;:31;;-1:-1:-1;;6890:31:102;6917:4;6890:31;;;6936:23;;;6890:24;6936:23;6660:306;;:::o;2206:471:78:-;2268:7;2312:8;3567:2;2403:37;;;;;;:71;;-1:-1:-1;1707:17:78;-1:-1:-1;;;;;1931:31:78;2463:10;1931:31;2444:30;2399:272;;;2541:47;:8;2550:36;;;2541:8;;:47;:::i;:::-;2533:56;;;:::i;:::-;2525:65;;2518:72;;;;2206:471;:::o;2399:272::-;735:10:89;2635:25:78;;;;2206:471;:::o;2399:272::-;2277:400;;2206:471;:::o;2912:187:72:-;3004:6;;;-1:-1:-1;;;;;3020:17:72;;;-1:-1:-1;;;;;;3020:17:72;;;;;;;3052:40;;3004:6;;;3020:17;3004:6;;3052:40;;2985:16;;3052:40;2975:124;2912:187;:::o;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;:::i;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14:286:114;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:114;;209:43;;199:71;;266:1;263;256:12;199:71;289:5;14:286;-1:-1:-1;;;14:286:114:o;497:289::-;539:3;577:5;571:12;604:6;599:3;592:19;660:6;653:4;646:5;642:16;635:4;630:3;626:14;620:47;712:1;705:4;696:6;691:3;687:16;683:27;676:38;775:4;768:2;764:7;759:2;751:6;747:15;743:29;738:3;734:39;730:50;723:57;;;497:289;;;;:::o;900:2912::-;1093:2;1082:9;1075:21;1056:4;1131:6;1125:13;1174:4;1169:2;1158:9;1154:18;1147:32;1216:12;1210:19;1265:4;1260:2;1249:9;1245:18;1238:32;1293:54;1342:3;1331:9;1327:19;1311:14;1293:54;:::i;:::-;1279:68;;1402:2;1388:12;1384:21;1378:28;1476:2;1472:7;1460:9;1452:6;1448:22;1444:36;1437:4;1426:9;1422:20;1415:66;1504:41;1538:6;1522:14;1504:41;:::i;:::-;1490:55;;;1600:4;1586:12;1582:23;1576:30;1675:2;1671:7;1659:9;1651:6;1647:22;1643:36;1637:3;1626:9;1622:19;1615:65;1703:41;1737:6;1721:14;1703:41;:::i;:::-;1689:55;;;1799:2;1785:12;1781:21;1775:28;1753:50;;1872:2;1868:7;1856:9;1848:6;1844:22;1840:36;1834:3;1823:9;1819:19;1812:65;1897:41;1931:6;1915:14;1897:41;:::i;:::-;1886:52;;;1987:2;1979:6;1975:15;1969:22;2058:2;2054:7;2042:9;2037:3;2033:19;2029:33;2022:4;2011:9;2007:20;2000:63;2090:14;2084:21;2079:3;2072:34;2162:2;2146:14;2142:23;2136:30;2131:2;2126:3;2122:12;2115:52;2225:4;2209:14;2205:25;2199:32;2192:4;2187:3;2183:14;2176:56;2289:2;2273:14;2269:23;2263:30;2323:6;2318:2;2313:3;2309:12;2302:28;2353:51;2396:6;2391:3;2387:16;2371:14;2353:51;:::i;:::-;2339:65;;2461:4;2445:14;2441:25;2435:32;2511:3;2503:6;2499:16;2492:4;2487:3;2483:14;2476:40;2539:41;2573:6;2557:14;2539:41;:::i;:::-;2525:55;;;2637:3;2621:14;2617:24;2611:31;2685:3;2677:6;2673:16;2667:3;2662;2658:13;2651:39;2713:41;2747:6;2731:14;2713:41;:::i;:::-;2699:55;;;2811:3;2795:14;2791:24;2785:31;2859:3;2851:6;2847:16;2841:3;2836;2832:13;2825:39;2887:41;2921:6;2905:14;2887:41;:::i;:::-;2873:55;;;2986:3;2970:14;2966:24;2960:31;3034:3;3026:6;3022:16;3016:3;3011;3007:13;3000:39;3062:42;3097:6;3080:15;3062:42;:::i;:::-;3048:56;;;3162:6;3146:14;3142:27;3136:34;3216:3;3208:6;3204:16;3195:6;3190:3;3186:16;3179:42;3244;3279:6;3262:15;3244:42;:::i;:::-;3230:56;;;3344:6;3328:14;3324:27;3318:34;3398:3;3390:6;3386:16;3377:6;3372:3;3368:16;3361:42;3427;3462:6;3445:15;3427:42;:::i;:::-;3412:57;;;3527:6;3511:14;3507:27;3501:34;3582:3;3573:7;3569:17;3560:6;3555:3;3551:16;3544:43;3611;3646:7;3629:15;3611:43;:::i;:::-;3596:58;;;3712:6;3696:14;3692:27;3686:34;3663:57;;3729:53;3774:6;3769:3;3765:16;3748:15;-1:-1:-1;;;;;857:31:114;845:44;;791:104;3729:53;3799:7;900:2912;-1:-1:-1;;;;;900:2912:114:o;3817:131::-;-1:-1:-1;;;;;3892:31:114;;3882:42;;3872:70;;3938:1;3935;3928:12;3953:247;4012:6;4065:2;4053:9;4044:7;4040:23;4036:32;4033:52;;;4081:1;4078;4071:12;4033:52;4120:9;4107:23;4139:31;4164:5;4139:31;:::i;4205:500::-;4392:2;4381:9;4374:21;4451:6;4445:13;4438:21;4431:29;4426:2;4415:9;4411:18;4404:57;4529:2;4521:6;4517:15;4511:22;4504:30;4497:38;4492:2;4481:9;4477:18;4470:66;4355:4;4583:2;4575:6;4571:15;4565:22;4625:4;4618;4607:9;4603:20;4596:34;4647:52;4694:3;4683:9;4679:19;4665:12;4647:52;:::i;:::-;4639:60;4205:500;-1:-1:-1;;;;4205:500:114:o;4710:220::-;4859:2;4848:9;4841:21;4822:4;4879:45;4920:2;4909:9;4905:18;4897:6;4879:45;:::i;5143:525::-;5242:6;5250;5303:2;5291:9;5282:7;5278:23;5274:32;5271:52;;;5319:1;5316;5309:12;5271:52;5358:9;5345:23;5377:31;5402:5;5377:31;:::i;:::-;5427:5;-1:-1:-1;5483:2:114;5468:18;;5455:32;5510:18;5499:30;;5496:50;;;5542:1;5539;5532:12;5496:50;5565:22;;5621:2;5603:16;;;5599:25;5596:45;;;5637:1;5634;5627:12;5596:45;5660:2;5650:12;;;5143:525;;;;;:::o;5673:528::-;5775:6;5783;5836:2;5824:9;5815:7;5811:23;5807:32;5804:52;;;5852:1;5849;5842:12;5804:52;5891:9;5878:23;5910:31;5935:5;5910:31;:::i;:::-;5960:5;-1:-1:-1;6016:2:114;6001:18;;5988:32;6043:18;6032:30;;6029:50;;;6075:1;6072;6065:12;6029:50;6098:22;;6154:2;6136:16;;;6132:25;6129:45;;;6170:1;6167;6160:12;6206:367;6269:8;6279:6;6333:3;6326:4;6318:6;6314:17;6310:27;6300:55;;6351:1;6348;6341:12;6300:55;-1:-1:-1;6374:20:114;;6417:18;6406:30;;6403:50;;;6449:1;6446;6439:12;6403:50;6486:4;6478:6;6474:17;6462:29;;6546:3;6539:4;6529:6;6526:1;6522:14;6514:6;6510:27;6506:38;6503:47;6500:67;;;6563:1;6560;6553:12;6500:67;6206:367;;;;;:::o;6578:802::-;6734:6;6742;6750;6758;6811:2;6799:9;6790:7;6786:23;6782:32;6779:52;;;6827:1;6824;6817:12;6779:52;6867:9;6854:23;6900:18;6892:6;6889:30;6886:50;;;6932:1;6929;6922:12;6886:50;6971:70;7033:7;7024:6;7013:9;7009:22;6971:70;:::i;:::-;7060:8;;-1:-1:-1;6945:96:114;-1:-1:-1;;7148:2:114;7133:18;;7120:32;7177:18;7164:32;;7161:52;;;7209:1;7206;7199:12;7161:52;7248:72;7312:7;7301:8;7290:9;7286:24;7248:72;:::i;:::-;6578:802;;;;-1:-1:-1;7339:8:114;-1:-1:-1;;;;6578:802:114:o;8371:380::-;8450:1;8446:12;;;;8493;;;8514:61;;8568:4;8560:6;8556:17;8546:27;;8514:61;8621:2;8613:6;8610:14;8590:18;8587:38;8584:161;;8667:10;8662:3;8658:20;8655:1;8648:31;8702:4;8699:1;8692:15;8730:4;8727:1;8720:15;8584:161;;8371:380;;;:::o;9009:127::-;9070:10;9065:3;9061:20;9058:1;9051:31;9101:4;9098:1;9091:15;9125:4;9122:1;9115:15;9141:331;9241:4;9299:11;9286:25;9393:2;9389:7;9378:8;9362:14;9358:29;9354:43;9334:18;9330:68;9320:96;;9412:1;9409;9402:12;9320:96;9433:33;;;;;9141:331;-1:-1:-1;;9141:331:114:o;9477:328::-;9574:4;9632:11;9619:25;9726:2;9722:7;9711:8;9695:14;9691:29;9687:43;9667:18;9663:68;9653:96;;9745:1;9742;9735:12;9810:202;9852:11;9904:3;9891:17;9951:5;9944:13;9937:21;9930:5;9927:32;9917:60;;9973:1;9970;9963:12;10017:516;10089:4;10095:6;10155:11;10142:25;10249:2;10245:7;10234:8;10218:14;10214:29;10210:43;10190:18;10186:68;10176:96;;10268:1;10265;10258:12;10176:96;10295:33;;10347:20;;;-1:-1:-1;10390:18:114;10379:30;;10376:50;;;10422:1;10419;10412:12;10376:50;10455:4;10443:17;;-1:-1:-1;10486:14:114;10482:27;;;10472:38;;10469:58;;;10523:1;10520;10513:12;10538:127;10599:10;10594:3;10590:20;10587:1;10580:31;10630:4;10627:1;10620:15;10654:4;10651:1;10644:15;10796:692;10898:2;10893:3;10890:11;10887:595;;;10935:10;10930:3;10927:19;10924:548;;;10987:5;10984:1;10977:16;11035:4;11032:1;11022:18;11100:2;11088:10;11084:19;11081:1;11077:27;11139:4;11127:10;11124:20;11121:45;;;-1:-1:-1;11163:1:114;11121:45;11202:23;;;;11272:2;11263:12;;11260:1;11256:20;11252:39;11317:1;11335:123;11349:2;11346:1;11343:9;11335:123;;;11438:1;11417:19;;;11410:30;11367:1;11360:9;11335:123;;;11339:3;;;10924:548;10796:692;;;:::o;11493:166::-;-1:-1:-1;;11621:1:114;11617:11;;;11613:24;11609:29;11599:40;11645:1;11641:11;;;;11596:57;;11493:166::o;11664:1182::-;11772:18;11767:3;11764:27;11761:53;;;11794:18;;:::i;:::-;11823:94;11913:3;11873:38;11905:4;11899:11;11873:38;:::i;:::-;11867:4;11823:94;:::i;:::-;11943:1;11968:2;11963:3;11960:11;11985:1;11980:608;;;;12632:1;12649:3;12646:93;;;-1:-1:-1;12705:19:114;;;12692:33;12646:93;12765:64;12825:3;12818:5;12765:64;:::i;:::-;12759:4;12752:78;;11953:887;;11980:608;10743:1;10736:14;;;10780:4;10767:18;;-1:-1:-1;;12016:17:114;;;12131:229;12145:7;12142:1;12139:14;12131:229;;;12234:19;;;12221:33;12206:49;;12341:4;12326:20;;;;12294:1;12282:14;;;;12161:12;12131:229;;;12135:3;12388;12379:7;12376:16;12373:159;;;12512:1;12508:6;12502:3;12496;12493:1;12489:11;12485:21;12481:34;12477:39;12464:9;12459:3;12455:19;12442:33;12438:79;12430:6;12423:95;12373:159;;;12575:1;12569:3;12566:1;12562:11;12558:19;12552:4;12545:33;11953:887;;11664:1182;;;:::o;12851:1825::-;13021:31;13046:5;13021:31;:::i;:::-;13014:39;13007:47;13079:4;13073:11;13111:3;13107:2;13103:12;13093:22;;13159:2;13152:3;13148:8;13144:2;13140:17;13137:25;13131:4;13124:39;13287:5;13242:40;13278:2;13271:5;13267:14;13242:40;:::i;:::-;13235:48;13228:56;13225:1;13221:64;13217:76;13212:2;13203:5;13199:10;13195:2;13191:19;13188:27;13185:109;13179:4;13172:123;;;13332:1;13326:4;13322:12;13377:59;13432:2;13425:5;13421:14;13414:5;13377:59;:::i;:::-;13466:18;13451:13;13448:37;13445:63;;;13488:18;;:::i;:::-;13517:116;13619:13;13573:44;13605:10;13599:17;13573:44;:::i;:::-;13561:10;13517:116;:::i;:::-;13659:1;13694:2;13679:13;13676:21;13711:1;13706:672;;;;14424:1;14441:13;14438:113;;;-1:-1:-1;14509:27:114;;;14496:41;14438:113;14583:76;14645:13;14636:7;14583:76;:::i;:::-;14571:10;14564:96;;13669:1001;;13706:672;10743:1;10736:14;;;10780:4;10767:18;;-1:-1:-1;;13742:27:114;;;13873:233;13887:7;13884:1;13881:14;13873:233;;;13974:27;;;13961:41;13946:57;;14089:2;14074:18;;;;14042:1;14030:14;;;;13903:10;13873:233;;;13877:3;14134:13;14125:7;14122:26;14119:187;;;14286:1;14282:6;14276:3;14260:13;14257:1;14253:21;14249:31;14245:44;14241:49;14228:9;14215:11;14211:27;14198:41;14194:97;14186:6;14179:113;14119:187;;;14365:1;14349:13;14346:1;14342:21;14338:29;14326:10;14319:49;13669:1001;;;;;;12851:1825;;:::o;14681:319::-;14768:4;14826:11;14813:25;14920:3;14916:8;14905;14889:14;14885:29;14881:44;14861:18;14857:69;14847:97;;14940:1;14937;14930:12;15005:176;15050:11;15102:3;15089:17;15115:31;15140:5;15115:31;:::i;15385:2325::-;15549:19;;15577:25;;15683:2;15672:14;;15659:28;15713:1;15703:12;;15696:35;15812:2;15801:14;;15788:28;15842:1;15832:12;;15825:35;15903:59;15958:2;15947:14;;15562:5;15903:59;:::i;:::-;15971:99;16056:13;16043:11;16039:1;16033:4;16029:12;15971:99;:::i;:::-;;;16115:60;16170:3;16163:5;16159:15;16152:5;16115:60;:::i;:::-;16184:101;16271:13;16256;16252:1;16246:4;16242:12;16184:101;:::i;:::-;;;16330:60;16385:3;16378:5;16374:15;16367:5;16330:60;:::i;:::-;16399:101;16486:13;16471;16467:1;16461:4;16457:12;16399:101;:::i;:::-;;;16545:60;16600:3;16593:5;16589:15;16582:5;16545:60;:::i;:::-;16614:101;16701:13;16686;16682:1;16676:4;16672:12;16614:101;:::i;:::-;;;16760:60;16815:3;16808:5;16804:15;16797:5;16760:60;:::i;:::-;16829:101;16916:13;16901;16897:1;16891:4;16887:12;16829:101;:::i;:::-;;;16977:60;17032:3;17025:5;17021:15;17014:5;16977:60;:::i;:::-;17046:103;17134:14;17118;17114:1;17108:4;17104:12;17046:103;:::i;:::-;;;17196:60;17251:3;17244:5;17240:15;17233:5;17196:60;:::i;:::-;17265:103;17353:14;17337;17333:1;17327:4;17323:12;17265:103;:::i;:::-;;;17415:60;17470:3;17463:5;17459:15;17452:5;17415:60;:::i;:::-;17484:104;17573:14;17557;17552:2;17546:4;17542:13;17484:104;:::i;:::-;;;17597:107;17659:44;17698:3;17691:5;17687:15;17659:44;:::i;:::-;17654:2;17648:4;17644:13;15289:11;;-1:-1:-1;;;;;;15285:54:114;-1:-1:-1;;;;;15341:31:114;;;;15282:91;;;;15269:105;;15186:194;17715:2474;17906:5;17893:19;17991:3;17987:8;17979:5;17963:14;17959:26;17955:41;17935:18;17931:66;17921:94;;18011:1;18008;18001:12;17921:94;18036:30;;18109:48;18036:30;;18109:48;:::i;:::-;18187:18;18172:13;18169:37;18166:63;;;18209:18;;:::i;:::-;18238:104;18328:13;18288:38;18320:4;18314:11;18288:38;:::i;:::-;18282:4;18238:104;:::i;:::-;18368:1;18403:2;18388:13;18385:21;18420:1;18415:664;;;;19125:1;19142:13;19139:113;;;-1:-1:-1;19210:27:114;;;19197:41;19139:113;19278:76;19340:13;19331:7;19278:76;:::i;:::-;19272:4;19265:90;;18378:987;;18415:664;10743:1;10736:14;;;10780:4;10767:18;;-1:-1:-1;;18451:27:114;;;18576:237;18590:7;18587:1;18584:14;18576:237;;;18679:27;;;18666:41;18651:57;;18794:4;18779:20;;;;18747:1;18735:14;;;;18606:12;18576:237;;;18580:3;18841:13;18832:7;18829:26;18826:187;;;18993:1;18989:6;18983:3;18967:13;18964:1;18960:21;18956:31;18952:44;18948:49;18935:9;18922:11;18918:27;18905:41;18901:97;18893:6;18886:113;18826:187;;;19066:1;19050:13;19047:1;19043:21;19039:29;19033:4;19026:43;18378:987;;;;;19410:57;19463:2;19457:4;19453:13;19447:4;19410:57;:::i;:::-;19476:101;19563:13;19548;19544:1;19538:4;19534:12;19476:101;:::i;:::-;;;19622:57;19675:2;19669:4;19665:13;19659:4;19622:57;:::i;:::-;19688:101;19775:13;19760;19756:1;19750:4;19746:12;19688:101;:::i;:::-;;;19834:57;19887:2;19881:4;19877:13;19871:4;19834:57;:::i;:::-;19798:93;;19900:101;19987:13;19972;19968:1;19962:4;19958:12;19900:101;:::i;:::-;;;20010:173;20108:74;20178:2;20171:5;20167:14;20160:5;20108:74;:::i;:::-;20104:1;20098:4;20094:12;20010:173;:::i;20194:331::-;20299:9;20310;20352:8;20340:10;20337:24;20334:44;;;20374:1;20371;20364:12;20334:44;20403:6;20393:8;20390:20;20387:40;;;20423:1;20420;20413:12;20387:40;-1:-1:-1;;20449:23:114;;;20494:25;;;;;-1:-1:-1;20194:331:114:o;20530:374::-;20651:19;;-1:-1:-1;;20688:40:114;;;20748:2;20740:11;;20737:161;;;20860:26;20856:31;20825:26;20821:31;20814:3;20810:2;20806:12;20803:1;20799:20;20795:58;20791:2;20787:67;20783:105;20774:114;;20737:161;;20530:374;;;;:::o","linkReferences":{},"immutableReferences":{"47386":[{"start":479,"length":32},{"start":588,"length":32},{"start":4763,"length":32}]}},"methodIdentifiers":{"MAX_BATCH_SIZE()":"cfdbf254","acceptOwnership()":"79ba5097","clearCreditEvents(address)":"96c3e905","clearDebt(address)":"498de65c","creditEvents()":"50101d84","creditEvents(address)":"ef673503","debt()":"0dca59c1","debt(address)":"9b6c56ec","hasCreditEvents(address)":"591236f7","hasDebt(address)":"f423aa6c","isTrustedForwarder(address)":"572b6c05","owner()":"8da5cb5b","pendingOwner()":"e30c3978","renounceOwnership()":"715018a6","setCreditEvents(address,(bool,bool,string))":"99db0828","setCreditEventsBatch(address[],(bool,bool,string)[])":"c41a71ff","setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))":"a6568202","setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])":"b05e5a41","supportsInterface(bytes4)":"01ffc9a7","transferOwnership(address)":"f2fde38b","trustedForwarder()":"7da0a877","version()":"54fd4d50"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.33+commit.64118f21\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"forwarderIrrevocable\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AdminWithAddressZeroNotAllowed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSize\",\"type\":\"uint256\"}],\"name\":\"BatchSizeTooLarge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInputLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SmartContractWithAddressZeroNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"CreditEventsCleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"CreditEventsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"DebtCleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"smartContract\",\"type\":\"address\"}],\"name\":\"DebtSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_BATCH_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"clearCreditEvents\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"clearDebt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"creditEvents\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"creditEvents\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debt\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"debt\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"hasCreditEvents\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"}],\"name\":\"hasDebt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents\",\"name\":\"creditEvents_\",\"type\":\"tuple\"}],\"name\":\"setCreditEvents\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"smartContracts\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"flagDefault\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"flagRedeemed\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"rating\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATCreditEvents.CreditEvents[]\",\"name\":\"creditEventsList\",\"type\":\"tuple[]\"}],\"name\":\"setCreditEventsBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"smartContract_\",\"type\":\"address\"},{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation\",\"name\":\"debt_\",\"type\":\"tuple\"}],\"name\":\"setDebt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"smartContracts\",\"type\":\"address[]\"},{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"issuerName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"issuerDescription\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"guarantor\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"debtHolder\",\"type\":\"string\"}],\"internalType\":\"struct ICMTATDebt.DebtIdentifier\",\"name\":\"debtIdentifier\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"parValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minimumDenomination\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"issuanceDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"maturityDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"couponPaymentFrequency\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestScheduleFormat\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"interestPaymentDate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"dayCountConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"businessDayConvention\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"currency\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"currencyContract\",\"type\":\"address\"}],\"internalType\":\"struct ICMTATDebt.DebtInstrument\",\"name\":\"debtInstrument\",\"type\":\"tuple\"}],\"internalType\":\"struct ICMTATDebt.DebtInformation[]\",\"name\":\"debts\",\"type\":\"tuple[]\"}],\"name\":\"setDebtBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"trustedForwarder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Ownership transfer is two-step (`transferOwnership` then `acceptOwnership` by the new owner). Every authorization hook collapses to `onlyOwner`, so this variant cannot separate duties. Advertises ERC-173 (contract ownership) through ERC-165.\",\"errors\":{\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"clearCreditEvents(address)\":{\"details\":\"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {CreditEventsCleared}.\"},\"clearDebt(address)\":{\"details\":\"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {DebtCleared}.\"},\"hasCreditEvents(address)\":{\"details\":\"True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}.\"},\"hasDebt(address)\":{\"details\":\"True after {setDebt} / {setDebtBatch}, false again after {clearDebt}.\"},\"isTrustedForwarder(address)\":{\"details\":\"Indicates whether any particular address is the trusted forwarder.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true for ERC-173 and ERC-165.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner. Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.\"},\"trustedForwarder()\":{\"details\":\"Returns the address of the trusted forwarder.\"}},\"stateVariables\":{\"ERC173_INTERFACE_ID\":{\"details\":\"ERC-165 identifier of the ERC-173 interface (`owner()` ^ `transferOwnership(address)`).\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"MAX_BATCH_SIZE()\":{\"notice\":\"Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`.\"},\"clearCreditEvents(address)\":{\"notice\":\"Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards and `creditEvents(smartContract_)` returns the zero struct, as before any record was set.\"},\"clearDebt(address)\":{\"notice\":\"Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards and `debt(smartContract_)` returns the zero struct, as before any record was set.\"},\"creditEvents()\":{\"notice\":\"Function to get the credit events for the sender's smart contract\"},\"creditEvents(address)\":{\"notice\":\"Function to get the credit events for a specific smart contract\"},\"debt()\":{\"notice\":\"Function to get the debt for the sender's smart contract\"},\"debt(address)\":{\"notice\":\"Function to get the debt for a specific smart contract\"},\"hasCreditEvents(address)\":{\"notice\":\"Returns true if credit events are currently set for the given smart contract\"},\"hasDebt(address)\":{\"notice\":\"Returns true if a debt record is currently set for the given smart contract\"},\"setCreditEvents(address,(bool,bool,string))\":{\"notice\":\"Function to set the credit events for a given smart contract\"},\"setCreditEventsBatch(address[],(bool,bool,string)[])\":{\"notice\":\"Batch version of {setCreditEvents}\"},\"setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))\":{\"notice\":\"Function to set the debt for a given smart contract\"},\"setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])\":{\"notice\":\"Batch version of {setDebt}\"},\"version()\":{\"notice\":\"Returns the current version of the smart contract\"}},\"notice\":\"DebtEngine deployment where a single owner manages both debt and credit events.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/deployment/DebtEngineOwnable.sol\":\"DebtEngineOwnable\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":CMTAT/=lib/CMTAT/contracts/\",\":OZ/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/CMTAT/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol\":{\"keccak256\":\"0x4e9ef9c96644bcd2159ea688cc2d6a8068a14282acc2b8d54615b99412961d79\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://7ea2cea23c7cf68a9ef1110ed6bee0aa5eba44365d58975c084545ede2c09c2b\",\"dweb:/ipfs/QmepuGYcv4zfxFFsPnCpBVzgCZq1HgPXqM49hbj7FDEyN1\"]},\"lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol\":{\"keccak256\":\"0xbb5ff9d854285182f0f305f13b37fcd54dd41e00d3d80a33b75639e2d8fc9c62\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://da1ffcafac20656e609e5e9a6aff665ba55a01036fe79b13cc22d475f9fa35dd\",\"dweb:/ipfs/QmNaQ286Dx3RX3hFq6M4Q8HSMsyNSjSX6fr5bruCTRMNVk\"]},\"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol\":{\"keccak256\":\"0x46f2908dcf2c2d5eac125837ab1ac76cc11c7ecc394041a59738ea4acaf072fa\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://de5a7fbe0b4970131fc545b4a198b49fa05cfaa104a471e97a64aa6b8630ac51\",\"dweb:/ipfs/Qmf6LiKNBQwFyxCbiiS4nLHXu4ydfzV9hQsXmJ9Qz43Rkc\"]},\"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol\":{\"keccak256\":\"0x86256da854b013551350056894193d38cd932f0de3cf5cd9ca964f40b35f396d\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://8851f89021a74c2712b2f78d30ce1012435106e70fac4ae9cb1d1e89c95ec2ae\",\"dweb:/ipfs/QmWJ4fwdyAPuVeXtddvV4sz5qwohNzZNJaBWkBseNLtTp6\"]},\"lib/openzeppelin-contracts/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol\":{\"keccak256\":\"0xdcad8898fda432696597752e8ec361b87d85c82cb258115427af006dacf7128c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e2c9d517f0c136d54bd00cd57959d25681d4d6273f5bbbc263afe228303772f0\",\"dweb:/ipfs/QmReNFjXBiufByiAAzfSQ2SM5r3qeUErn46BmN3yVRvrek\"]},\"lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol\":{\"keccak256\":\"0xfdb17e982a8744014f1804df7cacdd01f1423d19d79645da61def434eb17e4f3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4b626c1803f1bd5739859d1fe12bedb8c2c964a1f93e70d6f8c3c031d338d4e3\",\"dweb:/ipfs/QmacvfA17VWEhUApA4NykdWRC1koBXqvUdgCH13ZahmRxm\"]},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0x2d9dc2fe26180f74c11c13663647d38e259e45f95eb88f57b61d2160b0109d3e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://81233d1f98060113d9922180bb0f14f8335856fe9f339134b09335e9f678c377\",\"dweb:/ipfs/QmWh6R35SarhAn4z2wH8SU456jJSYL2FgucfTFgbHJJN4E\"]},\"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"src/DebtEngineBase.sol\":{\"keccak256\":\"0xcb2c0df8aacabdae4bc12f223941c5bde6af0cabbc3ba2731f7599351f44a372\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://04e85235c2169904352d6ea2001839db1da854eda3db21dd6e5bb6a314ee2991\",\"dweb:/ipfs/QmTkELnwfZbj39SM3req9j6cVDCmsshmCmizhsngNHsJh8\"]},\"src/DebtEngineInvariantStorage.sol\":{\"keccak256\":\"0xa72f3f1948d4a8121010bca782043fcb5247a082699fd1408874bf0a93a6792e\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://0e319e26710df1afd43d8f35c23f3e84ef39dae1b976a77fa02b9b78137e39d6\",\"dweb:/ipfs/QmUauq9LnoseQx5HYz8tvw9GvYEWXzphVteaRJs2tJvT4X\"]},\"src/deployment/DebtEngineOwnable.sol\":{\"keccak256\":\"0xbeb8a36dc389e2392b4a5f5cdf4b9db59a0e72147ddd4a67356d2e35e21b2fa4\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://40de0c6f0a764382c4dc31841f3a70a99db7defac7c9b6bb666144d59985796f\",\"dweb:/ipfs/QmR1uG2mu5kft2Zxc8PGXa6yfCGLgSbYoeMnJUE4dJhZ6z\"]},\"src/modules/VersionModule.sol\":{\"keccak256\":\"0x998f6230b54d2ea7b3348609d84bccf9351569e66cfaf1db56b0d9e8da3a68ac\",\"license\":\"MPL-2.0\",\"urls\":[\"bzz-raw://2affbe7c1539ab8c5e5ce98e4d0b63f9b300daa6f1df5c109b8a94ae547585e9\",\"dweb:/ipfs/QmRsHjz2ExGaGwiZenNF1eKnd1Cef3hLxe2riKoPTiNMda\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.33+commit.64118f21"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"forwarderIrrevocable","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"type":"error","name":"AdminWithAddressZeroNotAllowed"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"maxSize","type":"uint256"}],"type":"error","name":"BatchSizeTooLarge"},{"inputs":[],"type":"error","name":"InvalidInputLength"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"type":"error","name":"OwnableInvalidOwner"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"type":"error","name":"OwnableUnauthorizedAccount"},{"inputs":[],"type":"error","name":"SmartContractWithAddressZeroNotAllowed"},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"CreditEventsCleared","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"CreditEventsSet","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"DebtCleared","anonymous":false},{"inputs":[{"internalType":"address","name":"smartContract","type":"address","indexed":true}],"type":"event","name":"DebtSet","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferStarted","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferred","anonymous":false},{"inputs":[],"stateMutability":"view","type":"function","name":"MAX_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"acceptOwnership"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"clearCreditEvents"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"clearDebt"},{"inputs":[],"stateMutability":"view","type":"function","name":"creditEvents","outputs":[{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"creditEvents","outputs":[{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}]},{"inputs":[],"stateMutability":"view","type":"function","name":"debt","outputs":[{"internalType":"struct ICMTATDebt.DebtInformation","name":"","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"debt","outputs":[{"internalType":"struct ICMTATDebt.DebtInformation","name":"","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"hasCreditEvents","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"}],"stateMutability":"view","type":"function","name":"hasDebt","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"stateMutability":"view","type":"function","name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"},{"internalType":"struct ICMTATCreditEvents.CreditEvents","name":"creditEvents_","type":"tuple","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}],"stateMutability":"nonpayable","type":"function","name":"setCreditEvents"},{"inputs":[{"internalType":"address[]","name":"smartContracts","type":"address[]"},{"internalType":"struct ICMTATCreditEvents.CreditEvents[]","name":"creditEventsList","type":"tuple[]","components":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}]}],"stateMutability":"nonpayable","type":"function","name":"setCreditEventsBatch"},{"inputs":[{"internalType":"address","name":"smartContract_","type":"address"},{"internalType":"struct ICMTATDebt.DebtInformation","name":"debt_","type":"tuple","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}],"stateMutability":"nonpayable","type":"function","name":"setDebt"},{"inputs":[{"internalType":"address[]","name":"smartContracts","type":"address[]"},{"internalType":"struct ICMTATDebt.DebtInformation[]","name":"debts","type":"tuple[]","components":[{"internalType":"struct ICMTATDebt.DebtIdentifier","name":"debtIdentifier","type":"tuple","components":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerDescription","type":"string"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"debtHolder","type":"string"}]},{"internalType":"struct ICMTATDebt.DebtInstrument","name":"debtInstrument","type":"tuple","components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"uint256","name":"minimumDenomination","type":"uint256"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"couponPaymentFrequency","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"currency","type":"string"},{"internalType":"address","name":"currencyContract","type":"address"}]}]}],"stateMutability":"nonpayable","type":"function","name":"setDebtBatch"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"stateMutability":"view","type":"function","name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"},{"inputs":[],"stateMutability":"view","type":"function","name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"version","outputs":[{"internalType":"string","name":"","type":"string"}]}],"devdoc":{"kind":"dev","methods":{"acceptOwnership()":{"details":"The new owner accepts the ownership transfer."},"clearCreditEvents(address)":{"details":"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {CreditEventsCleared}."},"clearDebt(address)":{"details":"Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has no record succeeds and still emits {DebtCleared}."},"hasCreditEvents(address)":{"details":"True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}."},"hasDebt(address)":{"details":"True after {setDebt} / {setDebtBatch}, false again after {clearDebt}."},"isTrustedForwarder(address)":{"details":"Indicates whether any particular address is the trusted forwarder."},"owner()":{"details":"Returns the address of the current owner."},"pendingOwner()":{"details":"Returns the address of the pending owner."},"renounceOwnership()":{"details":"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner."},"supportsInterface(bytes4)":{"details":"Returns true for ERC-173 and ERC-165."},"transferOwnership(address)":{"details":"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner. Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer."},"trustedForwarder()":{"details":"Returns the address of the trusted forwarder."}},"version":1},"userdoc":{"kind":"user","methods":{"MAX_BATCH_SIZE()":{"notice":"Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`."},"clearCreditEvents(address)":{"notice":"Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards and `creditEvents(smartContract_)` returns the zero struct, as before any record was set."},"clearDebt(address)":{"notice":"Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards and `debt(smartContract_)` returns the zero struct, as before any record was set."},"creditEvents()":{"notice":"Function to get the credit events for the sender's smart contract"},"creditEvents(address)":{"notice":"Function to get the credit events for a specific smart contract"},"debt()":{"notice":"Function to get the debt for the sender's smart contract"},"debt(address)":{"notice":"Function to get the debt for a specific smart contract"},"hasCreditEvents(address)":{"notice":"Returns true if credit events are currently set for the given smart contract"},"hasDebt(address)":{"notice":"Returns true if a debt record is currently set for the given smart contract"},"setCreditEvents(address,(bool,bool,string))":{"notice":"Function to set the credit events for a given smart contract"},"setCreditEventsBatch(address[],(bool,bool,string)[])":{"notice":"Batch version of {setCreditEvents}"},"setDebt(address,((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address)))":{"notice":"Function to set the debt for a given smart contract"},"setDebtBatch(address[],((string,string,string,string),(uint256,uint256,uint256,string,string,string,string,string,string,string,string,address))[])":{"notice":"Batch version of {setDebt}"},"version()":{"notice":"Returns the current version of the smart contract"}},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","CMTAT/=lib/CMTAT/contracts/","OZ/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/CMTAT/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/deployment/DebtEngineOwnable.sol":"DebtEngineOwnable"},"evmVersion":"prague","libraries":{}},"sources":{"lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol":{"keccak256":"0x4e9ef9c96644bcd2159ea688cc2d6a8068a14282acc2b8d54615b99412961d79","urls":["bzz-raw://7ea2cea23c7cf68a9ef1110ed6bee0aa5eba44365d58975c084545ede2c09c2b","dweb:/ipfs/QmepuGYcv4zfxFFsPnCpBVzgCZq1HgPXqM49hbj7FDEyN1"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/ICMTAT.sol":{"keccak256":"0xbb5ff9d854285182f0f305f13b37fcd54dd41e00d3d80a33b75639e2d8fc9c62","urls":["bzz-raw://da1ffcafac20656e609e5e9a6aff665ba55a01036fe79b13cc22d475f9fa35dd","dweb:/ipfs/QmNaQ286Dx3RX3hFq6M4Q8HSMsyNSjSX6fr5bruCTRMNVk"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643.sol":{"keccak256":"0x46f2908dcf2c2d5eac125837ab1ac76cc11c7ecc394041a59738ea4acaf072fa","urls":["bzz-raw://de5a7fbe0b4970131fc545b4a198b49fa05cfaa104a471e97a64aa6b8630ac51","dweb:/ipfs/Qmf6LiKNBQwFyxCbiiS4nLHXu4ydfzV9hQsXmJ9Qz43Rkc"],"license":"MPL-2.0"},"lib/CMTAT/contracts/interfaces/tokenization/draft-IERC1643CMTAT.sol":{"keccak256":"0x86256da854b013551350056894193d38cd932f0de3cf5cd9ca964f40b35f396d","urls":["bzz-raw://8851f89021a74c2712b2f78d30ce1012435106e70fac4ae9cb1d1e89c95ec2ae","dweb:/ipfs/QmWJ4fwdyAPuVeXtddvV4sz5qwohNzZNJaBWkBseNLtTp6"],"license":"MPL-2.0"},"lib/openzeppelin-contracts/contracts/access/Ownable.sol":{"keccak256":"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb","urls":["bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6","dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol":{"keccak256":"0xdcad8898fda432696597752e8ec361b87d85c82cb258115427af006dacf7128c","urls":["bzz-raw://e2c9d517f0c136d54bd00cd57959d25681d4d6273f5bbbc263afe228303772f0","dweb:/ipfs/QmReNFjXBiufByiAAzfSQ2SM5r3qeUErn46BmN3yVRvrek"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol":{"keccak256":"0xfdb17e982a8744014f1804df7cacdd01f1423d19d79645da61def434eb17e4f3","urls":["bzz-raw://4b626c1803f1bd5739859d1fe12bedb8c2c964a1f93e70d6f8c3c031d338d4e3","dweb:/ipfs/QmacvfA17VWEhUApA4NykdWRC1koBXqvUdgCH13ZahmRxm"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/Context.sol":{"keccak256":"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2","urls":["bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12","dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol":{"keccak256":"0x2d9dc2fe26180f74c11c13663647d38e259e45f95eb88f57b61d2160b0109d3e","urls":["bzz-raw://81233d1f98060113d9922180bb0f14f8335856fe9f339134b09335e9f678c377","dweb:/ipfs/QmWh6R35SarhAn4z2wH8SU456jJSYL2FgucfTFgbHJJN4E"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol":{"keccak256":"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c","urls":["bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617","dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u"],"license":"MIT"},"src/DebtEngineBase.sol":{"keccak256":"0xcb2c0df8aacabdae4bc12f223941c5bde6af0cabbc3ba2731f7599351f44a372","urls":["bzz-raw://04e85235c2169904352d6ea2001839db1da854eda3db21dd6e5bb6a314ee2991","dweb:/ipfs/QmTkELnwfZbj39SM3req9j6cVDCmsshmCmizhsngNHsJh8"],"license":"MPL-2.0"},"src/DebtEngineInvariantStorage.sol":{"keccak256":"0xa72f3f1948d4a8121010bca782043fcb5247a082699fd1408874bf0a93a6792e","urls":["bzz-raw://0e319e26710df1afd43d8f35c23f3e84ef39dae1b976a77fa02b9b78137e39d6","dweb:/ipfs/QmUauq9LnoseQx5HYz8tvw9GvYEWXzphVteaRJs2tJvT4X"],"license":"MPL-2.0"},"src/deployment/DebtEngineOwnable.sol":{"keccak256":"0xbeb8a36dc389e2392b4a5f5cdf4b9db59a0e72147ddd4a67356d2e35e21b2fa4","urls":["bzz-raw://40de0c6f0a764382c4dc31841f3a70a99db7defac7c9b6bb666144d59985796f","dweb:/ipfs/QmR1uG2mu5kft2Zxc8PGXa6yfCGLgSbYoeMnJUE4dJhZ6z"],"license":"MPL-2.0"},"src/modules/VersionModule.sol":{"keccak256":"0x998f6230b54d2ea7b3348609d84bccf9351569e66cfaf1db56b0d9e8da3a68ac","urls":["bzz-raw://2affbe7c1539ab8c5e5ce98e4d0b63f9b300daa6f1df5c109b8a94ae547585e9","dweb:/ipfs/QmRsHjz2ExGaGwiZenNF1eKnd1Cef3hLxe2riKoPTiNMda"],"license":"MPL-2.0"}},"version":1},"id":105} \ No newline at end of file diff --git a/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.dbg.json b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.dbg.json new file mode 100644 index 0000000..c5024cc --- /dev/null +++ b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../../../build-info/5c080e994baa252f2f8666febebe1401.json" +} diff --git a/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json new file mode 100644 index 0000000..909e230 --- /dev/null +++ b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineAccessControl.sol/DebtEngineAccessControl.json @@ -0,0 +1,1133 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "DebtEngineAccessControl", + "sourceName": "src/deployment/DebtEngineAccessControl.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "forwarderIrrevocable", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessControlBadConfirmation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "neededRole", + "type": "bytes32" + } + ], + "name": "AccessControlUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "AdminWithAddressZeroNotAllowed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSize", + "type": "uint256" + } + ], + "name": "BatchSizeTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInputLength", + "type": "error" + }, + { + "inputs": [], + "name": "SmartContractWithAddressZeroNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "CreditEventsCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "CreditEventsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "DebtCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "DebtSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "CREDIT_EVENTS_MANAGER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEBT_MANAGER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_BATCH_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "clearCreditEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "clearDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "creditEvents", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "creditEvents", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "debt", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "debt", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMembers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "hasCreditEvents", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "hasDebt", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "callerConfirmation", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + }, + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "creditEvents_", + "type": "tuple" + } + ], + "name": "setCreditEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "smartContracts", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents[]", + "name": "creditEventsList", + "type": "tuple[]" + } + ], + "name": "setCreditEventsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + }, + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "debt_", + "type": "tuple" + } + ], + "name": "setDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "smartContracts", + "type": "address[]" + }, + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation[]", + "name": "debts", + "type": "tuple[]" + } + ], + "name": "setDebtBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "trustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60a060405234801561000f575f5ffd5b5060405161277d38038061277d83398101604081905261002e91610293565b6001600160a01b03808216608052821661005b5760405163f2b08d8760e01b815260040160405180910390fd5b6100655f8361006d565b505050610323565b5f8061007984846100a3565b9050801561009a575f8481526005602052604090206100989084610135565b505b90505b92915050565b5f6100ae8383610149565b61012e575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556100e66101ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161009d565b505f61009d565b5f61009a836001600160a01b0384166101c8565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff16156101905750600161009d565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff1661009a565b5f6101c361020d565b905090565b5f81815260018301602052604081205461012e57508154600181810184555f84815260208082209093018490558454848252828601909352604090209190915561009d565b5f366014808210801590610225575061022533610253565b1561024b5761023836828403815f6102c4565b610241916102eb565b60601c9250505090565b339250505090565b5f61025d60805190565b6001600160a01b0316826001600160a01b0316149050919050565b80516001600160a01b038116811461028e575f5ffd5b919050565b5f5f604083850312156102a4575f5ffd5b6102ad83610278565b91506102bb60208401610278565b90509250929050565b5f5f858511156102d2575f5ffd5b838611156102de575f5ffd5b5050820193919092039150565b80356001600160601b0319811690601484101561031c576001600160601b0319601485900360031b81901b82161691505b5092915050565b6080516124346103495f395f81816102b30152818161031001526114d701526124345ff3fe608060405234801561000f575f5ffd5b50600436106101bb575f3560e01c806396c3e905116100f3578063b05e5a4111610093578063cfdbf2541161006e578063cfdbf25414610468578063d547741f14610471578063ef67350314610484578063f423aa6c14610497575f5ffd5b8063b05e5a411461042f578063c41a71ff14610442578063ca15c87314610455575f5ffd5b8063a1de54de116100ce578063a1de54de146103ce578063a217fddf146103f5578063a3246ad3146103fc578063a65682021461041c575f5ffd5b806396c3e9051461039557806399db0828146103a85780639b6c56ec146103bb575f5ffd5b806354fd4d501161015e5780637da0a877116101395780637da0a8771461030e5780638a42115f146103485780639010d07c1461036f57806391d1485414610382575f5ffd5b806354fd4d501461027c578063572b6c05146102a3578063591236f7146102e3575f5ffd5b80632f2ff15d116101995780632f2ff15d1461022c57806336568abe14610241578063498de65c1461025457806350101d8414610267575f5ffd5b806301ffc9a7146101bf5780630dca59c1146101e7578063248a9ca3146101fc575b5f5ffd5b6101d26101cd36600461194e565b6104c2565b60405190151581526020015b60405180910390f35b6101ef6104ec565b6040516101de91906119a3565b61021e61020a366004611b4e565b5f9081526004602052604090206001015490565b6040519081526020016101de565b61023f61023a366004611b79565b610504565b005b61023f61024f366004611b79565b61052e565b61023f610262366004611ba7565b610576565b61026f61058a565b6040516101de9190611bc2565b60408051808201825260058152640302e332e360dc1b602082015290516101de9190611bfc565b6101d26102b1366004611ba7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6101d26102f1366004611ba7565b6001600160a01b03165f9081526003602052604090205460ff1690565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016101de565b61021e7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f81565b61033061037d366004611c0e565b6105b0565b6101d2610390366004611b79565b6105ce565b61023f6103a3366004611ba7565b61063f565b61023f6103b6366004611c2e565b610650565b6101ef6103c9366004611ba7565b610666565b61021e7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f834781565b61021e5f81565b61040f61040a366004611b4e565b610da8565b6040516101de9190611c76565b61023f61042a366004611cc1565b610dc1565b61023f61043d366004611d51565b610dd3565b61023f610450366004611d51565b610e9c565b61021e610463366004611b4e565b610f59565b61021e6101f481565b61023f61047f366004611b79565b610f6f565b61026f610492366004611ba7565b610f93565b6101d26104a5366004611ba7565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b03198216635a05180f60e01b14806104e657506104e682611086565b92915050565b6104f461185f565b6104ff6103c96110ba565b905090565b5f8281526004602052604090206001015461051e816110c3565b61052883836110d4565b50505050565b6105366110ba565b6001600160a01b0316816001600160a01b0316146105675760405163334bd91960e11b815260040160405180910390fd5b6105718282611107565b505050565b61057e611132565b6105878161115c565b50565b60408051606080820183525f8083526020830152918101919091526104ff6104926110ba565b5f8281526005602052604081206105c790836112ab565b9392505050565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff1615610615575060016104e6565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff166105c7565b6106476112b6565b610587816112e0565b6106586112b6565b6106628282611381565b5050565b61066e61185f565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906106a890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490611dbd565b801561071f5780601f106106f65761010080835404028352916020019161071f565b820191905f5260205f20905b81548152906001019060200180831161070257829003601f168201915b5050505050815260200160018201805461073890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461076490611dbd565b80156107af5780601f10610786576101008083540402835291602001916107af565b820191905f5260205f20905b81548152906001019060200180831161079257829003601f168201915b505050505081526020016002820180546107c890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546107f490611dbd565b801561083f5780601f106108165761010080835404028352916020019161083f565b820191905f5260205f20905b81548152906001019060200180831161082257829003601f168201915b5050505050815260200160038201805461085890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461088490611dbd565b80156108cf5780601f106108a6576101008083540402835291602001916108cf565b820191905f5260205f20905b8154815290600101906020018083116108b257829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461091a90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461094690611dbd565b80156109915780601f1061096857610100808354040283529160200191610991565b820191905f5260205f20905b81548152906001019060200180831161097457829003601f168201915b505050505081526020016004820180546109aa90611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546109d690611dbd565b8015610a215780601f106109f857610100808354040283529160200191610a21565b820191905f5260205f20905b815481529060010190602001808311610a0457829003601f168201915b50505050508152602001600582018054610a3a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6690611dbd565b8015610ab15780601f10610a8857610100808354040283529160200191610ab1565b820191905f5260205f20905b815481529060010190602001808311610a9457829003601f168201915b50505050508152602001600682018054610aca90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610af690611dbd565b8015610b415780601f10610b1857610100808354040283529160200191610b41565b820191905f5260205f20905b815481529060010190602001808311610b2457829003601f168201915b50505050508152602001600782018054610b5a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8690611dbd565b8015610bd15780601f10610ba857610100808354040283529160200191610bd1565b820191905f5260205f20905b815481529060010190602001808311610bb457829003601f168201915b50505050508152602001600882018054610bea90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1690611dbd565b8015610c615780601f10610c3857610100808354040283529160200191610c61565b820191905f5260205f20905b815481529060010190602001808311610c4457829003601f168201915b50505050508152602001600982018054610c7a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca690611dbd565b8015610cf15780601f10610cc857610100808354040283529160200191610cf1565b820191905f5260205f20905b815481529060010190602001808311610cd457829003601f168201915b50505050508152602001600a82018054610d0a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3690611dbd565b8015610d815780601f10610d5857610100808354040283529160200191610d81565b820191905f5260205f20905b815481529060010190602001808311610d6457829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b5f8181526005602052604090206060906104e690611419565b610dc9611132565b6106628282611425565b610ddb611132565b828114610dfb57604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610e2d5760405162ef8cfb60e11b8152600481019290925260248201526044015b60405180910390fd5b505f90505b83811015610e9557610e8d858583818110610e4f57610e4f611df5565b9050602002016020810190610e649190611ba7565b848484818110610e7657610e76611df5565b9050602002810190610e889190611e09565b611425565b600101610e32565b5050505050565b610ea46112b6565b828114610ec457604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610ef15760405162ef8cfb60e11b815260048101929092526024820152604401610e24565b505f90505b83811015610e9557610f51858583818110610f1357610f13611df5565b9050602002016020810190610f289190611ba7565b848484818110610f3a57610f3a611df5565b9050602002810190610f4c9190611e27565b611381565b600101610ef6565b5f8181526005602052604081206104e6906114bd565b5f82815260046020526040902060010154610f89816110c3565b6105288383611107565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610fff90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461102b90611dbd565b80156110765780601f1061104d57610100808354040283529160200191611076565b820191905f5260205f20905b81548152906001019060200180831161105957829003601f168201915b5050505050815250509050919050565b5f6001600160e01b03198216637965db0b60e01b14806104e657506301ffc9a760e01b6001600160e01b03198316146104e6565b5f6104ff6114c6565b610587816110cf6110ba565b611535565b5f5f6110e0848461156e565b905080156105c7575f8481526005602052604090206110ff9084611600565b509392505050565b5f5f6111138484611614565b905080156105c7575f8481526005602052604090206110ff908461169d565b7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f610587816110c3565b6001600160a01b038116611183576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526020819052604081209081816111a78282611908565b6111b4600183015f611908565b6111c1600283015f611908565b6111ce600383015f611908565b50505f600483018181556005840182905560068401829055906111f46007850182611908565b611201600483015f611908565b61120e600583015f611908565b61121b600683015f611908565b611228600783015f611908565b611235600883015f611908565b611242600983015f611908565b61124f600a83015f611908565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b5f6105c783836116b1565b7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f8347610587816110c3565b6001600160a01b038116611307576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff19168155919061133790830182611908565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b0382166113a8576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906113cb8282611fc1565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b60605f6105c7836116d7565b6001600160a01b03821661144c576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061146f8282612220565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f6104e6825490565b5f36601480821080159061150257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156115285761151536828403815f612364565b61151e9161238b565b60601c9250505090565b339250505090565b505090565b61153f82826105ce565b6106625760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e24565b5f61157983836105ce565b6115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556115b16110ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104e6565b505f6104e6565b5f6105c7836001600160a01b038416611730565b5f61161f83836105ce565b156115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191690556116556110ba565b6001600160a01b0316826001600160a01b0316847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45060016104e6565b5f6105c7836001600160a01b038416611775565b5f825f0182815481106116c6576116c6611df5565b905f5260205f200154905092915050565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561172457602002820191905f5260205f20905b815481526020019060010190808311611710575b50505050509050919050565b5f8181526001830160205260408120546115f957508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556104e6565b5f818152600183016020526040812054801561184f575f6117976001836123cb565b85549091505f906117aa906001906123cb565b9050808214611809575f865f0182815481106117c8576117c8611df5565b905f5260205f200154905080875f0184815481106117e8576117e8611df5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061181a5761181a6123ea565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506104e6565b5f9150506104e6565b5092915050565b60405180604001604052806118956040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016119036040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b50805461191490611dbd565b5f825580601f10611923575050565b601f0160209004905f5260205f209061058791905f5b80821115611530575f81840155600101611939565b5f6020828403121561195e575f5ffd5b81356001600160e01b0319811681146105c7575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526119c760e0850182611975565b90506020820151605f198583030160808601526119e48282611975565b9150506040820151605f198583030160a0860152611a028282611975565b91505060608201519150605f198482030160c0850152611a228183611975565b9150506020840151601f1984830301604085015280518252602081015160208301526040810151604083015260608101516101806060840152611a69610180840182611975565b905060808201518382036080850152611a828282611975565b91505060a082015183820360a0850152611a9c8282611975565b91505060c082015183820360c0850152611ab68282611975565b91505060e082015183820360e0850152611ad08282611975565b915050610100820151838203610100850152611aec8282611975565b915050610120820151838203610120850152611b088282611975565b915050610140820151838203610140850152611b248282611975565b9150506101608201519150611b456101608401836001600160a01b03169052565b95945050505050565b5f60208284031215611b5e575f5ffd5b5035919050565b6001600160a01b0381168114610587575f5ffd5b5f5f60408385031215611b8a575f5ffd5b823591506020830135611b9c81611b65565b809150509250929050565b5f60208284031215611bb7575f5ffd5b81356105c781611b65565b602081528151151560208201526020820151151560408201525f6040830151606080840152611bf46080840182611975565b949350505050565b602081525f6105c76020830184611975565b5f5f60408385031215611c1f575f5ffd5b50508035926020909101359150565b5f5f60408385031215611c3f575f5ffd5b8235611c4a81611b65565b9150602083013567ffffffffffffffff811115611c65575f5ffd5b830160608186031215611b9c575f5ffd5b602080825282518282018190525f918401906040840190835b81811015611cb65783516001600160a01b0316835260209384019390920191600101611c8f565b509095945050505050565b5f5f60408385031215611cd2575f5ffd5b8235611cdd81611b65565b9150602083013567ffffffffffffffff811115611cf8575f5ffd5b830160408186031215611b9c575f5ffd5b5f5f83601f840112611d19575f5ffd5b50813567ffffffffffffffff811115611d30575f5ffd5b6020830191508360208260051b8501011115611d4a575f5ffd5b9250929050565b5f5f5f5f60408587031215611d64575f5ffd5b843567ffffffffffffffff811115611d7a575f5ffd5b611d8687828801611d09565b909550935050602085013567ffffffffffffffff811115611da5575f5ffd5b611db187828801611d09565b95989497509550505050565b600181811c90821680611dd157607f821691505b602082108103611def57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e19833603018112611e1d575f5ffd5b9190910192915050565b5f8235605e19833603018112611e1d575f5ffd5b5f813580151581146104e6575f5ffd5b5f5f8335601e19843603018112611e60575f5ffd5b83018035915067ffffffffffffffff821115611e7a575f5ffd5b602001915036819003821315611d4a575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610571578282111561057157805f5260205f20601f840160051c6020851015611ecd57505f5b90810190601f840160051c035f5b81811015611ef0575f83820155600101611edb565b505050505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611f2457611f24611e8e565b611f3883611f328354611dbd565b83611ea2565b5f601f841160018114611f64575f8515611f525750838201355b611f5c8682611ef8565b845550610e95565b5f83815260208120601f198716915b82811015611f935786850135825560209485019460019092019101611f73565b5086821015611faf575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611fca82611e3b565b1515815460ff821691508160ff19821617835561ff00611fec60208601611e3b565b151560081b168261ffff198316171783555050600181016120106040840184611e4b565b67ffffffffffffffff81111561202857612028611e8e565b61203c816120368554611dbd565b85611ea2565b5f601f821160018114612068575f83156120565750838201355b6120608482611ef8565b8655506120bf565b5f85815260208120601f198516915b828110156120975786850135825560209485019460019092019101612077565b50848210156120b3575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e19833603018112611e1d575f5ffd5b5f81356104e681611b65565b81358155602082013560018201556040820135600282015561210e6060830183611e4b565b61211c818360038601611f0c565b505061212b6080830183611e4b565b612139818360048601611f0c565b505061214860a0830183611e4b565b612156818360058601611f0c565b505061216560c0830183611e4b565b612173818360068601611f0c565b505061218260e0830183611e4b565b612190818360078601611f0c565b50506121a0610100830183611e4b565b6121ae818360088601611f0c565b50506121be610120830183611e4b565b6121cc818360098601611f0c565b50506121dc610140830183611e4b565b6121ea8183600a8601611f0c565b50506106626121fc61016084016120dd565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112612233575f5ffd5b820161223f8180611e4b565b67ffffffffffffffff81111561225757612257611e8e565b61226b816122658654611dbd565b86611ea2565b5f601f821160018114612297575f83156122855750838201355b61228f8482611ef8565b8755506122ee565b5f86815260208120601f198516915b828110156122c657868501358255602094850194600190920191016122a6565b50848210156122e2575f1960f88660031b161c19848701351681555b505060018360011b0186555b505050506122ff6020820182611e4b565b61230d818360018701611f0c565b505061231c6040820182611e4b565b61232a818360028701611f0c565b50506123396060820182611e4b565b9150612349828260038601611f0c565b505061066261235b60208401846120c8565b600483016120e9565b5f5f85851115612372575f5ffd5b8386111561237e575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611858576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b818103818111156104e657634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603160045260245ffdfea26469706673582212205599a8584bbe39248debce7965b744bf02f1ed4f1dd2e81c4c3ba3727bb59c5264736f6c63430008210033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b50600436106101bb575f3560e01c806396c3e905116100f3578063b05e5a4111610093578063cfdbf2541161006e578063cfdbf25414610468578063d547741f14610471578063ef67350314610484578063f423aa6c14610497575f5ffd5b8063b05e5a411461042f578063c41a71ff14610442578063ca15c87314610455575f5ffd5b8063a1de54de116100ce578063a1de54de146103ce578063a217fddf146103f5578063a3246ad3146103fc578063a65682021461041c575f5ffd5b806396c3e9051461039557806399db0828146103a85780639b6c56ec146103bb575f5ffd5b806354fd4d501161015e5780637da0a877116101395780637da0a8771461030e5780638a42115f146103485780639010d07c1461036f57806391d1485414610382575f5ffd5b806354fd4d501461027c578063572b6c05146102a3578063591236f7146102e3575f5ffd5b80632f2ff15d116101995780632f2ff15d1461022c57806336568abe14610241578063498de65c1461025457806350101d8414610267575f5ffd5b806301ffc9a7146101bf5780630dca59c1146101e7578063248a9ca3146101fc575b5f5ffd5b6101d26101cd36600461194e565b6104c2565b60405190151581526020015b60405180910390f35b6101ef6104ec565b6040516101de91906119a3565b61021e61020a366004611b4e565b5f9081526004602052604090206001015490565b6040519081526020016101de565b61023f61023a366004611b79565b610504565b005b61023f61024f366004611b79565b61052e565b61023f610262366004611ba7565b610576565b61026f61058a565b6040516101de9190611bc2565b60408051808201825260058152640302e332e360dc1b602082015290516101de9190611bfc565b6101d26102b1366004611ba7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6101d26102f1366004611ba7565b6001600160a01b03165f9081526003602052604090205460ff1690565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016101de565b61021e7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f81565b61033061037d366004611c0e565b6105b0565b6101d2610390366004611b79565b6105ce565b61023f6103a3366004611ba7565b61063f565b61023f6103b6366004611c2e565b610650565b6101ef6103c9366004611ba7565b610666565b61021e7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f834781565b61021e5f81565b61040f61040a366004611b4e565b610da8565b6040516101de9190611c76565b61023f61042a366004611cc1565b610dc1565b61023f61043d366004611d51565b610dd3565b61023f610450366004611d51565b610e9c565b61021e610463366004611b4e565b610f59565b61021e6101f481565b61023f61047f366004611b79565b610f6f565b61026f610492366004611ba7565b610f93565b6101d26104a5366004611ba7565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b03198216635a05180f60e01b14806104e657506104e682611086565b92915050565b6104f461185f565b6104ff6103c96110ba565b905090565b5f8281526004602052604090206001015461051e816110c3565b61052883836110d4565b50505050565b6105366110ba565b6001600160a01b0316816001600160a01b0316146105675760405163334bd91960e11b815260040160405180910390fd5b6105718282611107565b505050565b61057e611132565b6105878161115c565b50565b60408051606080820183525f8083526020830152918101919091526104ff6104926110ba565b5f8281526005602052604081206105c790836112ab565b9392505050565b6001600160a01b0381165f9081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec602052604081205460ff1615610615575060016104e6565b5f8381526004602090815260408083206001600160a01b038616845290915290205460ff166105c7565b6106476112b6565b610587816112e0565b6106586112b6565b6106628282611381565b5050565b61066e61185f565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906106a890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490611dbd565b801561071f5780601f106106f65761010080835404028352916020019161071f565b820191905f5260205f20905b81548152906001019060200180831161070257829003601f168201915b5050505050815260200160018201805461073890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461076490611dbd565b80156107af5780601f10610786576101008083540402835291602001916107af565b820191905f5260205f20905b81548152906001019060200180831161079257829003601f168201915b505050505081526020016002820180546107c890611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546107f490611dbd565b801561083f5780601f106108165761010080835404028352916020019161083f565b820191905f5260205f20905b81548152906001019060200180831161082257829003601f168201915b5050505050815260200160038201805461085890611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461088490611dbd565b80156108cf5780601f106108a6576101008083540402835291602001916108cf565b820191905f5260205f20905b8154815290600101906020018083116108b257829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461091a90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461094690611dbd565b80156109915780601f1061096857610100808354040283529160200191610991565b820191905f5260205f20905b81548152906001019060200180831161097457829003601f168201915b505050505081526020016004820180546109aa90611dbd565b80601f01602080910402602001604051908101604052809291908181526020018280546109d690611dbd565b8015610a215780601f106109f857610100808354040283529160200191610a21565b820191905f5260205f20905b815481529060010190602001808311610a0457829003601f168201915b50505050508152602001600582018054610a3a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6690611dbd565b8015610ab15780601f10610a8857610100808354040283529160200191610ab1565b820191905f5260205f20905b815481529060010190602001808311610a9457829003601f168201915b50505050508152602001600682018054610aca90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610af690611dbd565b8015610b415780601f10610b1857610100808354040283529160200191610b41565b820191905f5260205f20905b815481529060010190602001808311610b2457829003601f168201915b50505050508152602001600782018054610b5a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8690611dbd565b8015610bd15780601f10610ba857610100808354040283529160200191610bd1565b820191905f5260205f20905b815481529060010190602001808311610bb457829003601f168201915b50505050508152602001600882018054610bea90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1690611dbd565b8015610c615780601f10610c3857610100808354040283529160200191610c61565b820191905f5260205f20905b815481529060010190602001808311610c4457829003601f168201915b50505050508152602001600982018054610c7a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca690611dbd565b8015610cf15780601f10610cc857610100808354040283529160200191610cf1565b820191905f5260205f20905b815481529060010190602001808311610cd457829003601f168201915b50505050508152602001600a82018054610d0a90611dbd565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3690611dbd565b8015610d815780601f10610d5857610100808354040283529160200191610d81565b820191905f5260205f20905b815481529060010190602001808311610d6457829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b5f8181526005602052604090206060906104e690611419565b610dc9611132565b6106628282611425565b610ddb611132565b828114610dfb57604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610e2d5760405162ef8cfb60e11b8152600481019290925260248201526044015b60405180910390fd5b505f90505b83811015610e9557610e8d858583818110610e4f57610e4f611df5565b9050602002016020810190610e649190611ba7565b848484818110610e7657610e76611df5565b9050602002810190610e889190611e09565b611425565b600101610e32565b5050505050565b610ea46112b6565b828114610ec457604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610ef15760405162ef8cfb60e11b815260048101929092526024820152604401610e24565b505f90505b83811015610e9557610f51858583818110610f1357610f13611df5565b9050602002016020810190610f289190611ba7565b848484818110610f3a57610f3a611df5565b9050602002810190610f4c9190611e27565b611381565b600101610ef6565b5f8181526005602052604081206104e6906114bd565b5f82815260046020526040902060010154610f89816110c3565b6105288383611107565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610fff90611dbd565b80601f016020809104026020016040519081016040528092919081815260200182805461102b90611dbd565b80156110765780601f1061104d57610100808354040283529160200191611076565b820191905f5260205f20905b81548152906001019060200180831161105957829003601f168201915b5050505050815250509050919050565b5f6001600160e01b03198216637965db0b60e01b14806104e657506301ffc9a760e01b6001600160e01b03198316146104e6565b5f6104ff6114c6565b610587816110cf6110ba565b611535565b5f5f6110e0848461156e565b905080156105c7575f8481526005602052604090206110ff9084611600565b509392505050565b5f5f6111138484611614565b905080156105c7575f8481526005602052604090206110ff908461169d565b7ff1ccac0b9c467559b42bcf4450270c2282a77aa27625c0a03977b6cc8e03e47f610587816110c3565b6001600160a01b038116611183576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526020819052604081209081816111a78282611908565b6111b4600183015f611908565b6111c1600283015f611908565b6111ce600383015f611908565b50505f600483018181556005840182905560068401829055906111f46007850182611908565b611201600483015f611908565b61120e600583015f611908565b61121b600683015f611908565b611228600783015f611908565b611235600883015f611908565b611242600983015f611908565b61124f600a83015f611908565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b5f6105c783836116b1565b7f7864c5715dd816b45f30fdc605e45f893e1481bb5eba14926e1d3cb2cb9f8347610587816110c3565b6001600160a01b038116611307576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff19168155919061133790830182611908565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b0382166113a8576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906113cb8282611fc1565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b60605f6105c7836116d7565b6001600160a01b03821661144c576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061146f8282612220565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f6104e6825490565b5f36601480821080159061150257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156115285761151536828403815f612364565b61151e9161238b565b60601c9250505090565b339250505090565b505090565b61153f82826105ce565b6106625760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e24565b5f61157983836105ce565b6115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191660011790556115b16110ba565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104e6565b505f6104e6565b5f6105c7836001600160a01b038416611730565b5f61161f83836105ce565b156115f9575f8381526004602090815260408083206001600160a01b03861684529091529020805460ff191690556116556110ba565b6001600160a01b0316826001600160a01b0316847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45060016104e6565b5f6105c7836001600160a01b038416611775565b5f825f0182815481106116c6576116c6611df5565b905f5260205f200154905092915050565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561172457602002820191905f5260205f20905b815481526020019060010190808311611710575b50505050509050919050565b5f8181526001830160205260408120546115f957508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556104e6565b5f818152600183016020526040812054801561184f575f6117976001836123cb565b85549091505f906117aa906001906123cb565b9050808214611809575f865f0182815481106117c8576117c8611df5565b905f5260205f200154905080875f0184815481106117e8576117e8611df5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061181a5761181a6123ea565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506104e6565b5f9150506104e6565b5092915050565b60405180604001604052806118956040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016119036040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b50805461191490611dbd565b5f825580601f10611923575050565b601f0160209004905f5260205f209061058791905f5b80821115611530575f81840155600101611939565b5f6020828403121561195e575f5ffd5b81356001600160e01b0319811681146105c7575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526119c760e0850182611975565b90506020820151605f198583030160808601526119e48282611975565b9150506040820151605f198583030160a0860152611a028282611975565b91505060608201519150605f198482030160c0850152611a228183611975565b9150506020840151601f1984830301604085015280518252602081015160208301526040810151604083015260608101516101806060840152611a69610180840182611975565b905060808201518382036080850152611a828282611975565b91505060a082015183820360a0850152611a9c8282611975565b91505060c082015183820360c0850152611ab68282611975565b91505060e082015183820360e0850152611ad08282611975565b915050610100820151838203610100850152611aec8282611975565b915050610120820151838203610120850152611b088282611975565b915050610140820151838203610140850152611b248282611975565b9150506101608201519150611b456101608401836001600160a01b03169052565b95945050505050565b5f60208284031215611b5e575f5ffd5b5035919050565b6001600160a01b0381168114610587575f5ffd5b5f5f60408385031215611b8a575f5ffd5b823591506020830135611b9c81611b65565b809150509250929050565b5f60208284031215611bb7575f5ffd5b81356105c781611b65565b602081528151151560208201526020820151151560408201525f6040830151606080840152611bf46080840182611975565b949350505050565b602081525f6105c76020830184611975565b5f5f60408385031215611c1f575f5ffd5b50508035926020909101359150565b5f5f60408385031215611c3f575f5ffd5b8235611c4a81611b65565b9150602083013567ffffffffffffffff811115611c65575f5ffd5b830160608186031215611b9c575f5ffd5b602080825282518282018190525f918401906040840190835b81811015611cb65783516001600160a01b0316835260209384019390920191600101611c8f565b509095945050505050565b5f5f60408385031215611cd2575f5ffd5b8235611cdd81611b65565b9150602083013567ffffffffffffffff811115611cf8575f5ffd5b830160408186031215611b9c575f5ffd5b5f5f83601f840112611d19575f5ffd5b50813567ffffffffffffffff811115611d30575f5ffd5b6020830191508360208260051b8501011115611d4a575f5ffd5b9250929050565b5f5f5f5f60408587031215611d64575f5ffd5b843567ffffffffffffffff811115611d7a575f5ffd5b611d8687828801611d09565b909550935050602085013567ffffffffffffffff811115611da5575f5ffd5b611db187828801611d09565b95989497509550505050565b600181811c90821680611dd157607f821691505b602082108103611def57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e19833603018112611e1d575f5ffd5b9190910192915050565b5f8235605e19833603018112611e1d575f5ffd5b5f813580151581146104e6575f5ffd5b5f5f8335601e19843603018112611e60575f5ffd5b83018035915067ffffffffffffffff821115611e7a575f5ffd5b602001915036819003821315611d4a575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610571578282111561057157805f5260205f20601f840160051c6020851015611ecd57505f5b90810190601f840160051c035f5b81811015611ef0575f83820155600101611edb565b505050505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611f2457611f24611e8e565b611f3883611f328354611dbd565b83611ea2565b5f601f841160018114611f64575f8515611f525750838201355b611f5c8682611ef8565b845550610e95565b5f83815260208120601f198716915b82811015611f935786850135825560209485019460019092019101611f73565b5086821015611faf575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611fca82611e3b565b1515815460ff821691508160ff19821617835561ff00611fec60208601611e3b565b151560081b168261ffff198316171783555050600181016120106040840184611e4b565b67ffffffffffffffff81111561202857612028611e8e565b61203c816120368554611dbd565b85611ea2565b5f601f821160018114612068575f83156120565750838201355b6120608482611ef8565b8655506120bf565b5f85815260208120601f198516915b828110156120975786850135825560209485019460019092019101612077565b50848210156120b3575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e19833603018112611e1d575f5ffd5b5f81356104e681611b65565b81358155602082013560018201556040820135600282015561210e6060830183611e4b565b61211c818360038601611f0c565b505061212b6080830183611e4b565b612139818360048601611f0c565b505061214860a0830183611e4b565b612156818360058601611f0c565b505061216560c0830183611e4b565b612173818360068601611f0c565b505061218260e0830183611e4b565b612190818360078601611f0c565b50506121a0610100830183611e4b565b6121ae818360088601611f0c565b50506121be610120830183611e4b565b6121cc818360098601611f0c565b50506121dc610140830183611e4b565b6121ea8183600a8601611f0c565b50506106626121fc61016084016120dd565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112612233575f5ffd5b820161223f8180611e4b565b67ffffffffffffffff81111561225757612257611e8e565b61226b816122658654611dbd565b86611ea2565b5f601f821160018114612297575f83156122855750838201355b61228f8482611ef8565b8755506122ee565b5f86815260208120601f198516915b828110156122c657868501358255602094850194600190920191016122a6565b50848210156122e2575f1960f88660031b161c19848701351681555b505060018360011b0186555b505050506122ff6020820182611e4b565b61230d818360018701611f0c565b505061231c6040820182611e4b565b61232a818360028701611f0c565b50506123396060820182611e4b565b9150612349828260038601611f0c565b505061066261235b60208401846120c8565b600483016120e9565b5f5f85851115612372575f5ffd5b8386111561237e575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611858576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b818103818111156104e657634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603160045260245ffdfea26469706673582212205599a8584bbe39248debce7965b744bf02f1ed4f1dd2e81c4c3ba3727bb59c5264736f6c63430008210033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.dbg.json b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.dbg.json new file mode 100644 index 0000000..c5024cc --- /dev/null +++ b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../../../build-info/5c080e994baa252f2f8666febebe1401.json" +} diff --git a/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json new file mode 100644 index 0000000..225f8c1 --- /dev/null +++ b/doc/compilation/v0.3.0/hardhat/deployment/DebtEngineOwnable.sol/DebtEngineOwnable.json @@ -0,0 +1,952 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "DebtEngineOwnable", + "sourceName": "src/deployment/DebtEngineOwnable.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "forwarderIrrevocable", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AdminWithAddressZeroNotAllowed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSize", + "type": "uint256" + } + ], + "name": "BatchSizeTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInputLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "SmartContractWithAddressZeroNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "CreditEventsCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "CreditEventsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "DebtCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartContract", + "type": "address" + } + ], + "name": "DebtSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MAX_BATCH_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "clearCreditEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "clearDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "creditEvents", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "creditEvents", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "debt", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "debt", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "hasCreditEvents", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + } + ], + "name": "hasDebt", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + }, + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents", + "name": "creditEvents_", + "type": "tuple" + } + ], + "name": "setCreditEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "smartContracts", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "bool", + "name": "flagDefault", + "type": "bool" + }, + { + "internalType": "bool", + "name": "flagRedeemed", + "type": "bool" + }, + { + "internalType": "string", + "name": "rating", + "type": "string" + } + ], + "internalType": "struct ICMTATCreditEvents.CreditEvents[]", + "name": "creditEventsList", + "type": "tuple[]" + } + ], + "name": "setCreditEventsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartContract_", + "type": "address" + }, + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation", + "name": "debt_", + "type": "tuple" + } + ], + "name": "setDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "smartContracts", + "type": "address[]" + }, + { + "components": [ + { + "components": [ + { + "internalType": "string", + "name": "issuerName", + "type": "string" + }, + { + "internalType": "string", + "name": "issuerDescription", + "type": "string" + }, + { + "internalType": "string", + "name": "guarantor", + "type": "string" + }, + { + "internalType": "string", + "name": "debtHolder", + "type": "string" + } + ], + "internalType": "struct ICMTATDebt.DebtIdentifier", + "name": "debtIdentifier", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "interestRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "parValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDenomination", + "type": "uint256" + }, + { + "internalType": "string", + "name": "issuanceDate", + "type": "string" + }, + { + "internalType": "string", + "name": "maturityDate", + "type": "string" + }, + { + "internalType": "string", + "name": "couponPaymentFrequency", + "type": "string" + }, + { + "internalType": "string", + "name": "interestScheduleFormat", + "type": "string" + }, + { + "internalType": "string", + "name": "interestPaymentDate", + "type": "string" + }, + { + "internalType": "string", + "name": "dayCountConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "businessDayConvention", + "type": "string" + }, + { + "internalType": "string", + "name": "currency", + "type": "string" + }, + { + "internalType": "address", + "name": "currencyContract", + "type": "address" + } + ], + "internalType": "struct ICMTATDebt.DebtInstrument", + "name": "debtInstrument", + "type": "tuple" + } + ], + "internalType": "struct ICMTATDebt.DebtInformation[]", + "name": "debts", + "type": "tuple[]" + } + ], + "name": "setDebtBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "trustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60a060405234801561000f575f5ffd5b50604051611fb6380380611fb683398101604081905261002e91610103565b80826001600160a01b03811661005d57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100668161007b565b506001600160a01b0316608052506101349050565b600580546001600160a01b031916905561009481610097565b50565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b80516001600160a01b03811681146100fe575f5ffd5b919050565b5f5f60408385031215610114575f5ffd5b61011d836100e8565b915061012b602084016100e8565b90509250929050565b608051611e5c61015a5f395f81816101df0152818161024c015261129b0152611e5c5ff3fe608060405234801561000f575f5ffd5b506004361061013d575f3560e01c806396c3e905116100b4578063c41a71ff11610079578063c41a71ff146102f4578063cfdbf25414610307578063e30c39781461031e578063ef6735031461032f578063f2fde38b14610342578063f423aa6c14610355575f5ffd5b806396c3e9051461029557806399db0828146102a85780639b6c56ec146102bb578063a6568202146102ce578063b05e5a41146102e1575f5ffd5b8063572b6c0511610105578063572b6c05146101cf578063591236f71461020f578063715018a61461023a57806379ba5097146102425780637da0a8771461024a5780638da5cb5b14610284575f5ffd5b806301ffc9a7146101415780630dca59c114610169578063498de65c1461017e57806350101d841461019357806354fd4d50146101a8575b5f5ffd5b61015461014f366004611439565b610380565b60405190151581526020015b60405180910390f35b6101716103b6565b6040516101609190611495565b61019161018c366004611654565b6103ce565b005b61019b6103e2565b604051610160919061166f565b60408051808201825260058152640302e332e360dc1b6020820152905161016091906116a9565b6101546101dd366004611654565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b61015461021d366004611654565b6001600160a01b03165f9081526003602052604090205460ff1690565b610191610408565b61019161041b565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610160565b6004546001600160a01b031661026c565b6101916102a3366004611654565b610482565b6101916102b63660046116bb565b610493565b6101716102c9366004611654565b6104a9565b6101916102dc36600461170e565b610beb565b6101916102ef36600461179e565b610bfd565b61019161030236600461179e565b610cc1565b6103106101f481565b604051908152602001610160565b6005546001600160a01b031661026c565b61019b61033d366004611654565b610d7e565b610191610350366004611654565b610e71565b610154610363366004611654565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b031982166307f5828d60e41b14806103b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6103be61134a565b6103c96102c9610ee2565b905090565b6103d6610eeb565b6103df81610ef3565b50565b60408051606080820183525f8083526020830152918101919091526103c961033d610ee2565b610410611042565b6104195f6110a0565b565b5f610424610ee2565b9050806001600160a01b03166104426005546001600160a01b031690565b6001600160a01b0316146104795760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6103df816110a0565b61048a610eeb565b6103df816110b9565b61049b610eeb565b6104a5828261115a565b5050565b6104b161134a565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906104eb9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105179061180a565b80156105625780601f1061053957610100808354040283529160200191610562565b820191905f5260205f20905b81548152906001019060200180831161054557829003601f168201915b5050505050815260200160018201805461057b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061180a565b80156105f25780601f106105c9576101008083540402835291602001916105f2565b820191905f5260205f20905b8154815290600101906020018083116105d557829003601f168201915b5050505050815260200160028201805461060b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106379061180a565b80156106825780601f1061065957610100808354040283529160200191610682565b820191905f5260205f20905b81548152906001019060200180831161066557829003601f168201915b5050505050815260200160038201805461069b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106c79061180a565b80156107125780601f106106e957610100808354040283529160200191610712565b820191905f5260205f20905b8154815290600101906020018083116106f557829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461075d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546107899061180a565b80156107d45780601f106107ab576101008083540402835291602001916107d4565b820191905f5260205f20905b8154815290600101906020018083116107b757829003601f168201915b505050505081526020016004820180546107ed9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108199061180a565b80156108645780601f1061083b57610100808354040283529160200191610864565b820191905f5260205f20905b81548152906001019060200180831161084757829003601f168201915b5050505050815260200160058201805461087d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108a99061180a565b80156108f45780601f106108cb576101008083540402835291602001916108f4565b820191905f5260205f20905b8154815290600101906020018083116108d757829003601f168201915b5050505050815260200160068201805461090d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109399061180a565b80156109845780601f1061095b57610100808354040283529160200191610984565b820191905f5260205f20905b81548152906001019060200180831161096757829003601f168201915b5050505050815260200160078201805461099d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109c99061180a565b8015610a145780601f106109eb57610100808354040283529160200191610a14565b820191905f5260205f20905b8154815290600101906020018083116109f757829003601f168201915b50505050508152602001600882018054610a2d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a599061180a565b8015610aa45780601f10610a7b57610100808354040283529160200191610aa4565b820191905f5260205f20905b815481529060010190602001808311610a8757829003601f168201915b50505050508152602001600982018054610abd9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae99061180a565b8015610b345780601f10610b0b57610100808354040283529160200191610b34565b820191905f5260205f20905b815481529060010190602001808311610b1757829003601f168201915b50505050508152602001600a82018054610b4d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b799061180a565b8015610bc45780601f10610b9b57610100808354040283529160200191610bc4565b820191905f5260205f20905b815481529060010190602001808311610ba757829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b610bf3610eeb565b6104a582826111f2565b610c05610eeb565b828114610c2557604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610c525760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610cb2858583818110610c7457610c74611842565b9050602002016020810190610c899190611654565b848484818110610c9b57610c9b611842565b9050602002810190610cad9190611856565b6111f2565b600101610c57565b5050505050565b610cc9610eeb565b828114610ce957604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610d165760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610d76858583818110610d3857610d38611842565b9050602002016020810190610d4d9190611654565b848484818110610d5f57610d5f611842565b9050602002810190610d719190611874565b61115a565b600101610d1b565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610dea9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610e169061180a565b8015610e615780601f10610e3857610100808354040283529160200191610e61565b820191905f5260205f20905b815481529060010190602001808311610e4457829003601f168201915b5050505050815250509050919050565b610e79611042565b600580546001600160a01b0383166001600160a01b03199091168117909155610eaa6004546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f6103c961128a565b610419611042565b6001600160a01b038116610f1a576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f908152602081905260408120908181610f3e82826113f3565b610f4b600183015f6113f3565b610f58600283015f6113f3565b610f65600383015f6113f3565b50505f60048301818155600584018290556006840182905590610f8b60078501826113f3565b610f98600483015f6113f3565b610fa5600583015f6113f3565b610fb2600683015f6113f3565b610fbf600783015f6113f3565b610fcc600883015f6113f3565b610fd9600983015f6113f3565b610fe6600a83015f6113f3565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b61104a610ee2565b6001600160a01b03166110656004546001600160a01b031690565b6001600160a01b0316146104195761107b610ee2565b60405163118cdaa760e01b81526001600160a01b039091166004820152602401610470565b600580546001600160a01b03191690556103df816112f9565b6001600160a01b0381166110e0576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff191681559190611110908301826113f3565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b038216611181576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906111a48282611a0f565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b6001600160a01b038216611219576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061123c8282611c6e565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f3660148082108015906112c657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156112ec576112d936828403815f611db2565b6112e291611dd9565b60601c9250505090565b339250505090565b505090565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60405180604001604052806113806040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016113ee6040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b5080546113ff9061180a565b5f825580601f1061140e575050565b601f0160209004905f5260205f20906103df91905f5b808211156112f4575f81840155600101611424565b5f60208284031215611449575f5ffd5b81356001600160e01b031981168114611460575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526114b960e0850182611467565b90506020820151605f198583030160808601526114d68282611467565b9150506040820151605f198583030160a08601526114f48282611467565b91505060608201519150605f198482030160c08501526115148183611467565b9150506020840151601f198483030160408501528051825260208101516020830152604081015160408301526060810151610180606084015261155b610180840182611467565b9050608082015183820360808501526115748282611467565b91505060a082015183820360a085015261158e8282611467565b91505060c082015183820360c08501526115a88282611467565b91505060e082015183820360e08501526115c28282611467565b9150506101008201518382036101008501526115de8282611467565b9150506101208201518382036101208501526115fa8282611467565b9150506101408201518382036101408501526116168282611467565b91505061016082015191506116376101608401836001600160a01b03169052565b95945050505050565b6001600160a01b03811681146103df575f5ffd5b5f60208284031215611664575f5ffd5b813561146081611640565b602081528151151560208201526020820151151560408201525f60408301516060808401526116a16080840182611467565b949350505050565b602081525f6114606020830184611467565b5f5f604083850312156116cc575f5ffd5b82356116d781611640565b9150602083013567ffffffffffffffff8111156116f2575f5ffd5b830160608186031215611703575f5ffd5b809150509250929050565b5f5f6040838503121561171f575f5ffd5b823561172a81611640565b9150602083013567ffffffffffffffff811115611745575f5ffd5b830160408186031215611703575f5ffd5b5f5f83601f840112611766575f5ffd5b50813567ffffffffffffffff81111561177d575f5ffd5b6020830191508360208260051b8501011115611797575f5ffd5b9250929050565b5f5f5f5f604085870312156117b1575f5ffd5b843567ffffffffffffffff8111156117c7575f5ffd5b6117d387828801611756565b909550935050602085013567ffffffffffffffff8111156117f2575f5ffd5b6117fe87828801611756565b95989497509550505050565b600181811c9082168061181e57607f821691505b60208210810361183c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e1983360301811261186a575f5ffd5b9190910192915050565b5f8235605e1983360301811261186a575f5ffd5b5f813580151581146103b0575f5ffd5b5f5f8335601e198436030181126118ad575f5ffd5b83018035915067ffffffffffffffff8211156118c7575f5ffd5b602001915036819003821315611797575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115611941578282111561194157805f5260205f20601f840160051c602085101561191a57505f5b90810190601f840160051c035f5b8181101561193d575f83820155600101611928565b5050505b505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611972576119726118db565b61198683611980835461180a565b836118ef565b5f601f8411600181146119b2575f85156119a05750838201355b6119aa8682611946565b845550610cba565b5f83815260208120601f198716915b828110156119e157868501358255602094850194600190920191016119c1565b50868210156119fd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611a1882611888565b1515815460ff821691508160ff19821617835561ff00611a3a60208601611888565b151560081b168261ffff19831617178355505060018101611a5e6040840184611898565b67ffffffffffffffff811115611a7657611a766118db565b611a8a81611a84855461180a565b856118ef565b5f601f821160018114611ab6575f8315611aa45750838201355b611aae8482611946565b865550611b0d565b5f85815260208120601f198516915b82811015611ae55786850135825560209485019460019092019101611ac5565b5084821015611b01575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e1983360301811261186a575f5ffd5b5f81356103b081611640565b813581556020820135600182015560408201356002820155611b5c6060830183611898565b611b6a81836003860161195a565b5050611b796080830183611898565b611b8781836004860161195a565b5050611b9660a0830183611898565b611ba481836005860161195a565b5050611bb360c0830183611898565b611bc181836006860161195a565b5050611bd060e0830183611898565b611bde81836007860161195a565b5050611bee610100830183611898565b611bfc81836008860161195a565b5050611c0c610120830183611898565b611c1a81836009860161195a565b5050611c2a610140830183611898565b611c388183600a860161195a565b50506104a5611c4a6101608401611b2b565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112611c81575f5ffd5b8201611c8d8180611898565b67ffffffffffffffff811115611ca557611ca56118db565b611cb981611cb3865461180a565b866118ef565b5f601f821160018114611ce5575f8315611cd35750838201355b611cdd8482611946565b875550611d3c565b5f86815260208120601f198516915b82811015611d145786850135825560209485019460019092019101611cf4565b5084821015611d30575f1960f88660031b161c19848701351681555b505060018360011b0186555b50505050611d4d6020820182611898565b611d5b81836001870161195a565b5050611d6a6040820182611898565b611d7881836002870161195a565b5050611d876060820182611898565b9150611d9782826003860161195a565b50506104a5611da96020840184611b16565b60048301611b37565b5f5f85851115611dc0575f5ffd5b83861115611dcc575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611e1f576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea26469706673582212200287d1b5d9b6a388478c19cdff46db6cde01b03141d9c5504aa508c8e89cd30e64736f6c63430008210033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061013d575f3560e01c806396c3e905116100b4578063c41a71ff11610079578063c41a71ff146102f4578063cfdbf25414610307578063e30c39781461031e578063ef6735031461032f578063f2fde38b14610342578063f423aa6c14610355575f5ffd5b806396c3e9051461029557806399db0828146102a85780639b6c56ec146102bb578063a6568202146102ce578063b05e5a41146102e1575f5ffd5b8063572b6c0511610105578063572b6c05146101cf578063591236f71461020f578063715018a61461023a57806379ba5097146102425780637da0a8771461024a5780638da5cb5b14610284575f5ffd5b806301ffc9a7146101415780630dca59c114610169578063498de65c1461017e57806350101d841461019357806354fd4d50146101a8575b5f5ffd5b61015461014f366004611439565b610380565b60405190151581526020015b60405180910390f35b6101716103b6565b6040516101609190611495565b61019161018c366004611654565b6103ce565b005b61019b6103e2565b604051610160919061166f565b60408051808201825260058152640302e332e360dc1b6020820152905161016091906116a9565b6101546101dd366004611654565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b61015461021d366004611654565b6001600160a01b03165f9081526003602052604090205460ff1690565b610191610408565b61019161041b565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610160565b6004546001600160a01b031661026c565b6101916102a3366004611654565b610482565b6101916102b63660046116bb565b610493565b6101716102c9366004611654565b6104a9565b6101916102dc36600461170e565b610beb565b6101916102ef36600461179e565b610bfd565b61019161030236600461179e565b610cc1565b6103106101f481565b604051908152602001610160565b6005546001600160a01b031661026c565b61019b61033d366004611654565b610d7e565b610191610350366004611654565b610e71565b610154610363366004611654565b6001600160a01b03165f9081526002602052604090205460ff1690565b5f6001600160e01b031982166307f5828d60e41b14806103b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6103be61134a565b6103c96102c9610ee2565b905090565b6103d6610eeb565b6103df81610ef3565b50565b60408051606080820183525f8083526020830152918101919091526103c961033d610ee2565b610410611042565b6104195f6110a0565b565b5f610424610ee2565b9050806001600160a01b03166104426005546001600160a01b031690565b6001600160a01b0316146104795760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6103df816110a0565b61048a610eeb565b6103df816110b9565b61049b610eeb565b6104a5828261115a565b5050565b6104b161134a565b6001600160a01b0382165f9081526020819052604090819020815160c081018352815490928391908201908390829082906104eb9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105179061180a565b80156105625780601f1061053957610100808354040283529160200191610562565b820191905f5260205f20905b81548152906001019060200180831161054557829003601f168201915b5050505050815260200160018201805461057b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061180a565b80156105f25780601f106105c9576101008083540402835291602001916105f2565b820191905f5260205f20905b8154815290600101906020018083116105d557829003601f168201915b5050505050815260200160028201805461060b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106379061180a565b80156106825780601f1061065957610100808354040283529160200191610682565b820191905f5260205f20905b81548152906001019060200180831161066557829003601f168201915b5050505050815260200160038201805461069b9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546106c79061180a565b80156107125780601f106106e957610100808354040283529160200191610712565b820191905f5260205f20905b8154815290600101906020018083116106f557829003601f168201915b505050505081525050815260200160048201604051806101800160405290815f8201548152602001600182015481526020016002820154815260200160038201805461075d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546107899061180a565b80156107d45780601f106107ab576101008083540402835291602001916107d4565b820191905f5260205f20905b8154815290600101906020018083116107b757829003601f168201915b505050505081526020016004820180546107ed9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108199061180a565b80156108645780601f1061083b57610100808354040283529160200191610864565b820191905f5260205f20905b81548152906001019060200180831161084757829003601f168201915b5050505050815260200160058201805461087d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546108a99061180a565b80156108f45780601f106108cb576101008083540402835291602001916108f4565b820191905f5260205f20905b8154815290600101906020018083116108d757829003601f168201915b5050505050815260200160068201805461090d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109399061180a565b80156109845780601f1061095b57610100808354040283529160200191610984565b820191905f5260205f20905b81548152906001019060200180831161096757829003601f168201915b5050505050815260200160078201805461099d9061180a565b80601f01602080910402602001604051908101604052809291908181526020018280546109c99061180a565b8015610a145780601f106109eb57610100808354040283529160200191610a14565b820191905f5260205f20905b8154815290600101906020018083116109f757829003601f168201915b50505050508152602001600882018054610a2d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a599061180a565b8015610aa45780601f10610a7b57610100808354040283529160200191610aa4565b820191905f5260205f20905b815481529060010190602001808311610a8757829003601f168201915b50505050508152602001600982018054610abd9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae99061180a565b8015610b345780601f10610b0b57610100808354040283529160200191610b34565b820191905f5260205f20905b815481529060010190602001808311610b1757829003601f168201915b50505050508152602001600a82018054610b4d9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b799061180a565b8015610bc45780601f10610b9b57610100808354040283529160200191610bc4565b820191905f5260205f20905b815481529060010190602001808311610ba757829003601f168201915b5050509183525050600b91909101546001600160a01b031660209091015290525092915050565b610bf3610eeb565b6104a582826111f2565b610c05610eeb565b828114610c2557604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610c525760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610cb2858583818110610c7457610c74611842565b9050602002016020810190610c899190611654565b848484818110610c9b57610c9b611842565b9050602002810190610cad9190611856565b6111f2565b600101610c57565b5050505050565b610cc9610eeb565b828114610ce957604051637db491eb60e01b815260040160405180910390fd5b826101f480821115610d165760405162ef8cfb60e11b815260048101929092526024820152604401610470565b505f90505b83811015610cba57610d76858583818110610d3857610d38611842565b9050602002016020810190610d4d9190611654565b848484818110610d5f57610d5f611842565b9050602002810190610d719190611874565b61115a565b600101610d1b565b60408051606080820183525f8083526020830152918101919091526001600160a01b0382165f908152600160208181526040928390208351606081018552815460ff808216151583526101009091041615159281019290925291820180549193840191610dea9061180a565b80601f0160208091040260200160405190810160405280929190818152602001828054610e169061180a565b8015610e615780601f10610e3857610100808354040283529160200191610e61565b820191905f5260205f20905b815481529060010190602001808311610e4457829003601f168201915b5050505050815250509050919050565b610e79611042565b600580546001600160a01b0383166001600160a01b03199091168117909155610eaa6004546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f6103c961128a565b610419611042565b6001600160a01b038116610f1a576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f908152602081905260408120908181610f3e82826113f3565b610f4b600183015f6113f3565b610f58600283015f6113f3565b610f65600383015f6113f3565b50505f60048301818155600584018290556006840182905590610f8b60078501826113f3565b610f98600483015f6113f3565b610fa5600583015f6113f3565b610fb2600683015f6113f3565b610fbf600783015f6113f3565b610fcc600883015f6113f3565b610fd9600983015f6113f3565b610fe6600a83015f6113f3565b50600b0180546001600160a01b031916905550506001600160a01b0381165f81815260026020526040808220805460ff19169055517ff81491b44a66523f3c6ff7757f6f92295a159e731dbfc9b81ed99ed57b2001d19190a250565b61104a610ee2565b6001600160a01b03166110656004546001600160a01b031690565b6001600160a01b0316146104195761107b610ee2565b60405163118cdaa760e01b81526001600160a01b039091166004820152602401610470565b600580546001600160a01b03191690556103df816112f9565b6001600160a01b0381166110e0576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0381165f9081526001602081905260408220805461ffff191681559190611110908301826113f3565b50506001600160a01b0381165f81815260036020526040808220805460ff19169055517fe4006aecf739e92881954246ffcefdb0a0d55f5c2e53854424555e3202c3079d9190a250565b6001600160a01b038216611181576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906111a48282611a0f565b50506001600160a01b0382165f81815260036020526040808220805460ff19166001179055517f719f5f23c61bce416331e2ce5ea33546e99cf9b54735b21eb46f95d835e9afcb9190a25050565b6001600160a01b038216611219576040516319a3a92960e11b815260040160405180910390fd5b6001600160a01b0382165f908152602081905260409020819061123c8282611c6e565b50506001600160a01b0382165f81815260026020526040808220805460ff19166001179055517f973dc8faaa322eeaeaff7004858c3198802796050fa95561a6cf3f24127f2f769190a25050565b5f3660148082108015906112c657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633145b156112ec576112d936828403815f611db2565b6112e291611dd9565b60601c9250505090565b339250505090565b505090565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60405180604001604052806113806040518060800160405280606081526020016060815260200160608152602001606081525090565b81526020016113ee6040518061018001604052805f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020015f6001600160a01b031681525090565b905290565b5080546113ff9061180a565b5f825580601f1061140e575050565b601f0160209004905f5260205f20906103df91905f5b808211156112f4575f81840155600101611424565b5f60208284031215611449575f5ffd5b81356001600160e01b031981168114611460575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f8251604060208401528051608060608501526114b960e0850182611467565b90506020820151605f198583030160808601526114d68282611467565b9150506040820151605f198583030160a08601526114f48282611467565b91505060608201519150605f198482030160c08501526115148183611467565b9150506020840151601f198483030160408501528051825260208101516020830152604081015160408301526060810151610180606084015261155b610180840182611467565b9050608082015183820360808501526115748282611467565b91505060a082015183820360a085015261158e8282611467565b91505060c082015183820360c08501526115a88282611467565b91505060e082015183820360e08501526115c28282611467565b9150506101008201518382036101008501526115de8282611467565b9150506101208201518382036101208501526115fa8282611467565b9150506101408201518382036101408501526116168282611467565b91505061016082015191506116376101608401836001600160a01b03169052565b95945050505050565b6001600160a01b03811681146103df575f5ffd5b5f60208284031215611664575f5ffd5b813561146081611640565b602081528151151560208201526020820151151560408201525f60408301516060808401526116a16080840182611467565b949350505050565b602081525f6114606020830184611467565b5f5f604083850312156116cc575f5ffd5b82356116d781611640565b9150602083013567ffffffffffffffff8111156116f2575f5ffd5b830160608186031215611703575f5ffd5b809150509250929050565b5f5f6040838503121561171f575f5ffd5b823561172a81611640565b9150602083013567ffffffffffffffff811115611745575f5ffd5b830160408186031215611703575f5ffd5b5f5f83601f840112611766575f5ffd5b50813567ffffffffffffffff81111561177d575f5ffd5b6020830191508360208260051b8501011115611797575f5ffd5b9250929050565b5f5f5f5f604085870312156117b1575f5ffd5b843567ffffffffffffffff8111156117c7575f5ffd5b6117d387828801611756565b909550935050602085013567ffffffffffffffff8111156117f2575f5ffd5b6117fe87828801611756565b95989497509550505050565b600181811c9082168061181e57607f821691505b60208210810361183c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e1983360301811261186a575f5ffd5b9190910192915050565b5f8235605e1983360301811261186a575f5ffd5b5f813580151581146103b0575f5ffd5b5f5f8335601e198436030181126118ad575f5ffd5b83018035915067ffffffffffffffff8211156118c7575f5ffd5b602001915036819003821315611797575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115611941578282111561194157805f5260205f20601f840160051c602085101561191a57505f5b90810190601f840160051c035f5b8181101561193d575f83820155600101611928565b5050505b505050565b5f19600383901b1c191660019190911b1790565b67ffffffffffffffff831115611972576119726118db565b61198683611980835461180a565b836118ef565b5f601f8411600181146119b2575f85156119a05750838201355b6119aa8682611946565b845550610cba565b5f83815260208120601f198716915b828110156119e157868501358255602094850194600190920191016119c1565b50868210156119fd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b611a1882611888565b1515815460ff821691508160ff19821617835561ff00611a3a60208601611888565b151560081b168261ffff19831617178355505060018101611a5e6040840184611898565b67ffffffffffffffff811115611a7657611a766118db565b611a8a81611a84855461180a565b856118ef565b5f601f821160018114611ab6575f8315611aa45750838201355b611aae8482611946565b865550611b0d565b5f85815260208120601f198516915b82811015611ae55786850135825560209485019460019092019101611ac5565b5084821015611b01575f1960f88660031b161c19848701351681555b505060018360011b0185555b50505050505050565b5f823561017e1983360301811261186a575f5ffd5b5f81356103b081611640565b813581556020820135600182015560408201356002820155611b5c6060830183611898565b611b6a81836003860161195a565b5050611b796080830183611898565b611b8781836004860161195a565b5050611b9660a0830183611898565b611ba481836005860161195a565b5050611bb360c0830183611898565b611bc181836006860161195a565b5050611bd060e0830183611898565b611bde81836007860161195a565b5050611bee610100830183611898565b611bfc81836008860161195a565b5050611c0c610120830183611898565b611c1a81836009860161195a565b5050611c2a610140830183611898565b611c388183600a860161195a565b50506104a5611c4a6101608401611b2b565b600b830180546001600160a01b0319166001600160a01b0392909216919091179055565b8135607e19833603018112611c81575f5ffd5b8201611c8d8180611898565b67ffffffffffffffff811115611ca557611ca56118db565b611cb981611cb3865461180a565b866118ef565b5f601f821160018114611ce5575f8315611cd35750838201355b611cdd8482611946565b875550611d3c565b5f86815260208120601f198516915b82811015611d145786850135825560209485019460019092019101611cf4565b5084821015611d30575f1960f88660031b161c19848701351681555b505060018360011b0186555b50505050611d4d6020820182611898565b611d5b81836001870161195a565b5050611d6a6040820182611898565b611d7881836002870161195a565b5050611d876060820182611898565b9150611d9782826003860161195a565b50506104a5611da96020840184611b16565b60048301611b37565b5f5f85851115611dc0575f5ffd5b83861115611dcc575f5ffd5b5050820193919092039150565b80356bffffffffffffffffffffffff198116906014841015611e1f576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea26469706673582212200287d1b5d9b6a388478c19cdff46db6cde01b03141d9c5504aa508c8e89cd30e64736f6c63430008210033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/doc/coverage/coverage/index-sort-b.html b/doc/coverage/coverage/index-sort-b.html index 80e218e..63173df 100644 --- a/doc/coverage/coverage/index-sort-b.html +++ b/doc/coverage/coverage/index-sort-b.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 75 + 79 + 94.9 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 31 + 33 + 93.9 % Branches: - 6 - 6 + 19 + 19 100.0 % @@ -81,17 +81,41 @@ Functions Sort by function coverage Branches Sort by branch coverage + + src/modules + +
100.0%
+ + 100.0 % + 2 / 2 + 100.0 % + 1 / 1 + - + 0 / 0 + + + src/deployment + +
84.0%84.0%
+ + 84.0 % + 21 / 25 + 84.6 % + 11 / 13 + 100.0 % + 3 / 3 + src -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/index-sort-f.html b/doc/coverage/coverage/index-sort-f.html index d3386f0..4c89a34 100644 --- a/doc/coverage/coverage/index-sort-f.html +++ b/doc/coverage/coverage/index-sort-f.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 75 + 79 + 94.9 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 31 + 33 + 93.9 % Branches: - 6 - 6 + 19 + 19 100.0 % @@ -81,17 +81,41 @@ Functions Sort by function coverage Branches Sort by branch coverage + + src/deployment + +
84.0%84.0%
+ + 84.0 % + 21 / 25 + 84.6 % + 11 / 13 + 100.0 % + 3 / 3 + + + src/modules + +
100.0%
+ + 100.0 % + 2 / 2 + 100.0 % + 1 / 1 + - + 0 / 0 + src -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/index-sort-l.html b/doc/coverage/coverage/index-sort-l.html index 2fea8d3..231f066 100644 --- a/doc/coverage/coverage/index-sort-l.html +++ b/doc/coverage/coverage/index-sort-l.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 75 + 79 + 94.9 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 31 + 33 + 93.9 % Branches: - 6 - 6 + 19 + 19 100.0 % @@ -81,17 +81,41 @@ Functions Sort by function coverage Branches Sort by branch coverage + + src/deployment + +
84.0%84.0%
+ + 84.0 % + 21 / 25 + 84.6 % + 11 / 13 + 100.0 % + 3 / 3 + + + src/modules + +
100.0%
+ + 100.0 % + 2 / 2 + 100.0 % + 1 / 1 + - + 0 / 0 + src -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/index.html b/doc/coverage/coverage/index.html index 9fc169f..da0ef0b 100644 --- a/doc/coverage/coverage/index.html +++ b/doc/coverage/coverage/index.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 75 + 79 + 94.9 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 31 + 33 + 93.9 % Branches: - 6 - 6 + 19 + 19 100.0 % @@ -84,14 +84,38 @@ src -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 + + + src/deployment + +
84.0%84.0%
+ + 84.0 % + 21 / 25 + 84.6 % + 11 / 13 + 100.0 % + 3 / 3 + + + src/modules + +
100.0%
+ + 100.0 % + 2 / 2 + 100.0 % + 1 / 1 + - + 0 / 0 diff --git a/doc/coverage/coverage/src/DebtEngine.sol.func-sort-c.html b/doc/coverage/coverage/src/DebtEngine.sol.func-sort-c.html deleted file mode 100644 index 1253521..0000000 --- a/doc/coverage/coverage/src/DebtEngine.sol.func-sort-c.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - LCOV - lcov.info - src/DebtEngine.sol - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - DebtEngine.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:212295.5 %
Date:2024-09-09 14:59:40Functions:81080.0 %
Branches:66100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
DebtEngine._msgData0
DebtEngine.hasRole0
DebtEngine.setCreditEvents3
DebtEngine.setCreditEventsBatch3
DebtEngine.setDebt3
DebtEngine.setDebtBatch3
DebtEngine.creditEvents4
DebtEngine.debt4
DebtEngine._contextSuffixLength12
DebtEngine._msgSender12
-
-
- - - -
Generated by: LCOV version 1.16
-
- - - diff --git a/doc/coverage/coverage/src/DebtEngine.sol.func.html b/doc/coverage/coverage/src/DebtEngine.sol.func.html deleted file mode 100644 index c03c4d9..0000000 --- a/doc/coverage/coverage/src/DebtEngine.sol.func.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - LCOV - lcov.info - src/DebtEngine.sol - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - DebtEngine.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:212295.5 %
Date:2024-09-09 14:59:40Functions:81080.0 %
Branches:66100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
DebtEngine._contextSuffixLength12
DebtEngine._msgData0
DebtEngine._msgSender12
DebtEngine.creditEvents4
DebtEngine.debt4
DebtEngine.hasRole0
DebtEngine.setCreditEvents3
DebtEngine.setCreditEventsBatch3
DebtEngine.setDebt3
DebtEngine.setDebtBatch3
-
-
- - - -
Generated by: LCOV version 1.16
-
- - - diff --git a/doc/coverage/coverage/src/DebtEngine.sol.gcov.html b/doc/coverage/coverage/src/DebtEngine.sol.gcov.html deleted file mode 100644 index c5a18b7..0000000 --- a/doc/coverage/coverage/src/DebtEngine.sol.gcov.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - LCOV - lcov.info - src/DebtEngine.sol - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - DebtEngine.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:212295.5 %
Date:2024-09-09 14:59:40Functions:81080.0 %
Branches:66100.0 %
-
- - - - - - - - -

-
           Branch data     Line data    Source code
-
-       1                 :            : // SPDX-License-Identifier: MPL-2.0
-       2                 :            : pragma solidity ^0.8.20;
-       3                 :            : 
-       4                 :            : import "OZ/access/AccessControl.sol";
-       5                 :            : import "OZ/metatx/ERC2771Context.sol";
-       6                 :            : import "CMTAT/interfaces/engine/IDebtEngine.sol";
-       7                 :            : import "./DebtEngineInvariantStorage.sol";
-       8                 :            : import {IDebtGlobal} from "CMTAT/interfaces/IDebtGlobal.sol";
-       9                 :            : 
-      10                 :            : contract DebtEngine is
-      11                 :            :     IDebtEngine,
-      12                 :            :     AccessControl,
-      13                 :            :     DebtEngineInvariantStorage,
-      14                 :            :     ERC2771Context
-      15                 :            : {
-      16                 :            :     /**
-      17                 :            :      * @notice
-      18                 :            :      * Get the current version of the smart contract
-      19                 :            :      */
-      20                 :            :     string public constant VERSION = "0.2.0";
-      21                 :            : 
-      22                 :            :     // Mapping of debts and credit events to specific smart contracts
-      23                 :            :     mapping(address => DebtBase) private _debts;
-      24                 :            :     mapping(address => CreditEvents) private _creditEvents;
-      25                 :            : 
-      26                 :            :     /**
-      27                 :            :      * Constructor to initialize the admin role
-      28                 :            :      */
-      29                 :            :     constructor(
-      30                 :            :         address admin,
-      31                 :            :         address forwarderIrrevocable
-      32                 :            :     ) ERC2771Context(forwarderIrrevocable) {
-      33                 :            :         if (admin == address(0)) {
-      34                 :            :             revert AdminWithAddressZeroNotAllowed();
-      35                 :            :         }
-      36                 :            :         _grantRole(DEFAULT_ADMIN_ROLE, admin);
-      37                 :            :     }
-      38                 :            : 
-      39                 :            :     /*//////////////////////////////////////////////////////////////
-      40                 :            :                             PUBLIC/EXTERNAL FUNCTIONS
-      41                 :            :     //////////////////////////////////////////////////////////////*/
-      42                 :            : 
-      43                 :            :     /* ============  USER-FACING FUNCTIONS ============ */
-      44                 :            :     /**
-      45                 :            :      * @notice  Function to get the debt for the sender's smart contract
-      46                 :            :      */
-      47                 :            :     function debt() external view returns (DebtBase memory) {
-      48                 :          3 :         return debt(msg.sender);
-      49                 :            :     }
-      50                 :            : 
-      51                 :            :     /**
-      52                 :            :      * @notice Function to get the debt for a specific smart contract
-      53                 :            :      */
-      54                 :            :     function debt(
-      55                 :            :         address smartContract_
-      56                 :            :     ) public view returns (DebtBase memory) {
-      57                 :          8 :         DebtBase memory d = _debts[smartContract_];
-      58                 :          8 :         return d;
-      59                 :            :     }
-      60                 :            : 
-      61                 :            :     /**
-      62                 :            :      * @notice Function to get the credit events for the sender's smart contract
-      63                 :            :      */
-      64                 :            :     function creditEvents() external view returns (CreditEvents memory) {
-      65                 :          3 :         return creditEvents(msg.sender);
-      66                 :            :     }
-      67                 :            : 
-      68                 :            :     /**
-      69                 :            :      * @notice Function to get the credit events for a specific smart contract
-      70                 :            :      */
-      71                 :            :     function creditEvents(
-      72                 :            :         address smartContract_
-      73                 :            :     ) public view returns (CreditEvents memory) {
-      74                 :          8 :         CreditEvents memory ce = _creditEvents[smartContract_];
-      75                 :          8 :         return ce;
-      76                 :            :     }
-      77                 :            : 
-      78                 :            :     /* ============ RESTRICTED-FACING FUNCTIONS ============ */
-      79                 :            :     /**
-      80                 :            :      * @notice Function to set the debt for a given smart contract
-      81                 :            :      */
-      82                 :            :     function setDebt(
-      83                 :            :         address smartContract_,
-      84                 :            :         DebtBase calldata debt_
-      85                 :            :     ) external onlyRole(DEBT_MANAGER_ROLE) {
-      86                 :          4 :         _debts[smartContract_] = debt_;
-      87                 :            :     }
-      88                 :            : 
-      89                 :            :     /*
-      90                 :            :      * @notice Function to set the credit events for a given smart contract
-      91                 :            :      */
-      92                 :            :     function setCreditEvents(
-      93                 :            :         address smartContract_,
-      94                 :            :         CreditEvents calldata creditEvents_
-      95                 :            :     ) external onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {
-      96                 :          4 :         _creditEvents[smartContract_] = creditEvents_;
-      97                 :            :     }
-      98                 :            : 
-      99                 :            :     /*
-     100                 :            :      * @notice Batch version of {setCreditEventsBatch}
-     101                 :            :      */
-     102                 :            :     function setCreditEventsBatch(
-     103                 :            :         address[] calldata smartContracts,
-     104                 :            :         CreditEvents[] calldata creditEventsList
-     105                 :            :     ) external onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {
-     106         [ +  + ]:          4 :         if (smartContracts.length != creditEventsList.length) {
-     107                 :          2 :             revert InvalidInputLength();
-     108                 :            :         }
-     109                 :            : 
-     110                 :          7 :         for (uint256 i = 0; i < smartContracts.length; i++) {
-     111                 :          4 :             _creditEvents[smartContracts[i]] = creditEventsList[i];
-     112                 :            :         }
-     113                 :            :     }
-     114                 :            : 
-     115                 :            :     /*
-     116                 :            :      * @notice Batch version of {setDebtBatch}
-     117                 :            :      */
-     118                 :            :     function setDebtBatch(
-     119                 :            :         address[] calldata smartContracts,
-     120                 :            :         DebtBase[] calldata debts
-     121                 :            :     ) external onlyRole(DEBT_MANAGER_ROLE) {
-     122         [ +  + ]:          4 :         if (smartContracts.length != debts.length) {
-     123                 :          2 :             revert InvalidInputLength();
-     124                 :            :         }
-     125                 :            : 
-     126                 :          7 :         for (uint256 i = 0; i < smartContracts.length; i++) {
-     127                 :          4 :             _debts[smartContracts[i]] = debts[i];
-     128                 :            :         }
-     129                 :            :     }
-     130                 :            : 
-     131                 :            :     /* ============ ACCESS CONTROL ============ */
-     132                 :            : 
-     133                 :            :     /*
-     134                 :            :      * @dev Returns `true` if `account` has been granted `role`.
-     135                 :            :      */
-     136                 :            :     function hasRole(
-     137                 :            :         bytes32 role,
-     138                 :            :         address account
-     139                 :            :     ) public view virtual override returns (bool) {
-     140                 :            :         // The Default Admin has all roles
-     141         [ +  + ]:         24 :         if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
-     142                 :         16 :             return true;
-     143                 :            :         }
-     144                 :         12 :         return AccessControl.hasRole(role, account);
-     145                 :            :     }
-     146                 :            : 
-     147                 :            :     /*//////////////////////////////////////////////////////////////
-     148                 :            :                            ERC2771
-     149                 :            :     //////////////////////////////////////////////////////////////*/
-     150                 :            : 
-     151                 :            :     /**
-     152                 :            :      * @dev This surcharge is not necessary if you do not use ERC2771
-     153                 :            :      */
-     154                 :            :     function _msgSender()
-     155                 :            :         internal
-     156                 :            :         view
-     157                 :            :         override(ERC2771Context, Context)
-     158                 :            :         returns (address sender)
-     159                 :            :     {
-     160                 :         36 :         return ERC2771Context._msgSender();
-     161                 :            :     }
-     162                 :            : 
-     163                 :            :     /**
-     164                 :            :      * @dev This surcharge is not necessary if you do not use ERC2771
-     165                 :            :      */
-     166                 :            :     function _msgData()
-     167                 :            :         internal
-     168                 :            :         view
-     169                 :            :         override(ERC2771Context, Context)
-     170                 :            :         returns (bytes calldata)
-     171                 :            :     {
-     172                 :          0 :         return ERC2771Context._msgData();
-     173                 :            :     }
-     174                 :            : 
-     175                 :            :     /**
-     176                 :            :      * @dev This surcharge is not necessary if you do not use the MetaTxModule
-     177                 :            :      */
-     178                 :            :     function _contextSuffixLength()
-     179                 :            :         internal
-     180                 :            :         view
-     181                 :            :         override(ERC2771Context, Context)
-     182                 :            :         returns (uint256)
-     183                 :            :     {
-     184                 :         36 :         return ERC2771Context._contextSuffixLength();
-     185                 :            :     }
-     186                 :            : }
-
-
-
- - - - -
Generated by: LCOV version 1.16
-
- - - diff --git a/doc/coverage/coverage/src/DebtEngineBase.sol.func-sort-c.html b/doc/coverage/coverage/src/DebtEngineBase.sol.func-sort-c.html new file mode 100644 index 0000000..779d58d --- /dev/null +++ b/doc/coverage/coverage/src/DebtEngineBase.sol.func-sort-c.html @@ -0,0 +1,157 @@ + + + + + + + LCOV - lcov.info - src/DebtEngineBase.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - DebtEngineBase.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:5252100.0 %
Date:2026-11-17 09:48:37Functions:1919100.0 %
Branches:1616100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineBase._msgSender2
DebtEngineBase.creditEvents.08
DebtEngineBase._clearCreditEvents10
DebtEngineBase.debt.019
DebtEngineBase.creditEvents.1523
DebtEngineBase.setCreditEventsBatch532
DebtEngineBase.setDebtBatch535
DebtEngineBase.clearCreditEvents781
DebtEngineBase.onlyCreditEventsManager781
DebtEngineBase.hasCreditEvents797
DebtEngineBase.setCreditEvents1052
DebtEngineBase._setCreditEvents1552
DebtEngineBase._clearDebt1591
DebtEngineBase.setDebt2254
DebtEngineBase.clearDebt2362
DebtEngineBase.onlyDebtManager2362
DebtEngineBase._setDebt2753
DebtEngineBase.debt.13276
DebtEngineBase.hasDebt3557
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/DebtEngineBase.sol.func.html b/doc/coverage/coverage/src/DebtEngineBase.sol.func.html new file mode 100644 index 0000000..bf053e0 --- /dev/null +++ b/doc/coverage/coverage/src/DebtEngineBase.sol.func.html @@ -0,0 +1,157 @@ + + + + + + + LCOV - lcov.info - src/DebtEngineBase.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - DebtEngineBase.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:5252100.0 %
Date:2026-11-17 09:48:37Functions:1919100.0 %
Branches:1616100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineBase._clearCreditEvents10
DebtEngineBase._clearDebt1591
DebtEngineBase._msgSender2
DebtEngineBase._setCreditEvents1552
DebtEngineBase._setDebt2753
DebtEngineBase.clearCreditEvents781
DebtEngineBase.clearDebt2362
DebtEngineBase.creditEvents.08
DebtEngineBase.creditEvents.1523
DebtEngineBase.debt.019
DebtEngineBase.debt.13276
DebtEngineBase.hasCreditEvents797
DebtEngineBase.hasDebt3557
DebtEngineBase.onlyCreditEventsManager781
DebtEngineBase.onlyDebtManager2362
DebtEngineBase.setCreditEvents1052
DebtEngineBase.setCreditEventsBatch532
DebtEngineBase.setDebt2254
DebtEngineBase.setDebtBatch535
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/DebtEngineBase.sol.gcov.html b/doc/coverage/coverage/src/DebtEngineBase.sol.gcov.html new file mode 100644 index 0000000..3982083 --- /dev/null +++ b/doc/coverage/coverage/src/DebtEngineBase.sol.gcov.html @@ -0,0 +1,320 @@ + + + + + + + LCOV - lcov.info - src/DebtEngineBase.sol + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - DebtEngineBase.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:5252100.0 %
Date:2026-11-17 09:48:37Functions:1919100.0 %
Branches:1616100.0 %
+
+ + + + + + + + +

+
           Branch data     Line data    Source code
+
+       1                 :            : // SPDX-License-Identifier: MPL-2.0
+       2                 :            : pragma solidity ^0.8.27;
+       3                 :            : 
+       4                 :            : import {IDebtEngine} from "CMTAT/interfaces/engine/IDebtEngine.sol";
+       5                 :            : import {DebtEngineInvariantStorage} from "./DebtEngineInvariantStorage.sol";
+       6                 :            : import {VersionModule} from "./modules/VersionModule.sol";
+       7                 :            : 
+       8                 :            : abstract contract DebtEngineBase is IDebtEngine, DebtEngineInvariantStorage, VersionModule {
+       9                 :            :     // Events
+      10                 :            :     event DebtSet(address indexed smartContract);
+      11                 :            :     event CreditEventsSet(address indexed smartContract);
+      12                 :            :     event DebtCleared(address indexed smartContract);
+      13                 :            :     event CreditEventsCleared(address indexed smartContract);
+      14                 :            : 
+      15                 :            :     // Mapping of debts and credit events to specific smart contracts
+      16                 :            :     mapping(address => DebtInformation) private _debts;
+      17                 :            :     mapping(address => CreditEvents) private _creditEvents;
+      18                 :            : 
+      19                 :            :     // Track whether debt/credit events have been explicitly set
+      20                 :            :     mapping(address => bool) private _debtSet;
+      21                 :            :     mapping(address => bool) private _creditEventsSet;
+      22                 :            : 
+      23                 :            :     /**
+      24                 :            :      * @notice Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`.
+      25                 :            :      * @dev A hard ceiling, not a recommended batch size. Every entry writes its whole struct to storage,
+      26                 :            :      * so on a network with a per-transaction gas cap (Ethereum mainnet: 2^24 gas since EIP-7825) a batch
+      27                 :            :      * of realistic records runs out of gas long before this limit. Size batches from a gas estimate.
+      28                 :            :      */
+      29                 :            :     uint256 public constant MAX_BATCH_SIZE = 500;
+      30                 :            : 
+      31                 :       2362 :     modifier onlyDebtManager() {
+      32                 :       2362 :         _authorizeSetDebt();
+      33                 :            :         _;
+      34                 :            :     }
+      35                 :            : 
+      36                 :        781 :     modifier onlyCreditEventsManager() {
+      37                 :        781 :         _authorizeSetCreditEvents();
+      38                 :            :         _;
+      39                 :            :     }
+      40                 :            : 
+      41                 :            :     /*//////////////////////////////////////////////////////////////
+      42                 :            :                             PUBLIC/EXTERNAL FUNCTIONS
+      43                 :            :     //////////////////////////////////////////////////////////////*/
+      44                 :            : 
+      45                 :            :     /* ============  USER-FACING FUNCTIONS ============ */
+      46                 :            :     /**
+      47                 :            :      * @notice  Function to get the debt for the sender's smart contract
+      48                 :            :      */
+      49                 :         19 :     function debt() external view virtual returns (DebtInformation memory) {
+      50                 :         19 :         return debt(_msgSender());
+      51                 :            :     }
+      52                 :            : 
+      53                 :            :     /**
+      54                 :            :      * @notice Function to get the debt for a specific smart contract
+      55                 :            :      */
+      56                 :       3276 :     function debt(address smartContract_) public view virtual returns (DebtInformation memory) {
+      57                 :       3295 :         return _debts[smartContract_];
+      58                 :            :     }
+      59                 :            : 
+      60                 :            :     /**
+      61                 :            :      * @notice Function to get the credit events for the sender's smart contract
+      62                 :            :      */
+      63                 :          8 :     function creditEvents() external view virtual returns (CreditEvents memory) {
+      64                 :          8 :         return creditEvents(_msgSender());
+      65                 :            :     }
+      66                 :            : 
+      67                 :            :     /**
+      68                 :            :      * @notice Function to get the credit events for a specific smart contract
+      69                 :            :      */
+      70                 :        523 :     function creditEvents(address smartContract_) public view virtual returns (CreditEvents memory) {
+      71                 :        531 :         return _creditEvents[smartContract_];
+      72                 :            :     }
+      73                 :            : 
+      74                 :            :     /**
+      75                 :            :      * @notice Returns true if a debt record is currently set for the given smart contract
+      76                 :            :      * @dev True after {setDebt} / {setDebtBatch}, false again after {clearDebt}.
+      77                 :            :      */
+      78                 :       3557 :     function hasDebt(address smartContract_) external view virtual returns (bool) {
+      79                 :       3557 :         return _debtSet[smartContract_];
+      80                 :            :     }
+      81                 :            : 
+      82                 :            :     /**
+      83                 :            :      * @notice Returns true if credit events are currently set for the given smart contract
+      84                 :            :      * @dev True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}.
+      85                 :            :      */
+      86                 :        797 :     function hasCreditEvents(address smartContract_) external view virtual returns (bool) {
+      87                 :        797 :         return _creditEventsSet[smartContract_];
+      88                 :            :     }
+      89                 :            : 
+      90                 :            :     /* ============ RESTRICTED-FACING FUNCTIONS ============ */
+      91                 :            :     /**
+      92                 :            :      * @notice Function to set the debt for a given smart contract
+      93                 :            :      */
+      94                 :       2254 :     function setDebt(address smartContract_, DebtInformation calldata debt_) external virtual onlyDebtManager {
+      95                 :       1729 :         _setDebt(smartContract_, debt_);
+      96                 :            :     }
+      97                 :            : 
+      98                 :            :     /**
+      99                 :            :      * @notice Function to set the credit events for a given smart contract
+     100                 :            :      */
+     101                 :       1052 :     function setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_)
+     102                 :            :         external
+     103                 :            :         virtual
+     104                 :            :         onlyCreditEventsManager
+     105                 :            :     {
+     106                 :        536 :         _setCreditEvents(smartContract_, creditEvents_);
+     107                 :            :     }
+     108                 :            : 
+     109                 :            :     /**
+     110                 :            :      * @notice Batch version of {setCreditEvents}
+     111                 :            :      */
+     112                 :        532 :     function setCreditEventsBatch(address[] calldata smartContracts, CreditEvents[] calldata creditEventsList)
+     113                 :            :         external
+     114                 :            :         virtual
+     115                 :            :         onlyCreditEventsManager
+     116                 :            :     {
+     117         [ +  + ]:         18 :         require(smartContracts.length == creditEventsList.length, InvalidInputLength());
+     118         [ +  + ]:         14 :         require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE));
+     119                 :            : 
+     120                 :         12 :         for (uint256 i = 0; i < smartContracts.length; i++) {
+     121                 :       1016 :             _setCreditEvents(smartContracts[i], creditEventsList[i]);
+     122                 :            :         }
+     123                 :            :     }
+     124                 :            : 
+     125                 :            :     /**
+     126                 :            :      * @notice Batch version of {setDebt}
+     127                 :            :      */
+     128                 :        535 :     function setDebtBatch(address[] calldata smartContracts, DebtInformation[] calldata debts)
+     129                 :            :         external
+     130                 :            :         virtual
+     131                 :            :         onlyDebtManager
+     132                 :            :     {
+     133         [ +  + ]:         21 :         require(smartContracts.length == debts.length, InvalidInputLength());
+     134         [ +  + ]:         17 :         require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE));
+     135                 :            : 
+     136                 :         15 :         for (uint256 i = 0; i < smartContracts.length; i++) {
+     137                 :       1022 :             _setDebt(smartContracts[i], debts[i]);
+     138                 :            :         }
+     139                 :            :     }
+     140                 :            : 
+     141                 :            :     /**
+     142                 :            :      * @notice Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards
+     143                 :            :      * and `debt(smartContract_)` returns the zero struct, as before any record was set.
+     144                 :            :      * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has
+     145                 :            :      * no record succeeds and still emits {DebtCleared}.
+     146                 :            :      */
+     147                 :       2362 :     function clearDebt(address smartContract_) external virtual onlyDebtManager {
+     148                 :       1591 :         _clearDebt(smartContract_);
+     149                 :            :     }
+     150                 :            : 
+     151                 :            :     /**
+     152                 :            :      * @notice Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards
+     153                 :            :      * and `creditEvents(smartContract_)` returns the zero struct, as before any record was set.
+     154                 :            :      * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has
+     155                 :            :      * no record succeeds and still emits {CreditEventsCleared}.
+     156                 :            :      */
+     157                 :        781 :     function clearCreditEvents(address smartContract_) external virtual onlyCreditEventsManager {
+     158                 :         10 :         _clearCreditEvents(smartContract_);
+     159                 :            :     }
+     160                 :            : 
+     161                 :            :     /*//////////////////////////////////////////////////////////////
+     162                 :            :                             INTERNAL FUNCTIONS
+     163                 :            :     //////////////////////////////////////////////////////////////*/
+     164                 :            : 
+     165                 :            :     /**
+     166                 :            :      * @dev Single write path for debt: rejects `address(0)`, stores the record, marks it as set
+     167                 :            :      * and emits {DebtSet}. Every public setter goes through it, so none can skip a step.
+     168                 :            :      */
+     169                 :       2753 :     function _setDebt(address smartContract_, DebtInformation calldata debt_) internal virtual {
+     170         [ +  + ]:       2753 :         require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed());
+     171                 :       2749 :         _debts[smartContract_] = debt_;
+     172                 :       2749 :         _debtSet[smartContract_] = true;
+     173                 :       2749 :         emit DebtSet(smartContract_);
+     174                 :            :     }
+     175                 :            : 
+     176                 :            :     /**
+     177                 :            :      * @dev Single write path for credit events: rejects `address(0)`, stores the record, marks it
+     178                 :            :      * as set and emits {CreditEventsSet}. Every public setter goes through it.
+     179                 :            :      */
+     180                 :       1552 :     function _setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) internal virtual {
+     181         [ +  + ]:       1552 :         require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed());
+     182                 :       1548 :         _creditEvents[smartContract_] = creditEvents_;
+     183                 :       1548 :         _creditEventsSet[smartContract_] = true;
+     184                 :       1548 :         emit CreditEventsSet(smartContract_);
+     185                 :            :     }
+     186                 :            : 
+     187                 :            :     /**
+     188                 :            :      * @dev Single delete path for debt: rejects `address(0)` (as `_setDebt` does), removes the record
+     189                 :            :      * and its "set" flag, emits {DebtCleared}.
+     190                 :            :      */
+     191                 :       1591 :     function _clearDebt(address smartContract_) internal virtual {
+     192         [ +  + ]:       1591 :         require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed());
+     193                 :            :         delete _debts[smartContract_];
+     194                 :            :         delete _debtSet[smartContract_];
+     195                 :       1589 :         emit DebtCleared(smartContract_);
+     196                 :            :     }
+     197                 :            : 
+     198                 :            :     /**
+     199                 :            :      * @dev Single delete path for credit events: rejects `address(0)` (as `_setCreditEvents` does),
+     200                 :            :      * removes the record and its "set" flag, emits {CreditEventsCleared}.
+     201                 :            :      */
+     202                 :         10 :     function _clearCreditEvents(address smartContract_) internal virtual {
+     203         [ +  + ]:         10 :         require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed());
+     204                 :            :         delete _creditEvents[smartContract_];
+     205                 :            :         delete _creditEventsSet[smartContract_];
+     206                 :          8 :         emit CreditEventsCleared(smartContract_);
+     207                 :            :     }
+     208                 :            : 
+     209                 :            :     /* ============ AUTHORIZATION HOOKS ============ */
+     210                 :            : 
+     211                 :            :     /**
+     212                 :            :      * @notice Authorization hook invoked before any debt change (`setDebt`, `setDebtBatch`, `clearDebt`).
+     213                 :            :      * @dev Must revert if the caller is not allowed. Implemented by each deployment contract
+     214                 :            :      * with its access-control policy; `view` guarantees the check cannot mutate state.
+     215                 :            :      */
+     216                 :            :     function _authorizeSetDebt() internal view virtual;
+     217                 :            : 
+     218                 :            :     /**
+     219                 :            :      * @notice Authorization hook invoked before any credit-events change (`setCreditEvents`, `setCreditEventsBatch`,
+     220                 :            :      * `clearCreditEvents`).
+     221                 :            :      * @dev Must revert if the caller is not allowed. Implemented by each deployment contract
+     222                 :            :      * with its access-control policy; `view` guarantees the check cannot mutate state.
+     223                 :            :      */
+     224                 :            :     function _authorizeSetCreditEvents() internal view virtual;
+     225                 :            : 
+     226                 :            :     /* ============ CONTEXT ============ */
+     227                 :            : 
+     228                 :            :     /**
+     229                 :            :      * @dev Returns the sender of the transaction.
+     230                 :            :      * Can be overridden to support meta-transactions (ERC2771).
+     231                 :            :      */
+     232                 :          2 :     function _msgSender() internal view virtual returns (address) {
+     233                 :          2 :         return msg.sender;
+     234                 :            :     }
+     235                 :            : }
+
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func-sort-c.html b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func-sort-c.html new file mode 100644 index 0000000..ecd57fa --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func-sort-c.html @@ -0,0 +1,109 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineAccessControl.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineAccessControl.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:131586.7 %
Date:2026-11-17 09:48:37Functions:6785.7 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineAccessControl._msgData0
DebtEngineAccessControl.constructor96
DebtEngineAccessControl.hasRole106
DebtEngineAccessControl._authorizeSetCreditEvents1057
DebtEngineAccessControl._authorizeSetDebt4084
DebtEngineAccessControl._contextSuffixLength5315
DebtEngineAccessControl._msgSender5315
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func.html b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func.html new file mode 100644 index 0000000..43cd66d --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.func.html @@ -0,0 +1,109 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineAccessControl.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineAccessControl.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:131586.7 %
Date:2026-11-17 09:48:37Functions:6785.7 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineAccessControl._authorizeSetCreditEvents1057
DebtEngineAccessControl._authorizeSetDebt4084
DebtEngineAccessControl._contextSuffixLength5315
DebtEngineAccessControl._msgData0
DebtEngineAccessControl._msgSender5315
DebtEngineAccessControl.constructor96
DebtEngineAccessControl.hasRole106
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.gcov.html b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.gcov.html new file mode 100644 index 0000000..2982b98 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineAccessControl.sol.gcov.html @@ -0,0 +1,157 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineAccessControl.sol + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineAccessControl.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:131586.7 %
Date:2026-11-17 09:48:37Functions:6785.7 %
Branches:33100.0 %
+
+ + + + + + + + +

+
           Branch data     Line data    Source code
+
+       1                 :            : // SPDX-License-Identifier: MPL-2.0
+       2                 :            : pragma solidity ^0.8.27;
+       3                 :            : 
+       4                 :            : import {AccessControl, IAccessControl} from "OZ/access/AccessControl.sol";
+       5                 :            : import {AccessControlEnumerable} from "OZ/access/extensions/AccessControlEnumerable.sol";
+       6                 :            : import {ERC2771Context, Context} from "OZ/metatx/ERC2771Context.sol";
+       7                 :            : import {DebtEngineBase} from "../DebtEngineBase.sol";
+       8                 :            : 
+       9                 :            : /**
+      10                 :            :  * @notice DebtEngine deployment with role-based access control.
+      11                 :            :  * @dev Uses `AccessControlEnumerable` so role holders can be listed on-chain.
+      12                 :            :  * `DEBT_MANAGER_ROLE` gates debt changes, `CREDIT_EVENTS_MANAGER_ROLE` gates credit-events changes.
+      13                 :            :  */
+      14                 :            : contract DebtEngineAccessControl is DebtEngineBase, AccessControlEnumerable, ERC2771Context {
+      15                 :            :     bytes32 public constant CREDIT_EVENTS_MANAGER_ROLE = keccak256("CREDIT_EVENTS_MANAGER_ROLE");
+      16                 :            :     bytes32 public constant DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE");
+      17                 :            : 
+      18                 :         96 :     constructor(address admin, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) {
+      19         [ +  + ]:         96 :         require(admin != address(0), AdminWithAddressZeroNotAllowed());
+      20                 :         95 :         _grantRole(DEFAULT_ADMIN_ROLE, admin);
+      21                 :            :     }
+      22                 :            : 
+      23                 :            :     /* ============ AUTHORIZATION HOOKS ============ */
+      24                 :            : 
+      25                 :       4084 :     function _authorizeSetDebt() internal view virtual override onlyRole(DEBT_MANAGER_ROLE) {}
+      26                 :            : 
+      27                 :       1057 :     function _authorizeSetCreditEvents() internal view virtual override onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {}
+      28                 :            : 
+      29                 :            :     /* ============ ACCESS CONTROL ============ */
+      30                 :            : 
+      31                 :            :     /**
+      32                 :            :      * @dev Returns `true` if `account` has been granted `role`.
+      33                 :            :      *
+      34                 :            :      * NOTE: The `DEFAULT_ADMIN_ROLE` is treated as a super-admin role.
+      35                 :            :      * Any account holding `DEFAULT_ADMIN_ROLE` is considered to hold every role,
+      36                 :            :      * even if it was not explicitly granted via `grantRole`.
+      37                 :            :      * This means `hasRole(ANY_ROLE, admin)` returns `true` for the admin.
+      38                 :            :      * `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` will NOT reflect
+      39                 :            :      * this implicit membership: the admin is not listed as a holder of the other roles.
+      40                 :            :      * Because OpenZeppelin's `_grantRole` / `_revokeRole` consult this function, granting a role to an admin
+      41                 :            :      * is a no-op, and revoking or renouncing one emits `RoleRevoked` while the admin keeps the power.
+      42                 :            :      */
+      43                 :        106 :     function hasRole(bytes32 role, address account)
+      44                 :            :         public
+      45                 :            :         view
+      46                 :            :         virtual
+      47                 :            :         override(AccessControl, IAccessControl)
+      48                 :            :         returns (bool)
+      49                 :            :     {
+      50                 :            :         // The Default Admin has all roles
+      51            [ + ]:       5306 :         if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+      52                 :       3367 :             return true;
+      53                 :            :         }
+      54                 :       1939 :         return AccessControl.hasRole(role, account);
+      55                 :            :     }
+      56                 :            : 
+      57                 :            :     /*//////////////////////////////////////////////////////////////
+      58                 :            :                            ERC2771
+      59                 :            :     //////////////////////////////////////////////////////////////*/
+      60                 :            : 
+      61                 :       5315 :     function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) {
+      62                 :       5315 :         return ERC2771Context._msgSender();
+      63                 :            :     }
+      64                 :            : 
+      65                 :          0 :     function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) {
+      66                 :          0 :         return ERC2771Context._msgData();
+      67                 :            :     }
+      68                 :            : 
+      69                 :       5315 :     function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) {
+      70                 :       5315 :         return ERC2771Context._contextSuffixLength();
+      71                 :            :     }
+      72                 :            : }
+
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func-sort-c.html b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func-sort-c.html new file mode 100644 index 0000000..406fc47 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func-sort-c.html @@ -0,0 +1,105 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineOwnable.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineOwnable.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:81080.0 %
Date:2026-11-17 09:48:37Functions:5683.3 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineOwnable._msgData0
DebtEngineOwnable.supportsInterface4
DebtEngineOwnable._authorizeSetDebt1067
DebtEngineOwnable._authorizeSetCreditEvents1308
DebtEngineOwnable._contextSuffixLength4195
DebtEngineOwnable._msgSender4195
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func.html b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func.html new file mode 100644 index 0000000..b2f09e2 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.func.html @@ -0,0 +1,105 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineOwnable.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineOwnable.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:81080.0 %
Date:2026-11-17 09:48:37Functions:5683.3 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
DebtEngineOwnable._authorizeSetCreditEvents1308
DebtEngineOwnable._authorizeSetDebt1067
DebtEngineOwnable._contextSuffixLength4195
DebtEngineOwnable._msgData0
DebtEngineOwnable._msgSender4195
DebtEngineOwnable.supportsInterface4
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.gcov.html b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.gcov.html new file mode 100644 index 0000000..71b761a --- /dev/null +++ b/doc/coverage/coverage/src/deployment/DebtEngineOwnable.sol.gcov.html @@ -0,0 +1,138 @@ + + + + + + + LCOV - lcov.info - src/deployment/DebtEngineOwnable.sol + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deployment - DebtEngineOwnable.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:81080.0 %
Date:2026-11-17 09:48:37Functions:5683.3 %
Branches:00-
+
+ + + + + + + + +

+
           Branch data     Line data    Source code
+
+       1                 :            : // SPDX-License-Identifier: MPL-2.0
+       2                 :            : pragma solidity ^0.8.27;
+       3                 :            : 
+       4                 :            : import {Ownable} from "OZ/access/Ownable.sol";
+       5                 :            : import {Ownable2Step} from "OZ/access/Ownable2Step.sol";
+       6                 :            : import {ERC2771Context, Context} from "OZ/metatx/ERC2771Context.sol";
+       7                 :            : import {ERC165} from "OZ/utils/introspection/ERC165.sol";
+       8                 :            : import {DebtEngineBase} from "../DebtEngineBase.sol";
+       9                 :            : 
+      10                 :            : /**
+      11                 :            :  * @notice DebtEngine deployment where a single owner manages both debt and credit events.
+      12                 :            :  * @dev Ownership transfer is two-step (`transferOwnership` then `acceptOwnership` by the new owner).
+      13                 :            :  * Every authorization hook collapses to `onlyOwner`, so this variant cannot separate duties.
+      14                 :            :  * Advertises ERC-173 (contract ownership) through ERC-165.
+      15                 :            :  */
+      16                 :            : contract DebtEngineOwnable is DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 {
+      17                 :            :     /// @dev ERC-165 identifier of the ERC-173 interface (`owner()` ^ `transferOwnership(address)`).
+      18                 :            :     bytes4 private constant ERC173_INTERFACE_ID = 0x7f5828d0;
+      19                 :            : 
+      20                 :            :     constructor(address owner, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) Ownable(owner) {}
+      21                 :            : 
+      22                 :            :     /* ============ ERC-165 ============ */
+      23                 :            : 
+      24                 :            :     /**
+      25                 :            :      * @inheritdoc ERC165
+      26                 :            :      * @dev Returns true for ERC-173 and ERC-165.
+      27                 :            :      */
+      28                 :          4 :     function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
+      29                 :          4 :         return interfaceId == ERC173_INTERFACE_ID || super.supportsInterface(interfaceId);
+      30                 :            :     }
+      31                 :            : 
+      32                 :            :     /* ============ AUTHORIZATION HOOKS ============ */
+      33                 :            : 
+      34                 :       1067 :     function _authorizeSetDebt() internal view virtual override onlyOwner {}
+      35                 :            : 
+      36                 :       1308 :     function _authorizeSetCreditEvents() internal view virtual override onlyOwner {}
+      37                 :            : 
+      38                 :            :     /*//////////////////////////////////////////////////////////////
+      39                 :            :                            ERC2771
+      40                 :            :     //////////////////////////////////////////////////////////////*/
+      41                 :            : 
+      42                 :       4195 :     function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) {
+      43                 :       4195 :         return ERC2771Context._msgSender();
+      44                 :            :     }
+      45                 :            : 
+      46                 :          0 :     function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) {
+      47                 :          0 :         return ERC2771Context._msgData();
+      48                 :            :     }
+      49                 :            : 
+      50                 :       4195 :     function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) {
+      51                 :       4195 :         return ERC2771Context._contextSuffixLength();
+      52                 :            :     }
+      53                 :            : }
+
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/index-sort-b.html b/doc/coverage/coverage/src/deployment/index-sort-b.html new file mode 100644 index 0000000..ba2e735 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/index-sort-b.html @@ -0,0 +1,119 @@ + + + + + + + LCOV - lcov.info - src/deployment + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deploymentHitTotalCoverage
Test:lcov.infoLines:212584.0 %
Date:2026-11-17 09:48:37Functions:111384.6 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
DebtEngineOwnable.sol +
80.0%80.0%
+
80.0 %8 / 1083.3 %5 / 6-0 / 0
DebtEngineAccessControl.sol +
86.7%86.7%
+
86.7 %13 / 1585.7 %6 / 7100.0 %3 / 3
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/index-sort-f.html b/doc/coverage/coverage/src/deployment/index-sort-f.html new file mode 100644 index 0000000..2e5dbe0 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/index-sort-f.html @@ -0,0 +1,119 @@ + + + + + + + LCOV - lcov.info - src/deployment + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deploymentHitTotalCoverage
Test:lcov.infoLines:212584.0 %
Date:2026-11-17 09:48:37Functions:111384.6 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
DebtEngineOwnable.sol +
80.0%80.0%
+
80.0 %8 / 1083.3 %5 / 6-0 / 0
DebtEngineAccessControl.sol +
86.7%86.7%
+
86.7 %13 / 1585.7 %6 / 7100.0 %3 / 3
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/index-sort-l.html b/doc/coverage/coverage/src/deployment/index-sort-l.html new file mode 100644 index 0000000..ff15a45 --- /dev/null +++ b/doc/coverage/coverage/src/deployment/index-sort-l.html @@ -0,0 +1,119 @@ + + + + + + + LCOV - lcov.info - src/deployment + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deploymentHitTotalCoverage
Test:lcov.infoLines:212584.0 %
Date:2026-11-17 09:48:37Functions:111384.6 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
DebtEngineOwnable.sol +
80.0%80.0%
+
80.0 %8 / 1083.3 %5 / 6-0 / 0
DebtEngineAccessControl.sol +
86.7%86.7%
+
86.7 %13 / 1585.7 %6 / 7100.0 %3 / 3
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/deployment/index.html b/doc/coverage/coverage/src/deployment/index.html new file mode 100644 index 0000000..2caf01a --- /dev/null +++ b/doc/coverage/coverage/src/deployment/index.html @@ -0,0 +1,119 @@ + + + + + + + LCOV - lcov.info - src/deployment + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/deploymentHitTotalCoverage
Test:lcov.infoLines:212584.0 %
Date:2026-11-17 09:48:37Functions:111384.6 %
Branches:33100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
DebtEngineAccessControl.sol +
86.7%86.7%
+
86.7 %13 / 1585.7 %6 / 7100.0 %3 / 3
DebtEngineOwnable.sol +
80.0%80.0%
+
80.0 %8 / 1083.3 %5 / 6-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/index-sort-b.html b/doc/coverage/coverage/src/index-sort-b.html index cd82152..6d23c11 100644 --- a/doc/coverage/coverage/src/index-sort-b.html +++ b/doc/coverage/coverage/src/index-sort-b.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 52 + 52 + 100.0 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 19 + 19 + 100.0 % Branches: - 6 - 6 + 16 + 16 100.0 % @@ -82,16 +82,16 @@ Branches Sort by branch coverage - DebtEngine.sol + DebtEngineBase.sol -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/src/index-sort-f.html b/doc/coverage/coverage/src/index-sort-f.html index def943a..d1fd6b4 100644 --- a/doc/coverage/coverage/src/index-sort-f.html +++ b/doc/coverage/coverage/src/index-sort-f.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 52 + 52 + 100.0 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 19 + 19 + 100.0 % Branches: - 6 - 6 + 16 + 16 100.0 % @@ -82,16 +82,16 @@ Branches Sort by branch coverage - DebtEngine.sol + DebtEngineBase.sol -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/src/index-sort-l.html b/doc/coverage/coverage/src/index-sort-l.html index 070d8fe..0270d52 100644 --- a/doc/coverage/coverage/src/index-sort-l.html +++ b/doc/coverage/coverage/src/index-sort-l.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 52 + 52 + 100.0 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 19 + 19 + 100.0 % Branches: - 6 - 6 + 16 + 16 100.0 % @@ -82,16 +82,16 @@ Branches Sort by branch coverage - DebtEngine.sol + DebtEngineBase.sol -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/src/index.html b/doc/coverage/coverage/src/index.html index 92ba240..8783933 100644 --- a/doc/coverage/coverage/src/index.html +++ b/doc/coverage/coverage/src/index.html @@ -31,26 +31,26 @@ lcov.info Lines: - 21 - 22 - 95.5 % + 52 + 52 + 100.0 % Date: - 2024-09-09 14:59:40 + 2026-11-17 09:48:37 Functions: - 8 - 10 - 80.0 % + 19 + 19 + 100.0 % Branches: - 6 - 6 + 16 + 16 100.0 % @@ -82,16 +82,16 @@ Branches Sort by branch coverage - DebtEngine.sol + DebtEngineBase.sol -
95.5%95.5%
+
100.0%
- 95.5 % - 21 / 22 - 80.0 % - 8 / 10 100.0 % - 6 / 6 + 52 / 52 + 100.0 % + 19 / 19 + 100.0 % + 16 / 16 diff --git a/doc/coverage/coverage/src/modules/VersionModule.sol.func-sort-c.html b/doc/coverage/coverage/src/modules/VersionModule.sol.func-sort-c.html new file mode 100644 index 0000000..d0f310a --- /dev/null +++ b/doc/coverage/coverage/src/modules/VersionModule.sol.func-sort-c.html @@ -0,0 +1,85 @@ + + + + + + + LCOV - lcov.info - src/modules/VersionModule.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modules - VersionModule.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
VersionModule.version12
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/VersionModule.sol.func.html b/doc/coverage/coverage/src/modules/VersionModule.sol.func.html new file mode 100644 index 0000000..66cdafb --- /dev/null +++ b/doc/coverage/coverage/src/modules/VersionModule.sol.func.html @@ -0,0 +1,85 @@ + + + + + + + LCOV - lcov.info - src/modules/VersionModule.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modules - VersionModule.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
VersionModule.version12
+
+
+ + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/VersionModule.sol.gcov.html b/doc/coverage/coverage/src/modules/VersionModule.sol.gcov.html new file mode 100644 index 0000000..8e88cee --- /dev/null +++ b/doc/coverage/coverage/src/modules/VersionModule.sol.gcov.html @@ -0,0 +1,106 @@ + + + + + + + LCOV - lcov.info - src/modules/VersionModule.sol + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modules - VersionModule.sol (source / functions)HitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ + + + + + + + +

+
           Branch data     Line data    Source code
+
+       1                 :            : // SPDX-License-Identifier: MPL-2.0
+       2                 :            : pragma solidity ^0.8.27;
+       3                 :            : 
+       4                 :            : abstract contract VersionModule {
+       5                 :            :     /* ============ State Variables ============ */
+       6                 :            :     /**
+       7                 :            :      * @dev
+       8                 :            :      * Get the current version of the smart contract
+       9                 :            :      */
+      10                 :            :     string private constant VERSION = "0.3.0";
+      11                 :            : 
+      12                 :            :     /*//////////////////////////////////////////////////////////////
+      13                 :            :                             PUBLIC/EXTERNAL FUNCTIONS
+      14                 :            :     //////////////////////////////////////////////////////////////*/
+      15                 :            :     /**
+      16                 :            :      * @notice Returns the current version of the smart contract
+      17                 :            :      */
+      18                 :         12 :     function version() public view virtual returns (string memory) {
+      19                 :         12 :         return VERSION;
+      20                 :            :     }
+      21                 :            : }
+
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/index-sort-b.html b/doc/coverage/coverage/src/modules/index-sort-b.html new file mode 100644 index 0000000..fbf2d07 --- /dev/null +++ b/doc/coverage/coverage/src/modules/index-sort-b.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - src/modules + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modulesHitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
VersionModule.sol +
100.0%
+
100.0 %2 / 2100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/index-sort-f.html b/doc/coverage/coverage/src/modules/index-sort-f.html new file mode 100644 index 0000000..280f759 --- /dev/null +++ b/doc/coverage/coverage/src/modules/index-sort-f.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - src/modules + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modulesHitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
VersionModule.sol +
100.0%
+
100.0 %2 / 2100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/index-sort-l.html b/doc/coverage/coverage/src/modules/index-sort-l.html new file mode 100644 index 0000000..e450b0c --- /dev/null +++ b/doc/coverage/coverage/src/modules/index-sort-l.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - src/modules + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modulesHitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
VersionModule.sol +
100.0%
+
100.0 %2 / 2100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/coverage/src/modules/index.html b/doc/coverage/coverage/src/modules/index.html new file mode 100644 index 0000000..4b1bf49 --- /dev/null +++ b/doc/coverage/coverage/src/modules/index.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - src/modules + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/modulesHitTotalCoverage
Test:lcov.infoLines:22100.0 %
Date:2026-11-17 09:48:37Functions:11100.0 %
Branches:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverageBranches Sort by branch coverage
VersionModule.sol +
100.0%
+
100.0 %2 / 2100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.16
+
+ + + diff --git a/doc/coverage/lcov.info b/doc/coverage/lcov.info index 463f9c2..fc803d2 100644 --- a/doc/coverage/lcov.info +++ b/doc/coverage/lcov.info @@ -1,93 +1,200 @@ TN: -SF:src/DebtEngine.sol -FN:47,DebtEngine.debt -FNDA:1,DebtEngine.debt -DA:48,1 -DA:48,1 -DA:48,1 -FN:54,DebtEngine.debt -FNDA:3,DebtEngine.debt -DA:57,4 -DA:57,4 -DA:58,4 -DA:58,4 -FN:64,DebtEngine.creditEvents -FNDA:1,DebtEngine.creditEvents -DA:65,1 -DA:65,1 -DA:65,1 -FN:71,DebtEngine.creditEvents -FNDA:3,DebtEngine.creditEvents -DA:74,4 -DA:74,4 -DA:75,4 -DA:75,4 -FN:82,DebtEngine.setDebt -FNDA:3,DebtEngine.setDebt -DA:86,2 -DA:86,2 -FN:92,DebtEngine.setCreditEvents -FNDA:3,DebtEngine.setCreditEvents -DA:96,2 -DA:96,2 -FN:102,DebtEngine.setCreditEventsBatch -FNDA:3,DebtEngine.setCreditEventsBatch -DA:106,2 -DA:106,2 -BRDA:106,0,0,1 -BRDA:106,0,1,1 -DA:107,1 -DA:107,1 -DA:110,1 -DA:110,1 -DA:110,3 -DA:110,2 -DA:111,2 -DA:111,2 -FN:118,DebtEngine.setDebtBatch -FNDA:3,DebtEngine.setDebtBatch -DA:122,2 -DA:122,2 -BRDA:122,1,0,1 -BRDA:122,1,1,1 -DA:123,1 -DA:123,1 -DA:126,1 -DA:126,1 -DA:126,3 -DA:126,2 -DA:127,2 -DA:127,2 -FN:136,DebtEngine.hasRole -FNDA:0,DebtEngine.hasRole -DA:141,12 -DA:141,12 -BRDA:141,2,0,8 -BRDA:141,2,1,4 -DA:142,8 -DA:142,8 -DA:144,4 -DA:144,4 -DA:144,4 -FN:154,DebtEngine._msgSender -FNDA:12,DebtEngine._msgSender -DA:160,12 -DA:160,12 -DA:160,12 -FN:166,DebtEngine._msgData -FNDA:0,DebtEngine._msgData -DA:172,0 -DA:172,0 -DA:172,0 -FN:178,DebtEngine._contextSuffixLength -FNDA:12,DebtEngine._contextSuffixLength -DA:184,12 -DA:184,12 -DA:184,12 -FNF:12 -FNH:10 -LF:22 -LH:21 -BRF:6 -BRH:6 +SF:src/DebtEngineBase.sol +DA:31,2362 +FN:31,DebtEngineBase.onlyDebtManager +FNDA:2362,DebtEngineBase.onlyDebtManager +DA:32,2362 +DA:36,781 +FN:36,DebtEngineBase.onlyCreditEventsManager +FNDA:781,DebtEngineBase.onlyCreditEventsManager +DA:37,781 +DA:49,19 +FN:49,DebtEngineBase.debt.0 +FNDA:19,DebtEngineBase.debt.0 +DA:50,19 +DA:56,3276 +FN:56,DebtEngineBase.debt.1 +FNDA:3276,DebtEngineBase.debt.1 +DA:57,3295 +DA:63,8 +FN:63,DebtEngineBase.creditEvents.0 +FNDA:8,DebtEngineBase.creditEvents.0 +DA:64,8 +DA:70,523 +FN:70,DebtEngineBase.creditEvents.1 +FNDA:523,DebtEngineBase.creditEvents.1 +DA:71,531 +DA:78,3557 +FN:78,DebtEngineBase.hasDebt +FNDA:3557,DebtEngineBase.hasDebt +DA:79,3557 +DA:86,797 +FN:86,DebtEngineBase.hasCreditEvents +FNDA:797,DebtEngineBase.hasCreditEvents +DA:87,797 +DA:94,2254 +FN:94,DebtEngineBase.setDebt +FNDA:2254,DebtEngineBase.setDebt +DA:95,1729 +DA:101,1052 +FN:101,DebtEngineBase.setCreditEvents +FNDA:1052,DebtEngineBase.setCreditEvents +DA:106,536 +DA:112,532 +FN:112,DebtEngineBase.setCreditEventsBatch +FNDA:532,DebtEngineBase.setCreditEventsBatch +DA:117,18 +BRDA:117,0,0,4 +BRDA:117,0,1,14 +DA:118,14 +BRDA:118,1,0,2 +BRDA:118,1,1,12 +DA:120,12 +DA:121,1016 +DA:128,535 +FN:128,DebtEngineBase.setDebtBatch +FNDA:535,DebtEngineBase.setDebtBatch +DA:133,21 +BRDA:133,2,0,4 +BRDA:133,2,1,17 +DA:134,17 +BRDA:134,3,0,2 +BRDA:134,3,1,15 +DA:136,15 +DA:137,1022 +DA:147,2362 +FN:147,DebtEngineBase.clearDebt +FNDA:2362,DebtEngineBase.clearDebt +DA:148,1591 +DA:157,781 +FN:157,DebtEngineBase.clearCreditEvents +FNDA:781,DebtEngineBase.clearCreditEvents +DA:158,10 +DA:169,2753 +FN:169,DebtEngineBase._setDebt +FNDA:2753,DebtEngineBase._setDebt +DA:170,2753 +BRDA:170,4,0,4 +BRDA:170,4,1,2749 +DA:171,2749 +DA:172,2749 +DA:173,2749 +DA:180,1552 +FN:180,DebtEngineBase._setCreditEvents +FNDA:1552,DebtEngineBase._setCreditEvents +DA:181,1552 +BRDA:181,5,0,4 +BRDA:181,5,1,1548 +DA:182,1548 +DA:183,1548 +DA:184,1548 +DA:191,1591 +FN:191,DebtEngineBase._clearDebt +FNDA:1591,DebtEngineBase._clearDebt +DA:192,1591 +BRDA:192,6,0,2 +BRDA:192,6,1,1589 +DA:195,1589 +DA:202,10 +FN:202,DebtEngineBase._clearCreditEvents +FNDA:10,DebtEngineBase._clearCreditEvents +DA:203,10 +BRDA:203,7,0,2 +BRDA:203,7,1,8 +DA:206,8 +DA:232,2 +FN:232,DebtEngineBase._msgSender +FNDA:2,DebtEngineBase._msgSender +DA:233,2 +FNF:19 +FNH:19 +LF:52 +LH:52 +BRF:16 +BRH:16 +end_of_record +TN: +SF:src/deployment/DebtEngineAccessControl.sol +DA:18,96 +FN:18,DebtEngineAccessControl.constructor +FNDA:96,DebtEngineAccessControl.constructor +DA:19,96 +BRDA:19,0,0,1 +BRDA:19,0,1,95 +DA:20,95 +DA:25,4084 +FN:25,DebtEngineAccessControl._authorizeSetDebt +FNDA:4084,DebtEngineAccessControl._authorizeSetDebt +DA:27,1057 +FN:27,DebtEngineAccessControl._authorizeSetCreditEvents +FNDA:1057,DebtEngineAccessControl._authorizeSetCreditEvents +DA:43,106 +FN:43,DebtEngineAccessControl.hasRole +FNDA:106,DebtEngineAccessControl.hasRole +DA:51,5306 +BRDA:51,1,0,3367 +DA:52,3367 +DA:54,1939 +DA:61,5315 +FN:61,DebtEngineAccessControl._msgSender +FNDA:5315,DebtEngineAccessControl._msgSender +DA:62,5315 +DA:65,0 +FN:65,DebtEngineAccessControl._msgData +FNDA:0,DebtEngineAccessControl._msgData +DA:66,0 +DA:69,5315 +FN:69,DebtEngineAccessControl._contextSuffixLength +FNDA:5315,DebtEngineAccessControl._contextSuffixLength +DA:70,5315 +FNF:7 +FNH:6 +LF:15 +LH:13 +BRF:3 +BRH:3 +end_of_record +TN: +SF:src/deployment/DebtEngineOwnable.sol +DA:28,4 +FN:28,DebtEngineOwnable.supportsInterface +FNDA:4,DebtEngineOwnable.supportsInterface +DA:29,4 +DA:34,1067 +FN:34,DebtEngineOwnable._authorizeSetDebt +FNDA:1067,DebtEngineOwnable._authorizeSetDebt +DA:36,1308 +FN:36,DebtEngineOwnable._authorizeSetCreditEvents +FNDA:1308,DebtEngineOwnable._authorizeSetCreditEvents +DA:42,4195 +FN:42,DebtEngineOwnable._msgSender +FNDA:4195,DebtEngineOwnable._msgSender +DA:43,4195 +DA:46,0 +FN:46,DebtEngineOwnable._msgData +FNDA:0,DebtEngineOwnable._msgData +DA:47,0 +DA:50,4195 +FN:50,DebtEngineOwnable._contextSuffixLength +FNDA:4195,DebtEngineOwnable._contextSuffixLength +DA:51,4195 +FNF:6 +FNH:5 +LF:10 +LH:8 +BRF:0 +BRH:0 +end_of_record +TN: +SF:src/modules/VersionModule.sol +DA:18,12 +FN:18,VersionModule.version +FNDA:12,VersionModule.version +DA:19,12 +FNF:1 +FNH:1 +LF:2 +LH:2 +BRF:0 +BRH:0 end_of_record diff --git a/doc/script/script_surya_graph.sh b/doc/script/script_surya_graph.sh index 31a1cef..33adbf5 100755 --- a/doc/script/script_surya_graph.sh +++ b/doc/script/script_surya_graph.sh @@ -1,18 +1,18 @@ -#/bin/bash -cd '../../' +#!/bin/bash +cd "$(dirname "$0")/../.." DIR=$(pwd) -DIR_OUT=${DIR}/docOut/surya_graph +DIR_OUT=${DIR}/doc/surya/surya_graph if ! [ -d "$DIR_OUT" ]; then - mkdir -p ./docOut/surya_graph + mkdir -p ./doc/surya/surya_graph fi cd './src' DIR=$(pwd) -for i in $(find $DIR -type f); +for i in $(find . -type f); do #echo $i filename=${i##*/} ext=${i##*.} if [[ $ext == 'sol' ]]; then - npx surya graph $i | dot -Tpng > ../docOut/surya_graph/surya_graph_$filename.png; + npx surya graph $i | dot -Tpng > ../doc/surya/surya_graph/surya_graph_$filename.png; fi done; \ No newline at end of file diff --git a/doc/script/script_surya_inheritance.sh b/doc/script/script_surya_inheritance.sh index 9182cab..d841d8c 100755 --- a/doc/script/script_surya_inheritance.sh +++ b/doc/script/script_surya_inheritance.sh @@ -1,17 +1,17 @@ -#/bin/bash -cd '../../' +#!/bin/bash +cd "$(dirname "$0")/../.." DIR=$(pwd) -DIR_OUT=${DIR}/docOut/surya_inheritance +DIR_OUT=${DIR}/doc/surya/surya_inheritance if ! [ -d "$DIR_OUT" ]; then - mkdir -p ./docOut/surya_inheritance + mkdir -p ./doc/surya/surya_inheritance fi cd './src' DIR=$(pwd) -for i in $(find $dir -type f); +for i in $(find . -type f); do filename=${i##*/} ext=${i##*.} if [[ $ext == 'sol' ]]; then - npx surya inheritance $i | dot -Tpng > ../docOut/surya_inheritance/surya_inheritance_$filename.png; + npx surya inheritance $i | dot -Tpng > ../doc/surya/surya_inheritance/surya_inheritance_$filename.png; fi done; \ No newline at end of file diff --git a/doc/script/script_surya_report.sh b/doc/script/script_surya_report.sh index 84769c9..3dd613c 100755 --- a/doc/script/script_surya_report.sh +++ b/doc/script/script_surya_report.sh @@ -1,17 +1,17 @@ -#/bin/bash -cd '../../' +#!/bin/bash +cd "$(dirname "$0")/../.." DIR=$(pwd) -DIR_OUT=${DIR}/docOut/surya_report +DIR_OUT=${DIR}/doc/surya/surya_report if ! [ -d "$DIR_OUT" ]; then - mkdir ./docOut/surya_report + mkdir -p ./doc/surya/surya_report fi cd './src' DIR=$(pwd) -for i in $(find $dir -type f); +for i in $(find . -type f); do filename=${i##*/} ext=${i##*.} if [[ $ext == 'sol' ]]; then - npx surya mdreport ../docOut/surya_report/surya_report_$filename.md $i; + npx surya mdreport ../doc/surya/surya_report/surya_report_$filename.md $i; fi done; \ No newline at end of file diff --git a/doc/slither-report.md b/doc/slither-report.md deleted file mode 100644 index 7c8a1d0..0000000 --- a/doc/slither-report.md +++ /dev/null @@ -1,100 +0,0 @@ -**THIS CHECKLIST IS NOT COMPLETE**. Use `--show-ignored-findings` to show all the results. -Summary - - [dead-code](#dead-code) (1 results) (Informational) - - [solc-version](#solc-version) (1 results) (Informational) - - [similar-names](#similar-names) (9 results) (Informational) -## dead-code - -> Acknowledge - -Impact: Informational -Confidence: Medium - - - [ ] ID-0 -[DebtEngine._msgData()](src/DebtEngine.sol#L160-L167) is never used and should be removed - -src/DebtEngine.sol#L160-L167 - -## solc-version - -> The version in the config file is 0.8.26 - -Impact: Informational -Confidence: High - - [ ] ID-1 - Version constraint ^0.8.20 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html) - - VerbatimInvalidDeduplication - - FullInlinerNonExpressionSplitArgumentEvaluationOrder - - MissingSideEffectsOnSelectorAccess. - It is used by: - - lib/CMTAT/contracts/interfaces/IDebtGlobal.sol#3 - - lib/CMTAT/contracts/interfaces/engine/IDebtEngine.sol#3 - - lib/openzeppelin-contracts/contracts/access/AccessControl.sol#4 - - lib/openzeppelin-contracts/contracts/access/IAccessControl.sol#4 - - lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol#4 - - lib/openzeppelin-contracts/contracts/utils/Context.sol#4 - - lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol#4 - - lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol#4 - - src/DebtEngine.sol#2 - - src/DebtEngineInvariantStorage.sol#2 - -## similar-names - -> Acknowledge - -Impact: Informational -Confidence: Medium - - - [ ] ID-2 -Variable [DebtEngine.debt(address).smartContract_](src/DebtEngine.sol#L48) is too similar to [DebtEngine.setDebtBatch(address[],IDebtGlobal.DebtBase[]).smartContracts](src/DebtEngine.sol#L112) - -src/DebtEngine.sol#L48 - - - - [ ] ID-3 -Variable [DebtEngine.setCreditEvents(address,IDebtGlobal.CreditEvents).smartContract_](src/DebtEngine.sol#L86) is too similar to [DebtEngine.setDebtBatch(address[],IDebtGlobal.DebtBase[]).smartContracts](src/DebtEngine.sol#L112) - -src/DebtEngine.sol#L86 - - - - [ ] ID-4 -Variable [DebtEngine.creditEvents(address).smartContract_](src/DebtEngine.sol#L65) is too similar to [DebtEngine.setDebtBatch(address[],IDebtGlobal.DebtBase[]).smartContracts](src/DebtEngine.sol#L112) - -src/DebtEngine.sol#L65 - - - - [ ] ID-5 -Variable [DebtEngine.debt(address).smartContract_](src/DebtEngine.sol#L48) is too similar to [DebtEngine.setCreditEventsBatch(address[],IDebtGlobal.CreditEvents[]).smartContracts](src/DebtEngine.sol#L96) - -src/DebtEngine.sol#L48 - - - - [ ] ID-6 -Variable [DebtEngine.setDebt(address,IDebtGlobal.DebtBase).smartContract_](src/DebtEngine.sol#L76) is too similar to [DebtEngine.setCreditEventsBatch(address[],IDebtGlobal.CreditEvents[]).smartContracts](src/DebtEngine.sol#L96) - -src/DebtEngine.sol#L76 - - - - [ ] ID-7 -Variable [DebtEngine.setDebt(address,IDebtGlobal.DebtBase).smartContract_](src/DebtEngine.sol#L76) is too similar to [DebtEngine.setDebtBatch(address[],IDebtGlobal.DebtBase[]).smartContracts](src/DebtEngine.sol#L112) - -src/DebtEngine.sol#L76 - - - - [ ] ID-8 -Variable [DebtEngine.creditEvents(address).smartContract_](src/DebtEngine.sol#L65) is too similar to [DebtEngine.setCreditEventsBatch(address[],IDebtGlobal.CreditEvents[]).smartContracts](src/DebtEngine.sol#L96) - -src/DebtEngine.sol#L65 - - - - [ ] ID-9 -Variable [DebtEngine.setCreditEvents(address,IDebtGlobal.CreditEvents).smartContract_](src/DebtEngine.sol#L86) is too similar to [DebtEngine.setCreditEventsBatch(address[],IDebtGlobal.CreditEvents[]).smartContracts](src/DebtEngine.sol#L96) - -src/DebtEngine.sol#L86 - - - - [ ] ID-10 -Variable [DebtEngine._creditEvents](src/DebtEngine.sol#L19) is too similar to [DebtEngine.setCreditEvents(address,IDebtGlobal.CreditEvents).creditEvents_](src/DebtEngine.sol#L87) - -src/DebtEngine.sol#L19 - diff --git a/doc/surya/surya_graph/surya_graph_DebtEngine.sol.png b/doc/surya/surya_graph/surya_graph_DebtEngine.sol.png deleted file mode 100644 index bf1e60b..0000000 Binary files a/doc/surya/surya_graph/surya_graph_DebtEngine.sol.png and /dev/null differ diff --git a/doc/surya/surya_graph/surya_graph_DebtEngineAccessControl.sol.png b/doc/surya/surya_graph/surya_graph_DebtEngineAccessControl.sol.png new file mode 100644 index 0000000..46d83a9 Binary files /dev/null and b/doc/surya/surya_graph/surya_graph_DebtEngineAccessControl.sol.png differ diff --git a/doc/surya/surya_graph/surya_graph_DebtEngineBase.sol.png b/doc/surya/surya_graph/surya_graph_DebtEngineBase.sol.png new file mode 100644 index 0000000..27a38fa Binary files /dev/null and b/doc/surya/surya_graph/surya_graph_DebtEngineBase.sol.png differ diff --git a/doc/surya/surya_graph/surya_graph_DebtEngineInvariantStorage.sol.png b/doc/surya/surya_graph/surya_graph_DebtEngineInvariantStorage.sol.png index e166f8f..96fe693 100644 Binary files a/doc/surya/surya_graph/surya_graph_DebtEngineInvariantStorage.sol.png and b/doc/surya/surya_graph/surya_graph_DebtEngineInvariantStorage.sol.png differ diff --git a/doc/surya/surya_graph/surya_graph_DebtEngineOwnable.sol.png b/doc/surya/surya_graph/surya_graph_DebtEngineOwnable.sol.png new file mode 100644 index 0000000..e69de29 diff --git a/doc/surya/surya_graph/surya_graph_VersionModule.sol.png b/doc/surya/surya_graph/surya_graph_VersionModule.sol.png new file mode 100644 index 0000000..153208f Binary files /dev/null and b/doc/surya/surya_graph/surya_graph_VersionModule.sol.png differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_DebtEngine.sol.png b/doc/surya/surya_inheritance/surya_inheritance_DebtEngine.sol.png deleted file mode 100644 index e2afc7a..0000000 Binary files a/doc/surya/surya_inheritance/surya_inheritance_DebtEngine.sol.png and /dev/null differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_DebtEngineAccessControl.sol.png b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineAccessControl.sol.png new file mode 100644 index 0000000..ce6b6da Binary files /dev/null and b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineAccessControl.sol.png differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_DebtEngineBase.sol.png b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineBase.sol.png new file mode 100644 index 0000000..4f31c9c Binary files /dev/null and b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineBase.sol.png differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_DebtEngineInvariantStorage.sol.png b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineInvariantStorage.sol.png index 10055c0..34dc169 100644 Binary files a/doc/surya/surya_inheritance/surya_inheritance_DebtEngineInvariantStorage.sol.png and b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineInvariantStorage.sol.png differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_DebtEngineOwnable.sol.png b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineOwnable.sol.png new file mode 100644 index 0000000..edcb329 Binary files /dev/null and b/doc/surya/surya_inheritance/surya_inheritance_DebtEngineOwnable.sol.png differ diff --git a/doc/surya/surya_inheritance/surya_inheritance_VersionModule.sol.png b/doc/surya/surya_inheritance/surya_inheritance_VersionModule.sol.png new file mode 100644 index 0000000..67c03fb Binary files /dev/null and b/doc/surya/surya_inheritance/surya_inheritance_VersionModule.sol.png differ diff --git a/doc/surya/surya_report/surya_report_DebtEngine.sol.md b/doc/surya/surya_report/surya_report_DebtEngineAccessControl.sol.md similarity index 58% rename from doc/surya/surya_report/surya_report_DebtEngine.sol.md rename to doc/surya/surya_report/surya_report_DebtEngineAccessControl.sol.md index a5a3842..59c00d7 100644 --- a/doc/surya/surya_report/surya_report_DebtEngine.sol.md +++ b/doc/surya/surya_report/surya_report_DebtEngineAccessControl.sol.md @@ -5,7 +5,7 @@ | File Name | SHA-1 Hash | |-------------|--------------| -| ./DebtEngine.sol | [object Promise] | +| ./deployment/DebtEngineAccessControl.sol | [object Promise] | ### Contracts Description Table @@ -15,16 +15,10 @@ |:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| | └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | |||||| -| **DebtEngine** | Implementation | IDebtEngine, AccessControl, DebtEngineInvariantStorage, ERC2771Context ||| +| **DebtEngineAccessControl** | Implementation | DebtEngineBase, AccessControlEnumerable, ERC2771Context ||| | └ | | Public ❗️ | 🛑 | ERC2771Context | -| └ | debt | External ❗️ | |NO❗️ | -| └ | debt | Public ❗️ | |NO❗️ | -| └ | creditEvents | External ❗️ | |NO❗️ | -| └ | creditEvents | Public ❗️ | |NO❗️ | -| └ | setDebt | External ❗️ | 🛑 | onlyRole | -| └ | setCreditEvents | External ❗️ | 🛑 | onlyRole | -| └ | setCreditEventsBatch | External ❗️ | 🛑 | onlyRole | -| └ | setDebtBatch | External ❗️ | 🛑 | onlyRole | +| └ | _authorizeSetDebt | Internal 🔒 | | onlyRole | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | onlyRole | | └ | hasRole | Public ❗️ | |NO❗️ | | └ | _msgSender | Internal 🔒 | | | | └ | _msgData | Internal 🔒 | | | diff --git a/doc/surya/surya_report/surya_report_DebtEngineBase.sol.md b/doc/surya/surya_report/surya_report_DebtEngineBase.sol.md new file mode 100644 index 0000000..dd91a60 --- /dev/null +++ b/doc/surya/surya_report/surya_report_DebtEngineBase.sol.md @@ -0,0 +1,45 @@ +## Sūrya's Description Report + +### Files Description Table + + +| File Name | SHA-1 Hash | +|-------------|--------------| +| ./DebtEngineBase.sol | [object Promise] | + + +### Contracts Description Table + + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **DebtEngineBase** | Implementation | IDebtEngine, DebtEngineInvariantStorage, VersionModule ||| +| └ | debt | External ❗️ | |NO❗️ | +| └ | debt | Public ❗️ | |NO❗️ | +| └ | creditEvents | External ❗️ | |NO❗️ | +| └ | creditEvents | Public ❗️ | |NO❗️ | +| └ | hasDebt | External ❗️ | |NO❗️ | +| └ | hasCreditEvents | External ❗️ | |NO❗️ | +| └ | setDebt | External ❗️ | 🛑 | onlyDebtManager | +| └ | setCreditEvents | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | setCreditEventsBatch | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | setDebtBatch | External ❗️ | 🛑 | onlyDebtManager | +| └ | clearDebt | External ❗️ | 🛑 | onlyDebtManager | +| └ | clearCreditEvents | External ❗️ | 🛑 | onlyCreditEventsManager | +| └ | _setDebt | Internal 🔒 | 🛑 | | +| └ | _setCreditEvents | Internal 🔒 | 🛑 | | +| └ | _clearDebt | Internal 🔒 | 🛑 | | +| └ | _clearCreditEvents | Internal 🔒 | 🛑 | | +| └ | _authorizeSetDebt | Internal 🔒 | | | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | | +| └ | _msgSender | Internal 🔒 | | | + + +### Legend + +| Symbol | Meaning | +|:--------:|-----------| +| 🛑 | Function can modify state | +| 💵 | Function is payable | diff --git a/doc/surya/surya_report/surya_report_DebtEngineOwnable.sol.md b/doc/surya/surya_report/surya_report_DebtEngineOwnable.sol.md new file mode 100644 index 0000000..c27edb2 --- /dev/null +++ b/doc/surya/surya_report/surya_report_DebtEngineOwnable.sol.md @@ -0,0 +1,33 @@ +## Sūrya's Description Report + +### Files Description Table + + +| File Name | SHA-1 Hash | +|-------------|--------------| +| ./deployment/DebtEngineOwnable.sol | [object Promise] | + + +### Contracts Description Table + + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **DebtEngineOwnable** | Implementation | DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 ||| +| └ | | Public ❗️ | 🛑 | ERC2771Context Ownable | +| └ | supportsInterface | Public ❗️ | |NO❗️ | +| └ | _authorizeSetDebt | Internal 🔒 | | onlyOwner | +| └ | _authorizeSetCreditEvents | Internal 🔒 | | onlyOwner | +| └ | _msgSender | Internal 🔒 | | | +| └ | _msgData | Internal 🔒 | | | +| └ | _contextSuffixLength | Internal 🔒 | | | + + +### Legend + +| Symbol | Meaning | +|:--------:|-----------| +| 🛑 | Function can modify state | +| 💵 | Function is payable | diff --git a/doc/surya/surya_report/surya_report_VersionModule.sol.md b/doc/surya/surya_report/surya_report_VersionModule.sol.md new file mode 100644 index 0000000..698bc1a --- /dev/null +++ b/doc/surya/surya_report/surya_report_VersionModule.sol.md @@ -0,0 +1,27 @@ +## Sūrya's Description Report + +### Files Description Table + + +| File Name | SHA-1 Hash | +|-------------|--------------| +| ./modules/VersionModule.sol | [object Promise] | + + +### Contracts Description Table + + +| Contract | Type | Bases | | | +|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:| +| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** | +|||||| +| **VersionModule** | Implementation | ||| +| └ | version | Public ❗️ | |NO❗️ | + + +### Legend + +| Symbol | Meaning | +|:--------:|-----------| +| 🛑 | Function can modify state | +| 💵 | Function is payable | diff --git a/doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md b/doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md new file mode 100644 index 0000000..0ea7bd8 --- /dev/null +++ b/doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md @@ -0,0 +1,268 @@ +# Deploy a DebtEngine with a CMTAT v3.0.0 debt token + +- [1. What the engine provides](#1-what-the-engine-provides) +- [2. Choose the setup](#2-choose-the-setup) +- [3. Contracts and roles](#3-contracts-and-roles) +- [4. Deployment steps](#4-deployment-steps) + - [4.1 DebtEngineAccessControl with CMTATStandaloneDebt](#41-debtengineaccesscontrol-with-cmtatstandalonedebt) + - [4.2 DebtEngineOwnable with CMTATStandaloneDebt](#42-debtengineownable-with-cmtatstandalonedebt) + - [4.3 Upgradeable token behind a proxy](#43-upgradeable-token-behind-a-proxy) + - [Deployment scripts](#deployment-scripts) +- [5. One engine, several tokens](#5-one-engine-several-tokens) +- [6. Read workflow](#6-read-workflow) +- [7. Operating the engine](#7-operating-the-engine) +- [8. Handing over administration](#8-handing-over-administration) +- [9. Checks and troubleshooting](#9-checks-and-troubleshooting) + +This guide deploys DebtEngine v0.3.0 next to a **CMTAT v3.0.0** debt token and connects them: + +- **Where it sits:** one engine contract outside the token. The token's `debt()` and `creditEvents()` return what the engine stores for the token's address. +- **When it is connected:** always **after** the token is deployed. CMTAT v3.0.0 has no debt-engine constructor argument; the token is connected with `setDebtEngine(engine)`. +- **What changes for holders:** nothing on transfers or mints. The engine only serves data; it is not a compliance engine. + +Every step below is executed by `test/DeployGuideCMTATv3.0.0.t.sol` against the CMTAT v3.0.0 submodule (`forge test --match-contract DeployGuideCMTATv300Test`). Each test is named after the section it validates. The calls are written in function-call notation. Two Foundry scripts cover the engine side and the connection; see [Deployment scripts](#deployment-scripts) at the end of section 4. Record writes are data-specific and are issued with your usual tooling (Safe transaction builder, `cast`, a custom script). + +## 1. What the engine provides + +| Call on the token | With an engine set | Without an engine | +|---|---|---| +| `token.debt()` | `engine.debt()`, which returns the record stored under `msg.sender` = the token address | the token's own `DebtModule` record | +| `token.creditEvents()` | `engine.creditEvents()`, same rule | the token's own `DebtModule` record | +| `token.setDebt(...)`, `token.setCreditEvents(...)` | still write the token's own record, which is **not read** while an engine is set | write the token's own record | + +- A record is keyed by the **token address**: for an upgradeable token, the proxy address. +- Every record is public: anyone can call `engine.debt(token)`, `engine.creditEvents(token)`, `engine.hasDebt(token)` and `engine.hasCreditEvents(token)`. +- `hasDebt(token)` is the only way to tell "no record" from "a record full of zeros"; `token.debt()` returns the zero struct in both cases. + +## 2. Choose the setup + +**Access-control variant (chosen at deployment, cannot be changed later):** + +| Variant | Who writes records | Use it when | +|---|---|---| +| `DebtEngineAccessControl` | `DEBT_MANAGER_ROLE` for debt, `CREDIT_EVENTS_MANAGER_ROLE` for credit events; `DEFAULT_ADMIN_ROLE` implicitly holds both | Duties are separated (e.g. the issuer maintains the debt terms, a rating or servicing agent maintains credit events), or role holders must be listed on-chain (`getRoleMember`) | +| `DebtEngineOwnable` | The owner, for everything | One entity (often a multisig) maintains all data | + +**Meta-transactions:** + +| Forwarder | Effect | +|---|---| +| `address(0)` | Meta-transactions disabled. Recommended unless you need relayed admin transactions. | +| An ERC-2771 forwarder | Fixed for the engine's lifetime. The forwarder is trusted for **every** function, including role management and ownership transfer, so use one that verifies EIP-712 signatures (e.g. OpenZeppelin `ERC2771Forwarder`). Changing it means deploying a new engine. | + +**Token type:** `CMTATStandaloneDebt` (deployed directly) or `CMTATUpgradeableDebt` (behind a proxy). Both include CMTAT's `DebtEngineModule`; other CMTAT deployment variants cannot be connected to an engine. + +## 3. Contracts and roles + +| Contract | Constructor | Key roles | +|---|---|---| +| `DebtEngineAccessControl` | `constructor(address admin, address forwarderIrrevocable)` | `DEFAULT_ADMIN_ROLE` (= `0x00`, granted to `admin`), `DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE")`, `CREDIT_EVENTS_MANAGER_ROLE = keccak256("CREDIT_EVENTS_MANAGER_ROLE")` | +| `DebtEngineOwnable` | `constructor(address owner, address forwarderIrrevocable)` | owner (`Ownable2Step`) | +| `CMTATStandaloneDebt` (v3.0.0) | `constructor(address admin, ERC20Attributes, ExtraInformationAttributes, Engine)` | `DEBT_ROLE` connects the engine (`setDebtEngine`); CMTAT's `DEFAULT_ADMIN_ROLE` implicitly holds it | +| `CMTATUpgradeableDebt` (v3.0.0) | `constructor()` (disables initializers), then `initialize(admin, ERC20Attributes, ExtraInformationAttributes, Engine)` through the proxy | same as above | + +Constructor parameters of the engine: + +| Parameter | Type | Purpose | Checks | +|---|---|---|---| +| `admin` / `owner` | `address` | Initial administrator | Must not be `address(0)` (`AdminWithAddressZeroNotAllowed` / `OwnableInvalidOwner`) | +| `forwarderIrrevocable` | `address` | ERC-2771 trusted forwarder | None; `address(0)` disables meta-transactions; immutable | + +Two separate permission sets are involved, and they are held by different contracts: + +- **Engine side:** who may write records (the engine's roles or owner). +- **Token side:** who may connect or disconnect the engine (the token's `DEBT_ROLE`). An engine manager cannot call `setDebtEngine` on the token, and a token admin cannot write engine records unless also granted on the engine. + +## 4. Deployment steps + +The steps use one administrator for readability; in production the roles are usually held by separate accounts or multisigs. + +**Order matters:** write the token's record in the engine **before** calling `setDebtEngine` on the token. From that call on, the token reads only the engine; if the engine has no record yet, `token.debt()` returns the zero struct, and any data written earlier with `token.setDebt(...)` is no longer visible (`testGuide_6_ConnectingBeforeWritingHidesLocalData`). + +### 4.1 DebtEngineAccessControl with CMTATStandaloneDebt + +Validated by `testGuide_4_1_AccessControlWithStandaloneToken`. + +1. **Deploy the engine:** `DebtEngineAccessControl(admin, address(0))`. Check `engine.version() == "0.3.0"`. +2. **Grant the operational roles** (as `admin`): + - `engine.grantRole(DEBT_MANAGER_ROLE, debtManager)` + - `engine.grantRole(CREDIT_EVENTS_MANAGER_ROLE, creditManager)` +3. **Deploy the token:** `CMTATStandaloneDebt(tokenAdmin, erc20Attributes, extraInformationAttributes, engines)`. +4. **Write the token's records** in the engine: + - as `debtManager`: `engine.setDebt(token, debtInformation)` + - as `creditManager`: `engine.setCreditEvents(token, creditEvents)` +5. **Connect the token** (as a `DEBT_ROLE` holder of the token): `token.setDebtEngine(engine)`. The token emits `DebtEngine(engine)`. +6. **Verify:** + - `token.debtEngine() == engine` + - `engine.hasDebt(token) == true`, `engine.hasCreditEvents(token) == true` + - `token.debt()` and `token.creditEvents()` return the records written in step 4. + +```mermaid +sequenceDiagram + actor Admin + actor DebtManager + actor CreditManager + actor TokenAdmin + participant Engine as DebtEngineAccessControl + participant Token as CMTATStandaloneDebt + Admin->>Engine: deploy(admin, forwarder = 0) + Admin->>Engine: grantRole(DEBT_MANAGER_ROLE, debtManager) + Admin->>Engine: grantRole(CREDIT_EVENTS_MANAGER_ROLE, creditManager) + TokenAdmin->>Token: deploy(tokenAdmin, ...) + DebtManager->>Engine: setDebt(token, debtInformation) + Engine-->>DebtManager: emit DebtSet(token) + CreditManager->>Engine: setCreditEvents(token, creditEvents) + Engine-->>CreditManager: emit CreditEventsSet(token) + TokenAdmin->>Token: setDebtEngine(engine) + Token-->>TokenAdmin: emit DebtEngine(engine) +``` + +### 4.2 DebtEngineOwnable with CMTATStandaloneDebt + +Validated by `testGuide_4_2_OwnableWithStandaloneToken`. + +1. **Deploy the engine** with the deployer as owner: `DebtEngineOwnable(deployer, address(0))`. +2. **Deploy the token** and **write its records** as the owner: `engine.setDebt(token, debtInformation)`, `engine.setCreditEvents(token, creditEvents)`. +3. **Hand ownership to the multisig** in two steps: + - as the deployer: `engine.transferOwnership(multisig)` (nothing moves yet; `engine.pendingOwner() == multisig`) + - as the multisig: `engine.acceptOwnership()` +4. **Connect the token:** `token.setDebtEngine(engine)`, then verify as in 4.1. + +Notes: +- `transferOwnership(address(0))` does not renounce ownership; it cancels a pending transfer. +- `renounceOwnership()` leaves the engine without an owner and **freezes every record** permanently. + +### 4.3 Upgradeable token behind a proxy + +Validated by `testGuide_4_3_UpgradeableTokenThroughProxy`. + +1. **Deploy the engine** (4.1 step 1, or 4.2 step 1). +2. **Deploy the token implementation:** `CMTATUpgradeableDebt()`. +3. **Deploy the proxy** with the initializer call, e.g. an ERC-1967 proxy: `ERC1967Proxy(implementation, initializeCalldata)`. `initialize` is overloaded in the CMTAT base contracts; encode the debt variant's signature explicitly: `initialize(address,(string,string,uint8),(string,(string,string,bytes32),string),(address,address,address))`. +4. **Write the records under the proxy address**: `engine.setDebt(proxy, debtInformation)`. Holders and integrators call the proxy, so the engine sees the proxy as `msg.sender`; a record stored under the implementation address is never read. +5. **Connect** through the proxy: `CMTATUpgradeableDebt(proxy).setDebtEngine(engine)`, then verify. + +An upgrade of the token implementation keeps the proxy address, so the engine record stays valid. + +### Deployment scripts + +Tested by `test/script/DeployScripts.t.sol`. + +**`script/DeployDebtEngine.s.sol`** deploys the engine (section 4.1 steps 1–2, or 4.2 step 1) and checks the result (version, admin / owner, forwarder, granted roles): + +| Variable | Default | Meaning | +|---|---|---| +| `ENGINE_VARIANT` | `access-control` | `access-control` or `ownable`; anything else reverts with `UnknownVariant` | +| `ENGINE_ADMIN` | the broadcaster | Initial admin / owner | +| `FORWARDER` | `address(0)` | ERC-2771 forwarder (immutable) | +| `DEBT_MANAGER`, `CREDIT_EVENTS_MANAGER` | unset | RBAC only: granted the manager roles. Requires the broadcaster to be the admin (`BroadcasterIsNotAdmin`); rejected for `ownable` (`ManagersNeedAccessControlVariant`) | + +```bash +ENGINE_VARIANT=access-control DEBT_MANAGER=0x... CREDIT_EVENTS_MANAGER=0x... \ + forge script script/DeployDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast +``` + +To deploy for a multisig admin, either set `ENGINE_ADMIN` to the multisig (and grant the managers from it afterwards), or deploy with the broadcaster as admin, grant the managers, and follow section 8. + +**`script/ConnectDebtEngine.s.sol`** runs on the token side (section 4.1 step 5): the broadcaster must hold the token's `DEBT_ROLE`. It **refuses to connect** when the engine holds no debt record for the token (`NoDebtRecordForToken`), which enforces the write-before-connect order; set `ALLOW_EMPTY_RECORD=true` to override. It checks `token.debtEngine()` afterwards. + +```bash +TOKEN=0x... DEBT_ENGINE=0x... \ + forge script script/ConnectDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast +``` + +Run either script without `--broadcast` first for a simulation. + +## 5. One engine, several tokens + +Validated by `testGuide_5_OneEngineSeveralTokens`. + +One engine can serve any number of tokens; each token reads its own record. + +1. Write all records in one call: `engine.setDebtBatch([tokenA, tokenB], [debtA, debtB])` (and `setCreditEventsBatch` for credit events). +2. Connect each token: `tokenA.setDebtEngine(engine)`, `tokenB.setDebtEngine(engine)`. + +Batch limits: +- The arrays must have the same length (`InvalidInputLength`), and contain at most `MAX_BATCH_SIZE` = 500 entries (`BatchSizeTooLarge`). +- In practice the transaction gas limit binds first. In the test suite a debt record with typical strings costs about 400k gas and a short credit-events record about 71k; under the Ethereum mainnet cap of 16,777,216 gas per transaction (EIP-7825), a batch holds roughly 40 debt records or 230 credit-events records. Estimate gas for your own data. +- A duplicated address keeps the last record and emits one event per entry. + +## 6. Read workflow + +```mermaid +sequenceDiagram + actor Holder as Holder / integrator + participant Token as CMTAT debt token + participant Engine as DebtEngine + Holder->>Token: debt() + alt engine set + Token->>Engine: debt() (msg.sender = token) + Engine-->>Token: record stored for the token, or the zero struct + else no engine + Token->>Token: own DebtModule record + end + Token-->>Holder: DebtInformation +``` + +- `token.creditEvents()` follows the same path. +- An integrator that needs to know whether a record exists calls `engine.hasDebt(token)` / `engine.hasCreditEvents(token)` directly. + +## 7. Operating the engine + +Validated by `testGuide_7_Operations` and `testGuide_7_RolesAreSeparated`. + +| Task | Call | Caller (`DebtEngineAccessControl`) | Caller (`DebtEngineOwnable`) | Effect on the token | +|---|---|---|---|---| +| Update the debt terms | `engine.setDebt(token, debtInformation)` | `DEBT_MANAGER_ROLE` | owner | Visible immediately | +| Record a credit event (default, redemption, rating change) | `engine.setCreditEvents(token, creditEvents)` | `CREDIT_EVENTS_MANAGER_ROLE` | owner | Visible immediately | +| Update many tokens | `setDebtBatch` / `setCreditEventsBatch` | as above | owner | Visible immediately | +| Delete a record | `engine.clearDebt(token)` / `engine.clearCreditEvents(token)` | as above | owner | Token returns the zero struct; `hasDebt` becomes false | +| Replace the engine | `token.setDebtEngine(newEngine)` | token `DEBT_ROLE` | token `DEBT_ROLE` | Token reads the new engine; write the record there first | +| Disconnect the engine | `token.setDebtEngine(address(0))` | token `DEBT_ROLE` | token `DEBT_ROLE` | Token falls back to its own `DebtModule` data | +| Grant / revoke a manager | `engine.grantRole` / `engine.revokeRole` | `DEFAULT_ADMIN_ROLE` | — | None | + +Notes: +- Setting the engine the token already uses reverts on the token side with `CMTAT_DebtEngineModule_SameValue`. +- A debt manager cannot write credit events and vice versa; neither can connect a token, which needs the token's own `DEBT_ROLE`. +- Clearing a record that does not exist succeeds and still emits `DebtCleared` / `CreditEventsCleared`. + +## 8. Handing over administration + +Validated by `testGuide_8_AdminHandoverRunbook`. + +`DebtEngineAccessControl` treats `DEFAULT_ADMIN_ROLE` as holding every role. As a side effect, granting a manager role to an account that is already admin is a silent no-op, and revoking one from it emits `RoleRevoked` while the account keeps the power. To move administration from a deployer key to a multisig while the deployer stays a debt manager, use this order: + +1. as the deployer: `engine.grantRole(DEFAULT_ADMIN_ROLE, multisig)` +2. as the deployer: `engine.renounceRole(DEFAULT_ADMIN_ROLE, deployer)` +3. as the multisig: `engine.grantRole(DEBT_MANAGER_ROLE, deployer)` + +Granting the manager role in step 1, before renouncing, would be lost at step 2. If the last `DEFAULT_ADMIN_ROLE` holder renounces, roles can no longer be granted or revoked. + +For `DebtEngineOwnable`, use the two-step transfer of section 4.2. + +## 9. Checks and troubleshooting + +After deployment: + +| Check | Expected | +|---|---| +| `engine.version()` | `"0.3.0"` | +| `token.debtEngine()` | the engine address | +| `engine.hasDebt(token)` / `engine.hasCreditEvents(token)` | `true` for every record written | +| `token.debt()` / `token.creditEvents()` | the records written in the engine | +| `engine.getRoleMemberCount(DEBT_MANAGER_ROLE)` (RBAC) | the managers granted (the admin is not listed) | +| `engine.owner()` (Ownable) | the final owner; `pendingOwner()` is `address(0)` | +| `engine.isTrustedForwarder(x)` | `true` only for the forwarder chosen at deployment | + +| Symptom / error | Cause | Fix | +|---|---|---| +| `token.debt()` returns zeros | The engine has no record for this token address (wrong address, the implementation instead of the proxy, record cleared), or the token was connected before the record was written | Check `engine.hasDebt(token)`; write the record under the proxy / token address | +| `AccessControlUnauthorizedAccount(account, role)` on the engine | The caller lacks `DEBT_MANAGER_ROLE` / `CREDIT_EVENTS_MANAGER_ROLE` | Grant the role from a `DEFAULT_ADMIN_ROLE` holder | +| `AccessControlUnauthorizedAccount(account, DEBT_ROLE)` on the token | `setDebtEngine` called by an account without the token's `DEBT_ROLE` | Call it from the token admin or a `DEBT_ROLE` holder | +| `OwnableUnauthorizedAccount(account)` | Not the owner, or ownership not yet accepted | Call from the owner; `acceptOwnership()` from the pending owner | +| `SmartContractWithAddressZeroNotAllowed()` | A set or clear for `address(0)` | Pass the token address | +| `InvalidInputLength()` / `BatchSizeTooLarge(size, 500)` | Batch arrays of different lengths / too many entries | Fix the arrays; split the batch | +| `CMTAT_DebtEngineModule_SameValue()` | `setDebtEngine` with the engine already set | Nothing to do | +| A manager role granted to the admin does not appear in `getRoleMember` | Implicit admin membership (section 8) | Grant it after the account stops being admin | + +See also: the README sections *Access Control*, *Gasless support (ERC-2771)* and *Compatibility*, and the security review in `doc/tools/v0.3.0/CLAUDE_AUDIT.md`. diff --git a/doc/tools/AUDIT_OVERVIEW.md b/doc/tools/AUDIT_OVERVIEW.md new file mode 100644 index 0000000..9f94235 --- /dev/null +++ b/doc/tools/AUDIT_OVERVIEW.md @@ -0,0 +1,47 @@ +# DebtEngine — audit and analysis overview + +> DebtEngine has **not been audited by an audit company**. The analyses below are static-analysis runs and AI-assisted reviews. + +**In scope:** the production sources under `src/` (`DebtEngineBase`, `DebtEngineInvariantStorage`, `modules/VersionModule`, `deployment/DebtEngineAccessControl`, `deployment/DebtEngineOwnable`). Dependencies (`lib/`: CMTAT, OpenZeppelin, forge-std), tests and deployment scripts are out of scope. + +## Analyses + +| Version | Analysis | Report | Triage | +|---|---|---|---| +| v0.3.0 | Slither 0.11.6 | [slither-report.md](./v0.3.0/slither-report.md) | [slither-report-feedback.md](./v0.3.0/slither-report-feedback.md) | +| v0.3.0 | Aderyn 0.6.5 | [aderyn-report.md](./v0.3.0/aderyn-report.md) | [aderyn-report-feedback.md](./v0.3.0/aderyn-report-feedback.md) | +| v0.3.0 | Claude security audit (AI-assisted) | [CLAUDE_AUDIT.md](./v0.3.0/CLAUDE_AUDIT.md) | in the report | +| v0.3.0 | Claude code-quality review (AI-assisted) | [CLAUDE_ANALYSIS.md](./v0.3.0/CLAUDE_ANALYSIS.md) | in the report | +| v0.3.0 | Test coverage (`forge coverage`) | [doc/coverage](../coverage/coverage/index.html) | — | + +## Static analysis, v0.3.0 (commit `3b86328` + the F-4 fix) + +| Tool | High | Medium | Low | Info | Relevant to fix? | +|---|---|---|---|---|---| +| Slither 0.11.6 | 0 | 0 | 0 | 2 | **No** — both `dead-code` results are the compiler-required `_msgData` overrides | +| Aderyn 0.6.5 | 0 | — | 7 (25 instances) | — | **No** — centralization, pragma, PUSH0, hook idiom, bounded batch loops: by design or environment; one false positive | + +## Test coverage, v0.3.0 + +| File | Lines | Branches | Functions | +|---|---|---|---| +| `DebtEngineBase.sol` | 100% (52/52) | 100% (16/16) | 100% (19/19) | +| `deployment/DebtEngineAccessControl.sol` | 86.67% (13/15) | 100% (3/3) | 85.71% (6/7) | +| `deployment/DebtEngineOwnable.sol` | 80.00% (8/10) | 100% (0/0) | 83.33% (5/6) | +| `modules/VersionModule.sol` | 100% (2/2) | 100% (0/0) | 100% (1/1) | +| **Total** | **94.94% (75/79)** | **100% (19/19)** | **93.94% (31/33)** | + +The only uncovered functions are the two `_msgData` overrides, which the compiler requires and nothing calls. 154 tests, including fuzz tests and mutation-verified access-control tests. + +## Findings from the AI-assisted reviews + +Claude security audit, v0.3.0: **0 Critical, 0 High, 0 Medium, 0 Low, 4 Info.** + +| ID | Severity | Finding | Status | +|---|---|---|---| +| F-1 | Info | An admin passes every role check, so granting it a manager role is a no-op and revoking one emits `RoleRevoked` without effect | Documented (runbook in README and the deployment guide); code fix proposed | +| F-3 | Info | Renouncing the last admin freezes role management | Documented (by design) | +| F-4 | Info | `clearDebt` / `clearCreditEvents` accepted `address(0)` | Fixed (code): they now revert with `SmartContractWithAddressZeroNotAllowed` | +| F-7 | Info | README role table omitted the clear functions | Fixed | + +The code-quality review changes that landed in v0.3.0 (single write paths, `virtual` public API, `require` guards, ERC-165 for the Ownable variant, documented batch gas limits) are listed in its disposition table. diff --git a/doc/tools/CLAUDE_ANALYSIS_SUMMARY.md b/doc/tools/CLAUDE_ANALYSIS_SUMMARY.md new file mode 100644 index 0000000..b0f4ed3 --- /dev/null +++ b/doc/tools/CLAUDE_ANALYSIS_SUMMARY.md @@ -0,0 +1,21 @@ +# AI-assisted findings ↔ production code + +This file links findings from AI-assisted reviews (`doc/tools//CLAUDE_ANALYSIS.md`) to the production code in `src/` they changed or explain. Production comments never cite these reports: their IDs restart each release and their paths move, while a deployed contract's comments cannot be corrected. The substance lives in the NatSpec; the link lives here. + +## How to use + +- Add one entry per code location whenever an AI-assisted finding changes code in `src/`, or explains why it must not change. +- Identify a finding by **report, release, ID and title**, since IDs are not stable across releases. +- Keep `file:line` current when a symbol moves. + +## v0.3.0 — `doc/tools/v0.3.0/CLAUDE_ANALYSIS.md` + +### S-1. `clearDebt` / `clearCreditEvents` — deleting a record and resetting `hasDebt` / `hasCreditEvents` + +| | | +|---|---| +| Location | `src/DebtEngineBase.sol:146`, `clearDebt`; `src/DebtEngineBase.sol:155`, `clearCreditEvents`; `src/DebtEngineBase.sol:188`, `_clearDebt` / `_clearCreditEvents`; `src/DebtEngineBase.sol:78`, `hasDebt` / `hasCreditEvents` | +| Code | `function clearDebt(address smartContract_) external virtual onlyDebtManager {` | +| Comment now | `@notice Deletes the debt record of smartContract_; hasDebt returns false afterwards and debt(smartContract_) returns the zero struct, as before any record was set.` / `@dev Clearing a contract that has no record succeeds and still emits {DebtCleared}.` (same wording for credit events); `hasDebt`: `@notice Returns true if a debt record is currently set ...` / `@dev True after {setDebt} / {setDebtBatch}, false again after {clearDebt}.` | +| Finding | `CLAUDE_ANALYSIS.md` (v0.3.0) **U-1**, "Clearing a record" (also resolves **H-2**, "A record can never be removed; `hasDebt` stays `true` forever"): verdict *decide*, adopted | +| Change applied | Added `clearDebt` / `clearCreditEvents`, internal `_clearDebt` / `_clearCreditEvents`, events `DebtCleared` / `CreditEventsCleared`; gated by the existing `_authorizeSetDebt` / `_authorizeSetCreditEvents` hooks. `hasDebt` / `hasCreditEvents` now mean "currently set" instead of "ever set". No new storage; +617 / +587 runtime bytes. | diff --git a/doc/tools/v0.3.0/CLAUDE_ANALYSIS.md b/doc/tools/v0.3.0/CLAUDE_ANALYSIS.md new file mode 100644 index 0000000..82ae0ce --- /dev/null +++ b/doc/tools/v0.3.0/CLAUDE_ANALYSIS.md @@ -0,0 +1,382 @@ +# DebtEngine v0.3.0 — Code Quality Review + +| | | +|---|---| +| Scope | `src/` (`DebtEngineBase`, `DebtEngineInvariantStorage`, `modules/VersionModule`, `deployment/DebtEngineAccessControl`, `deployment/DebtEngineOwnable`) and `test/` | +| Baseline commit | `fac07f2` (branch `dev`), plus the uncommitted v0.3.0 work present at the start of the review | +| Compiler | solc 0.8.33, optimizer 200 runs, legacy pipeline (no `via_ir`), `evm_version = prague`; Foundry 1.5.0 | +| Dependencies | CMTAT v3.0.0, OpenZeppelin Contracts v5.5.0 | +| Date | 2026-11-16 | +| Mode | **Patching**: mechanical fixes applied, tests added; ✅ means *changed and verified*, ⬜ means *deliberately left as is* | +| Produced with | Claude Code (AI-assisted review — a working document, not an audit) | + +**This is a code-quality review, not a security audit.** Nothing found lets an unauthorized party move value, bypass a restriction or brick a contract. The engine stores data written by authorized roles only; every write path is guarded by an authorization hook, and the hooks were mutation-tested (removing any of them fails the suite). + +Baseline: `forge build` and `forge test` green at the start, **69 tests**. End: **104 tests**, all green, `forge fmt --check` clean. + +## Disposition summary + +| ID | Finding | Outcome | +|---|---|---| +| A-1 | Loops: `i++`, `calldata`, bounded iteration | ⬜ nothing to change | +| B-1 | Storage reads | ⬜ nothing to change | +| C-1 | `DebtSet` / `CreditEventsSet` each emitted from two places | ✅ single emit site via `_setDebt` / `_setCreditEvents` | +| C-2 | Events carry only the address, not the record | ⬜ keep | +| C-3 | Trusted forwarder set in the constructor without an event | ⬜ keep | +| D-1 | Write logic (check + store + flag + event) written four times | ✅ extracted (with C-1) | +| D-2 | ERC-2771 overrides duplicated in both deployment contracts | ⬜ keep — compiler requires them (probe: `Error 6480`) | +| E-1 | Public/external functions and context overrides not `virtual`, unlike hooks, `version()` and `hasRole` | ✅ all `virtual`, harness test | +| F-1 | `DebtEngineOwnable` does not advertise ERC-173 through ERC-165 (SHOULD) | ✅ `supportsInterface` added | +| F-2 | `IDebtEngine` interface id is `0x00000000` | ⬜ keep, do not advertise | +| F-3 | `transferOwnership(address(0))` does not renounce (ERC-173 deviation inherited from OpenZeppelin) | ✅ documented + test | +| G-1 | `pragma ^0.8.20` / README "0.8.20+" false once guards use `require` with custom errors | ✅ `^0.8.27` (corrected during the review, see M-1) | +| G-2 | README function table missing `version()`, `MAX_BATCH_SIZE`, `supportsInterface` | ✅ | +| G-3 | Agent guide: stale attribute-order rule; tool-report paths | ✅ | +| G-4 | Production-source reference scan; NatSpec length | ⬜ nothing found | +| H-1 | `MAX_BATCH_SIZE = 500` is unreachable under the mainnet transaction gas cap | ✅ documented; value → Outstanding | +| H-2 | A record can never be removed; `hasDebt` stays `true` forever | ✅ fixed by U-1 | +| H-3 | Renouncing ownership / admin freezes all records | ⬜ keep, documented | +| H-4 | `debt()` / `creditEvents()` answer for `_msgSender()`, so a forwarder can query any token | ⬜ keep (the data is public anyway) | +| I-1 | Interface granularity (`IDebtEngine`) | ⬜ nothing found | +| J-1 | `view` hooks block OpenZeppelin `AccessManaged.restricted` | ⬜ keep; view-only alternative compiles | +| J-2 | Legibility of names and directories | ⬜ keep | +| K-1 | Missing tests: batch-size guard, boundaries, forwarder, length direction | ✅ 35 tests added | +| L-1 | Braceless control-flow bodies | ⬜ none found | +| M-1 | `if`/`revert` guards | ✅ 9 converted to `require(cond, Error())` | +| U-1 | No way to clear a record | ✅ `clearDebt` / `clearCreditEvents` added | +| U-2 | No enumeration of the tokens that have a record | ⬜ leave | +| U-3 | No guidance on a batch size that fits in one transaction | ✅ documented (H-1) | + +29 rows: 14 ✅, 15 ⬜. + +## Outstanding + +| ID | Item | Why it is still open | +|---|---|---| +| H-1 | Lower `MAX_BATCH_SIZE`, or keep 500 as a chain-agnostic ceiling | A design choice: 500 is harmless (an oversized batch runs out of gas and reverts), but a value near the mainnet limit (about 40 debt records) would catch mistakes earlier on mainnet and be wrong on chains with other caps. | +| — | Slither report in `doc/tools/v0.3.0/slither-report.md` predates this review | Slither cannot run on the review machine (`ModuleNotFoundError: No module named 'slither'`); re-run it after reinstalling. The Aderyn report was regenerated. | + +## A. Loops and iteration + +### A-1. Nothing to change + +`setDebtBatch` (`src/DebtEngineBase.sol:124`) and `setCreditEventsBatch` (`:108`) iterate with `for (uint256 i = 0; i < smartContracts.length; i++)`. The pragma is now `^0.8.27`, built with 0.8.33: since 0.8.22 the compiler removes the overflow check of such a counter, so `unchecked { ++i }` would buy nothing and is **not** recommended. Parameters are `calldata`; iteration is bounded by `MAX_BATCH_SIZE` (see H-1 for why the bound that matters in practice is the gas cap). + +## B. Storage reads + +### B-1. Nothing to change + +No slot is read twice in one call; each setter writes the record and its `has*` flag once. No external call separates storage accesses. + +## C. Events + +### C-1. Each event had two emit sites — ✅ fixed + +Before: `emit DebtSet` appeared in `setDebt` and in the `setDebtBatch` loop, `emit CreditEventsSet` in `setCreditEvents` and in the `setCreditEventsBatch` loop, each preceded by its own zero-address check and storage writes. "Every write emits" held by convention. + +Now: `_setDebt` (`src/DebtEngineBase.sol:145`) and `_setCreditEvents` (`:156`) own validation, write, flag and event; the four public setters call them. `grep -rn 'emit DebtSet\|emit CreditEventsSet' src` returns one site each. + +Measured (`forge snapshot --diff`, same test files before and after): + +| Path | Δ gas | +|---|---| +| `setDebt` / `setCreditEvents` (single) | +34 (one internal call) | +| `setDebtBatch` / `setCreditEventsBatch`, 2 entries | −1,346 / −1,354 | +| Deployment (`testDeploy`) | −110,569 (AccessControl), −110,555 (Ownable) | +| Runtime size | −551 bytes on both contracts | + +Verified by M2, M3 and M7 below (removing the flag, the zero check or the emit from the helper fails 8, 4 and 6 tests). + +### C-2. Events carry only the address — ⬜ keep + +`DebtSet(address indexed smartContract)` does not carry the record. Putting `DebtInformation` (eleven strings and three integers) in the event would cost several thousand gas per write for data an indexer can read with `debt(address)` at the block of the event. Keep. + +### C-3. Forwarder configured without an event — ⬜ keep + +`ERC2771Context(forwarderIrrevocable)` sets an immutable; ERC-2771 defines no event, and the value is readable through `trustedForwarder()` / `isTrustedForwarder()`. The admin and owner are evented by OpenZeppelin (`RoleGranted`, `OwnershipTransferred`, tested). Keep. + +## D. Duplication + +### D-1. Write logic written four times — ✅ fixed + +See C-1. The two batch functions still repeat their two `require` lines (length match, size cap); two lines each, not worth a helper. + +### D-2. ERC-2771 overrides duplicated — ⬜ keep + +`_msgSender`, `_msgData` and `_contextSuffixLength` are identical in `DebtEngineAccessControl` (`:59`–`:69`) and `DebtEngineOwnable` (`:42`–`:52`): 9 code lines each. Probe: a shared `abstract contract DebtEngineERC2771 is DebtEngineBase, ERC2771Context` holding the overrides, inherited by both variants, fails with **`Error (6480)` "Derived contract must override function `_msgSender`"** (and `_msgData`, `_contextSuffixLength`), because `AccessControl` and `Ownable` also inherit `Context`. Solidity requires the most-derived contract to name every base, so the duplication cannot be removed. Keep. + +## E. `virtual` / override convention + +### E-1. Inconsistent `virtual` — ✅ fixed + +Before: the authorization hooks, `version()` and `hasRole` were `virtual`; `debt`, `creditEvents`, `hasDebt`, `hasCreditEvents`, the four setters and the three context overrides in each deployment contract were not. A derived deployment could not, for example, add a check to `setDebtBatch`. Now all are `virtual`; the convention is recorded in `CLAUDE.md` / `AGENTS.md`. + +- Cost: `forge snapshot --diff` shows **0** changed entries, `forge build --sizes` identical. +- Guard: `test/DebtEngineHarness.t.sol` overrides `setDebt` and `hasDebt`, so removing `virtual` breaks the build, and `testOverridesOfPublicFunctionsAreReached` asserts the overrides are actually called. + +## F. ERC / specification conformance + +### F.1 Inventory + +| Standard | Status | How the code claims it | Spec text read | Result | +|---|---|---|---|---| +| CMTAT `IDebtEngine` (`ICMTATDebt` + `ICMTATCreditEvents`) | project interface, CMTAT v3.0.0 | `DebtEngineBase is IDebtEngine` | `lib/CMTAT` v3.0.0 | conforms; real `CMTATStandaloneDebt` reads both records in tests | +| ERC-2771 | Final | `ERC2771Context` (OpenZeppelin 5.5.0) in both deployments | `ethereum/ERCs` `erc-2771.md` | conforms: `isTrustedForwarder` exposed and non-reverting; sender taken from the last 20 bytes only for the trusted forwarder (now tested) | +| ERC-173 | Final | `Ownable2Step` in `DebtEngineOwnable` | `ethereum/ERCs` `erc-173.md` | `owner()`, `transferOwnership`, `OwnershipTransferred` (also at deployment, tested); SHOULD-implement ERC-165 was missing → F-1; zero-address renounce deviates → F-3 | +| ERC-165 | Final | `AccessControlEnumerable` (RBAC); now `ERC165` (Ownable) | OpenZeppelin 5.5.0 | RBAC advertises `IAccessControlEnumerable`, `IAccessControl`, `IERC165`; Ownable advertises ERC-173 and ERC-165; `0xffffffff` false (tested) | +| ERC-3643 `version()` | Final (ERC-3643) | `VersionModule.version()` | CMTAT `IERC3643Base` | same signature; not advertised (DebtEngine is not a token) | + +### F-1. ERC-173 not advertised through ERC-165 — ✅ fixed + +ERC-173: "Contracts should also implement ERC165 for the ERC-173 interface" (`0x7f5828d0`). `DebtEngineOwnable` had no `supportsInterface`. Added `ERC165` and `supportsInterface` (`src/deployment/DebtEngineOwnable.sol:28`), +113 runtime bytes. `testSupportsInterface` pins `type(IERC173).interfaceId == 0x7f5828d0` from a test-local declaration of the standard; mutant M4 (drop the id) fails it. + +### F-2. `IDebtEngine` id is `0x00000000` — ⬜ keep + +`IDebtEngine` declares no function itself, so `type(IDebtEngine).interfaceId` is `0x00000000`; advertising it would need a flattened id. CMTAT's `setDebtEngine` performs no ERC-165 check, so there is no consumer. Keep. + +### F-3. `transferOwnership(address(0))` does not renounce — ✅ documented + +ERC-173 specifies renouncing with `transferOwnership(address(0))`. Under OpenZeppelin `Ownable2Step` it only sets `pendingOwner` to zero (cancelling a pending transfer); renouncing is `renounceOwnership`. Documented in the README; `testTransferOwnershipToZeroCancelsPendingTransfer` pins the behaviour. + +### F.2 Custom features vs standards + +Ownership and roles use OpenZeppelin (ERC-173, `AccessControlEnumerable`); the version getter matches ERC-3643 `version()`; meta-transactions use ERC-2771. Batch setters are custom rather than `Multicall`: keep, because they enforce the size cap and length match in one place. Nothing to adopt. + +## G. Code / documentation mismatch + +### G-1. Minimum compiler — ✅ fixed (correction of M-1) + +M-1 switched guards to `require(condition, CustomError())`. On the legacy pipeline this needs solc 0.8.27: building with `--use 0.8.26` fails with "Require with a custom error is only available using the via-ir pipeline", 0.8.27 compiles. The sources still said `pragma ^0.8.20` and the README "Solidity 0.8.20+". Raised the pragma to `^0.8.27` in `src/` and `test/`, and updated the README and agent guide. Recorded here because the review introduced the mismatch and caught it before finishing. + +### G-2. README function table incomplete — ✅ fixed + +Added `MAX_BATCH_SIZE()`, `version()`, `supportsInterface(bytes4)`, the `virtual` / single-write-path note and the batch-size caveat (H-1). + +### G-3. Agent guide stale — ✅ fixed + +`CLAUDE.md` said "function modifier order `internal view override`", contradicted by the hooks (`internal view virtual override onlyOwner`). Replaced with the full attribute order and the `virtual`, `require` and braces conventions. Tool-report paths now point to `doc/tools/v0.3.0/`; the removed draft reviews are no longer listed. `AGENTS.md` re-synced. + +### G-4. Reference scan and NatSpec length — ⬜ nothing found + +The production-source scan for documentation paths, test names and review IDs returns nothing. NatSpec blocks in `src/` after the review: 22 blocks, median 3.5 lines, longest 10 (`hasRole`, which documents the implicit-admin behaviour). No source comment cites an AI-assisted report, so `CLAUDE_ANALYSIS_SUMMARY.md` is not needed. + +## H. Weird behaviour + +### H-1. `MAX_BATCH_SIZE` is not the limit that binds — ✅ documented, value open + +EIP-7825 (Final, part of Fusaka) caps a transaction at 16,777,216 gas. Measured in the suite (AccessControl variant): one realistic debt record costs about 400k gas (`setDebt` 458,284 gas; a second record in `setDebtBatch` adds 401,580), and `testSetCreditEventsBatchAtMaxSize` (500 short records) costs 35,655,870 gas, about 71k per record. Even 500 *empty* debt records cost 36.4M gas. So on mainnet a batch holds roughly 40 debt records or 230 credit-events records; the cap of 500 can never be reached there. Not a vulnerability (an oversized batch reverts out of gas, nothing is written). Documented in the NatSpec of `MAX_BATCH_SIZE` (`src/DebtEngineBase.sol:21`–`27`) and the README. Whether to lower the value is in *Outstanding*. + +### H-2. Records cannot be removed — ✅ fixed (U-1) + +Once set, `hasDebt` / `hasCreditEvents` stayed `true`; a record could only be overwritten. Fixed by `clearDebt` / `clearCreditEvents` (U-1). + +### H-3. Renouncing freezes the registry — ⬜ keep + +`renounceOwnership` (Ownable variant) or renouncing `DEFAULT_ADMIN_ROLE` with no other manager leaves every record permanently frozen. For a registry, freezing can be intended (immutable records); it is OpenZeppelin's behaviour and is documented in the README. + +**Decision (maintainer, 2026-11-17): keep the current admin model.** The implicit super-admin in `hasRole` stays (same model as CMTAT's `AccessControlModule`). OpenZeppelin `AccessControlDefaultAdminRules` (single admin, delayed two-step handover and renounce) was considered and **rejected as too complex** for this contract: it changes the constructor, adds a delay parameter and six overrides to combine with `AccessControlEnumerable`. The residual risk stays operational: transfer the admin role with `grantRole` to the new admin **before** `renounceRole` / `revokeRole` on the old one, and never renounce the last admin unless freezing the records is intended. + +### H-4. Caller-based getters through a forwarder — ⬜ keep + +`debt()` returns the record of `_msgSender()`; through the trusted forwarder anyone can make it answer for any token address (tested in `testDebtForCallerThroughTrustedForwarder`). Harmless: `debt(address)` already exposes every record. + +## I. Interface granularity + +### I-1. Nothing found + +CMTAT's `DebtEngineModule` calls `debt()` and `creditEvents()`; `IDebtEngine` requires exactly those two functions (one from `ICMTATDebt`, one from `ICMTATCreditEvents`). No ERC-165 guard. + +## J. Modularity + +### J-1. `view` hooks and OpenZeppelin `AccessManaged` — ⬜ keep + +Probe (scratch copy, deleted): a third deployment `DebtEngineAccessManaged is DebtEngineBase, AccessManaged` overriding the hooks with `restricted` fails with **`Error (8961)` "Function cannot be declared as view because this expression (potentially) modifies the state"**: `restricted` may consume a scheduled operation. An override cannot relax `view`, so the only way to use `restricted` would be dropping `view` from the base hooks, losing the compiler guarantee that authorization never writes state. A view-only alternative **compiles**: + +```solidity +function _authorizeSetDebt() internal view virtual override { + (bool immediate,) = AuthorityUtils.canCallWithDelay(authority(), _msgSender(), address(this), msg.sig); + require(immediate, IAccessManaged.AccessManagedUnauthorized(_msgSender())); +} +``` + +It supports immediate permissions only (no scheduled, delayed operations). Keep `view`; use this form if an AccessManager variant is ever needed. + +### J-2. Legibility — ⬜ keep + +``` +src/DebtEngineBase.sol abstract contract DebtEngineBase +src/DebtEngineInvariantStorage.sol abstract contract DebtEngineInvariantStorage +src/deployment/DebtEngineAccessControl.sol contract DebtEngineAccessControl +src/deployment/DebtEngineOwnable.sol contract DebtEngineOwnable +src/modules/VersionModule.sol abstract contract VersionModule +``` + +Directories match contents (`deployment/` holds the only deployable contracts). `DebtEngineInvariantStorage` holds only errors, but the name follows the CMTAT ecosystem convention, so keep. Embedding the engine in a token is not a goal (it is an external engine by design), so no downstream-embedding probe was needed. + +## K. Tests + +### K.1 Correctness + +- Every guard has a negative test with the exact selector and arguments: `SmartContractWithAddressZeroNotAllowed` (4 paths), `InvalidInputLength` (both directions, both batches), `BatchSizeTooLarge` (both batches, new), `AdminWithAddressZeroNotAllowed`, `OwnableInvalidOwner`, both hooks in both variants, role separation, pending-owner acceptance. +- Before the review, `BatchSizeTooLarge` had **no test** and the length check was tested only with fewer addresses than records. +- Low-level forwarder calls use `vm.expectRevert` with the specific unauthorized-account error and the relayed address. + +Mutants, each run in a throwaway copy of the repository (working tree untouched): + +| # | Mutation | Result | +|---|---|---| +| H1–H3 | Remove the modifier from one hook (AC debt, AC credit events, Ownable debt) | killed (4 failures each) | +| M1 | First batch cap `<=` → `<` | killed (2) | +| M2 | Drop the `has*` flag in `_setDebt` | killed (8) | +| M3 | Drop the zero check in `_setCreditEvents` | killed (4) | +| M4 | Drop the ERC-173 id from `supportsInterface` | killed (1) | +| M5 | AC `_msgSender` returns `msg.sender` (ignore forwarder) | killed (3) | +| M6 | Drop the implicit-admin shortcut in `hasRole` | killed (32) | +| M7 | Drop `emit DebtSet` | killed (6) | +| M8 | Debt batch length `==` → `>=` | **survived**, then killed (2) by the new "more addresses than records" tests | +| M9 | Credit batch length `==` → `>=` | killed (2) after the same tests | +| M10 | Remove the debt batch size guard | killed (`testCannotSetDebtBatchAboveMaxSize`) | + +### K.2 Coverage (`forge coverage`, tests excluded from the report) + +| Contract | Lines | Branches | Funcs | Uncovered | Verdict | +|---|---|---|---|---|---| +| `DebtEngineBase` | 100% (42/42) | 100% (12/12) | 100% (15/15) | — | — | +| `DebtEngineAccessControl` | 86.67% (13/15) | 100% (3/3) | 85.71% (6/7) | `_msgData` | acceptable: required override, nothing in OpenZeppelin `AccessControl` calls it | +| `DebtEngineOwnable` | 80% (8/10) | 100% (0/0) | 83.33% (5/6) | `_msgData` | acceptable: same reason | +| `VersionModule` | 100% | 100% | 100% | — | — | + +Before the review: `DebtEngineBase` 92.31% lines, 75% branches (both `BatchSizeTooLarge` guards and the base `_msgSender` uncovered). The HTML report in `doc/coverage/` was regenerated. + +### K.3 Edge cases + +| Family | Cases missing before | Test written | +|---|---|---| +| Boundaries | batch of exactly `MAX_BATCH_SIZE`, `MAX_BATCH_SIZE + 1`, empty batch | `testSet*BatchAtMaxSize`, `testCannotSet*BatchAboveMaxSize`, `testEmptyBatchesAreNoOps` | +| Duplicates and order | same address twice in one batch | `testDuplicateAddressInDebtBatchLastWriteWins` (last write wins, two events) | +| State transitions | overwriting a record; ownership transfer to zero | `testSetDebtOverwritesPreviousRecord`, `testTransferOwnershipToZeroCancelsPendingTransfer` | +| Authorization | relayed call through the trusted forwarder (authorized, unauthorized, spoofed by a non-forwarder) | `testSetDebtThroughTrustedForwarder`, `testForwarderCannotRelayUnauthorizedSigner`, `testUntrustedCallerCannotSpoofSender` | +| Arithmetic / values | arbitrary record values | `testFuzz_SetDebtRoundTrip`, `testFuzz_SetCreditEventsRoundTrip` (256 runs each, both variants) | +| Events | deployment `OwnershipTransferred`; no event on empty batch | `testOwnershipTransferredEmittedAtDeployment`, `testEmptyBatchesAreNoOps` | + +Fuzzed: write-then-read for both record types. Not invariant-tested: no conserved quantity beyond "a record equals the last write", which the fuzz tests cover. Reentrancy: no external calls in the engine. + +## L. Control-flow bodies in braces + +### L-1. None found + +The brace scan on `src/` and `test/` returns nothing. + +## M. Guards + +### M-1. `if`/`revert` → `require(cond, Error())` — ✅ fixed + +Nine guards converted (`src/DebtEngineBase.sol:113`, `:114`, `:129`, `:130`, `:146`, `:157`; `src/deployment/DebtEngineAccessControl.sol:19`; the two single setters now go through the helpers). No exception was needed: every error argument is a calldata length or a constant. Measured: batch calls +13 gas (`BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)` is built on the success path), deployment about +1,200 gas, runtime +6 bytes, before C-1. Revert data is unchanged, so every existing `expectRevert` passed unchanged. Side effect: minimum compiler 0.8.27 (G-1). + +## U. User experience + +Actors: the deployer (admin or owner, forwarder), the debt manager and credit-events manager (or the owner), the CMTAT token (reads its own record), integrators and indexers (read any record), relayers (ERC-2771). + +| ID | Actor | Journey step | What they must do today | Proposed addition | Verdict | +|---|---|---|---|---|---| +| U-1 | Debt / credit-events manager | Retire a token or correct a record set by mistake | Overwrite with an empty struct; `hasDebt` still says `true` | `clearDebt` / `clearCreditEvents` | ✅ done | +| U-2 | Indexer | List every token that has a record | Replay `DebtSet` / `CreditEventsSet` from deployment | On-chain enumeration | leave | +| U-3 | Manager | Size a batch that fits in one transaction | Trial and error against the gas cap | Documentation (H-1) | ✅ done | + +### U-1. Clearing a record + +1. **Journey:** a manager retires a token, or removes a record written to the wrong address. +2. **Today:** `setDebt(token, emptyStruct)`; `debt(token)` returns zeros but `hasDebt(token)` stays `true`, so an integrator using `hasDebt` to mean "has a debt record" reads a cleared token as configured. +3. **Change, as code (Proposed, compiled in a scratch copy, then deleted):** + + ```solidity + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + /// @notice Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards. + function clearDebt(address smartContract_) external virtual onlyDebtManager { + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + + /// @notice Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards. + function clearCreditEvents(address smartContract_) external virtual onlyCreditEventsManager { + delete _creditEvents[smartContract_]; + delete _creditEventsSet[smartContract_]; + emit CreditEventsCleared(smartContract_); + } + ``` + +4. **How to adopt:** add to `DebtEngineBase` (both variants inherit it; the existing hooks gate it), update the README function table and the capability table. +5. **Limits and interactions:** a CMTAT token pointing at the engine then reads an empty record, the same as before it was set; no storage-layout change (no new state); new ABI entries and events. +6. **Cost, measured:** +599 runtime bytes (`DebtEngineAccessControl` 8,573 → 9,172), +565 (`DebtEngineOwnable`), `forge build --sizes`; both far below EIP-170. +7. **Test to add:** set → clear → `hasDebt == false`, `debt()` equals the zero struct, event emitted; unauthorized caller rejected in both variants. +8. **Verdict: decide.** It changes what `hasDebt` means ("currently set" instead of "ever set"), which is a product decision. +9. **Decision: adopted.** Implemented in `DebtEngineBase` as proposed, with internal delete paths `_clearDebt` / `_clearCreditEvents`; `hasDebt` / `hasCreditEvents` now mean "currently set". Measured cost: +617 runtime bytes (`DebtEngineAccessControl` 8,573 → 9,190), +587 (`DebtEngineOwnable` 7,107 → 7,694). Tests added in the shared suite (both variants) and RBAC role-separation tests. Linked from `doc/tools/CLAUDE_ANALYSIS_SUMMARY.md` S-1. + +### U-2. Enumerating the tokens with a record + +1. **Journey:** an indexer or dashboard lists every token the engine serves. +2. **Today:** replays `DebtSet` / `CreditEventsSet` since deployment and de-duplicates. +3. **Change:** an `EnumerableSet.AddressSet` updated in `_setDebt` / `_setCreditEvents`, with `tokens()` / `tokenCount()` views (not implemented, not compiled). +4. **How to adopt:** update the set in the single write paths (C-1 makes that a two-line change). +5. **Limits:** one extra storage write (about 20k–45k gas) on the first record of each token; unbounded return array for `tokens()`. +6. **Cost:** not measured, as the verdict is leave. +7. **Test:** set count equals the number of distinct tokens written, fuzzed. +8. **Verdict: leave.** Events plus `hasDebt` answer the question off-chain, and the engine serves a small number of issuer tokens. + +## Static analysis (Aderyn, regenerated) + +`doc/tools/v0.3.0/aderyn-report.md`: 0 High, 7 Low, all by design: L-1 centralization (authorized roles are the point of the engine), L-2 floating pragma (`^0.8.27` lets integrators compile with newer solc; the project pins 0.8.33), L-3 PUSH0 (`prague` target; set `evm_version` for chains without it), L-4 empty blocks (the hook idiom: the check is the modifier), L-5 / L-6 `require` and storage writes in loops (bounded batches), L-7 unchecked return of `_grantRole` in the constructor (always `true` on a fresh contract). + +## Corrections during the review + +- **G-1 was introduced by M-1.** Converting to `require` with custom errors silently raised the minimum compiler to 0.8.27 while the pragma still said `^0.8.20`; caught by the documentation pass and fixed. +- **Cumulative gas diffs are not comparable.** Comparing the final snapshot with the initial one shows `setDebt` +647 gas, which contradicts the per-step +34. The difference comes from the 35 new test functions changing the test contracts' selector dispatch, which `forge snapshot` charges to the test. The per-step figures above were each measured with unchanged test files and are the valid ones. + +## Review completeness + +**Setup** +- [x] Mode: patching, chosen by the user; stated in the header. +- [x] Conventions read (`CLAUDE.md` / `AGENTS.md`, `CONTRIBUTING.md`); solc 0.8.33, optimizer 200, no `via_ir`. +- [x] Baseline: build and tests green, 69 tests. + +**Checks** +- [x] A — compiler checked before loop advice; `calldata`; bounded iteration. +- [x] B — nothing to cache. +- [x] C — emit sites counted; `_setX` helpers implemented and measured. +- [x] D — duplication found; the reason D-2 cannot be shared proven by compile (`6480`). +- [x] E — convention made explicit in the agent guide; harness test. +- [x] F.1 — inventory table; ERC-173 and ERC-2771 read from the spec text (`ethereum/ERCs`); ERC-165 ids pinned in tests. +- [x] F.2 — compared; nothing to adopt. +- [x] G — doc claims grepped; NatSpec distribution measured; reference scan empty; rule already in the agent guide. +- [x] H — per-contract questions asked; H-1 measured against EIP-7825. +- [x] I — functions called vs required counted. +- [x] J — listing run; AccessManaged probe compiled and graded (`8961`); scratch files outside the repository. +- [x] K.1 — every guard has a negative test; 13 mutants, 1 survivor killed by new tests. +- [x] K.2 — `forge coverage` run; uncovered items have verdicts. +- [x] K.3 — families walked; fuzzed properties stated. +- [x] L — brace scan empty. +- [x] M — 9 guards converted, measured. +- [x] U — actors and journeys; U-1 code compiled and sized; U-2 labelled not compiled. + +**Measurement and changes** +- [x] Gas figures from `forge snapshot --diff` per step, with unchanged test files; probe and mutation copies kept outside the repository. +- [x] Fixes seen to fail when reverted (mutants M2–M10, harness compile for E-1). +- [x] Storage layout: no state variable added, removed or reordered (only internal functions, `virtual`, guards and `supportsInterface`); ABI additions: `supportsInterface` on `DebtEngineOwnable` only. +- [x] End: `forge fmt --check`, `forge build`, `forge test` green (104 tests = 69 + 35 added); sizes far below EIP-170. +- [x] Report-only checks: N/A (patching mode). + +**Report** +- [x] Header complete, vulnerability statement included. +- [x] File:line references re-checked against the final code. +- [x] Corrections kept in place. +- [x] Disposition rows counted (29). +- [x] Outstanding lists the open decisions and the stale Slither report. +- [x] K and U tables present. + +**Finally** +- [x] Changelog and agent guides updated (`CLAUDE.md` = `AGENTS.md`). +- [x] No source comment cites this report. +- [x] Commit message offered. diff --git a/doc/tools/v0.3.0/CLAUDE_AUDIT.md b/doc/tools/v0.3.0/CLAUDE_AUDIT.md new file mode 100644 index 0000000..c914e3e --- /dev/null +++ b/doc/tools/v0.3.0/CLAUDE_AUDIT.md @@ -0,0 +1,301 @@ +# DebtEngine v0.3.0 — Claude Security Audit Report + +| | | +|---|---| +| Tool | Claude (Anthropic), driven by a set of custom smart-contract security-audit skills; the specific internal skills used are intentionally not enumerated here | +| Codebase | DebtEngine v0.3.0, commit `705208b` (branch `dev`) | +| Toolchain | solc 0.8.33, optimizer 200 runs, legacy pipeline, `evm_version = prague`; Foundry 1.5.0; CMTAT v3.0.0, OpenZeppelin Contracts v5.5.0 | +| Severity framework | Code4rena (High / Medium / Low / Info) | +| Date | 2026-11-16 | +| Nature | AI-assisted security review. It is **not** an audit by an audit company. | + +## 1. Scope and methodology + +**In scope:** every production source under `src/`: + +- `src/DebtEngineBase.sol` +- `src/DebtEngineInvariantStorage.sol` +- `src/modules/VersionModule.sol` +- `src/deployment/DebtEngineAccessControl.sol` +- `src/deployment/DebtEngineOwnable.sol` + +**Out of scope:** `lib/` (CMTAT, OpenZeppelin, forge-std) and `test/`. Dependency code is quoted where it executes behaviour of an in-scope contract. + +**Method:** +- A threat model: actors, trust levels, and 20 threats with IDs. +- An enumeration of every privileged entry point and the guard it passes. The call graph was traced by hand, because Slither could not run in the review environment. +- A targeted review of each threat, with executable Foundry proofs of concept and fuzz tests. +- An adversarial self-review: a separate pass tried to dismiss or downgrade every finding against the code and the documentation. + +## 2. Executive summary + +**0 Critical, 0 High, 0 Medium, 0 Low, 4 Info.** + +The engine holds no funds and makes no external calls. Every state-changing function is gated by an authorization hook, and fuzzing over arbitrary callers in both deployment variants found no unauthorized write path. The Info findings concern role bookkeeping when an account holds `DEFAULT_ADMIN_ROLE`, freezing on renounce, one consistency nit, and the documentation. Three of the four are resolved by documentation and one (F-4) by a code fix applied after the audit. + +**Cleared hypotheses.** Each of these would have been High or Medium; each was tested and does not hold: + +- **Unauthorized write.** Every one of the six writers (`setDebt`, `setDebtBatch`, `clearDebt`, `setCreditEvents`, `setCreditEventsBatch`, `clearCreditEvents`) rejects any caller that is not authorized, in both variants. This was fuzzed over arbitrary callers. In an earlier mutation run, removing any hook's modifier made the suite fail. +- **Role-separation bypass.** A debt manager cannot set or clear credit events, and a credit-events manager cannot touch debt. +- **Meta-transaction sender spoofing.** A caller that is not the trusted forwarder cannot impersonate an account by appending its address to the calldata. +- **Records stored under `address(0)`.** Both setters reject it. +- **Interface mismatch with CMTAT.** A real CMTAT v3.0.0 `CMTATStandaloneDebt` reads both record types through the engine. +- **Reentrancy, upgrade and initializer issues.** Not applicable: there are no external calls, no proxy and no initializer. + +The test suite went from 124 to **136** tests, all passing. Two of the new tests are fuzz tests (256 runs each). + +## 3. Findings + +| ID | Finding | Severity | Status | Component | PoC | +|---|---|---|---|---|---| +| F-1 | Implicit-admin `hasRole` override breaks role grant / revoke bookkeeping | Info (downgraded from Low) | Documented; code fix proposed | `src/deployment/DebtEngineAccessControl.sol:41-53` | `testPoC_F1_GrantRoleToAdminIsSilentNoOp`, `testPoC_F1_RevokeRoleFromAdminEmitsButKeepsPower`, `testPoC_F1_AdminHandoverDropsSelfGrantedRole` | +| F-3 | Renouncing the last admin freezes role management | Info | Documented (by design) | OZ `AccessControl.renounceRole` | `testLastAdminRenounceFreezesRoles` | +| F-4 | `clearDebt` / `clearCreditEvents` accept `address(0)` | Info | ✅ Fixed | `src/DebtEngineBase.sol:188-202` | `testCannotClearAddressZero` (inverted PoC) | +| F-7 | README RBAC role table omits the clear functions | Info | Fixed (documentation) | `README.md` | — | + +IDs F-2, F-5 and F-6 were dismissed in the adversarial review and are recorded in section 7. Line numbers refer to the audited commit `705208b`. + +### F-1. Implicit-admin `hasRole` override breaks role grant / revoke bookkeeping — Info + +- **Location:** + - `src/deployment/DebtEngineAccessControl.sol:41-53` (`hasRole`). + - Executed by `lib/openzeppelin-contracts/contracts/access/AccessControl.sol:181-206` (`_grantRole`, `_revokeRole`; OpenZeppelin v5.5.0). + - Reached from `grantRole` (`:120-122`), `revokeRole` (`:135-137`) and `renounceRole` (`:155-161`). +- **Description:** `hasRole` returns `true` for any role when the account holds `DEFAULT_ADMIN_ROLE`. OpenZeppelin's `_grantRole` / `_revokeRole` use `hasRole` to decide whether membership changes, so for an admin: + - `grantRole(DEBT_MANAGER_ROLE, admin)` stores nothing, emits no `RoleGranted`, and does not enumerate the admin; + - `revokeRole(DEBT_MANAGER_ROLE, admin)` (or `renounceRole`) emits `RoleRevoked` although the admin keeps the power. + +Problematic code: + +```solidity +// src/deployment/DebtEngineAccessControl.sol:41-53 +function hasRole(bytes32 role, address account) + public + view + virtual + override(AccessControl, IAccessControl) + returns (bool) +{ + // The Default Admin has all roles + if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { // ◀ also consulted by _grantRole / _revokeRole + return true; + } + return AccessControl.hasRole(role, account); +} +``` + +```solidity +// lib/openzeppelin-contracts/contracts/access/AccessControl.sol:181-206 (OZ v5.5.0) +function _grantRole(bytes32 role, address account) internal virtual returns (bool) { + if (!hasRole(role, account)) { // ◀ true for an admin → grant skipped, no event + _roles[role].hasRole[account] = true; + emit RoleGranted(role, account, _msgSender()); + return true; + } else { + return false; + } +} +... +function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { + if (hasRole(role, account)) { // ◀ true for an admin → RoleRevoked emitted, power kept + _roles[role].hasRole[account] = false; + emit RoleRevoked(role, account, _msgSender()); + return true; + } else { + return false; + } +} +``` + +- **Impact:** no unauthorized access, and no record changes without an authorized key. Two operational consequences: + - **Monitoring is misled.** A tool that rebuilds role holders from events sees a `RoleRevoked` for an admin that still writes records, and never sees a "grant" an admin made to itself. + - **An admin handover can drop an intended role.** Take the usual sequence: grant yourself the manager role, grant admin to a multisig, renounce admin. The old admin ends up with no manager role, because the first grant was a no-op. Operations stop until the new admin re-grants it. +- **Severity adjustment (Low → Info, adversarial review):** + - The grant side was already documented in the README note on the super-admin: no `RoleGranted` event, and the admin is not enumerated. + - Only the trusted admin is affected, and one re-grant by the new admin restores the lost role. + - CMTAT's `AccessControlModule.hasRole` (`lib/CMTAT/contracts/modules/wrapper/security/AccessControlModule.sol:34-45`) uses the same override, so CMTAT tokens behave the same way. + - What remained undocumented was the misleading `RoleRevoked` event and the handover trap. +- **Fix — Implemented (documentation, Option C):** + - The README super-admin note now explains the revocation behaviour and gives the handover runbook: renounce `DEFAULT_ADMIN_ROLE` first, then have the new admin grant the manager role. + - The `hasRole` NatSpec says the same. + - `testF1_RunbookGrantAfterRenounceWorks` pins the runbook. + - Contract behaviour is unchanged. +- **Fix code — Proposed, not implemented (Option A):** keep the super-admin semantics for checks, but make bookkeeping record only explicit membership. + - **Tested:** compiled and run in a scratch copy. The three PoCs above fail, as intended, and the other 133 tests pass; +81 runtime bytes. + - **Requirements:** `pragma ^0.8.28` (transient value types) and a Cancun-or-later chain. + - **Behaviour change:** revoking a manager role from an admin becomes a silent no-op, so the README note would need rewriting. + - **Risk:** the adversarial review found no reentrancy window. The `onlyRole` check runs before the flag is set, no external call happens while it is set, and a revert rolls the transient flag back. + + ```solidity + // src/deployment/DebtEngineAccessControl.sol + /// @dev Set only while `_grantRole` / `_revokeRole` run, so they record explicit membership. + bool private transient _explicitRolesOnly; + + function hasRole(bytes32 role, address account) + public view virtual override(AccessControl, IAccessControl) returns (bool) + { + // The Default Admin has all roles, except while role bookkeeping runs (see _grantRole / _revokeRole) + if (!_explicitRolesOnly && AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { + return true; + } + return AccessControl.hasRole(role, account); + } + + function _grantRole(bytes32 role, address account) internal virtual override returns (bool granted) { + _explicitRolesOnly = true; + granted = super._grantRole(role, account); + _explicitRolesOnly = false; + } + + function _revokeRole(bytes32 role, address account) internal virtual override returns (bool revoked) { + _explicitRolesOnly = true; + revoked = super._revokeRole(role, account); + _explicitRolesOnly = false; + } + ``` + + An alternative, **Option B**, drops the override and accepts the admin inside the hooks. That is not recommended: it diverges from CMTAT, and the hooks could no longer be a bare `onlyRole`. + + ```solidity + function _authorizeSetDebt() internal view virtual override { + if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender())) { + _checkRole(DEBT_MANAGER_ROLE); + } + } + ``` + +### F-3. Renouncing the last admin freezes role management — Info + +- **Location:** `lib/openzeppelin-contracts/contracts/access/AccessControl.sol:155-161` (`renounceRole`, OZ v5.5.0); `src/deployment/DebtEngineAccessControl.sol` does not use `AccessControlDefaultAdminRules`. +- **Description and impact:** after the only `DEFAULT_ADMIN_ROLE` holder renounces, no role can be granted or revoked again. Existing managers keep writing, and the registry is frozen once they renounce too. At the audited commit the README described this for the Ownable variant only. + +```solidity +// lib/openzeppelin-contracts/contracts/access/AccessControl.sol:155-161 (OZ v5.5.0) +function renounceRole(bytes32 role, address callerConfirmation) public virtual { + if (callerConfirmation != _msgSender()) { + revert AccessControlBadConfirmation(); + } + + _revokeRole(role, callerConfirmation); // ◀ the last DEFAULT_ADMIN_ROLE holder can leave; nobody can grant again +} +``` + +- **Fix:** no code fix. This is by design, since a registry may be meant to freeze. **Implemented (documentation):** the README RBAC note now says "If the last `DEFAULT_ADMIN_ROLE` holder renounces, roles can no longer be granted or revoked." A code alternative is OpenZeppelin `AccessControlDefaultAdminRules` (a delayed two-step admin transfer). It would change the constructor and the ABI, so it is not proposed. + +### F-4. `clearDebt` / `clearCreditEvents` accept `address(0)` — Info + +- **Location:** `src/DebtEngineBase.sol:146-157` (`clearDebt`, `clearCreditEvents`), `:188-202` (`_clearDebt`, `_clearCreditEvents`). +- **Description and impact:** the setters reject `address(0)`, the clear functions do not. No state changes (nothing can be stored under `address(0)`), but `DebtCleared(address(0))` / `CreditEventsCleared(address(0))` can be emitted. The NatSpec already says clearing an unset record succeeds and emits. + +```solidity +// src/DebtEngineBase.sol:188-192 +function _clearDebt(address smartContract_) internal virtual { + // ◀ no address(0) check, unlike _setDebt (:168) + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); +} +``` + +- **Fix code — Implemented** (after the audit, before release): `src/DebtEngineBase.sol:191-192` and `:202-203` (`_clearDebt`, `_clearCreditEvents`), so `clearDebt` / `clearCreditEvents` now revert with `SmartContractWithAddressZeroNotAllowed`, like the setters. Cost: +78 runtime bytes per deployment contract, about +28 gas per clear call. + + ```solidity + // src/DebtEngineBase.sol:191-196 + function _clearDebt(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + // same first line in _clearCreditEvents (:202-203) + ``` + + Verified by `testCannotClearAddressZero` (both variants, both clear functions), inverted from the PoC that asserted the old behaviour; with the two checks removed, it is the one test that fails. + +### F-7. README RBAC role table omits the clear functions — Info + +- **Location:** `README.md`, the "DebtEngineAccessControl (RBAC)" role table. +- **Description:** at the audited commit, `DEBT_MANAGER_ROLE` was described as "Can call `setDebt` and `setDebtBatch`", and the credit-events role the same way. This contradicted the capability table just above it, which includes `clearDebt` / `clearCreditEvents`. An operator granting the role from that table would not know that it also allows deleting records. This finding came out of the adversarial review. +- **Fix:** no code fix. **Implemented (documentation):** both rows now list the clear function. + +## 4. Invariant verification + +| Invariant | Property | Holds? | Evidence | +|---|---|---|---| +| I-1 | Only an authorized account changes `_debts`, `_creditEvents` or the `has*` flags | ✅ | `testFuzz_OnlyAuthorizedCanWrite` (256 runs; six writers × two variants, with the variant's specific error) | +| I-2 | `hasDebt(a)` is true iff the last write to `a` was a set | ✅ | `testFuzz_SetClearSequenceMatchesModel` (256 runs, sequences of up to 32 set / clear operations checked against a model) | +| I-3 | `debt(a)` equals the last record set, or the zero struct after a clear | ✅ | same, plus `testFuzz_SetDebtRoundTrip` / `testFuzz_SetCreditEventsRoundTrip` | +| I-4 | No record is stored under `address(0)`, and no clear accepts it | ✅ | `testCannotSetDebtForAddressZero`, `testCannotSetCreditEventsForAddressZero`, batch variants, `testCannotClearAddressZero` (F-4 fixed) | +| I-5 | A debt manager cannot change credit events, and vice versa | ✅ | `testDebtManagerCannotSetCreditEvents`, `testCreditEventsManagerCannotSetDebt`, `testDebtManagerCannotClearCreditEvents`, `testCreditEventsManagerCannotClearDebt` | +| I-6 | Without the trusted forwarder, `_msgSender() == msg.sender` | ✅ | `testUntrustedCallerCannotSpoofSender`, `testBaseMsgSenderIsMsgSender` | + +## 5. Access-control verification + +| Entry point | `DebtEngineAccessControl` | `DebtEngineOwnable` | Verified | +|---|---|---|---| +| `setDebt`, `setDebtBatch`, `clearDebt` | `DEBT_MANAGER_ROLE` (or admin) | owner | ✅ positive and negative tests, fuzzed callers | +| `setCreditEvents`, `setCreditEventsBatch`, `clearCreditEvents` | `CREDIT_EVENTS_MANAGER_ROLE` (or admin) | owner | ✅ | +| `grantRole` / `revokeRole` | `DEFAULT_ADMIN_ROLE` | — | ✅ (F-1 behaviour for admins) | +| `renounceRole` | the account itself | — | ✅ (F-3) | +| `transferOwnership` → `acceptOwnership` | — | owner → pending owner | ✅ two-step; `transferOwnership(address(0))` cancels a pending transfer | +| `renounceOwnership` | — | owner | ✅ freezes all records | +| Views (`debt`, `creditEvents`, `hasDebt`, `hasCreditEvents`, `version`, `supportsInterface`) | anyone | anyone | ✅ | + +**Negative results:** +- A debt manager cannot touch credit events, and a credit-events manager cannot touch debt. +- Neither manager role can grant roles. +- A pending owner other than the nominated one cannot accept. +- A non-forwarder cannot spoof a sender. + +**Centralization premise:** +- The default admin implicitly holds every role. This is inherent to the model (and to CMTAT), not a finding. +- The trusted forwarder is trusted for every function, role and ownership management included. +- A single admin or owner key can rewrite or delete every record. + +## 6. Remediation — what was implemented + +The documentation remediation landed in commit `e7be94b`; F-4 is the only code change, applied afterwards. + +| Finding | Status | What changed | Verified by | +|---|---|---|---| +| F-1 | ⚠️ Documented, behaviour unchanged | README super-admin note: the admin-revocation behaviour and the handover runbook; `hasRole` NatSpec extended | `testF1_RunbookGrantAfterRenounceWorks`; the three `testPoC_F1_*` keep asserting the current behaviour | +| F-3 | ⚠️ Documented, behaviour unchanged | README RBAC note: renouncing the last admin freezes role management | `testLastAdminRenounceFreezesRoles` | +| F-7 | ✅ Fixed (documentation) | README RBAC role table lists `clearDebt` / `clearCreditEvents` | — | +| Forwarder trust (dismissed F-2) | ⚠️ Documented | README "Gasless support": the forwarder is trusted for every function, including role management and ownership transfer; use a signature-verifying forwarder or `address(0)` | `testPoC_F2_ForwarderCanGrantAdminRole`, `testPoC_F2_ForwarderCanStartOwnershipTransfer` | +| F-4 | ✅ Fixed (code) | `_clearDebt` / `_clearCreditEvents` reject `address(0)` with `SmartContractWithAddressZeroNotAllowed` (`src/DebtEngineBase.sol:192`, `:203`). Behaviour change: clearing `address(0)` now reverts instead of emitting an event | `testCannotClearAddressZero` (inverted PoC; fails with the checks removed) | +| F-1 Option A | ⬜ Declined for now | A design decision for the maintainers (compiler bump, divergence from CMTAT) | Compiled and tested in a scratch copy only | + +No breaking change to the ABI or storage was introduced; F-4 adds a revert path to `clearDebt` / `clearCreditEvents` for `address(0)` only. + +## 7. Potential improvements (open backlog) + +These are hardening and documentation items, not vulnerabilities. + +| # | Improvement | Addresses | Effort | Breaking? | Priority | +|---|---|---|---|---|---| +| 1 | Adopt F-1 Option A so that role bookkeeping records explicit membership | F-1 | Small (code and tests exist) | Behavioural: revoking from an admin becomes a no-op; needs solc ≥ 0.8.28, Cancun+ | **Design decision** | +| 2 | README integration note: write the engine record before `setDebtEngine` on the token; integrators use `hasDebt(token)` to tell "empty" from "unset" | dismissed F-5 | Trivial | No | Low | +| 3 | Re-run Slither once it can run in the review environment, and refresh `doc/tools/v0.3.0/slither-report.md` | tooling | Trivial | No | Low | + +- **Item 1** is a choice between two consistent behaviours: today's, which matches CMTAT and is now documented, and exact bookkeeping. Neither is a defect. +- **Item 3** comes from CMTAT's fallback rule. A CMTAT token that points at the engine returns the engine's answer even when the engine holds no record for it, so the token's own data is hidden. DebtEngine cannot change this. + +## 8. Scope and duplicate check + +- **Scope:** every finding is in an in-scope contract, or in a dependency line those contracts execute (OZ v5.5.0, quoted with its version). +- **Duplicates:** no automated-analysis report ships with the project. The Slither and Aderyn reports in `doc/tools/v0.3.0/` report none of these findings. The v0.3.0 code-quality review (`CLAUDE_ANALYSIS.md`) raised the batch-size observation; it is listed below and is not counted again. +- **Considered and dismissed:** + +| ID | Observation | Reason | +|---|---|---| +| F-2 | The trusted forwarder can perform admin actions (grant `DEFAULT_ADMIN_ROLE`, start an ownership transfer) | ERC-2771 trust model: the forwarder is fully trusted and immutable, and the README already says a compromised forwarder means redeploying; now stated explicitly (section 6) | +| F-5 | Pointing a CMTAT token at the engine hides the token's own `DebtModule` data | CMTAT `DebtEngineModule` behaviour (`lib/`, out of scope); the README notes the empty read after a clear; backlog item 3 | +| F-6 | Batches hit the per-transaction gas cap (EIP-7825) long before `MAX_BATCH_SIZE` | Already documented in the NatSpec and README; admin-only, and an oversized batch reverts without effect | +| AC-5 | Ownership lost through a mistyped transfer | `Ownable2Step` requires acceptance | +| AC-6 | A compromised admin, owner or manager rewrites records | Trusted actor | +| MTX-3 | `forwarder = address(0)` trusts some sender | `msg.sender` is never `address(0)` | +| DATA-4 | A duplicated address in a batch | Last write wins, two events; tested | +| DOS-2 | Oversized strings | Only trusted writers choose them, and they pay for them | +| INT-1 | Any party can read any token's record | Records are public by design (`debt(address)`) | +| STD-1 | Wrong ERC-165 advertisement | Interface ids pinned in tests for both variants | +| UPG-1 / REE-1 | Upgrade, initializer and reentrancy | Not applicable | diff --git a/doc/tools/v0.3.0/aderyn-report-feedback.md b/doc/tools/v0.3.0/aderyn-report-feedback.md new file mode 100644 index 0000000..a2e433e --- /dev/null +++ b/doc/tools/v0.3.0/aderyn-report-feedback.md @@ -0,0 +1,35 @@ +# Aderyn report — feedback (DebtEngine v0.3.0) + +Report: [aderyn-report.md](./aderyn-report.md) · Overview: [../AUDIT_OVERVIEW.md](../AUDIT_OVERVIEW.md) + +| | | +|---|---| +| Tool | Aderyn 0.6.5 | +| Command | `aderyn -x mocks --output doc/tools/v0.3.0/aderyn-report.md` | +| Scope | `src/` (5 files, 182 nSLOC) from the Foundry config; mocks: none in the project; 0 `lib/` paths in the output | +| Commit | `3b86328` + the F-4 fix, 2026-11-17 (re-run after the fix: same findings) | + +## Executive triage + +**No finding is exploitable and nothing needs fixing.** 0 High, 7 Low (25 instances); every instance was checked against the source and is by design, environment-dependent or a false positive. + +## Findings + +| ID | Finding | Instances | Locations | Disposition | Reason | +|---|---|---|---|---|---| +| L-1 | Centralization Risk | 6 | `DebtEngineAccessControl.sol:14, 25, 27`; `DebtEngineOwnable.sol:16, 34, 36` | By design | The engine is a registry written by trusted parties: `DEFAULT_ADMIN_ROLE` and the two manager roles, or the owner. Documented in the README (access-control section) and in the Claude security audit (centralization premise) | +| L-2 | Unspecific Solidity Pragma | 5 | line 2 of every file in `src/` | By design | `^0.8.27` is the minimum for `require(condition, CustomError())` on the legacy pipeline and lets integrators compile with newer solc; the project itself pins solc 0.8.33 in `foundry.toml` and `hardhat.config.js` | +| L-3 | PUSH0 Opcode | 5 | line 2 of every file in `src/` | Environment | The build targets `evm_version = prague`. Chains without PUSH0 (pre-Shanghai) need `evm_version` lowered at deployment; no code change | +| L-4 | Empty Block | 4 | `DebtEngineAccessControl.sol:25, 27`; `DebtEngineOwnable.sol:34, 36` | By design | The authorization hooks have an empty body on purpose: the check is the modifier (`onlyRole(...)` / `onlyOwner`). Removing a modifier fails the test suite (mutation-tested) | +| L-5 | Loop Contains `require`/`revert` | 2 | `DebtEngineBase.sol:120` (`setCreditEventsBatch`), `:136` (`setDebtBatch`) | By design | The zero-address check runs per entry inside `_setDebt` / `_setCreditEvents`; an invalid entry must revert the whole batch rather than be skipped silently | +| L-6 | Costly operations inside loop | 2 | `DebtEngineBase.sol:120`, `:136` | By design | Each entry is one record write, which is the purpose of a batch. Bounded by `MAX_BATCH_SIZE` (500) and, in practice, by the per-transaction gas cap (documented in the NatSpec and README) | +| L-7 | Unchecked Return | 1 | `DebtEngineAccessControl.sol:20` (`_grantRole(DEFAULT_ADMIN_ROLE, admin)`) | False positive | In the constructor the role cannot be held yet, so `_grantRole` always returns `true`; `testRoleMembersAreEnumerable` checks the admin is the `DEFAULT_ADMIN_ROLE` member | + +## Delta from the previous v0.3.0 run (commit `df79202`) + +| Finding | Before | Now | Change | +|---|---|---|---| +| L-1 … L-4, L-7 | same instances | same instances | None | +| L-5, L-6 | `DebtEngineBase.sol:116`, `:132` | `:120`, `:136` | Line shift only: the clear-functions commit (`705208b`) added the `DebtCleared` / `CreditEventsCleared` events and two NatSpec lines above the batch functions | + +The `clearDebt` / `clearCreditEvents` functions added since the previous run produce no new finding. diff --git a/doc/tools/v0.3.0/aderyn-report.md b/doc/tools/v0.3.0/aderyn-report.md new file mode 100644 index 0000000..e65d2f4 --- /dev/null +++ b/doc/tools/v0.3.0/aderyn-report.md @@ -0,0 +1,302 @@ +# Aderyn report — DebtEngine v0.3.0 + +| | | +|---|---| +| Tool | Aderyn 0.6.5 | +| Command | `aderyn -x mocks --output doc/tools/v0.3.0/aderyn-report.md` | +| Scope | `src/` only (5 files, 182 nSLOC), read from the Foundry config; the project has no mocks. Scope check: 0 `lib/` paths in the output | +| Date / commit | 2026-11-17, `3b86328` + the F-4 fix (zero-address check in `_clearDebt` / `_clearCreditEvents`); findings unchanged by the fix | +| Result | **0 High · 7 Low** (25 instances) | + +| ID | Finding | Severity | Instances | Assessment | +|---|---|---|---|---| +| L-1 | Centralization Risk | Low | 6 | By design: admin / owner and managers are trusted roles | +| L-2 | Unspecific Solidity Pragma | Low | 5 | By design: `^0.8.27` for integrators; the project pins solc 0.8.33 | +| L-3 | PUSH0 Opcode | Low | 5 | Environment: target is `prague`; set `evm_version` for chains without PUSH0 | +| L-4 | Empty Block | Low | 4 | By design: authorization hooks, the check is the `onlyRole` / `onlyOwner` modifier | +| L-5 | Loop Contains `require`/`revert` | Low | 2 | By design: an invalid entry must revert the whole batch | +| L-6 | Costly operations inside loop | Low | 2 | By design: one storage write per record; batches bounded by `MAX_BATCH_SIZE` and the gas cap | +| L-7 | Unchecked Return | Low | 1 | False positive: `_grantRole` in the constructor always returns `true` on a fresh contract | + +**Nothing to fix.** Triage: [aderyn-report-feedback.md](./aderyn-report-feedback.md) · Overview: [../AUDIT_OVERVIEW.md](../AUDIT_OVERVIEW.md) + +--- + +# Aderyn Analysis Report + +This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a static analysis tool built by [Cyfrin](https://cyfrin.io), a blockchain security company. This report is not a substitute for manual audit or security review. It should not be relied upon for any purpose other than to assist in the identification of potential security vulnerabilities. +# Table of Contents + +- [Summary](#summary) + - [Files Summary](#files-summary) + - [Files Details](#files-details) + - [Issue Summary](#issue-summary) +- [Low Issues](#low-issues) + - [L-1: Centralization Risk](#l-1-centralization-risk) + - [L-2: Unspecific Solidity Pragma](#l-2-unspecific-solidity-pragma) + - [L-3: PUSH0 Opcode](#l-3-push0-opcode) + - [L-4: Empty Block](#l-4-empty-block) + - [L-5: Loop Contains `require`/`revert`](#l-5-loop-contains-requirerevert) + - [L-6: Costly operations inside loop](#l-6-costly-operations-inside-loop) + - [L-7: Unchecked Return](#l-7-unchecked-return) + + +# Summary + +## Files Summary + +| Key | Value | +| --- | --- | +| .sol Files | 5 | +| Total nSLOC | 182 | + + +## Files Details + +| Filepath | nSLOC | +| --- | --- | +| src/DebtEngineBase.sol | 108 | +| src/DebtEngineInvariantStorage.sol | 7 | +| src/deployment/DebtEngineAccessControl.sol | 36 | +| src/deployment/DebtEngineOwnable.sol | 24 | +| src/modules/VersionModule.sol | 7 | +| **Total** | **182** | + + +## Issue Summary + +| Category | No. of Issues | +| --- | --- | +| High | 0 | +| Low | 7 | + + +# Low Issues + +## L-1: Centralization Risk + +Contracts have owners with privileged rights to perform admin tasks and need to be trusted to not perform malicious updates or drain funds. + +
6 Found Instances + + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 14](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L14) + + ```solidity + contract DebtEngineAccessControl is DebtEngineBase, AccessControlEnumerable, ERC2771Context { + ``` + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 25](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L25) + + ```solidity + function _authorizeSetDebt() internal view virtual override onlyRole(DEBT_MANAGER_ROLE) {} + ``` + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 27](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L27) + + ```solidity + function _authorizeSetCreditEvents() internal view virtual override onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {} + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 16](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L16) + + ```solidity + contract DebtEngineOwnable is DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 { + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 34](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L34) + + ```solidity + function _authorizeSetDebt() internal view virtual override onlyOwner {} + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 36](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L36) + + ```solidity + function _authorizeSetCreditEvents() internal view virtual override onlyOwner {} + ``` + +
+ + + +## L-2: Unspecific Solidity Pragma + +Consider using a specific version of Solidity in your contracts instead of a wide version. For example, instead of `pragma solidity ^0.8.0;`, use `pragma solidity 0.8.0;` + +
5 Found Instances + + +- Found in src/DebtEngineBase.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/DebtEngineInvariantStorage.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineInvariantStorage.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/modules/VersionModule.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/modules/VersionModule.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +
+ + + +## L-3: PUSH0 Opcode + +Solc compiler version 0.8.20 switches the default target EVM version to Shanghai, which means that the generated bytecode will include PUSH0 opcodes. Be sure to select the appropriate EVM version in case you intend to deploy on a chain other than mainnet like L2 chains that may not support PUSH0, otherwise deployment of your contracts will fail. + +
5 Found Instances + + +- Found in src/DebtEngineBase.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/DebtEngineInvariantStorage.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineInvariantStorage.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +- Found in src/modules/VersionModule.sol [Line: 2](../../../../../home/ryan/Pictures/dev/DebtEngine/src/modules/VersionModule.sol#L2) + + ```solidity + pragma solidity ^0.8.27; + ``` + +
+ + + +## L-4: Empty Block + +Consider removing empty blocks. + +
4 Found Instances + + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 25](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L25) + + ```solidity + function _authorizeSetDebt() internal view virtual override onlyRole(DEBT_MANAGER_ROLE) {} + ``` + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 27](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L27) + + ```solidity + function _authorizeSetCreditEvents() internal view virtual override onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {} + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 34](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L34) + + ```solidity + function _authorizeSetDebt() internal view virtual override onlyOwner {} + ``` + +- Found in src/deployment/DebtEngineOwnable.sol [Line: 36](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineOwnable.sol#L36) + + ```solidity + function _authorizeSetCreditEvents() internal view virtual override onlyOwner {} + ``` + +
+ + + +## L-5: Loop Contains `require`/`revert` + +Avoid `require` / `revert` statements in a loop because a single bad item can cause the whole transaction to fail. It's better to forgive on fail and return failed elements post processing of the loop + +
2 Found Instances + + +- Found in src/DebtEngineBase.sol [Line: 120](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L120) + + ```solidity + for (uint256 i = 0; i < smartContracts.length; i++) { + ``` + +- Found in src/DebtEngineBase.sol [Line: 136](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L136) + + ```solidity + for (uint256 i = 0; i < smartContracts.length; i++) { + ``` + +
+ + + +## L-6: Costly operations inside loop + +Invoking `SSTORE` operations in loops may waste gas. Use a local variable to hold the loop computation result. + +
2 Found Instances + + +- Found in src/DebtEngineBase.sol [Line: 120](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L120) + + ```solidity + for (uint256 i = 0; i < smartContracts.length; i++) { + ``` + +- Found in src/DebtEngineBase.sol [Line: 136](../../../../../home/ryan/Pictures/dev/DebtEngine/src/DebtEngineBase.sol#L136) + + ```solidity + for (uint256 i = 0; i < smartContracts.length; i++) { + ``` + +
+ + + +## L-7: Unchecked Return + +Function returns a value but it is ignored. Consider checking the return value. + +
1 Found Instances + + +- Found in src/deployment/DebtEngineAccessControl.sol [Line: 20](../../../../../home/ryan/Pictures/dev/DebtEngine/src/deployment/DebtEngineAccessControl.sol#L20) + + ```solidity + _grantRole(DEFAULT_ADMIN_ROLE, admin); + ``` + +
+ + + diff --git a/doc/tools/v0.3.0/slither-report-feedback.md b/doc/tools/v0.3.0/slither-report-feedback.md new file mode 100644 index 0000000..3674a14 --- /dev/null +++ b/doc/tools/v0.3.0/slither-report-feedback.md @@ -0,0 +1,36 @@ +# Slither report — feedback (DebtEngine v0.3.0) + +Report: [slither-report.md](./slither-report.md) · Overview: [../AUDIT_OVERVIEW.md](../AUDIT_OVERVIEW.md) + +| | | +|---|---| +| Tool | Slither 0.11.6 | +| Command | `slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts\|test\|CMTAT\|forge-std\|script"` | +| Scope | `src/` (5 files); mocks: none in the project; dependencies (`lib/`), tests and `script/` excluded | +| Commit | `3b86328` + the F-4 fix, 2026-11-17 (re-run after the fix: same findings) | + +## Executive triage + +**No finding is exploitable and nothing needs fixing.** Slither reports 2 Informational results, both the same `dead-code` detector on a compiler-required override. + +## Findings + +| ID | Detector | Severity | Location | Disposition | Reason | +|---|---|---|---|---|---| +| ID-0 | `dead-code` | Informational | `src/deployment/DebtEngineAccessControl.sol:65-67` (`_msgData`) | By design | Required override: the contract inherits `Context` through both `AccessControlEnumerable` and `ERC2771Context`, and solc rejects the contract without an explicit `_msgData` override (`Error (6480)`). Nothing in `src/` or in the OpenZeppelin `AccessControl` / `Ownable` code it inherits calls `_msgData` (OpenZeppelin only calls it from `AccessManaged`, which is not used), so the function is unreachable but cannot be removed | +| ID-1 | `dead-code` | Informational | `src/deployment/DebtEngineOwnable.sol:46-48` (`_msgData`) | By design | Same reason, with `Ownable2Step` and `ERC2771Context` | + +The v0.3.0 code-quality review records the same pair as unreachable-but-required (coverage: the only uncovered functions are these two overrides), and a probe that moved the overrides into a shared module failed with `Error (6480)`. + +## Delta from the previous report (v0.2.0-era report, `src/DebtEngine.sol`) + +| Detector | Before | Now | Why | +|---|---|---|---| +| `dead-code` | 1 (`DebtEngine._msgData`) | 2 | The single contract was split into two deployment contracts; each carries its own required override | +| `solc-version` | 1 (`^0.8.20` has known severe issues, e.g. `VerbatimInvalidDeduplication`) | 0 | Pragma raised to `^0.8.27` (needed for `require` with custom errors); the build pins 0.8.33 | +| `similar-names` | 9 (`smartContract_` vs `smartContracts`) | 0 | Not reported by this run of Slither 0.11.6 on the refactored code; the parameter names are unchanged in substance and the finding was cosmetic | +| **Total** | **11** | **2** | | + +## Environment note + +The previous report could not be refreshed for most of the v0.3.0 cycle: the local `slither` launcher pointed at a Python 3.10 user install while the system `python3` is 3.14 (`ModuleNotFoundError: No module named 'slither'`). This run uses `uvx --from slither-analyzer slither …`, which installs Slither in an isolated cached environment. Slither runs `forge clean` and a forced rebuild as part of its Foundry compilation, so `out/` and `cache/` are rebuilt afterwards. diff --git a/doc/tools/v0.3.0/slither-report.md b/doc/tools/v0.3.0/slither-report.md new file mode 100644 index 0000000..c9708b6 --- /dev/null +++ b/doc/tools/v0.3.0/slither-report.md @@ -0,0 +1,39 @@ +# Slither report — DebtEngine v0.3.0 + +| | | +|---|---| +| Tool | Slither 0.11.6 (run with `uvx --from slither-analyzer`) | +| Command | `slither . --compile-force-framework foundry --checklist --filter-paths "openzeppelin-contracts\|test\|CMTAT\|forge-std\|script" > doc/tools/v0.3.0/slither-report.md` | +| Scope | `src/` only (5 files); dependencies, tests and deployment scripts filtered out; the project has no mocks. Scope check: 0 `lib/` paths in the output | +| Date / commit | 2026-11-17, `3b86328` + the F-4 fix (zero-address check in `_clearDebt` / `_clearCreditEvents`); findings unchanged by the fix | +| Result | **0 High · 0 Medium · 0 Low · 2 Informational** | + +| Detector | Severity | Instances | Assessment | +|---|---|---|---| +| `dead-code` | Informational | 2 | By design: `_msgData()` overrides in `DebtEngineAccessControl` / `DebtEngineOwnable` are required by the compiler (`Context` is inherited twice) and cannot be removed | + +**Nothing to fix.** Triage: [slither-report-feedback.md](./slither-report-feedback.md) · Overview: [../AUDIT_OVERVIEW.md](../AUDIT_OVERVIEW.md) + +--- + +'forge clean' running (wd: /home/ryan/Pictures/dev/DebtEngine) +'forge config --json' running +'forge build --build-info --deny never --skip ./test/** ./script/** --force' running (wd: /home/ryan/Pictures/dev/DebtEngine) +**THIS CHECKLIST IS NOT COMPLETE**. Use `--show-ignored-findings` to show all the results. +Summary + - [dead-code](#dead-code) (2 results) (Informational) +## dead-code +Impact: Informational +Confidence: Medium + - [ ] ID-0 +[DebtEngineAccessControl._msgData()](src/deployment/DebtEngineAccessControl.sol#L65-L67) is never used and should be removed + +src/deployment/DebtEngineAccessControl.sol#L65-L67 + + + - [ ] ID-1 +[DebtEngineOwnable._msgData()](src/deployment/DebtEngineOwnable.sol#L46-L48) is never used and should be removed + +src/deployment/DebtEngineOwnable.sol#L46-L48 + + diff --git a/foundry.toml b/foundry.toml index 25b918f..1c01a1e 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,6 +1,10 @@ [profile.default] +solc = "0.8.33" src = "src" out = "out" libs = ["lib"] +optimizer = true +optimizer_runs = 200 +evm_version = 'prague' # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/hardhat.config.js b/hardhat.config.js new file mode 100644 index 0000000..a0e318a --- /dev/null +++ b/hardhat.config.js @@ -0,0 +1,26 @@ +/** @type import('hardhat/config').HardhatUserConfig */ + +// Resolves imports with the Foundry remappings (`forge remappings`: CMTAT/, OZ/, @openzeppelin/...), +// so Hardhat compiles exactly the sources Foundry compiles. Requires `forge` on the PATH. +require('@nomicfoundation/hardhat-foundry') + +module.exports = { + // Same compiler settings as foundry.toml; keep the two in sync. + solidity: { + version: '0.8.33', + settings: { + optimizer: { + enabled: true, + runs: 200 + }, + evmVersion: 'prague' + } + }, + paths: { + // Production contracts only: the tests and scripts are Foundry (.t.sol / .s.sol). + sources: './src', + // Separate from Foundry's cache/ and out/. + cache: './cache_hardhat', + artifacts: './artifacts' + } +} diff --git a/lib/CMTAT b/lib/CMTAT index e8048d4..69eecc9 160000 --- a/lib/CMTAT +++ b/lib/CMTAT @@ -1 +1 @@ -Subproject commit e8048d43b0299afd83f150d3725ab299994b4271 +Subproject commit 69eecc9735ce8ada84fd35801888b05747658939 diff --git a/lib/forge-std b/lib/forge-std index 1714bee..c29afdd 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 1714bee72e286e73f76e320d110e0eaf5c4e649d +Subproject commit c29afdd40a82db50a3d3709d324416be50050e5e diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index dbb6104..fcbae53 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit dbb6104ce834628e473d2173bbc9d47f81a9eec3 +Subproject commit fcbae5394ae8ad52d8e580a3477db99814b9d565 diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable index 723f8ca..aa677e9 160000 --- a/lib/openzeppelin-contracts-upgradeable +++ b/lib/openzeppelin-contracts-upgradeable @@ -1 +1 @@ -Subproject commit 723f8cab09cdae1aca9ec9cc1cfa040c2d4b06c1 +Subproject commit aa677e9d28ed78fc427ec47ba2baef2030c58e7c diff --git a/package-lock.json b/package-lock.json index bbf8960..b065776 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,478 +5,4732 @@ "packages": { "": { "devDependencies": { + "@nomicfoundation/hardhat-foundry": "^1.2.1", + "hardhat": "^2.29.2", "prettier-plugin-solidity": "^1.4.1", "surya": "^0.4.11" } }, - "node_modules/@solidity-parser/parser": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", - "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", - "dev": true - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "node_modules/@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==", "dev": true, + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp.cjs" + }, "engines": { - "node": ">=8" + "node": ">=18" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@ethereumjs/util": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-9.1.0.tgz", + "integrity": "sha512-XBEKsYqLGXLah9PNJbgdkigthkG7TAGvlD/sH12beMXEyHDyigfcbdvHhmLyDWgDyOJn4QwiQUaF7yeuhnjdog==", "dev": true, + "license": "MPL-2.0", "dependencies": { - "color-convert": "^2.0.1" + "@ethereumjs/rlp": "^5.0.2", + "ethereum-cryptography": "^2.2.1" }, "engines": { - "node": ">=8" + "node": ">=18" + } + }, + "node_modules/@ethereumjs/util/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.4.0" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://paulmillr.com/funding/" } }, - "node_modules/antlr4ts": { - "version": "0.5.0-alpha.4", - "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", - "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", - "dev": true - }, - "node_modules/c3-linearization": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/c3-linearization/-/c3-linearization-0.3.0.tgz", - "integrity": "sha512-eQNsZQhFSJAhrNrITy2FpKh7EHS98q/pniDtQhndWqqsvayiPeqZ9T6I9V9PsHcm0nc+ZYJHKUvI/hh37I33HQ==", - "dev": true + "node_modules/@ethereumjs/util/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "node_modules/@ethereumjs/util/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", "dev": true, + "license": "MIT", "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" }, - "engines": { - "node": ">=12" + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@ethereumjs/util/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" }, - "engines": { - "node": ">=7.0.0" + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "node_modules/@ethereumjs/util/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", "dev": true, - "engines": { - "node": ">=0.1.90" + "license": "MIT", + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" } }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "node_modules/@ethersproject/abi": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.8.0.tgz", + "integrity": "sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==", "dev": true, - "engines": { - "node": ">=6" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "node_modules/@ethersproject/abstract-provider": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz", + "integrity": "sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg==", "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0" } }, - "node_modules/graphviz": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/graphviz/-/graphviz-0.0.9.tgz", - "integrity": "sha512-SmoY2pOtcikmMCqCSy2NO1YsRfu9OO0wpTlOYW++giGjfX1a6gax/m1Fo8IdUd0/3H15cTOfR1SMKwohj4LKsg==", + "node_modules/@ethersproject/abstract-signer": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz", + "integrity": "sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "temp": "~0.4.0" - }, - "engines": { - "node": ">=0.6.8" + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0" } }, - "node_modules/hasha": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", - "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "node_modules/@ethersproject/address": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.8.0.tgz", + "integrity": "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "is-stream": "^2.0.0", - "type-fest": "^0.8.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/rlp": "^5.8.0" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "node_modules/@ethersproject/base64": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.8.0.tgz", + "integrity": "sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ==", "dev": true, - "engines": { - "node": ">=8" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0" } }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "node_modules/@ethersproject/bignumber": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.8.0.tgz", + "integrity": "sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA==", "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "bn.js": "^5.2.1" } }, - "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "node_modules/@ethersproject/bytes": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.8.0.tgz", + "integrity": "sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A==", "dev": true, - "peer": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.8.0" } }, - "node_modules/prettier-plugin-solidity": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.4.1.tgz", - "integrity": "sha512-Mq8EtfacVZ/0+uDKTtHZGW3Aa7vEbX/BNx63hmVg6YTiTXSiuKP0amj0G6pGwjmLaOfymWh3QgXEZkjQbU8QRg==", + "node_modules/@ethersproject/constants": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.8.0.tgz", + "integrity": "sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "@solidity-parser/parser": "^0.18.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "prettier": ">=2.3.0" + "@ethersproject/bignumber": "^5.8.0" } }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "node_modules/@ethersproject/hash": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.8.0.tgz", + "integrity": "sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" } }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "node_modules/@ethersproject/keccak256": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.8.0.tgz", + "integrity": "sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng==", "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "js-sha3": "0.8.0" } }, - "node_modules/sha1-file": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/sha1-file/-/sha1-file-2.0.1.tgz", - "integrity": "sha512-L4Kum9Lp8cWqcGKycZcXxR6spUoG4idDIUzAKjPiELnIZWxiFlZ5HFVzFxVxuWuGPsrraeL0JoGk0nFZ7AGFEQ==", + "node_modules/@ethersproject/logger": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.8.0.tgz", + "integrity": "sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT" + }, + "node_modules/@ethersproject/networks": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.8.0.tgz", + "integrity": "sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "hasha": "^5.2.0" - }, - "engines": { - "node": ">=10" + "@ethersproject/logger": "^5.8.0" } }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "node_modules/@ethersproject/properties": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.8.0.tgz", + "integrity": "sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" + "@ethersproject/logger": "^5.8.0" } }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "node_modules/@ethersproject/rlp": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.8.0.tgz", + "integrity": "sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" } }, - "node_modules/surya": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/surya/-/surya-0.4.11.tgz", - "integrity": "sha512-SsDGqYQ1XCkGfCutLQ5s0Es2Tt41lY4FcrxlMiiOzPVJbD3AclI+Cot2SbtXuw/CeqRqaugLE5B95tfMDsRp9g==", + "node_modules/@ethersproject/signing-key": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.8.0.tgz", + "integrity": "sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "@solidity-parser/parser": "^0.16.1", - "c3-linearization": "^0.3.0", - "colors": "^1.4.0", - "graphviz": "0.0.9", - "sha1-file": "^2.0.0", - "treeify": "^1.1.0", - "yargs": "^17.0.0" - }, - "bin": { - "surya": "bin/surya" + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "bn.js": "^5.2.1", + "elliptic": "6.6.1", + "hash.js": "1.1.7" } }, - "node_modules/surya/node_modules/@solidity-parser/parser": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.2.tgz", - "integrity": "sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==", + "node_modules/@ethersproject/strings": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.8.0.tgz", + "integrity": "sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "antlr4ts": "^0.5.0-alpha.4" + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0" } }, - "node_modules/temp": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.4.0.tgz", - "integrity": "sha512-IsFisGgDKk7qzK9erMIkQe/XwiSUdac7z3wYOsjcLkhPBy3k1SlvLoIh2dAHIlEpgA971CgguMrx9z8fFg7tSA==", + "node_modules/@ethersproject/transactions": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.8.0.tgz", + "integrity": "sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg==", "dev": true, - "engines": [ - "node >=0.4.0" - ] + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0" + } }, - "node_modules/treeify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", - "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "node_modules/@ethersproject/web": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.8.0.tgz", + "integrity": "sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw==", "dev": true, - "engines": { - "node": ">=0.6" + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" } }, - "node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.6.0.tgz", + "integrity": "sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=10" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "node_modules/@noble/curves": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.2.tgz", + "integrity": "sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g==", "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.7.2" + }, "engines": { - "node": ">=10" + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", + "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@nomicfoundation/edr": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.12.0-next.23.tgz", + "integrity": "sha512-F2/6HZh8Q9RsgkOIkRrckldbhPjIZY7d4mT9LYuW68miwGQ5l7CkAgcz9fRRiurA0+YJhtsbx/EyrD9DmX9BOw==", + "dev": true, + "license": "MIT", "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" + "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.23", + "@nomicfoundation/edr-darwin-x64": "0.12.0-next.23", + "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.23", + "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.23", + "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.23", + "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.23", + "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.23" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-darwin-arm64": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.12.0-next.23.tgz", + "integrity": "sha512-Amh7mRoDzZyJJ4efqoePqdoZOzharmSOttZuJDlVE5yy07BoE8hL6ZRpa5fNYn0LCqn/KoWs8OHANWxhKDGhvQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-darwin-x64": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.12.0-next.23.tgz", + "integrity": "sha512-9wn489FIQm7m0UCD+HhktjWx6vskZzeZD9oDc2k9ZvbBzdXwPp5tiDqUBJ+eQpByAzCDfteAJwRn2lQCE0U+Iw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.12.0-next.23.tgz", + "integrity": "sha512-nlk5EejSzEUfEngv0Jkhqq3/wINIfF2ED9wAofc22w/V1DV99ASh9l3/e/MIHOQFecIZ9MDqt0Em9/oDyB1Uew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.12.0-next.23.tgz", + "integrity": "sha512-SJuPBp3Rc6vM92UtVTUxZQ/QlLhLfwTftt2XUiYohmGKB3RjGzpgduEFMCA0LEnucUckU6UHrJNFHiDm77C4PQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.12.0-next.23.tgz", + "integrity": "sha512-NU+Qs3u7Qt6t3bJFdmmjd5CsvgI2bPPzO31KifM2Ez96/jsXYho5debtTQnimlb5NAqiHTSlxjh/F8ROcptmeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-musl": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.12.0-next.23.tgz", + "integrity": "sha512-F78fZA2h6/ssiCSZOovlgIu0dUeI7ItKPsDDF3UUlIibef052GCXmliMinC90jVPbrjUADMd1BUwjfI0Z8OllQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.12.0-next.23.tgz", + "integrity": "sha512-IfJZQJn7d/YyqhmguBIGoCKjE9dKjbu6V6iNEPApfwf5JyyjHYyyfkLU4rf7hygj57bfH4sl1jtQ6r8HnT62lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@nomicfoundation/hardhat-foundry": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-foundry/-/hardhat-foundry-1.2.1.tgz", + "integrity": "sha512-pH1KeyI0sysgi7I7uQKPLXWl895EkuS6V41rSi820Ipqp/FScIwDh27RbevgC9zJ4ufSsSz34njm9cvRMGMNVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.1.0" + }, + "peerDependencies": { + "hardhat": "^2.26.0" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz", + "integrity": "sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + }, + "optionalDependencies": { + "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2", + "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-arm64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz", + "integrity": "sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-x64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.2.tgz", + "integrity": "sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.2.tgz", + "integrity": "sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.2.tgz", + "integrity": "sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.2.tgz", + "integrity": "sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.2.tgz", + "integrity": "sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-win32-x64-msvc": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.2.tgz", + "integrity": "sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@scure/bip39": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@sentry/core": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", + "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/hub": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", + "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/minimal": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", + "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/node": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", + "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/core": "5.30.0", + "@sentry/hub": "5.30.0", + "@sentry/tracing": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/tracing": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", + "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/types": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", + "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", + "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@solidity-parser/parser": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", + "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + "dev": true + }, + "node_modules/adm-zip": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.6.1.tgz", + "integrity": "sha512-Xwrja8nx9e5o2N1my4DsKCeKpdrnACyr1wtbPxBDgGzKzKyE9kRtBFA8mWldI+RVlD7CBZNWY/wQ2+ydwOR6kQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/antlr4ts": { + "version": "0.5.0-alpha.4", + "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", + "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/bn.js": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.5.tgz", + "integrity": "sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true, + "license": "MIT" + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true, + "license": "ISC" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/c3-linearization": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/c3-linearization/-/c3-linearization-0.3.0.tgz", + "integrity": "sha512-eQNsZQhFSJAhrNrITy2FpKh7EHS98q/pniDtQhndWqqsvayiPeqZ9T6I9V9PsHcm0nc+ZYJHKUvI/hh37I33HQ==", + "dev": true + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.5", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.5.tgz", + "integrity": "sha512-3aRg6/JxfffFD+OlOjOFR3Vo79l39ooBTFucxx+MT3dhCtzn3EmiUPQo+6/OZuI2jbXi3YKgmiTFBgChQMwIRQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ethereum-cryptography": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", + "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fp-ts": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", + "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/graphviz": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/graphviz/-/graphviz-0.0.9.tgz", + "integrity": "sha512-SmoY2pOtcikmMCqCSy2NO1YsRfu9OO0wpTlOYW++giGjfX1a6gax/m1Fo8IdUd0/3H15cTOfR1SMKwohj4LKsg==", + "dev": true, + "dependencies": { + "temp": "~0.4.0" + }, + "engines": { + "node": ">=0.6.8" + } + }, + "node_modules/hardhat": { + "version": "2.29.2", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.29.2.tgz", + "integrity": "sha512-PCRtmT0C1B1EmOH0KFMtQZtyhhCi+AoE64u5M//9BYvTrBvJetoy1X7eMS6rZX6vPFNuctp9DM14VgI61rYTYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ethereumjs/util": "^9.1.0", + "@ethersproject/abi": "^5.1.2", + "@nomicfoundation/edr": "0.12.0-next.23", + "@nomicfoundation/solidity-analyzer": "^0.1.0", + "@sentry/node": "^5.18.1", + "adm-zip": "^0.6.0", + "aggregate-error": "^3.0.0", + "ansi-escapes": "^4.3.0", + "boxen": "^5.1.2", + "chokidar": "^4.0.0", + "ci-info": "^2.0.0", + "debug": "^4.1.1", + "enquirer": "^2.3.0", + "env-paths": "^2.2.0", + "ethereum-cryptography": "^1.0.3", + "find-up": "^5.0.0", + "fp-ts": "1.19.3", + "fs-extra": "^7.0.1", + "immutable": "^4.0.0-rc.12", + "io-ts": "1.10.4", + "json-stream-stringify": "^3.1.4", + "keccak": "^3.0.2", + "lodash": "^4.17.11", + "micro-eth-signer": "^0.14.0", + "mnemonist": "^0.38.0", + "mocha": "^11.1.0", + "p-map": "^4.0.0", + "picocolors": "^1.1.0", + "raw-body": "^2.4.1", + "resolve": "1.17.0", + "semver": "^6.3.0", + "solc": "0.8.26", + "source-map-support": "^0.5.13", + "stacktrace-parser": "^0.1.10", + "tinyglobby": "^0.2.6", + "tsort": "0.0.1", + "undici": "^6.28.0", + "ws": "^7.4.6" + }, + "bin": { + "hardhat": "internal/cli/bootstrap.js" + }, + "peerDependencies": { + "ts-node": "*", + "typescript": "*" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/hardhat/node_modules/semver": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "dependencies": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/immutable": { + "version": "4.3.9", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.9.tgz", + "integrity": "sha512-ObHy4YN7ycwZOUCLI1/6svfyAFu7vL8RhAvVu/bh/RZW9EPlOyDaQ9jDQWCtdqzaXUjgXZCW1migtHE7YI7UGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/io-ts": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", + "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fp-ts": "^1.0.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-stream-stringify": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/json-stream-stringify/-/json-stream-stringify-3.1.7.tgz", + "integrity": "sha512-F4MWetLtY42YMaAKw5cV4e47zMD5aOT+tjjQWjX18ACtdkQ5Y/vrcfbcQ107Rh+MXjOCIx4KhW0wPmOvG8iQ5w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=7.10.1" + } + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keccak": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", + "integrity": "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/micro-eth-signer": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.14.0.tgz", + "integrity": "sha512-5PLLzHiVYPWClEvZIXXFu5yutzpadb73rnQCpUqIHu3No3coFuWQNfE5tkBQJ7djuLYl6aRLaS0MgWJYGoqiBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.8.1", + "@noble/hashes": "~1.7.1", + "micro-packed": "~0.7.2" + } + }, + "node_modules/micro-eth-signer/node_modules/@noble/hashes": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", + "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/micro-packed": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.7.3.tgz", + "integrity": "sha512-2Milxs+WNC00TRlem41oRswvw31146GiSaoCT7s3Xi2gMUglW5QBeqlQaZeHr5tJx9nm3i57LNXPqxOOaWtTYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/micro-packed/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mnemonist": { + "version": "0.38.5", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", + "integrity": "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "obliterator": "^2.0.0" + } + }, + "node_modules/mocha": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.8.0.tgz", + "integrity": "sha512-VyCeUdGN3A9lmCTTgG4yuvY9ixxaDk+xt2R/7/+1AP6EqNG+G9OKkzBwhVtVYoNX8YsxNSgAl8mOv3IAeOpFbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-stdout": "^1.3.1", + "chokidar": "^4.0.1", + "debug": "^4.3.5", + "diff": "^7.0.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^10.4.5", + "he": "^1.2.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^9.0.5", + "ms": "^2.1.3", + "picocolors": "^1.1.1", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^9.2.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1", + "yargs-unparser": "^2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "dev": true, + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/obliterator": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.5.tgz", + "integrity": "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==", + "dev": true, + "license": "MIT" + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-solidity": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.4.1.tgz", + "integrity": "sha512-Mq8EtfacVZ/0+uDKTtHZGW3Aa7vEbX/BNx63hmVg6YTiTXSiuKP0amj0G6pGwjmLaOfymWh3QgXEZkjQbU8QRg==", + "dev": true, + "dependencies": { + "@solidity-parser/parser": "^0.18.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "prettier": ">=2.3.0" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/sha1-file": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/sha1-file/-/sha1-file-2.0.1.tgz", + "integrity": "sha512-L4Kum9Lp8cWqcGKycZcXxR6spUoG4idDIUzAKjPiELnIZWxiFlZ5HFVzFxVxuWuGPsrraeL0JoGk0nFZ7AGFEQ==", + "dev": true, + "dependencies": { + "hasha": "^5.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/solc": { + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.26.tgz", + "integrity": "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solc.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/solc/node_modules/semver": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.3.tgz", + "integrity": "sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stacktrace-parser": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz", + "integrity": "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.7.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stacktrace-parser/node_modules/type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/surya": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/surya/-/surya-0.4.11.tgz", + "integrity": "sha512-SsDGqYQ1XCkGfCutLQ5s0Es2Tt41lY4FcrxlMiiOzPVJbD3AclI+Cot2SbtXuw/CeqRqaugLE5B95tfMDsRp9g==", + "dev": true, + "dependencies": { + "@solidity-parser/parser": "^0.16.1", + "c3-linearization": "^0.3.0", + "colors": "^1.4.0", + "graphviz": "0.0.9", + "sha1-file": "^2.0.0", + "treeify": "^1.1.0", + "yargs": "^17.0.0" + }, + "bin": { + "surya": "bin/surya" + } + }, + "node_modules/surya/node_modules/@solidity-parser/parser": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.2.tgz", + "integrity": "sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==", + "dev": true, + "dependencies": { + "antlr4ts": "^0.5.0-alpha.4" + } + }, + "node_modules/temp": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.4.0.tgz", + "integrity": "sha512-IsFisGgDKk7qzK9erMIkQe/XwiSUdac7z3wYOsjcLkhPBy3k1SlvLoIh2dAHIlEpgA971CgguMrx9z8fFg7tSA==", + "dev": true, + "engines": [ + "node >=0.4.0" + ] + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tsort": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", + "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==", + "dev": true, + "license": "MIT" + }, + "node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/undici": { + "version": "6.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/workerpool": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", + "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/ws": { + "version": "7.5.14", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.14.tgz", + "integrity": "sha512-u9Oi2nQ8SZnTUAf6spLLKF5TyqoG3Nbbrd4ai6Sjo4P24bycDewhQqtNMIg4bFpnpH/TD4qk4IuAVhT0HIIqug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==", + "dev": true + }, + "@ethereumjs/util": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-9.1.0.tgz", + "integrity": "sha512-XBEKsYqLGXLah9PNJbgdkigthkG7TAGvlD/sH12beMXEyHDyigfcbdvHhmLyDWgDyOJn4QwiQUaF7yeuhnjdog==", + "dev": true, + "requires": { + "@ethereumjs/rlp": "^5.0.2", + "ethereum-cryptography": "^2.2.1" + }, + "dependencies": { + "@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "requires": { + "@noble/hashes": "1.4.0" + } + }, + "@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true + }, + "@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "requires": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + } + }, + "@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "requires": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + } + }, + "ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "requires": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + } + } + }, + "@ethersproject/abi": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.8.0.tgz", + "integrity": "sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==", + "dev": true, + "requires": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz", + "integrity": "sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg==", + "dev": true, + "requires": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz", + "integrity": "sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA==", + "dev": true, + "requires": { + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0" + } + }, + "@ethersproject/address": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.8.0.tgz", + "integrity": "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA==", + "dev": true, + "requires": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/rlp": "^5.8.0" + } + }, + "@ethersproject/base64": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.8.0.tgz", + "integrity": "sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.8.0.tgz", + "integrity": "sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "bn.js": "^5.2.1" + } + }, + "@ethersproject/bytes": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.8.0.tgz", + "integrity": "sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A==", + "dev": true, + "requires": { + "@ethersproject/logger": "^5.8.0" + } + }, + "@ethersproject/constants": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.8.0.tgz", + "integrity": "sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg==", + "dev": true, + "requires": { + "@ethersproject/bignumber": "^5.8.0" + } + }, + "@ethersproject/hash": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.8.0.tgz", + "integrity": "sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA==", + "dev": true, + "requires": { + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.8.0.tgz", + "integrity": "sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.8.0.tgz", + "integrity": "sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA==", + "dev": true + }, + "@ethersproject/networks": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.8.0.tgz", + "integrity": "sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg==", + "dev": true, + "requires": { + "@ethersproject/logger": "^5.8.0" + } + }, + "@ethersproject/properties": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.8.0.tgz", + "integrity": "sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw==", + "dev": true, + "requires": { + "@ethersproject/logger": "^5.8.0" + } + }, + "@ethersproject/rlp": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.8.0.tgz", + "integrity": "sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.8.0.tgz", + "integrity": "sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "bn.js": "^5.2.1", + "elliptic": "6.6.1", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.8.0.tgz", + "integrity": "sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg==", + "dev": true, + "requires": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "@ethersproject/transactions": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.8.0.tgz", + "integrity": "sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg==", + "dev": true, + "requires": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0" + } + }, + "@ethersproject/web": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.8.0.tgz", + "integrity": "sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw==", + "dev": true, + "requires": { + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.6.0.tgz", + "integrity": "sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "requires": { + "ansi-regex": "^6.2.2" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, + "@noble/curves": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.2.tgz", + "integrity": "sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g==", + "dev": true, + "requires": { + "@noble/hashes": "1.7.2" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", + "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", + "dev": true + } + } + }, + "@noble/hashes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", + "dev": true + }, + "@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true + }, + "@nomicfoundation/edr": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.12.0-next.23.tgz", + "integrity": "sha512-F2/6HZh8Q9RsgkOIkRrckldbhPjIZY7d4mT9LYuW68miwGQ5l7CkAgcz9fRRiurA0+YJhtsbx/EyrD9DmX9BOw==", + "dev": true, + "requires": { + "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.23", + "@nomicfoundation/edr-darwin-x64": "0.12.0-next.23", + "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.23", + "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.23", + "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.23", + "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.23", + "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.23" + } + }, + "@nomicfoundation/edr-darwin-arm64": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.12.0-next.23.tgz", + "integrity": "sha512-Amh7mRoDzZyJJ4efqoePqdoZOzharmSOttZuJDlVE5yy07BoE8hL6ZRpa5fNYn0LCqn/KoWs8OHANWxhKDGhvQ==", + "dev": true + }, + "@nomicfoundation/edr-darwin-x64": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.12.0-next.23.tgz", + "integrity": "sha512-9wn489FIQm7m0UCD+HhktjWx6vskZzeZD9oDc2k9ZvbBzdXwPp5tiDqUBJ+eQpByAzCDfteAJwRn2lQCE0U+Iw==", + "dev": true + }, + "@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.12.0-next.23.tgz", + "integrity": "sha512-nlk5EejSzEUfEngv0Jkhqq3/wINIfF2ED9wAofc22w/V1DV99ASh9l3/e/MIHOQFecIZ9MDqt0Em9/oDyB1Uew==", + "dev": true + }, + "@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.12.0-next.23.tgz", + "integrity": "sha512-SJuPBp3Rc6vM92UtVTUxZQ/QlLhLfwTftt2XUiYohmGKB3RjGzpgduEFMCA0LEnucUckU6UHrJNFHiDm77C4PQ==", + "dev": true + }, + "@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.12.0-next.23.tgz", + "integrity": "sha512-NU+Qs3u7Qt6t3bJFdmmjd5CsvgI2bPPzO31KifM2Ez96/jsXYho5debtTQnimlb5NAqiHTSlxjh/F8ROcptmeQ==", + "dev": true + }, + "@nomicfoundation/edr-linux-x64-musl": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.12.0-next.23.tgz", + "integrity": "sha512-F78fZA2h6/ssiCSZOovlgIu0dUeI7ItKPsDDF3UUlIibef052GCXmliMinC90jVPbrjUADMd1BUwjfI0Z8OllQ==", + "dev": true + }, + "@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.12.0-next.23", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.12.0-next.23.tgz", + "integrity": "sha512-IfJZQJn7d/YyqhmguBIGoCKjE9dKjbu6V6iNEPApfwf5JyyjHYyyfkLU4rf7hygj57bfH4sl1jtQ6r8HnT62lw==", + "dev": true + }, + "@nomicfoundation/hardhat-foundry": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-foundry/-/hardhat-foundry-1.2.1.tgz", + "integrity": "sha512-pH1KeyI0sysgi7I7uQKPLXWl895EkuS6V41rSi820Ipqp/FScIwDh27RbevgC9zJ4ufSsSz34njm9cvRMGMNVA==", + "dev": true, + "requires": { + "picocolors": "^1.1.0" + } + }, + "@nomicfoundation/solidity-analyzer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz", + "integrity": "sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA==", + "dev": true, + "requires": { + "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2", + "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2" + } + }, + "@nomicfoundation/solidity-analyzer-darwin-arm64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz", + "integrity": "sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-darwin-x64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.2.tgz", + "integrity": "sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.2.tgz", + "integrity": "sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.2.tgz", + "integrity": "sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.2.tgz", + "integrity": "sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-linux-x64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.2.tgz", + "integrity": "sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg==", + "dev": true, + "optional": true + }, + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.2.tgz", + "integrity": "sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA==", + "dev": true, + "optional": true + }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, + "@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true + }, + "@scure/bip32": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", + "dev": true, + "requires": { + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", + "@scure/base": "~1.1.0" + } + }, + "@scure/bip39": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", + "dev": true, + "requires": { + "@noble/hashes": "~1.2.0", + "@scure/base": "~1.1.0" + } + }, + "@sentry/core": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", + "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", + "dev": true, + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", + "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", + "dev": true, + "requires": { + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", + "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", + "dev": true, + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/node": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", + "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", + "dev": true, + "requires": { + "@sentry/core": "5.30.0", + "@sentry/hub": "5.30.0", + "@sentry/tracing": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + } + }, + "@sentry/tracing": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", + "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", + "dev": true, + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", + "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==", + "dev": true + }, + "@sentry/utils": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", + "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", + "dev": true, + "requires": { + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@solidity-parser/parser": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", + "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + "dev": true + }, + "adm-zip": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.6.1.tgz", + "integrity": "sha512-Xwrja8nx9e5o2N1my4DsKCeKpdrnACyr1wtbPxBDgGzKzKyE9kRtBFA8mWldI+RVlD7CBZNWY/wQ2+ydwOR6kQ==", + "dev": true + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + } + }, + "ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + }, + "dependencies": { + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + } + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "antlr4ts": { + "version": "0.5.0-alpha.4", + "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", + "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "bn.js": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.5.tgz", + "integrity": "sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==", + "dev": true + }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "brace-expansion": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true + }, + "c3-linearization": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/c3-linearization/-/c3-linearization-0.3.0.tgz", + "integrity": "sha512-eQNsZQhFSJAhrNrITy2FpKh7EHS98q/pniDtQhndWqqsvayiPeqZ9T6I9V9PsHcm0nc+ZYJHKUvI/hh37I33HQ==", + "dev": true + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "requires": { + "readdirp": "^4.0.1" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true + }, + "cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true + }, + "diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true + }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dev": true, + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.5", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.5.tgz", + "integrity": "sha512-3aRg6/JxfffFD+OlOjOFR3Vo79l39ooBTFucxx+MT3dhCtzn3EmiUPQo+6/OZuI2jbXi3YKgmiTFBgChQMwIRQ==", + "dev": true + } + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + } + }, + "env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "ethereum-cryptography": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", + "dev": true, + "requires": { + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" + } + }, + "fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "requires": {} + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "follow-redirects": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", + "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==", + "dev": true + }, + "foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + } + }, + "fp-ts": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", + "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==", + "dev": true + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + } + }, + "graceful-fs": { + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", + "dev": true + }, + "graphviz": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/graphviz/-/graphviz-0.0.9.tgz", + "integrity": "sha512-SmoY2pOtcikmMCqCSy2NO1YsRfu9OO0wpTlOYW++giGjfX1a6gax/m1Fo8IdUd0/3H15cTOfR1SMKwohj4LKsg==", + "dev": true, + "requires": { + "temp": "~0.4.0" + } + }, + "hardhat": { + "version": "2.29.2", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.29.2.tgz", + "integrity": "sha512-PCRtmT0C1B1EmOH0KFMtQZtyhhCi+AoE64u5M//9BYvTrBvJetoy1X7eMS6rZX6vPFNuctp9DM14VgI61rYTYQ==", + "dev": true, + "requires": { + "@ethereumjs/util": "^9.1.0", + "@ethersproject/abi": "^5.1.2", + "@nomicfoundation/edr": "0.12.0-next.23", + "@nomicfoundation/solidity-analyzer": "^0.1.0", + "@sentry/node": "^5.18.1", + "adm-zip": "^0.6.0", + "aggregate-error": "^3.0.0", + "ansi-escapes": "^4.3.0", + "boxen": "^5.1.2", + "chokidar": "^4.0.0", + "ci-info": "^2.0.0", + "debug": "^4.1.1", + "enquirer": "^2.3.0", + "env-paths": "^2.2.0", + "ethereum-cryptography": "^1.0.3", + "find-up": "^5.0.0", + "fp-ts": "1.19.3", + "fs-extra": "^7.0.1", + "immutable": "^4.0.0-rc.12", + "io-ts": "1.10.4", + "json-stream-stringify": "^3.1.4", + "keccak": "^3.0.2", + "lodash": "^4.17.11", + "micro-eth-signer": "^0.14.0", + "mnemonist": "^0.38.0", + "mocha": "^11.1.0", + "p-map": "^4.0.0", + "picocolors": "^1.1.0", + "raw-body": "^2.4.1", + "resolve": "1.17.0", + "semver": "^6.3.0", + "solc": "0.8.26", + "source-map-support": "^0.5.13", + "stacktrace-parser": "^0.1.10", + "tinyglobby": "^0.2.6", + "tsort": "0.0.1", + "undici": "^6.28.0", + "ws": "^7.4.6" + }, + "dependencies": { + "semver": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true + } + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "requires": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dev": true, + "requires": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "immutable": { + "version": "4.3.9", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.9.tgz", + "integrity": "sha512-ObHy4YN7ycwZOUCLI1/6svfyAFu7vL8RhAvVu/bh/RZW9EPlOyDaQ9jDQWCtdqzaXUjgXZCW1migtHE7YI7UGQ==", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "io-ts": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", + "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", + "dev": true, + "requires": { + "fp-ts": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true + }, + "js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "json-stream-stringify": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/json-stream-stringify/-/json-stream-stringify-3.1.7.tgz", + "integrity": "sha512-F4MWetLtY42YMaAKw5cV4e47zMD5aOT+tjjQWjX18ACtdkQ5Y/vrcfbcQ107Rh+MXjOCIx4KhW0wPmOvG8iQ5w==", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "keccak": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", + "integrity": "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==", + "dev": true, + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", + "dev": true + }, + "lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "dev": true + }, + "micro-eth-signer": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.14.0.tgz", + "integrity": "sha512-5PLLzHiVYPWClEvZIXXFu5yutzpadb73rnQCpUqIHu3No3coFuWQNfE5tkBQJ7djuLYl6aRLaS0MgWJYGoqiBw==", + "dev": true, + "requires": { + "@noble/curves": "~1.8.1", + "@noble/hashes": "~1.7.1", + "micro-packed": "~0.7.2" }, - "engines": { - "node": ">=12" + "dependencies": { + "@noble/hashes": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", + "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", + "dev": true + } } }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "micro-packed": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.7.3.tgz", + "integrity": "sha512-2Milxs+WNC00TRlem41oRswvw31146GiSaoCT7s3Xi2gMUglW5QBeqlQaZeHr5tJx9nm3i57LNXPqxOOaWtTYg==", "dev": true, - "engines": { - "node": ">=12" + "requires": { + "@scure/base": "~1.2.5" + }, + "dependencies": { + "@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "dev": true + } } - } - }, - "dependencies": { - "@solidity-parser/parser": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", - "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "dev": true }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", "dev": true }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "brace-expansion": "^2.0.2" } }, - "antlr4ts": { - "version": "0.5.0-alpha.4", - "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", - "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", - "dev": true - }, - "c3-linearization": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/c3-linearization/-/c3-linearization-0.3.0.tgz", - "integrity": "sha512-eQNsZQhFSJAhrNrITy2FpKh7EHS98q/pniDtQhndWqqsvayiPeqZ9T6I9V9PsHcm0nc+ZYJHKUvI/hh37I33HQ==", + "minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", "dev": true }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "mnemonist": { + "version": "0.38.5", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", + "integrity": "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg==", "dev": true, "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" + "obliterator": "^2.0.0" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "mocha": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.8.0.tgz", + "integrity": "sha512-VyCeUdGN3A9lmCTTgG4yuvY9ixxaDk+xt2R/7/+1AP6EqNG+G9OKkzBwhVtVYoNX8YsxNSgAl8mOv3IAeOpFbw==", "dev": true, "requires": { - "color-name": "~1.1.4" + "browser-stdout": "^1.3.1", + "chokidar": "^4.0.1", + "debug": "^4.3.5", + "diff": "^7.0.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^10.4.5", + "he": "^1.2.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^9.0.5", + "ms": "^2.1.3", + "picocolors": "^1.1.1", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^9.2.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1", + "yargs-unparser": "^2.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "dev": true }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", "dev": true }, - "escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "obliterator": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.5.tgz", + "integrity": "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==", "dev": true }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "dev": true }, - "graphviz": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/graphviz/-/graphviz-0.0.9.tgz", - "integrity": "sha512-SmoY2pOtcikmMCqCSy2NO1YsRfu9OO0wpTlOYW++giGjfX1a6gax/m1Fo8IdUd0/3H15cTOfR1SMKwohj4LKsg==", + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { - "temp": "~0.4.0" + "yocto-queue": "^0.1.0" } }, - "hasha": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", - "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "is-stream": "^2.0.0", - "type-fest": "^0.8.0" + "p-limit": "^3.0.2" } }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "requires": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + } + }, + "picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true }, "prettier": { @@ -496,18 +4750,92 @@ "semver": "^7.5.4" } }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "dev": true, + "requires": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true }, + "serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, "sha1-file": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/sha1-file/-/sha1-file-2.0.1.tgz", @@ -517,6 +4845,98 @@ "hasha": "^5.2.0" } }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true + }, + "solc": { + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.26.tgz", + "integrity": "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==", + "dev": true, + "requires": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "dependencies": { + "semver": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.3.tgz", + "integrity": "sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ==", + "dev": true + } + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "stacktrace-parser": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz", + "integrity": "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==", + "dev": true, + "requires": { + "type-fest": "^0.7.1" + }, + "dependencies": { + "type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "dev": true + } + } + }, + "statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "dev": true + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -528,6 +4948,17 @@ "strip-ansi": "^6.0.1" } }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -537,6 +4968,30 @@ "ansi-regex": "^5.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "surya": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/surya/-/surya-0.4.11.tgz", @@ -569,18 +5024,103 @@ "integrity": "sha512-IsFisGgDKk7qzK9erMIkQe/XwiSUdac7z3wYOsjcLkhPBy3k1SlvLoIh2dAHIlEpgA971CgguMrx9z8fFg7tSA==", "dev": true }, + "tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "requires": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true + }, "treeify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", "dev": true }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsort": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", + "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==", + "dev": true + }, "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "undici": { + "version": "6.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + } + }, + "workerpool": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", + "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", + "dev": true + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -592,6 +5132,24 @@ "strip-ansi": "^6.0.0" } }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "ws": { + "version": "7.5.14", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.14.tgz", + "integrity": "sha512-u9Oi2nQ8SZnTUAf6spLLKF5TyqoG3Nbbrd4ai6Sjo4P24bycDewhQqtNMIg4bFpnpH/TD4qk4IuAVhT0HIIqug==", + "dev": true, + "requires": {} + }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -618,6 +5176,24 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 313d17f..b9ffa5f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,11 @@ { + "scripts": { + "compile:hardhat": "hardhat compile", + "clean:hardhat": "hardhat clean" + }, "devDependencies": { + "@nomicfoundation/hardhat-foundry": "^1.2.1", + "hardhat": "^2.29.2", "prettier-plugin-solidity": "^1.4.1", "surya": "^0.4.11" } diff --git a/script/ConnectDebtEngine.s.sol b/script/ConnectDebtEngine.s.sol new file mode 100644 index 0000000..7f1cf3f --- /dev/null +++ b/script/ConnectDebtEngine.s.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Script} from "forge-std/Script.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {IDebtEngine} from "CMTAT/interfaces/engine/IDebtEngine.sol"; +import {DebtEngineModule} from "CMTAT/modules/wrapper/options/DebtEngineModule.sol"; + +/** + * @title Connect a CMTAT v3.0.0 debt token to a DebtEngine + * @dev Runs on the token side: the broadcaster must hold the token's `DEBT_ROLE` (CMTAT's `DEFAULT_ADMIN_ROLE` + * implicitly does). For an upgradeable token, `TOKEN` is the proxy address. + * + * Environment variables: + * - `TOKEN` (required): the CMTAT debt token (`CMTATStandaloneDebt` or the `CMTATUpgradeableDebt` proxy). + * - `DEBT_ENGINE` (required): the engine to connect. + * - `ALLOW_EMPTY_RECORD` (optional, default `false`): connect even if the engine holds no debt record for the + * token. Once connected, the token reads only the engine, so connecting first hides the token's own data. + * + * Usage: + * TOKEN=0x... DEBT_ENGINE=0x... forge script script/ConnectDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast + */ +contract ConnectDebtEngine is Script { + struct Config { + address token; + address engine; + bool allowEmptyRecord; + } + + error NoDebtRecordForToken(address engine, address token); + + function run() external { + connect( + Config({ + token: vm.envAddress("TOKEN"), + engine: vm.envAddress("DEBT_ENGINE"), + allowEmptyRecord: vm.envOr("ALLOW_EMPTY_RECORD", false) + }) + ); + } + + /// @notice Checks the engine holds the token's record, connects the token, and checks the token now reads it. + function connect(Config memory cfg) public { + DebtEngineBase engine = DebtEngineBase(cfg.engine); + require(cfg.allowEmptyRecord || engine.hasDebt(cfg.token), NoDebtRecordForToken(cfg.engine, cfg.token)); + + vm.startBroadcast(); + DebtEngineModule(cfg.token).setDebtEngine(IDebtEngine(cfg.engine)); + vm.stopBroadcast(); + + require(address(DebtEngineModule(cfg.token).debtEngine()) == cfg.engine, "DebtEngine: not connected"); + } +} diff --git a/script/DeployDebtEngine.s.sol b/script/DeployDebtEngine.s.sol new file mode 100644 index 0000000..ecd9a7a --- /dev/null +++ b/script/DeployDebtEngine.s.sol @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Script} from "forge-std/Script.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {DebtEngineAccessControl} from "../src/deployment/DebtEngineAccessControl.sol"; +import {DebtEngineOwnable} from "../src/deployment/DebtEngineOwnable.sol"; + +/** + * @title Deploy a DebtEngine (RBAC or Ownable variant) + * @dev Environment variables (all optional): + * - `ENGINE_VARIANT`: `access-control` (default) or `ownable`. + * - `ENGINE_ADMIN`: initial admin / owner; defaults to the broadcaster. + * - `FORWARDER`: ERC-2771 trusted forwarder, immutable; defaults to `address(0)` (meta-transactions disabled). + * - `DEBT_MANAGER`, `CREDIT_EVENTS_MANAGER` (RBAC only): granted the manager roles when set. Granting needs the + * broadcaster to be the admin. + * + * Usage: + * forge script script/DeployDebtEngine.s.sol --rpc-url $RPC_URL --account --broadcast + */ +contract DeployDebtEngine is Script { + struct Config { + bool ownable; + address admin; + address forwarder; + address debtManager; + address creditEventsManager; + } + + error UnknownVariant(string variant); + error ManagersNeedAccessControlVariant(); + error BroadcasterIsNotAdmin(address broadcaster, address admin); + + function run() external returns (DebtEngineBase engine) { + return deploy(readConfig()); + } + + /// @notice Reads the configuration from the environment (see the contract NatSpec). + function readConfig() public view returns (Config memory cfg) { + string memory variant = vm.envOr("ENGINE_VARIANT", string("access-control")); + if (_eq(variant, "ownable")) { + cfg.ownable = true; + } else { + require(_eq(variant, "access-control"), UnknownVariant(variant)); + } + cfg.admin = vm.envOr("ENGINE_ADMIN", address(0)); + cfg.forwarder = vm.envOr("FORWARDER", address(0)); + cfg.debtManager = vm.envOr("DEBT_MANAGER", address(0)); + cfg.creditEventsManager = vm.envOr("CREDIT_EVENTS_MANAGER", address(0)); + } + + /** + * @notice Deploys the engine described by `cfg`, grants the optional manager roles and checks the result. + * @dev `cfg.admin == address(0)` means "the broadcaster". + */ + function deploy(Config memory cfg) public returns (DebtEngineBase engine) { + bool grantsManagers = cfg.debtManager != address(0) || cfg.creditEventsManager != address(0); + require(!(cfg.ownable && grantsManagers), ManagersNeedAccessControlVariant()); + + vm.startBroadcast(); + address broadcaster = _broadcaster(); + address admin = cfg.admin == address(0) ? broadcaster : cfg.admin; + require(!grantsManagers || admin == broadcaster, BroadcasterIsNotAdmin(broadcaster, admin)); + + if (cfg.ownable) { + engine = new DebtEngineOwnable(admin, cfg.forwarder); + } else { + DebtEngineAccessControl rbac = new DebtEngineAccessControl(admin, cfg.forwarder); + if (cfg.debtManager != address(0)) { + rbac.grantRole(rbac.DEBT_MANAGER_ROLE(), cfg.debtManager); + } + if (cfg.creditEventsManager != address(0)) { + rbac.grantRole(rbac.CREDIT_EVENTS_MANAGER_ROLE(), cfg.creditEventsManager); + } + engine = rbac; + } + vm.stopBroadcast(); + + _check(engine, cfg, admin); + } + + /// @dev Post-deployment checks: version, administrator, forwarder and granted roles. + function _check(DebtEngineBase engine, Config memory cfg, address admin) internal view { + require(_eq(engine.version(), "0.3.0"), "DebtEngine: unexpected version"); + if (cfg.ownable) { + require(DebtEngineOwnable(address(engine)).owner() == admin, "DebtEngine: owner not set"); + } else { + DebtEngineAccessControl rbac = DebtEngineAccessControl(address(engine)); + require(rbac.getRoleMember(rbac.DEFAULT_ADMIN_ROLE(), 0) == admin, "DebtEngine: admin not set"); + if (cfg.debtManager != address(0)) { + require(rbac.hasRole(rbac.DEBT_MANAGER_ROLE(), cfg.debtManager), "DebtEngine: debt manager"); + } + if (cfg.creditEventsManager != address(0)) { + require( + rbac.hasRole(rbac.CREDIT_EVENTS_MANAGER_ROLE(), cfg.creditEventsManager), + "DebtEngine: credit events manager" + ); + } + } + if (cfg.forwarder != address(0)) { + require(DebtEngineAccessControl(address(engine)).isTrustedForwarder(cfg.forwarder), "DebtEngine: forwarder"); + } + } + + function _broadcaster() internal returns (address sender) { + (, sender,) = vm.readCallers(); + } + + function _eq(string memory a, string memory b) internal pure returns (bool) { + return keccak256(bytes(a)) == keccak256(bytes(b)); + } +} diff --git a/src/DebtEngine.sol b/src/DebtEngine.sol deleted file mode 100644 index ee61e58..0000000 --- a/src/DebtEngine.sol +++ /dev/null @@ -1,186 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -pragma solidity ^0.8.20; - -import "OZ/access/AccessControl.sol"; -import "OZ/metatx/ERC2771Context.sol"; -import "CMTAT/interfaces/engine/IDebtEngine.sol"; -import "./DebtEngineInvariantStorage.sol"; -import {IDebtGlobal} from "CMTAT/interfaces/IDebtGlobal.sol"; - -contract DebtEngine is - IDebtEngine, - AccessControl, - DebtEngineInvariantStorage, - ERC2771Context -{ - /** - * @notice - * Get the current version of the smart contract - */ - string public constant VERSION = "0.2.0"; - - // Mapping of debts and credit events to specific smart contracts - mapping(address => DebtBase) private _debts; - mapping(address => CreditEvents) private _creditEvents; - - /** - * Constructor to initialize the admin role - */ - constructor( - address admin, - address forwarderIrrevocable - ) ERC2771Context(forwarderIrrevocable) { - if (admin == address(0)) { - revert AdminWithAddressZeroNotAllowed(); - } - _grantRole(DEFAULT_ADMIN_ROLE, admin); - } - - /*////////////////////////////////////////////////////////////// - PUBLIC/EXTERNAL FUNCTIONS - //////////////////////////////////////////////////////////////*/ - - /* ============ USER-FACING FUNCTIONS ============ */ - /** - * @notice Function to get the debt for the sender's smart contract - */ - function debt() external view returns (DebtBase memory) { - return debt(msg.sender); - } - - /** - * @notice Function to get the debt for a specific smart contract - */ - function debt( - address smartContract_ - ) public view returns (DebtBase memory) { - DebtBase memory d = _debts[smartContract_]; - return d; - } - - /** - * @notice Function to get the credit events for the sender's smart contract - */ - function creditEvents() external view returns (CreditEvents memory) { - return creditEvents(msg.sender); - } - - /** - * @notice Function to get the credit events for a specific smart contract - */ - function creditEvents( - address smartContract_ - ) public view returns (CreditEvents memory) { - CreditEvents memory ce = _creditEvents[smartContract_]; - return ce; - } - - /* ============ RESTRICTED-FACING FUNCTIONS ============ */ - /** - * @notice Function to set the debt for a given smart contract - */ - function setDebt( - address smartContract_, - DebtBase calldata debt_ - ) external onlyRole(DEBT_MANAGER_ROLE) { - _debts[smartContract_] = debt_; - } - - /* - * @notice Function to set the credit events for a given smart contract - */ - function setCreditEvents( - address smartContract_, - CreditEvents calldata creditEvents_ - ) external onlyRole(CREDIT_EVENTS_MANAGER_ROLE) { - _creditEvents[smartContract_] = creditEvents_; - } - - /* - * @notice Batch version of {setCreditEventsBatch} - */ - function setCreditEventsBatch( - address[] calldata smartContracts, - CreditEvents[] calldata creditEventsList - ) external onlyRole(CREDIT_EVENTS_MANAGER_ROLE) { - if (smartContracts.length != creditEventsList.length) { - revert InvalidInputLength(); - } - - for (uint256 i = 0; i < smartContracts.length; i++) { - _creditEvents[smartContracts[i]] = creditEventsList[i]; - } - } - - /* - * @notice Batch version of {setDebtBatch} - */ - function setDebtBatch( - address[] calldata smartContracts, - DebtBase[] calldata debts - ) external onlyRole(DEBT_MANAGER_ROLE) { - if (smartContracts.length != debts.length) { - revert InvalidInputLength(); - } - - for (uint256 i = 0; i < smartContracts.length; i++) { - _debts[smartContracts[i]] = debts[i]; - } - } - - /* ============ ACCESS CONTROL ============ */ - - /* - * @dev Returns `true` if `account` has been granted `role`. - */ - function hasRole( - bytes32 role, - address account - ) public view virtual override returns (bool) { - // The Default Admin has all roles - if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { - return true; - } - return AccessControl.hasRole(role, account); - } - - /*////////////////////////////////////////////////////////////// - ERC2771 - //////////////////////////////////////////////////////////////*/ - - /** - * @dev This surcharge is not necessary if you do not use ERC2771 - */ - function _msgSender() - internal - view - override(ERC2771Context, Context) - returns (address sender) - { - return ERC2771Context._msgSender(); - } - - /** - * @dev This surcharge is not necessary if you do not use ERC2771 - */ - function _msgData() - internal - view - override(ERC2771Context, Context) - returns (bytes calldata) - { - return ERC2771Context._msgData(); - } - - /** - * @dev This surcharge is not necessary if you do not use the MetaTxModule - */ - function _contextSuffixLength() - internal - view - override(ERC2771Context, Context) - returns (uint256) - { - return ERC2771Context._contextSuffixLength(); - } -} diff --git a/src/DebtEngineBase.sol b/src/DebtEngineBase.sol new file mode 100644 index 0000000..379d139 --- /dev/null +++ b/src/DebtEngineBase.sol @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {IDebtEngine} from "CMTAT/interfaces/engine/IDebtEngine.sol"; +import {DebtEngineInvariantStorage} from "./DebtEngineInvariantStorage.sol"; +import {VersionModule} from "./modules/VersionModule.sol"; + +abstract contract DebtEngineBase is IDebtEngine, DebtEngineInvariantStorage, VersionModule { + // Events + event DebtSet(address indexed smartContract); + event CreditEventsSet(address indexed smartContract); + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + // Mapping of debts and credit events to specific smart contracts + mapping(address => DebtInformation) private _debts; + mapping(address => CreditEvents) private _creditEvents; + + // Track whether debt/credit events have been explicitly set + mapping(address => bool) private _debtSet; + mapping(address => bool) private _creditEventsSet; + + /** + * @notice Maximum number of entries accepted by `setDebtBatch` and `setCreditEventsBatch`. + * @dev A hard ceiling, not a recommended batch size. Every entry writes its whole struct to storage, + * so on a network with a per-transaction gas cap (Ethereum mainnet: 2^24 gas since EIP-7825) a batch + * of realistic records runs out of gas long before this limit. Size batches from a gas estimate. + */ + uint256 public constant MAX_BATCH_SIZE = 500; + + modifier onlyDebtManager() { + _authorizeSetDebt(); + _; + } + + modifier onlyCreditEventsManager() { + _authorizeSetCreditEvents(); + _; + } + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /* ============ USER-FACING FUNCTIONS ============ */ + /** + * @notice Function to get the debt for the sender's smart contract + */ + function debt() external view virtual returns (DebtInformation memory) { + return debt(_msgSender()); + } + + /** + * @notice Function to get the debt for a specific smart contract + */ + function debt(address smartContract_) public view virtual returns (DebtInformation memory) { + return _debts[smartContract_]; + } + + /** + * @notice Function to get the credit events for the sender's smart contract + */ + function creditEvents() external view virtual returns (CreditEvents memory) { + return creditEvents(_msgSender()); + } + + /** + * @notice Function to get the credit events for a specific smart contract + */ + function creditEvents(address smartContract_) public view virtual returns (CreditEvents memory) { + return _creditEvents[smartContract_]; + } + + /** + * @notice Returns true if a debt record is currently set for the given smart contract + * @dev True after {setDebt} / {setDebtBatch}, false again after {clearDebt}. + */ + function hasDebt(address smartContract_) external view virtual returns (bool) { + return _debtSet[smartContract_]; + } + + /** + * @notice Returns true if credit events are currently set for the given smart contract + * @dev True after {setCreditEvents} / {setCreditEventsBatch}, false again after {clearCreditEvents}. + */ + function hasCreditEvents(address smartContract_) external view virtual returns (bool) { + return _creditEventsSet[smartContract_]; + } + + /* ============ RESTRICTED-FACING FUNCTIONS ============ */ + /** + * @notice Function to set the debt for a given smart contract + */ + function setDebt(address smartContract_, DebtInformation calldata debt_) external virtual onlyDebtManager { + _setDebt(smartContract_, debt_); + } + + /** + * @notice Function to set the credit events for a given smart contract + */ + function setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) + external + virtual + onlyCreditEventsManager + { + _setCreditEvents(smartContract_, creditEvents_); + } + + /** + * @notice Batch version of {setCreditEvents} + */ + function setCreditEventsBatch(address[] calldata smartContracts, CreditEvents[] calldata creditEventsList) + external + virtual + onlyCreditEventsManager + { + require(smartContracts.length == creditEventsList.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setCreditEvents(smartContracts[i], creditEventsList[i]); + } + } + + /** + * @notice Batch version of {setDebt} + */ + function setDebtBatch(address[] calldata smartContracts, DebtInformation[] calldata debts) + external + virtual + onlyDebtManager + { + require(smartContracts.length == debts.length, InvalidInputLength()); + require(smartContracts.length <= MAX_BATCH_SIZE, BatchSizeTooLarge(smartContracts.length, MAX_BATCH_SIZE)); + + for (uint256 i = 0; i < smartContracts.length; i++) { + _setDebt(smartContracts[i], debts[i]); + } + } + + /** + * @notice Deletes the debt record of `smartContract_`; `hasDebt` returns false afterwards + * and `debt(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {DebtCleared}. + */ + function clearDebt(address smartContract_) external virtual onlyDebtManager { + _clearDebt(smartContract_); + } + + /** + * @notice Deletes the credit events of `smartContract_`; `hasCreditEvents` returns false afterwards + * and `creditEvents(smartContract_)` returns the zero struct, as before any record was set. + * @dev Reverts with {SmartContractWithAddressZeroNotAllowed} for `address(0)`. Clearing a contract that has + * no record succeeds and still emits {CreditEventsCleared}. + */ + function clearCreditEvents(address smartContract_) external virtual onlyCreditEventsManager { + _clearCreditEvents(smartContract_); + } + + /*////////////////////////////////////////////////////////////// + INTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + + /** + * @dev Single write path for debt: rejects `address(0)`, stores the record, marks it as set + * and emits {DebtSet}. Every public setter goes through it, so none can skip a step. + */ + function _setDebt(address smartContract_, DebtInformation calldata debt_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _debts[smartContract_] = debt_; + _debtSet[smartContract_] = true; + emit DebtSet(smartContract_); + } + + /** + * @dev Single write path for credit events: rejects `address(0)`, stores the record, marks it + * as set and emits {CreditEventsSet}. Every public setter goes through it. + */ + function _setCreditEvents(address smartContract_, CreditEvents calldata creditEvents_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + _creditEvents[smartContract_] = creditEvents_; + _creditEventsSet[smartContract_] = true; + emit CreditEventsSet(smartContract_); + } + + /** + * @dev Single delete path for debt: rejects `address(0)` (as `_setDebt` does), removes the record + * and its "set" flag, emits {DebtCleared}. + */ + function _clearDebt(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _debts[smartContract_]; + delete _debtSet[smartContract_]; + emit DebtCleared(smartContract_); + } + + /** + * @dev Single delete path for credit events: rejects `address(0)` (as `_setCreditEvents` does), + * removes the record and its "set" flag, emits {CreditEventsCleared}. + */ + function _clearCreditEvents(address smartContract_) internal virtual { + require(smartContract_ != address(0), SmartContractWithAddressZeroNotAllowed()); + delete _creditEvents[smartContract_]; + delete _creditEventsSet[smartContract_]; + emit CreditEventsCleared(smartContract_); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + /** + * @notice Authorization hook invoked before any debt change (`setDebt`, `setDebtBatch`, `clearDebt`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetDebt() internal view virtual; + + /** + * @notice Authorization hook invoked before any credit-events change (`setCreditEvents`, `setCreditEventsBatch`, + * `clearCreditEvents`). + * @dev Must revert if the caller is not allowed. Implemented by each deployment contract + * with its access-control policy; `view` guarantees the check cannot mutate state. + */ + function _authorizeSetCreditEvents() internal view virtual; + + /* ============ CONTEXT ============ */ + + /** + * @dev Returns the sender of the transaction. + * Can be overridden to support meta-transactions (ERC2771). + */ + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } +} diff --git a/src/DebtEngineInvariantStorage.sol b/src/DebtEngineInvariantStorage.sol index 36d46d5..4cc09ac 100644 --- a/src/DebtEngineInvariantStorage.sol +++ b/src/DebtEngineInvariantStorage.sol @@ -1,15 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -pragma solidity ^0.8.20; +pragma solidity ^0.8.27; -contract DebtEngineInvariantStorage { - // CreditEvents - bytes32 public constant CREDIT_EVENTS_MANAGER_ROLE = - keccak256("CREDIT_EVENTS_MANAGER_ROLE"); - - // DebtModule - bytes32 public constant DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE"); - - // custom error +abstract contract DebtEngineInvariantStorage { error AdminWithAddressZeroNotAllowed(); + error BatchSizeTooLarge(uint256 size, uint256 maxSize); error InvalidInputLength(); + error SmartContractWithAddressZeroNotAllowed(); } diff --git a/src/deployment/DebtEngineAccessControl.sol b/src/deployment/DebtEngineAccessControl.sol new file mode 100644 index 0000000..ab9c15e --- /dev/null +++ b/src/deployment/DebtEngineAccessControl.sol @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {AccessControl, IAccessControl} from "OZ/access/AccessControl.sol"; +import {AccessControlEnumerable} from "OZ/access/extensions/AccessControlEnumerable.sol"; +import {ERC2771Context, Context} from "OZ/metatx/ERC2771Context.sol"; +import {DebtEngineBase} from "../DebtEngineBase.sol"; + +/** + * @notice DebtEngine deployment with role-based access control. + * @dev Uses `AccessControlEnumerable` so role holders can be listed on-chain. + * `DEBT_MANAGER_ROLE` gates debt changes, `CREDIT_EVENTS_MANAGER_ROLE` gates credit-events changes. + */ +contract DebtEngineAccessControl is DebtEngineBase, AccessControlEnumerable, ERC2771Context { + bytes32 public constant CREDIT_EVENTS_MANAGER_ROLE = keccak256("CREDIT_EVENTS_MANAGER_ROLE"); + bytes32 public constant DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE"); + + constructor(address admin, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) { + require(admin != address(0), AdminWithAddressZeroNotAllowed()); + _grantRole(DEFAULT_ADMIN_ROLE, admin); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + function _authorizeSetDebt() internal view virtual override onlyRole(DEBT_MANAGER_ROLE) {} + + function _authorizeSetCreditEvents() internal view virtual override onlyRole(CREDIT_EVENTS_MANAGER_ROLE) {} + + /* ============ ACCESS CONTROL ============ */ + + /** + * @dev Returns `true` if `account` has been granted `role`. + * + * NOTE: The `DEFAULT_ADMIN_ROLE` is treated as a super-admin role. + * Any account holding `DEFAULT_ADMIN_ROLE` is considered to hold every role, + * even if it was not explicitly granted via `grantRole`. + * This means `hasRole(ANY_ROLE, admin)` returns `true` for the admin. + * `getRoleMember`, `getRoleMemberCount` and `getRoleMembers` will NOT reflect + * this implicit membership: the admin is not listed as a holder of the other roles. + * Because OpenZeppelin's `_grantRole` / `_revokeRole` consult this function, granting a role to an admin + * is a no-op, and revoking or renouncing one emits `RoleRevoked` while the admin keeps the power. + */ + function hasRole(bytes32 role, address account) + public + view + virtual + override(AccessControl, IAccessControl) + returns (bool) + { + // The Default Admin has all roles + if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) { + return true; + } + return AccessControl.hasRole(role, account); + } + + /*////////////////////////////////////////////////////////////// + ERC2771 + //////////////////////////////////////////////////////////////*/ + + function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) { + return ERC2771Context._msgSender(); + } + + function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) { + return ERC2771Context._msgData(); + } + + function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) { + return ERC2771Context._contextSuffixLength(); + } +} diff --git a/src/deployment/DebtEngineOwnable.sol b/src/deployment/DebtEngineOwnable.sol new file mode 100644 index 0000000..bbbcee0 --- /dev/null +++ b/src/deployment/DebtEngineOwnable.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Ownable} from "OZ/access/Ownable.sol"; +import {Ownable2Step} from "OZ/access/Ownable2Step.sol"; +import {ERC2771Context, Context} from "OZ/metatx/ERC2771Context.sol"; +import {ERC165} from "OZ/utils/introspection/ERC165.sol"; +import {DebtEngineBase} from "../DebtEngineBase.sol"; + +/** + * @notice DebtEngine deployment where a single owner manages both debt and credit events. + * @dev Ownership transfer is two-step (`transferOwnership` then `acceptOwnership` by the new owner). + * Every authorization hook collapses to `onlyOwner`, so this variant cannot separate duties. + * Advertises ERC-173 (contract ownership) through ERC-165. + */ +contract DebtEngineOwnable is DebtEngineBase, Ownable2Step, ERC2771Context, ERC165 { + /// @dev ERC-165 identifier of the ERC-173 interface (`owner()` ^ `transferOwnership(address)`). + bytes4 private constant ERC173_INTERFACE_ID = 0x7f5828d0; + + constructor(address owner, address forwarderIrrevocable) ERC2771Context(forwarderIrrevocable) Ownable(owner) {} + + /* ============ ERC-165 ============ */ + + /** + * @inheritdoc ERC165 + * @dev Returns true for ERC-173 and ERC-165. + */ + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return interfaceId == ERC173_INTERFACE_ID || super.supportsInterface(interfaceId); + } + + /* ============ AUTHORIZATION HOOKS ============ */ + + function _authorizeSetDebt() internal view virtual override onlyOwner {} + + function _authorizeSetCreditEvents() internal view virtual override onlyOwner {} + + /*////////////////////////////////////////////////////////////// + ERC2771 + //////////////////////////////////////////////////////////////*/ + + function _msgSender() internal view virtual override(DebtEngineBase, ERC2771Context, Context) returns (address) { + return ERC2771Context._msgSender(); + } + + function _msgData() internal view virtual override(ERC2771Context, Context) returns (bytes calldata) { + return ERC2771Context._msgData(); + } + + function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256) { + return ERC2771Context._contextSuffixLength(); + } +} diff --git a/src/modules/VersionModule.sol b/src/modules/VersionModule.sol new file mode 100644 index 0000000..38f2042 --- /dev/null +++ b/src/modules/VersionModule.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +abstract contract VersionModule { + /* ============ State Variables ============ */ + /** + * @dev + * Get the current version of the smart contract + */ + string private constant VERSION = "0.3.0"; + + /*////////////////////////////////////////////////////////////// + PUBLIC/EXTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////*/ + /** + * @notice Returns the current version of the smart contract + */ + function version() public view virtual returns (string memory) { + return VERSION; + } +} diff --git a/test/DebtEngine.t.sol b/test/DebtEngine.t.sol deleted file mode 100644 index 01b5cf7..0000000 --- a/test/DebtEngine.t.sol +++ /dev/null @@ -1,348 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -pragma solidity ^0.8.20; - -import "forge-std/Test.sol"; -import "../src/DebtEngine.sol"; -import "CMTAT/interfaces/engine/IDebtEngine.sol"; -import {IDebtGlobal} from "CMTAT/interfaces/IDebtGlobal.sol"; -import "../src/DebtEngineInvariantStorage.sol"; -import "OZ/access/AccessControl.sol"; -import "CMTAT/CMTAT_STANDALONE.sol"; -contract DebtEngineTest is - Test, - AccessControl, - IDebtGlobal, - DebtEngineInvariantStorage -{ - DebtEngine private debtEngine; - address private admin = address(0x1); - address private attacker = address(0x2); - address private testContract = address(0x3); - address private testContract1 = address(0x4); - address private testContract2 = address(0x5); - address AddressZero = address(0); - CMTAT_STANDALONE cmtat; - - // Sample data for DebtBase and CreditEvents - DebtEngine.DebtBase private debtSample = - DebtBase({ - interestRate: 5, - parValue: 1000, - guarantor: "Guarantor A", - bondHolder: "Bond Holder B", - maturityDate: "2025-01-01", - interestScheduleFormat: "Annual", - interestPaymentDate: "2024-12-31", - dayCountConvention: "30/360", - businessDayConvention: "Modified Following", - publicHolidaysCalendar: "US", - issuanceDate: "2023-01-01", - couponFrequency: "Semi-Annual" - }); - - DebtEngine.CreditEvents private creditEventSample = - CreditEvents({flagDefault: false, flagRedeemed: true, rating: "AAA"}); - - // Sample data for DebtBase and CreditEvents - DebtEngine.DebtBase private debtSample1 = - DebtBase({ - interestRate: 5, - parValue: 1000, - guarantor: "Guarantor A", - bondHolder: "Bond Holder B", - maturityDate: "2025-01-01", - interestScheduleFormat: "Annual", - interestPaymentDate: "2024-12-31", - dayCountConvention: "30/360", - businessDayConvention: "Modified Following", - publicHolidaysCalendar: "US", - issuanceDate: "2023-01-01", - couponFrequency: "Semi-Annual" - }); - - DebtEngine.DebtBase private debtSample2 = - DebtBase({ - interestRate: 6, - parValue: 2000, - guarantor: "Guarantor B", - bondHolder: "Bond Holder C", - maturityDate: "2026-01-01", - interestScheduleFormat: "Monthly", - interestPaymentDate: "2025-12-31", - dayCountConvention: "Actual/Actual", - businessDayConvention: "Following", - publicHolidaysCalendar: "UK", - issuanceDate: "2024-01-01", - couponFrequency: "Quarterly" - }); - - DebtEngine.CreditEvents private creditEventSample1 = - CreditEvents({flagDefault: false, flagRedeemed: true, rating: "AAA"}); - - DebtEngine.CreditEvents private creditEventSample2 = - CreditEvents({flagDefault: true, flagRedeemed: false, rating: "BBB"}); - - function setUp() public { - // Deploy the DebtEngine contract with admin role - debtEngine = new DebtEngine(admin, AddressZero); - ICMTATConstructor.ERC20Attributes - memory erc20Attributes = ICMTATConstructor.ERC20Attributes( - "CMTA Token", - "CMTAT", - 0 - ); - ICMTATConstructor.BaseModuleAttributes - memory baseModuleAttributes = ICMTATConstructor - .BaseModuleAttributes( - "CMTAT_ISIN", - "https://cmta.ch", - "CMTAT_info" - ); - ICMTATConstructor.Engine memory engines = ICMTATConstructor.Engine( - IRuleEngine(AddressZero), - IDebtEngine(AddressZero), - IAuthorizationEngine(AddressZero), - IERC1643(AddressZero) - ); - cmtat = new CMTAT_STANDALONE( - AddressZero, - admin, - erc20Attributes, - baseModuleAttributes, - engines - ); - } - - /*////////////////////////////////////////////////////////////// - DEPLOYMENT - ///////////////////////////////////////*/ - - function testDeploy() public { - address forwarder = address(0x1); - debtEngine = new DebtEngine(admin, forwarder); - - // Forwarder - assertEq(debtEngine.isTrustedForwarder(forwarder), true); - // admin - vm.expectRevert( - abi.encodeWithSelector(AdminWithAddressZeroNotAllowed.selector) - ); - debtEngine = new DebtEngine(AddressZero, forwarder); - } - - /*////////////////////////////////////////////////////////////// - Access control - ///////////////////////////////////////*/ - - function testSetDebtAsAdmin() public { - // Act - // Call as admin - vm.prank(admin); - debtEngine.setDebt(testContract, debtSample); - - // Assert - // Verify that debt was set correctly - DebtEngine.DebtBase memory debt = debtEngine.debt(testContract); - assertEq(debt.interestRate, 5); - assertEq(debt.parValue, 1000); - } - - function testCannotNonAdminSetDebt() public { - // Attempt to set debt as non-admin - vm.prank(attacker); - vm.expectRevert( - abi.encodeWithSelector( - AccessControlUnauthorizedAccount.selector, - attacker, - DEBT_MANAGER_ROLE - ) - ); - debtEngine.setDebt(testContract, debtSample); - } - - function testCanAdminSetCreditEvents() public { - // Call as admin - vm.prank(admin); - debtEngine.setCreditEvents(testContract, creditEventSample); - - // Act - // Verify that credit events were set correctly - DebtEngine.CreditEvents memory credit = debtEngine.creditEvents( - testContract - ); - assertEq(credit.flagDefault, false); - assertEq(credit.flagRedeemed, true); - assertEq(credit.rating, "AAA"); - } - - function testCannotNonAdminSetCreditEvents() public { - // Act - // Attempt to set credit events as non-admin - vm.prank(attacker); - vm.expectRevert( - abi.encodeWithSelector( - AccessControlUnauthorizedAccount.selector, - attacker, - CREDIT_EVENTS_MANAGER_ROLE - ) - ); - debtEngine.setCreditEvents(testContract, creditEventSample); - } - - function testSetDebtsBatchAsAdmin() public { - // Call as admin to set multiple debts - address[] memory contracts = new address[](2); - contracts[0] = testContract1; - contracts[1] = testContract2; - - DebtEngine.DebtBase[] memory debts = new DebtEngine.DebtBase[](2); - debts[0] = debtSample1; - debts[1] = debtSample2; - - vm.prank(admin); - debtEngine.setDebtBatch(contracts, debts); - - // Verify that both debts were set correctly - DebtEngine.DebtBase memory debt1 = debtEngine.debt(testContract1); - assertEq(debt1.interestRate, 5); - assertEq(debt1.parValue, 1000); - - DebtEngine.DebtBase memory debt2 = debtEngine.debt(testContract2); - assertEq(debt2.interestRate, 6); - assertEq(debt2.parValue, 2000); - } - - function testSetDebtsBatchAsNonAdminFails() public { - // Attempt to set multiple debts as non-admin - address[] memory contracts = new address[](2); - contracts[0] = testContract1; - contracts[1] = testContract2; - - DebtEngine.DebtBase[] memory debts = new DebtEngine.DebtBase[](2); - debts[0] = debtSample1; - debts[1] = debtSample2; - - vm.prank(attacker); - vm.expectRevert( - abi.encodeWithSelector( - AccessControlUnauthorizedAccount.selector, - attacker, - DEBT_MANAGER_ROLE - ) - ); - debtEngine.setDebtBatch(contracts, debts); - } - - function testSetCreditEventsBatchAsAdmin() public { - // Call as admin to set multiple credit events - address[] memory contracts = new address[](2); - contracts[0] = testContract1; - contracts[1] = testContract2; - - DebtEngine.CreditEvents[] - memory creditEventsList = new DebtEngine.CreditEvents[](2); - creditEventsList[0] = creditEventSample1; - creditEventsList[1] = creditEventSample2; - - vm.prank(admin); - debtEngine.setCreditEventsBatch(contracts, creditEventsList); - - // Verify that both credit events were set correctly - DebtEngine.CreditEvents memory credit1 = debtEngine.creditEvents( - testContract1 - ); - assertEq(credit1.flagDefault, false); - assertEq(credit1.rating, "AAA"); - - DebtEngine.CreditEvents memory credit2 = debtEngine.creditEvents( - testContract2 - ); - assertEq(credit2.flagDefault, true); - assertEq(credit2.rating, "BBB"); - } - - function testSetCreditEventsBatchAsNonAdminFails() public { - // Attempt to set multiple credit events as non-admin - address[] memory contracts = new address[](2); - contracts[0] = testContract1; - contracts[1] = testContract2; - - DebtEngine.CreditEvents[] - memory creditEventsList = new DebtEngine.CreditEvents[](2); - creditEventsList[0] = creditEventSample1; - creditEventsList[1] = creditEventSample2; - - vm.prank(attacker); - vm.expectRevert( - abi.encodeWithSelector( - AccessControlUnauthorizedAccount.selector, - attacker, - CREDIT_EVENTS_MANAGER_ROLE - ) - ); - debtEngine.setCreditEventsBatch(contracts, creditEventsList); - } - - /*////////////////////////////////////////////////////////////// - Get - ///////////////////////////////////////*/ - - function testCanReturnCMTATDebt() public { - // Arrange - vm.prank(admin); - debtEngine.setDebt(address(cmtat), debtSample); - - vm.prank(admin); - cmtat.setDebtEngine(debtEngine); - - // Call from CMTAT, return debt smart contract - DebtEngine.DebtBase memory debt = cmtat.debt(); - assertEq(debt.parValue, 1000); - } - - function testCanReturnCMTATCreditEvents() public { - // Call as admin to set credit events for non-admin's contract - vm.prank(admin); - debtEngine.setCreditEvents(address(cmtat), creditEventSample); - - vm.prank(admin); - cmtat.setDebtEngine(debtEngine); - - // Call from attacker, should return credit events for attacker address - vm.prank(attacker); - DebtEngine.CreditEvents memory credit = cmtat.creditEvents(); - assertEq(credit.flagRedeemed, true); - } - - /*////////////////////////////////////////////////////////////// - INVALID PARAMETER - ///////////////////////////////////////*/ - function testSetDebtsBatchLengthMismatch() public { - // Set arrays with mismatched lengths - address[] memory contracts = new address[](1); - contracts[0] = testContract1; - - DebtEngine.DebtBase[] memory debts = new DebtEngine.DebtBase[](2); - debts[0] = debtSample1; - debts[1] = debtSample2; - - vm.prank(admin); - vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); - debtEngine.setDebtBatch(contracts, debts); - } - - function testSetCreditEventsBatchLengthMismatch() public { - // Set arrays with mismatched lengths - address[] memory contracts = new address[](1); - contracts[0] = testContract1; - - DebtEngine.CreditEvents[] - memory creditEventsList = new DebtEngine.CreditEvents[](2); - creditEventsList[0] = creditEventSample1; - creditEventsList[1] = creditEventSample2; - - vm.prank(admin); - vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); - debtEngine.setCreditEventsBatch(contracts, creditEventsList); - } -} diff --git a/test/DebtEngineAccessControl.t.sol b/test/DebtEngineAccessControl.t.sol new file mode 100644 index 0000000..4ac39e2 --- /dev/null +++ b/test/DebtEngineAccessControl.t.sol @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {DebtEngineBaseTest} from "./DebtEngineBase.t.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {DebtEngineAccessControl} from "../src/deployment/DebtEngineAccessControl.sol"; +import {IAccessControl} from "OZ/access/IAccessControl.sol"; +import {IAccessControlEnumerable} from "OZ/access/extensions/IAccessControlEnumerable.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; + +contract DebtEngineAccessControlTest is DebtEngineBaseTest { + DebtEngineAccessControl private debtEngineAc; + + bytes32 private constant DEBT_MANAGER_ROLE = keccak256("DEBT_MANAGER_ROLE"); + bytes32 private constant CREDIT_EVENTS_MANAGER_ROLE = keccak256("CREDIT_EVENTS_MANAGER_ROLE"); + + function _deployEngine() internal override { + debtEngineAc = new DebtEngineAccessControl(admin, ADDRESS_ZERO); + debtEngine = debtEngineAc; + } + + function _deployEngineWithForwarder(address forwarder) internal override returns (DebtEngineBase engine) { + DebtEngineAccessControl e = new DebtEngineAccessControl(admin, forwarder); + engine = e; + } + + function _expectUnauthorizedDebtRevert(address caller) internal override { + vm.expectRevert( + abi.encodeWithSelector(IAccessControl.AccessControlUnauthorizedAccount.selector, caller, DEBT_MANAGER_ROLE) + ); + } + + function _expectUnauthorizedCreditEventsRevert(address caller) internal override { + vm.expectRevert( + abi.encodeWithSelector( + IAccessControl.AccessControlUnauthorizedAccount.selector, caller, CREDIT_EVENTS_MANAGER_ROLE + ) + ); + } + + /*////////////////////////////////////////////////////////////// + DEPLOYMENT + ///////////////////////////////////////*/ + + function testDeploy() public override { + address forwarder = address(0x1); + debtEngineAc = new DebtEngineAccessControl(admin, forwarder); + + // Forwarder + assertEq(debtEngineAc.isTrustedForwarder(forwarder), true); + // admin + vm.expectRevert(abi.encodeWithSelector(AdminWithAddressZeroNotAllowed.selector)); + new DebtEngineAccessControl(ADDRESS_ZERO, forwarder); + } + + /*////////////////////////////////////////////////////////////// + Access control — unauthorized + ///////////////////////////////////////*/ + + function testCannotNonAdminSetDebt() public { + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.setDebt(testContract, debtSample); + } + + function testCannotNonAdminSetCreditEvents() public { + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.setCreditEvents(testContract, creditEventSample); + } + + function testSetDebtsBatchAsNonAdminFails() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.setDebtBatch(contracts, debts); + } + + function testSetCreditEventsBatchAsNonAdminFails() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + } + + /*////////////////////////////////////////////////////////////// + RBAC-specific: role grant/revoke + ///////////////////////////////////////*/ + + function testGrantDebtManagerRole() public { + bytes32 role = DEBT_MANAGER_ROLE; + + vm.prank(admin); + debtEngineAc.grantRole(role, attacker); + + vm.prank(attacker); + debtEngine.setDebt(testContract, debtSample); + + ICMTATDebt.DebtInformation memory d = debtEngine.debt(testContract); + assertEq(d.debtInstrument.interestRate, 5); + } + + function testRevokeDebtManagerRole() public { + bytes32 role = DEBT_MANAGER_ROLE; + + vm.prank(admin); + debtEngineAc.grantRole(role, attacker); + + vm.prank(admin); + debtEngineAc.revokeRole(role, attacker); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.setDebt(testContract, debtSample); + } + + function testGrantCreditEventsManagerRole() public { + bytes32 role = CREDIT_EVENTS_MANAGER_ROLE; + + vm.prank(admin); + debtEngineAc.grantRole(role, attacker); + + vm.prank(attacker); + debtEngine.setCreditEvents(testContract, creditEventSample); + + ICMTATCreditEvents.CreditEvents memory credit = debtEngine.creditEvents(testContract); + assertEq(credit.flagRedeemed, true); + } + + function testRevokeCreditEventsManagerRole() public { + bytes32 role = CREDIT_EVENTS_MANAGER_ROLE; + + vm.prank(admin); + debtEngineAc.grantRole(role, attacker); + + vm.prank(admin); + debtEngineAc.revokeRole(role, attacker); + + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.setCreditEvents(testContract, creditEventSample); + } + + /*////////////////////////////////////////////////////////////// + RBAC-specific: role separation + ///////////////////////////////////////*/ + + function testDebtManagerCannotSetCreditEvents() public { + vm.prank(admin); + debtEngineAc.grantRole(DEBT_MANAGER_ROLE, attacker); + + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.setCreditEvents(testContract, creditEventSample); + } + + function testDebtManagerCannotClearCreditEvents() public { + vm.prank(admin); + debtEngineAc.grantRole(DEBT_MANAGER_ROLE, attacker); + + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.clearCreditEvents(testContract); + } + + function testCreditEventsManagerCannotClearDebt() public { + vm.prank(admin); + debtEngineAc.grantRole(CREDIT_EVENTS_MANAGER_ROLE, attacker); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.clearDebt(testContract); + } + + function testCreditEventsManagerCannotSetDebt() public { + vm.prank(admin); + debtEngineAc.grantRole(CREDIT_EVENTS_MANAGER_ROLE, attacker); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.setDebt(testContract, debtSample); + } + + /*////////////////////////////////////////////////////////////// + RBAC-specific: enumeration + ///////////////////////////////////////*/ + + function testRoleMembersAreEnumerable() public { + assertEq(debtEngineAc.getRoleMemberCount(debtEngineAc.DEFAULT_ADMIN_ROLE()), 1); + assertEq(debtEngineAc.getRoleMember(debtEngineAc.DEFAULT_ADMIN_ROLE(), 0), admin); + + vm.prank(admin); + debtEngineAc.grantRole(DEBT_MANAGER_ROLE, attacker); + assertEq(debtEngineAc.getRoleMemberCount(DEBT_MANAGER_ROLE), 1); + assertEq(debtEngineAc.getRoleMember(DEBT_MANAGER_ROLE, 0), attacker); + + vm.prank(admin); + debtEngineAc.revokeRole(DEBT_MANAGER_ROLE, attacker); + assertEq(debtEngineAc.getRoleMemberCount(DEBT_MANAGER_ROLE), 0); + } + + function testImplicitAdminIsNotEnumerated() public view { + // The admin passes every hasRole check but is not listed as a role member + assertTrue(debtEngineAc.hasRole(DEBT_MANAGER_ROLE, admin)); + assertTrue(debtEngineAc.hasRole(CREDIT_EVENTS_MANAGER_ROLE, admin)); + assertEq(debtEngineAc.getRoleMemberCount(DEBT_MANAGER_ROLE), 0); + assertEq(debtEngineAc.getRoleMemberCount(CREDIT_EVENTS_MANAGER_ROLE), 0); + } + + function testSupportsInterface() public view { + assertTrue(debtEngineAc.supportsInterface(type(IAccessControlEnumerable).interfaceId)); + assertTrue(debtEngineAc.supportsInterface(type(IAccessControl).interfaceId)); + assertFalse(debtEngineAc.supportsInterface(0xffffffff)); + } + + function testRoleConstants() public view { + assertEq(debtEngineAc.DEBT_MANAGER_ROLE(), DEBT_MANAGER_ROLE); + assertEq(debtEngineAc.CREDIT_EVENTS_MANAGER_ROLE(), CREDIT_EVENTS_MANAGER_ROLE); + } +} diff --git a/test/DebtEngineBase.t.sol b/test/DebtEngineBase.t.sol new file mode 100644 index 0000000..7187c1b --- /dev/null +++ b/test/DebtEngineBase.t.sol @@ -0,0 +1,710 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Test} from "forge-std/Test.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; +import {IERC1643CMTAT} from "CMTAT/interfaces/tokenization/draft-IERC1643CMTAT.sol"; +import {ISnapshotEngine} from "CMTAT/interfaces/engine/ISnapshotEngine.sol"; +import {IRuleEngine} from "CMTAT/interfaces/engine/IRuleEngine.sol"; +import {IERC1643} from "CMTAT/interfaces/tokenization/draft-IERC1643.sol"; +import {DebtEngineInvariantStorage} from "../src/DebtEngineInvariantStorage.sol"; +import {CMTATStandaloneDebt} from "CMTAT/deployment/debt/CMTATStandaloneDebt.sol"; +import {ICMTATConstructor} from "CMTAT/interfaces/technical/ICMTATConstructor.sol"; + +abstract contract DebtEngineBaseTest is Test, DebtEngineInvariantStorage { + DebtEngineBase internal debtEngine; + address internal admin = address(0x1); + address internal attacker = address(0x2); + address internal testContract = address(0x3); + address internal testContract1 = address(0x4); + address internal testContract2 = address(0x5); + address internal constant ADDRESS_ZERO = address(0); + CMTATStandaloneDebt internal cmtat; + + // Sample data for DebtInformation and CreditEvents + ICMTATDebt.DebtInformation internal debtSample; + + ICMTATCreditEvents.CreditEvents internal creditEventSample = + ICMTATCreditEvents.CreditEvents({flagDefault: false, flagRedeemed: true, rating: "AAA"}); + + ICMTATDebt.DebtIdentifier internal debtIdentifier1 = ICMTATDebt.DebtIdentifier({ + issuerName: "Name", issuerDescription: "Description", guarantor: "Guarantor A", debtHolder: "Bond Holder B" + }); + + ICMTATDebt.DebtInstrument internal debtSample1 = ICMTATDebt.DebtInstrument({ + interestRate: 5, + parValue: 1000, + minimumDenomination: 5000, + issuanceDate: "2023-01-01", + maturityDate: "2025-01-01", + couponPaymentFrequency: "Semi-Annual", + interestScheduleFormat: "Annual", + interestPaymentDate: "2024-12-31", + dayCountConvention: "30/360", + businessDayConvention: "Modified Following", + currency: "USDC", + currencyContract: address(0x3) + }); + + ICMTATDebt.DebtInstrument internal debtSample2 = ICMTATDebt.DebtInstrument({ + interestRate: 6, + parValue: 2000, + minimumDenomination: 0, + issuanceDate: "2024-01-01", + maturityDate: "2026-01-01", + couponPaymentFrequency: "Quarterly", + interestScheduleFormat: "Monthly", + interestPaymentDate: "2025-12-31", + dayCountConvention: "Actual/Actual", + businessDayConvention: "Following", + currency: "", + currencyContract: address(0) + }); + + ICMTATDebt.DebtIdentifier internal debtIdentifier2 = ICMTATDebt.DebtIdentifier({ + issuerName: "Name2", issuerDescription: "Description2", guarantor: "Guarantor B", debtHolder: "Bond Holder C" + }); + + ICMTATCreditEvents.CreditEvents internal creditEventSample1 = + ICMTATCreditEvents.CreditEvents({flagDefault: false, flagRedeemed: true, rating: "AAA"}); + + ICMTATCreditEvents.CreditEvents internal creditEventSample2 = + ICMTATCreditEvents.CreditEvents({flagDefault: true, flagRedeemed: false, rating: "BBB"}); + + function setUp() public { + debtSample = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + + _deployEngine(); + + ICMTATConstructor.ERC20Attributes memory erc20Attributes = + ICMTATConstructor.ERC20Attributes("CMTA Token", "CMTAT", 0); + ICMTATConstructor.ExtraInformationAttributes memory extraInformationAttributes = + ICMTATConstructor.ExtraInformationAttributes( + "CMTAT_ISIN", IERC1643CMTAT.DocumentInfo("terms", "https://cmta.ch", bytes32(0)), "CMTAT_info" + ); + ICMTATConstructor.Engine memory engines = + ICMTATConstructor.Engine(IRuleEngine(ADDRESS_ZERO), ISnapshotEngine(ADDRESS_ZERO), IERC1643(ADDRESS_ZERO)); + cmtat = new CMTATStandaloneDebt(admin, erc20Attributes, extraInformationAttributes, engines); + } + + function _deployEngine() internal virtual; + function _deployEngineWithForwarder(address forwarder) internal virtual returns (DebtEngineBase); + function _expectUnauthorizedDebtRevert(address caller) internal virtual; + function _expectUnauthorizedCreditEventsRevert(address caller) internal virtual; + + /*////////////////////////////////////////////////////////////// + DEPLOYMENT + ///////////////////////////////////////*/ + + function testDeploy() public virtual; + + function testVersion() public view { + assertEq(debtEngine.version(), "0.3.0"); + } + + /*////////////////////////////////////////////////////////////// + Set/Get Debt + ///////////////////////////////////////*/ + + function testSetDebtAsAdmin() public { + vm.prank(admin); + debtEngine.setDebt(testContract, debtSample); + + ICMTATDebt.DebtInformation memory d = debtEngine.debt(testContract); + assertEq(d.debtInstrument.interestRate, 5); + assertEq(d.debtInstrument.parValue, 1000); + } + + function testCanAdminSetCreditEvents() public { + vm.prank(admin); + debtEngine.setCreditEvents(testContract, creditEventSample); + + ICMTATCreditEvents.CreditEvents memory credit = debtEngine.creditEvents(testContract); + assertEq(credit.flagDefault, false); + assertEq(credit.flagRedeemed, true); + assertEq(credit.rating, "AAA"); + } + + function testSetDebtsBatchAsAdmin() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.prank(admin); + debtEngine.setDebtBatch(contracts, debts); + + ICMTATDebt.DebtInformation memory debt1 = debtEngine.debt(testContract1); + assertEq(debt1.debtInstrument.interestRate, 5); + assertEq(debt1.debtInstrument.parValue, 1000); + + ICMTATDebt.DebtInformation memory debt2 = debtEngine.debt(testContract2); + assertEq(debt2.debtInstrument.interestRate, 6); + assertEq(debt2.debtInstrument.parValue, 2000); + } + + function testSetCreditEventsBatchAsAdmin() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + vm.prank(admin); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + + ICMTATCreditEvents.CreditEvents memory credit1 = debtEngine.creditEvents(testContract1); + assertEq(credit1.flagDefault, false); + assertEq(credit1.rating, "AAA"); + + ICMTATCreditEvents.CreditEvents memory credit2 = debtEngine.creditEvents(testContract2); + assertEq(credit2.flagDefault, true); + assertEq(credit2.rating, "BBB"); + } + + /*////////////////////////////////////////////////////////////// + CMTAT Integration + ///////////////////////////////////////*/ + + function testCanReturnCMTATDebt() public { + vm.prank(admin); + debtEngine.setDebt(address(cmtat), debtSample); + + vm.prank(admin); + cmtat.setDebtEngine(debtEngine); + + ICMTATDebt.DebtInformation memory d = cmtat.debt(); + assertEq(d.debtInstrument.parValue, 1000); + } + + function testCanReturnCMTATCreditEvents() public { + vm.prank(admin); + debtEngine.setCreditEvents(address(cmtat), creditEventSample); + + vm.prank(admin); + cmtat.setDebtEngine(debtEngine); + + vm.prank(attacker); + ICMTATCreditEvents.CreditEvents memory credit = cmtat.creditEvents(); + assertEq(credit.flagRedeemed, true); + } + + /*////////////////////////////////////////////////////////////// + INVALID PARAMETER + ///////////////////////////////////////*/ + + function testSetDebtsBatchLengthMismatch() public { + address[] memory contracts = new address[](1); + contracts[0] = testContract1; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); + debtEngine.setDebtBatch(contracts, debts); + } + + function testSetCreditEventsBatchLengthMismatch() public { + address[] memory contracts = new address[](1); + contracts[0] = testContract1; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + } + + // More addresses than records: must revert with InvalidInputLength, not an out-of-bounds panic + function testSetDebtsBatchMoreAddressesThanRecords() public { + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](1); + debts[0] = debtSample; + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); + debtEngine.setDebtBatch(_addresses(2), debts); + } + + function testSetCreditEventsBatchMoreAddressesThanRecords() public { + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](1); + creditEventsList[0] = creditEventSample1; + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(InvalidInputLength.selector)); + debtEngine.setCreditEventsBatch(_addresses(2), creditEventsList); + } + + function testCannotSetDebtForAddressZero() public { + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(SmartContractWithAddressZeroNotAllowed.selector)); + debtEngine.setDebt(ADDRESS_ZERO, debtSample); + } + + function testCannotSetCreditEventsForAddressZero() public { + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(SmartContractWithAddressZeroNotAllowed.selector)); + debtEngine.setCreditEvents(ADDRESS_ZERO, creditEventSample); + } + + function testCannotSetDebtBatchWithAddressZero() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = ADDRESS_ZERO; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(SmartContractWithAddressZeroNotAllowed.selector)); + debtEngine.setDebtBatch(contracts, debts); + } + + function testCannotSetCreditEventsBatchWithAddressZero() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = ADDRESS_ZERO; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + vm.prank(admin); + vm.expectRevert(abi.encodeWithSelector(SmartContractWithAddressZeroNotAllowed.selector)); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + } + + /*////////////////////////////////////////////////////////////// + EVENTS + ///////////////////////////////////////*/ + + function testSetDebtEmitsEvent() public { + vm.prank(admin); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.DebtSet(testContract); + debtEngine.setDebt(testContract, debtSample); + } + + function testSetCreditEventsEmitsEvent() public { + vm.prank(admin); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.CreditEventsSet(testContract); + debtEngine.setCreditEvents(testContract, creditEventSample); + } + + function testSetDebtBatchEmitsEvents() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.prank(admin); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.DebtSet(testContract1); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.DebtSet(testContract2); + debtEngine.setDebtBatch(contracts, debts); + } + + function testSetCreditEventsBatchEmitsEvents() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + vm.prank(admin); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.CreditEventsSet(testContract1); + vm.expectEmit(true, false, false, false); + emit DebtEngineBase.CreditEventsSet(testContract2); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + } + + /*////////////////////////////////////////////////////////////// + HAS DEBT / HAS CREDIT EVENTS + ///////////////////////////////////////*/ + + function testHasDebtReturnsFalseWhenNotSet() public view { + assertEq(debtEngine.hasDebt(testContract), false); + } + + function testHasDebtReturnsTrueWhenSet() public { + vm.prank(admin); + debtEngine.setDebt(testContract, debtSample); + + assertEq(debtEngine.hasDebt(testContract), true); + } + + function testHasCreditEventsReturnsFalseWhenNotSet() public view { + assertEq(debtEngine.hasCreditEvents(testContract), false); + } + + function testHasCreditEventsReturnsTrueWhenSet() public { + vm.prank(admin); + debtEngine.setCreditEvents(testContract, creditEventSample); + + assertEq(debtEngine.hasCreditEvents(testContract), true); + } + + function testHasDebtBatchSetsFlags() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + assertEq(debtEngine.hasDebt(testContract1), false); + assertEq(debtEngine.hasDebt(testContract2), false); + + vm.prank(admin); + debtEngine.setDebtBatch(contracts, debts); + + assertEq(debtEngine.hasDebt(testContract1), true); + assertEq(debtEngine.hasDebt(testContract2), true); + } + + function testHasCreditEventsBatchSetsFlags() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + assertEq(debtEngine.hasCreditEvents(testContract1), false); + assertEq(debtEngine.hasCreditEvents(testContract2), false); + + vm.prank(admin); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + + assertEq(debtEngine.hasCreditEvents(testContract1), true); + assertEq(debtEngine.hasCreditEvents(testContract2), true); + } + + /*////////////////////////////////////////////////////////////// + Batch size limit + ///////////////////////////////////////*/ + + function _addresses(uint256 n) internal pure returns (address[] memory list) { + list = new address[](n); + for (uint256 i = 0; i < n; ++i) { + list[i] = address(uint160(0x1000 + i)); + } + } + + function testCannotSetDebtBatchAboveMaxSize() public { + uint256 n = debtEngine.MAX_BATCH_SIZE() + 1; + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](n); + vm.expectRevert(abi.encodeWithSelector(BatchSizeTooLarge.selector, n, n - 1)); + vm.prank(admin); + debtEngine.setDebtBatch(_addresses(n), debts); + } + + function testCannotSetCreditEventsBatchAboveMaxSize() public { + uint256 n = debtEngine.MAX_BATCH_SIZE() + 1; + ICMTATCreditEvents.CreditEvents[] memory list = new ICMTATCreditEvents.CreditEvents[](n); + vm.expectRevert(abi.encodeWithSelector(BatchSizeTooLarge.selector, n, n - 1)); + vm.prank(admin); + debtEngine.setCreditEventsBatch(_addresses(n), list); + } + + function testSetCreditEventsBatchAtMaxSize() public { + uint256 n = debtEngine.MAX_BATCH_SIZE(); + address[] memory contracts = _addresses(n); + ICMTATCreditEvents.CreditEvents[] memory list = new ICMTATCreditEvents.CreditEvents[](n); + for (uint256 i = 0; i < n; ++i) { + list[i] = creditEventSample1; + } + vm.prank(admin); + debtEngine.setCreditEventsBatch(contracts, list); + assertTrue(debtEngine.hasCreditEvents(contracts[0])); + assertTrue(debtEngine.hasCreditEvents(contracts[n - 1])); + } + + function testSetDebtBatchAtMaxSize() public { + uint256 n = debtEngine.MAX_BATCH_SIZE(); + address[] memory contracts = _addresses(n); + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](n); + vm.prank(admin); + debtEngine.setDebtBatch(contracts, debts); + assertTrue(debtEngine.hasDebt(contracts[0])); + assertTrue(debtEngine.hasDebt(contracts[n - 1])); + } + + /*////////////////////////////////////////////////////////////// + Batch edge cases + ///////////////////////////////////////*/ + + function testEmptyBatchesAreNoOps() public { + vm.recordLogs(); + vm.startPrank(admin); + debtEngine.setDebtBatch(new address[](0), new ICMTATDebt.DebtInformation[](0)); + debtEngine.setCreditEventsBatch(new address[](0), new ICMTATCreditEvents.CreditEvents[](0)); + vm.stopPrank(); + assertEq(vm.getRecordedLogs().length, 0); + } + + function testDuplicateAddressInDebtBatchLastWriteWins() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract1; + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.recordLogs(); + vm.prank(admin); + debtEngine.setDebtBatch(contracts, debts); + + assertEq(vm.getRecordedLogs().length, 2); + assertEq(debtEngine.debt(testContract1).debtInstrument.interestRate, debtSample2.interestRate); + } + + function testSetDebtOverwritesPreviousRecord() public { + vm.startPrank(admin); + debtEngine.setDebt(testContract, debtSample); + debtEngine.setDebt( + testContract, ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}) + ); + vm.stopPrank(); + ICMTATDebt.DebtInformation memory d = debtEngine.debt(testContract); + assertEq(d.debtInstrument.interestRate, debtSample2.interestRate); + assertEq(d.debtIdentifier.issuerName, debtIdentifier2.issuerName); + } + + /*////////////////////////////////////////////////////////////// + Fuzz: what is written is what is read + ///////////////////////////////////////*/ + + function testFuzz_SetDebtRoundTrip( + address target, + uint256 interestRate, + uint256 parValue, + string calldata issuerName + ) public { + vm.assume(target != address(0)); + ICMTATDebt.DebtInformation memory info = debtSample; + info.debtInstrument.interestRate = interestRate; + info.debtInstrument.parValue = parValue; + info.debtIdentifier.issuerName = issuerName; + + vm.prank(admin); + debtEngine.setDebt(target, info); + + ICMTATDebt.DebtInformation memory d = debtEngine.debt(target); + assertEq(d.debtInstrument.interestRate, interestRate); + assertEq(d.debtInstrument.parValue, parValue); + assertEq(d.debtIdentifier.issuerName, issuerName); + assertTrue(debtEngine.hasDebt(target)); + } + + function testFuzz_SetCreditEventsRoundTrip( + address target, + bool flagDefault, + bool flagRedeemed, + string calldata rating + ) public { + vm.assume(target != address(0)); + vm.prank(admin); + debtEngine.setCreditEvents( + target, + ICMTATCreditEvents.CreditEvents({flagDefault: flagDefault, flagRedeemed: flagRedeemed, rating: rating}) + ); + + ICMTATCreditEvents.CreditEvents memory c = debtEngine.creditEvents(target); + assertEq(c.flagDefault, flagDefault); + assertEq(c.flagRedeemed, flagRedeemed); + assertEq(c.rating, rating); + assertTrue(debtEngine.hasCreditEvents(target)); + } + + /*////////////////////////////////////////////////////////////// + ERC-2771: trusted forwarder + ///////////////////////////////////////*/ + + address internal constant FORWARDER = address(0xF0); + + function testSetDebtThroughTrustedForwarder() public { + DebtEngineBase engine = _deployEngineWithForwarder(FORWARDER); + bytes memory data = abi.encodeCall(DebtEngineBase.setDebt, (testContract, debtSample)); + + // The forwarder appends the signer: the authorized signer passes + vm.prank(FORWARDER); + (bool ok,) = address(engine).call(abi.encodePacked(data, admin)); + assertTrue(ok); + assertEq(engine.debt(testContract).debtInstrument.parValue, debtSample.debtInstrument.parValue); + } + + function testForwarderCannotRelayUnauthorizedSigner() public { + DebtEngineBase engine = _deployEngineWithForwarder(FORWARDER); + bytes memory data = abi.encodeCall(DebtEngineBase.setDebt, (testContract, debtSample)); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(FORWARDER); + (bool ok,) = address(engine).call(abi.encodePacked(data, attacker)); + assertTrue(ok, "expectRevert: call returns true when the expected revert happened"); + } + + function testUntrustedCallerCannotSpoofSender() public { + DebtEngineBase engine = _deployEngineWithForwarder(FORWARDER); + bytes memory data = abi.encodeCall(DebtEngineBase.setDebt, (testContract, debtSample)); + + // Appending the admin address from a non-forwarder is ignored: the caller itself is checked + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + (bool ok,) = address(engine).call(abi.encodePacked(data, admin)); + assertTrue(ok, "expectRevert: call returns true when the expected revert happened"); + } + + function testDebtForCallerThroughTrustedForwarder() public { + DebtEngineBase engine = _deployEngineWithForwarder(FORWARDER); + vm.prank(admin); + engine.setDebt(testContract, debtSample); + + vm.prank(FORWARDER); + (bool ok, bytes memory ret) = + address(engine).staticcall(abi.encodePacked(abi.encodeWithSignature("debt()"), testContract)); + assertTrue(ok); + ICMTATDebt.DebtInformation memory d = abi.decode(ret, (ICMTATDebt.DebtInformation)); + assertEq(d.debtInstrument.parValue, debtSample.debtInstrument.parValue); + } + + /*////////////////////////////////////////////////////////////// + Clear + ///////////////////////////////////////*/ + + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + function testClearDebt() public { + vm.prank(admin); + debtEngine.setDebt(testContract, debtSample); + assertTrue(debtEngine.hasDebt(testContract)); + + vm.expectEmit(true, false, false, false, address(debtEngine)); + emit DebtCleared(testContract); + vm.prank(admin); + debtEngine.clearDebt(testContract); + + assertFalse(debtEngine.hasDebt(testContract)); + ICMTATDebt.DebtInformation memory empty; + assertEq(abi.encode(debtEngine.debt(testContract)), abi.encode(empty)); + } + + function testClearCreditEvents() public { + vm.prank(admin); + debtEngine.setCreditEvents(testContract, creditEventSample); + assertTrue(debtEngine.hasCreditEvents(testContract)); + + vm.expectEmit(true, false, false, false, address(debtEngine)); + emit CreditEventsCleared(testContract); + vm.prank(admin); + debtEngine.clearCreditEvents(testContract); + + assertFalse(debtEngine.hasCreditEvents(testContract)); + ICMTATCreditEvents.CreditEvents memory empty; + assertEq(abi.encode(debtEngine.creditEvents(testContract)), abi.encode(empty)); + } + + function testClearDebtLeavesCreditEventsAndOtherContracts() public { + vm.startPrank(admin); + debtEngine.setDebt(testContract, debtSample); + debtEngine.setDebt(testContract1, debtSample); + debtEngine.setCreditEvents(testContract, creditEventSample); + debtEngine.clearDebt(testContract); + vm.stopPrank(); + + assertFalse(debtEngine.hasDebt(testContract)); + assertTrue(debtEngine.hasDebt(testContract1)); + assertTrue(debtEngine.hasCreditEvents(testContract)); + assertEq(debtEngine.creditEvents(testContract).rating, creditEventSample.rating); + } + + function testClearCreditEventsLeavesDebt() public { + vm.startPrank(admin); + debtEngine.setDebt(testContract, debtSample); + debtEngine.setCreditEvents(testContract, creditEventSample); + debtEngine.clearCreditEvents(testContract); + vm.stopPrank(); + + assertFalse(debtEngine.hasCreditEvents(testContract)); + assertTrue(debtEngine.hasDebt(testContract)); + } + + function testClearUnsetRecordSucceeds() public { + vm.expectEmit(true, false, false, false, address(debtEngine)); + emit DebtCleared(testContract); + vm.prank(admin); + debtEngine.clearDebt(testContract); + assertFalse(debtEngine.hasDebt(testContract)); + + vm.expectEmit(true, false, false, false, address(debtEngine)); + emit CreditEventsCleared(testContract); + vm.prank(admin); + debtEngine.clearCreditEvents(testContract); + assertFalse(debtEngine.hasCreditEvents(testContract)); + } + + function testSetAfterClear() public { + vm.startPrank(admin); + debtEngine.setDebt(testContract, debtSample); + debtEngine.clearDebt(testContract); + debtEngine.setDebt(testContract, debtSample); + vm.stopPrank(); + + assertTrue(debtEngine.hasDebt(testContract)); + assertEq(debtEngine.debt(testContract).debtInstrument.parValue, debtSample.debtInstrument.parValue); + } + + function testCannotUnauthorizedClearDebt() public { + vm.prank(admin); + debtEngine.setDebt(testContract, debtSample); + + _expectUnauthorizedDebtRevert(attacker); + vm.prank(attacker); + debtEngine.clearDebt(testContract); + assertTrue(debtEngine.hasDebt(testContract)); + } + + function testCannotUnauthorizedClearCreditEvents() public { + vm.prank(admin); + debtEngine.setCreditEvents(testContract, creditEventSample); + + _expectUnauthorizedCreditEventsRevert(attacker); + vm.prank(attacker); + debtEngine.clearCreditEvents(testContract); + assertTrue(debtEngine.hasCreditEvents(testContract)); + } + + function testCMTATReadsEmptyRecordAfterClear() public { + vm.startPrank(admin); + debtEngine.setDebt(address(cmtat), debtSample); + debtEngine.setCreditEvents(address(cmtat), creditEventSample); + cmtat.setDebtEngine(debtEngine); + debtEngine.clearDebt(address(cmtat)); + debtEngine.clearCreditEvents(address(cmtat)); + vm.stopPrank(); + + assertEq(cmtat.debt().debtInstrument.parValue, 0); + assertEq(cmtat.creditEvents().rating, ""); + } +} diff --git a/test/DebtEngineHarness.t.sol b/test/DebtEngineHarness.t.sol new file mode 100644 index 0000000..bd6ab62 --- /dev/null +++ b/test/DebtEngineHarness.t.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Test} from "forge-std/Test.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; + +/** + * @dev Test-only engine with no access control and no ERC-2771. + * It overrides public functions of `DebtEngineBase`, so removing `virtual` from them breaks the build, + * and it relies on the base `_msgSender()` (`msg.sender`), which both deployment contracts override. + */ +contract DebtEngineHarness is DebtEngineBase { + bool public overridesReached; + + function setDebt(address smartContract_, DebtInformation calldata debt_) external override { + overridesReached = true; + _setDebt(smartContract_, debt_); + } + + function hasDebt(address) external pure override returns (bool) { + return true; + } + + function _authorizeSetDebt() internal view override {} + + function _authorizeSetCreditEvents() internal view override {} +} + +contract DebtEngineHarnessTest is Test { + DebtEngineHarness internal harness; + + function setUp() public { + harness = new DebtEngineHarness(); + } + + function testOverridesOfPublicFunctionsAreReached() public { + assertTrue(harness.hasDebt(address(0x1234))); + + ICMTATDebt.DebtInformation memory info; + info.debtInstrument.parValue = 42; + harness.setDebt(address(this), info); + assertTrue(harness.overridesReached()); + } + + function testBaseMsgSenderIsMsgSender() public { + ICMTATDebt.DebtInformation memory info; + info.debtInstrument.parValue = 42; + harness.setDebt(address(this), info); + + // debt() resolves the caller through the base _msgSender(), i.e. msg.sender + assertEq(harness.debt().debtInstrument.parValue, 42); + + ICMTATCreditEvents.CreditEvents memory c = harness.creditEvents(); + assertEq(c.rating, ""); + } +} diff --git a/test/DebtEngineOwnable.t.sol b/test/DebtEngineOwnable.t.sol new file mode 100644 index 0000000..7c1eeb4 --- /dev/null +++ b/test/DebtEngineOwnable.t.sol @@ -0,0 +1,187 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {DebtEngineBaseTest} from "./DebtEngineBase.t.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {IERC165} from "OZ/utils/introspection/IERC165.sol"; + +/// @dev ERC-173 as declared in the standard, to compute its interface id independently. +interface IERC173 { + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + function owner() external view returns (address); + + function transferOwnership(address newOwner) external; +} +import {DebtEngineOwnable} from "../src/deployment/DebtEngineOwnable.sol"; +import {Ownable} from "OZ/access/Ownable.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; + +contract DebtEngineOwnableTest is DebtEngineBaseTest { + DebtEngineOwnable private debtEngineOwn; + + function _deployEngine() internal override { + debtEngineOwn = new DebtEngineOwnable(admin, ADDRESS_ZERO); + debtEngine = debtEngineOwn; + } + + function _deployEngineWithForwarder(address forwarder) internal override returns (DebtEngineBase engine) { + DebtEngineOwnable e = new DebtEngineOwnable(admin, forwarder); + engine = e; + } + + function _expectUnauthorizedDebtRevert(address caller) internal override { + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, caller)); + } + + function _expectUnauthorizedCreditEventsRevert(address caller) internal override { + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, caller)); + } + + /*////////////////////////////////////////////////////////////// + DEPLOYMENT + ///////////////////////////////////////*/ + + function testDeploy() public override { + address forwarder = address(0x1); + debtEngineOwn = new DebtEngineOwnable(admin, forwarder); + + // Forwarder + assertEq(debtEngineOwn.isTrustedForwarder(forwarder), true); + // owner + assertEq(debtEngineOwn.owner(), admin); + // zero address + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableInvalidOwner.selector, ADDRESS_ZERO)); + new DebtEngineOwnable(ADDRESS_ZERO, forwarder); + } + + /*////////////////////////////////////////////////////////////// + Access control — unauthorized + ///////////////////////////////////////*/ + + function testCannotNonOwnerSetDebt() public { + vm.prank(attacker); + _expectUnauthorizedDebtRevert(attacker); + debtEngine.setDebt(testContract, debtSample); + } + + function testCannotNonOwnerSetCreditEvents() public { + vm.prank(attacker); + _expectUnauthorizedCreditEventsRevert(attacker); + debtEngine.setCreditEvents(testContract, creditEventSample); + } + + function testSetDebtsBatchAsNonOwnerFails() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier1, debtInstrument: debtSample1}); + debts[1] = ICMTATDebt.DebtInformation({debtIdentifier: debtIdentifier2, debtInstrument: debtSample2}); + + vm.prank(attacker); + _expectUnauthorizedDebtRevert(attacker); + debtEngine.setDebtBatch(contracts, debts); + } + + function testSetCreditEventsBatchAsNonOwnerFails() public { + address[] memory contracts = new address[](2); + contracts[0] = testContract1; + contracts[1] = testContract2; + + ICMTATCreditEvents.CreditEvents[] memory creditEventsList = new ICMTATCreditEvents.CreditEvents[](2); + creditEventsList[0] = creditEventSample1; + creditEventsList[1] = creditEventSample2; + + vm.prank(attacker); + _expectUnauthorizedCreditEventsRevert(attacker); + debtEngine.setCreditEventsBatch(contracts, creditEventsList); + } + + /*////////////////////////////////////////////////////////////// + Ownable-specific: transferOwnership, renounceOwnership + ///////////////////////////////////////*/ + + function testTransferOwnershipIsTwoStep() public { + address newOwner = address(0x99); + + vm.prank(admin); + debtEngineOwn.transferOwnership(newOwner); + + // Step 1 only proposes: control has not moved yet + assertEq(debtEngineOwn.owner(), admin); + assertEq(debtEngineOwn.pendingOwner(), newOwner); + + vm.prank(newOwner); + _expectUnauthorizedDebtRevert(newOwner); + debtEngine.setDebt(testContract, debtSample); + + // Step 2: the pending owner accepts + vm.prank(newOwner); + debtEngineOwn.acceptOwnership(); + assertEq(debtEngineOwn.owner(), newOwner); + assertEq(debtEngineOwn.pendingOwner(), ADDRESS_ZERO); + + // New owner can set debt + vm.prank(newOwner); + debtEngine.setDebt(testContract, debtSample); + + ICMTATDebt.DebtInformation memory d = debtEngine.debt(testContract); + assertEq(d.debtInstrument.interestRate, 5); + + // Old owner can no longer set debt + vm.prank(admin); + _expectUnauthorizedDebtRevert(admin); + debtEngine.setDebt(testContract, debtSample); + } + + function testOnlyPendingOwnerCanAcceptOwnership() public { + vm.prank(admin); + debtEngineOwn.transferOwnership(address(0x99)); + + vm.prank(attacker); + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, attacker)); + debtEngineOwn.acceptOwnership(); + assertEq(debtEngineOwn.owner(), admin); + } + + function testRenounceOwnership() public { + vm.prank(admin); + debtEngineOwn.renounceOwnership(); + assertEq(debtEngineOwn.owner(), ADDRESS_ZERO); + + // No one can set debt anymore + vm.prank(admin); + _expectUnauthorizedDebtRevert(admin); + debtEngine.setDebt(testContract, debtSample); + } + + /*////////////////////////////////////////////////////////////// + ERC-165 / ERC-173 + ///////////////////////////////////////*/ + + function testSupportsInterface() public view { + assertEq(type(IERC173).interfaceId, bytes4(0x7f5828d0)); + assertTrue(debtEngineOwn.supportsInterface(type(IERC173).interfaceId)); + assertTrue(debtEngineOwn.supportsInterface(type(IERC165).interfaceId)); + assertFalse(debtEngineOwn.supportsInterface(0xffffffff)); + } + + // ERC-173 says transferOwnership(address(0)) renounces; under Ownable2Step it only cancels a pending transfer + function testTransferOwnershipToZeroCancelsPendingTransfer() public { + vm.startPrank(admin); + debtEngineOwn.transferOwnership(address(0x99)); + debtEngineOwn.transferOwnership(ADDRESS_ZERO); + vm.stopPrank(); + + assertEq(debtEngineOwn.owner(), admin); + assertEq(debtEngineOwn.pendingOwner(), ADDRESS_ZERO); + } + + function testOwnershipTransferredEmittedAtDeployment() public { + vm.expectEmit(true, true, false, false); + emit IERC173.OwnershipTransferred(ADDRESS_ZERO, admin); + new DebtEngineOwnable(admin, ADDRESS_ZERO); + } +} diff --git a/test/DebtEngineThreatModel.t.sol b/test/DebtEngineThreatModel.t.sol new file mode 100644 index 0000000..1d7a280 --- /dev/null +++ b/test/DebtEngineThreatModel.t.sol @@ -0,0 +1,290 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Test, Vm} from "forge-std/Test.sol"; +import {DebtEngineBase} from "../src/DebtEngineBase.sol"; +import {DebtEngineInvariantStorage} from "../src/DebtEngineInvariantStorage.sol"; +import {DebtEngineAccessControl} from "../src/deployment/DebtEngineAccessControl.sol"; +import {DebtEngineOwnable} from "../src/deployment/DebtEngineOwnable.sol"; +import {IAccessControl} from "OZ/access/IAccessControl.sol"; +import {Ownable} from "OZ/access/Ownable.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; +import {IERC1643CMTAT} from "CMTAT/interfaces/tokenization/draft-IERC1643CMTAT.sol"; +import {ISnapshotEngine} from "CMTAT/interfaces/engine/ISnapshotEngine.sol"; +import {IRuleEngine} from "CMTAT/interfaces/engine/IRuleEngine.sol"; +import {IERC1643} from "CMTAT/interfaces/tokenization/draft-IERC1643.sol"; +import {CMTATStandaloneDebt} from "CMTAT/deployment/debt/CMTATStandaloneDebt.sol"; +import {ICMTATConstructor} from "CMTAT/interfaces/technical/ICMTATConstructor.sol"; + +/** + * @dev Tests derived from AUDIT/THREAT_MODEL.md (threat IDs in each @notice). + * PoC tests assert the current behaviour of a finding in AUDIT/RESULT.md. + */ +contract DebtEngineThreatModelTest is Test, DebtEngineInvariantStorage { + event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); + event DebtCleared(address indexed smartContract); + event CreditEventsCleared(address indexed smartContract); + + address internal admin = address(0xA11CE); + address internal newAdmin = address(0xB0B); + address internal forwarder = address(0xF0F0); + address internal token = address(0x7070); + + DebtEngineAccessControl internal rbac; + DebtEngineOwnable internal owned; + + bytes32 internal DEBT_MANAGER_ROLE; + bytes32 internal CREDIT_EVENTS_MANAGER_ROLE; + bytes32 internal constant DEFAULT_ADMIN_ROLE = 0x00; + + function setUp() public { + rbac = new DebtEngineAccessControl(admin, forwarder); + owned = new DebtEngineOwnable(admin, forwarder); + DEBT_MANAGER_ROLE = rbac.DEBT_MANAGER_ROLE(); + CREDIT_EVENTS_MANAGER_ROLE = rbac.CREDIT_EVENTS_MANAGER_ROLE(); + } + + function _info(uint256 parValue) internal pure returns (ICMTATDebt.DebtInformation memory info) { + info.debtInstrument.parValue = parValue; + info.debtIdentifier.issuerName = "Issuer"; + } + + function _credit() internal pure returns (ICMTATCreditEvents.CreditEvents memory c) { + c = ICMTATCreditEvents.CreditEvents({flagDefault: false, flagRedeemed: true, rating: "AAA"}); + } + + /*////////////////////////////////////////////////////////////// + AC-3 — implicit-admin hasRole vs role bookkeeping (F-1) + //////////////////////////////////////////////////////////////*/ + + /// @notice AC-3 / F-1 PoC: granting a manager role to an admin records nothing and emits nothing. + function testPoC_F1_GrantRoleToAdminIsSilentNoOp() public { + vm.recordLogs(); + vm.prank(admin); + rbac.grantRole(DEBT_MANAGER_ROLE, admin); + + assertEq(vm.getRecordedLogs().length, 0, "no RoleGranted event"); + assertEq(rbac.getRoleMemberCount(DEBT_MANAGER_ROLE), 0, "admin not enumerated"); + assertTrue(rbac.hasRole(DEBT_MANAGER_ROLE, admin), "yet hasRole reports true"); + } + + /// @notice AC-3 / F-1 PoC: revoking a manager role from an admin emits RoleRevoked, but the admin keeps the power. + function testPoC_F1_RevokeRoleFromAdminEmitsButKeepsPower() public { + vm.expectEmit(true, true, true, false, address(rbac)); + emit RoleRevoked(DEBT_MANAGER_ROLE, admin, admin); + vm.prank(admin); + rbac.revokeRole(DEBT_MANAGER_ROLE, admin); + + assertTrue(rbac.hasRole(DEBT_MANAGER_ROLE, admin)); + vm.prank(admin); + rbac.setDebt(token, _info(1)); + assertTrue(rbac.hasDebt(token), "admin still writes after its role was 'revoked'"); + } + + /// @notice AC-3 / F-1 PoC: an admin that "grants" itself a manager role, hands admin over and renounces, + /// loses the manager role it believed it had kept. + function testPoC_F1_AdminHandoverDropsSelfGrantedRole() public { + vm.startPrank(admin); + rbac.grantRole(DEBT_MANAGER_ROLE, admin); // silent no-op (see above) + rbac.grantRole(DEFAULT_ADMIN_ROLE, newAdmin); + rbac.renounceRole(DEFAULT_ADMIN_ROLE, admin); + vm.stopPrank(); + + vm.expectRevert( + abi.encodeWithSelector(IAccessControl.AccessControlUnauthorizedAccount.selector, admin, DEBT_MANAGER_ROLE) + ); + vm.prank(admin); + rbac.setDebt(token, _info(1)); + } + + /// @notice AC-3 / F-1 runbook: grant the manager role only after the account stops being admin. + function testF1_RunbookGrantAfterRenounceWorks() public { + vm.startPrank(admin); + rbac.grantRole(DEFAULT_ADMIN_ROLE, newAdmin); + rbac.renounceRole(DEFAULT_ADMIN_ROLE, admin); + vm.stopPrank(); + + vm.prank(newAdmin); + rbac.grantRole(DEBT_MANAGER_ROLE, admin); + assertEq(rbac.getRoleMember(DEBT_MANAGER_ROLE, 0), admin); + + vm.prank(admin); + rbac.setDebt(token, _info(1)); + assertTrue(rbac.hasDebt(token)); + } + + /*////////////////////////////////////////////////////////////// + AC-4 — last admin renounces (F-3) + //////////////////////////////////////////////////////////////*/ + + /// @notice AC-4 / F-3: after the only admin renounces, no role can ever be granted again. + function testLastAdminRenounceFreezesRoles() public { + vm.prank(admin); + rbac.renounceRole(DEFAULT_ADMIN_ROLE, admin); + assertEq(rbac.getRoleMemberCount(DEFAULT_ADMIN_ROLE), 0); + + vm.expectRevert( + abi.encodeWithSelector(IAccessControl.AccessControlUnauthorizedAccount.selector, admin, DEFAULT_ADMIN_ROLE) + ); + vm.prank(admin); + rbac.grantRole(DEBT_MANAGER_ROLE, newAdmin); + } + + /*////////////////////////////////////////////////////////////// + MTX — trusted forwarder (F-2) + //////////////////////////////////////////////////////////////*/ + + /// @notice MTX-2 / F-2 PoC: the trusted forwarder can act as the admin for role management, not only data writes. + function testPoC_F2_ForwarderCanGrantAdminRole() public { + address attacker = address(0xBAD); + bytes memory data = abi.encodeCall(IAccessControl.grantRole, (DEFAULT_ADMIN_ROLE, attacker)); + vm.prank(forwarder); + (bool ok,) = address(rbac).call(abi.encodePacked(data, admin)); + assertTrue(ok); + assertTrue(rbac.hasRole(DEFAULT_ADMIN_ROLE, attacker)); + } + + /// @notice MTX-2 / F-2 PoC (Ownable): the forwarder can start an ownership transfer on behalf of the owner. + function testPoC_F2_ForwarderCanStartOwnershipTransfer() public { + address attacker = address(0xBAD); + vm.prank(forwarder); + (bool ok,) = address(owned).call(abi.encodePacked(abi.encodeCall(Ownable.transferOwnership, (attacker)), admin)); + assertTrue(ok); + assertEq(owned.pendingOwner(), attacker); + } + + /// @notice MTX-1: the forwarder relays clearDebt for an authorized signer. + function testForwarderRelaysClearDebt() public { + vm.prank(admin); + rbac.setDebt(token, _info(7)); + + vm.prank(forwarder); + (bool ok,) = address(rbac).call(abi.encodePacked(abi.encodeCall(DebtEngineBase.clearDebt, (token)), admin)); + assertTrue(ok); + assertFalse(rbac.hasDebt(token)); + } + + /*////////////////////////////////////////////////////////////// + DATA-2 — clear accepts address(0) (F-4) + //////////////////////////////////////////////////////////////*/ + + /// @notice DATA-2 / F-4 (fixed): clear functions reject address(0), like the setters, in both variants. + /// Inverted from the PoC that asserted they accepted it. + function testCannotClearAddressZero() public { + DebtEngineBase[2] memory engines = [DebtEngineBase(rbac), DebtEngineBase(owned)]; + for (uint256 i = 0; i < engines.length; ++i) { + vm.startPrank(admin); + vm.expectRevert(SmartContractWithAddressZeroNotAllowed.selector); + engines[i].clearDebt(address(0)); + vm.expectRevert(SmartContractWithAddressZeroNotAllowed.selector); + engines[i].clearCreditEvents(address(0)); + vm.stopPrank(); + } + } + + /*////////////////////////////////////////////////////////////// + DATA-3 — engine shadows token-local data (F-5) + //////////////////////////////////////////////////////////////*/ + + function _deployToken() internal returns (CMTATStandaloneDebt cmtat) { + cmtat = new CMTATStandaloneDebt( + admin, + ICMTATConstructor.ERC20Attributes("CMTA Token", "CMTAT", 0), + ICMTATConstructor.ExtraInformationAttributes( + "CMTAT_ISIN", IERC1643CMTAT.DocumentInfo("terms", "https://cmta.ch", bytes32(0)), "CMTAT_info" + ), + ICMTATConstructor.Engine(IRuleEngine(address(0)), ISnapshotEngine(address(0)), IERC1643(address(0))) + ); + } + + /// @notice DATA-3 / F-5 PoC: a token's own debt disappears from `debt()` as soon as it points at an engine + /// that holds no record for it. + function testPoC_F5_EngineShadowsTokenLocalDebt() public { + CMTATStandaloneDebt cmtat = _deployToken(); + vm.startPrank(admin); + cmtat.setDebt(_info(1000)); + assertEq(cmtat.debt().debtInstrument.parValue, 1000); + + cmtat.setDebtEngine(rbac); + vm.stopPrank(); + + assertFalse(rbac.hasDebt(address(cmtat))); + assertEq(cmtat.debt().debtInstrument.parValue, 0, "token-local debt hidden by the engine"); + } + + /*////////////////////////////////////////////////////////////// + AC-1 / I-1 — only authorized callers write (fuzz) + //////////////////////////////////////////////////////////////*/ + + function _assertAllWritersReject(DebtEngineBase engine, address caller) internal { + address[] memory targets = new address[](1); + targets[0] = token; + ICMTATDebt.DebtInformation[] memory infos = new ICMTATDebt.DebtInformation[](1); + ICMTATCreditEvents.CreditEvents[] memory credits = new ICMTATCreditEvents.CreditEvents[](1); + + vm.startPrank(caller); + vm.expectRevert(); + engine.setDebt(token, _info(1)); + vm.expectRevert(); + engine.setDebtBatch(targets, infos); + vm.expectRevert(); + engine.clearDebt(token); + vm.expectRevert(); + engine.setCreditEvents(token, _credit()); + vm.expectRevert(); + engine.setCreditEventsBatch(targets, credits); + vm.expectRevert(); + engine.clearCreditEvents(token); + vm.stopPrank(); + } + + /// @notice AC-1 / I-1: any caller that is not the admin / owner is rejected by all six writers, in both variants, + /// with the variant's own unauthorized error. + function testFuzz_OnlyAuthorizedCanWrite(address caller) public { + vm.assume(caller != admin && caller != forwarder); + + _assertAllWritersReject(rbac, caller); + _assertAllWritersReject(owned, caller); + + // The specific errors, on one path per variant + vm.expectRevert( + abi.encodeWithSelector(IAccessControl.AccessControlUnauthorizedAccount.selector, caller, DEBT_MANAGER_ROLE) + ); + vm.prank(caller); + rbac.clearDebt(token); + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, caller)); + vm.prank(caller); + owned.clearCreditEvents(token); + + assertFalse(rbac.hasDebt(token)); + assertFalse(owned.hasCreditEvents(token)); + } + + /*////////////////////////////////////////////////////////////// + I-2 / I-3 — set / clear sequences match a model (fuzz) + //////////////////////////////////////////////////////////////*/ + + /// @notice I-2 / I-3: after any sequence of set / clear operations, hasDebt and debt() equal a simple model. + function testFuzz_SetClearSequenceMatchesModel(uint256 ops, uint8 length) public { + length = uint8(bound(length, 1, 32)); + bool modelSet; + uint256 modelPar; + + vm.startPrank(admin); + for (uint256 i = 0; i < length; ++i) { + if ((ops >> i) & 1 == 1) { + uint256 par = uint256(keccak256(abi.encode(ops, i))); + rbac.setDebt(token, _info(par)); + modelSet = true; + modelPar = par; + } else { + rbac.clearDebt(token); + modelSet = false; + modelPar = 0; + } + assertEq(rbac.hasDebt(token), modelSet); + assertEq(rbac.debt(token).debtInstrument.parValue, modelPar); + } + vm.stopPrank(); + } +} diff --git a/test/DeployGuideCMTATv3.0.0.t.sol b/test/DeployGuideCMTATv3.0.0.t.sol new file mode 100644 index 0000000..9cfa605 --- /dev/null +++ b/test/DeployGuideCMTATv3.0.0.t.sol @@ -0,0 +1,330 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Test} from "forge-std/Test.sol"; +import {DebtEngineAccessControl} from "../src/deployment/DebtEngineAccessControl.sol"; +import {DebtEngineOwnable} from "../src/deployment/DebtEngineOwnable.sol"; +import {IAccessControl} from "OZ/access/IAccessControl.sol"; +import {ERC1967Proxy} from "OZ/proxy/ERC1967/ERC1967Proxy.sol"; +import {ICMTATDebt, ICMTATCreditEvents} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; +import {IDebtEngine} from "CMTAT/interfaces/engine/IDebtEngine.sol"; +import {IERC1643CMTAT} from "CMTAT/interfaces/tokenization/draft-IERC1643CMTAT.sol"; +import {ISnapshotEngine} from "CMTAT/interfaces/engine/ISnapshotEngine.sol"; +import {IRuleEngine} from "CMTAT/interfaces/engine/IRuleEngine.sol"; +import {IERC1643} from "CMTAT/interfaces/tokenization/draft-IERC1643.sol"; +import {CMTATStandaloneDebt} from "CMTAT/deployment/debt/CMTATStandaloneDebt.sol"; +import {CMTATUpgradeableDebt} from "CMTAT/deployment/debt/CMTATUpgradeableDebt.sol"; +import {DebtEngineModule} from "CMTAT/modules/wrapper/options/DebtEngineModule.sol"; +import {ICMTATConstructor} from "CMTAT/interfaces/technical/ICMTATConstructor.sol"; + +/** + * @dev Runs, step by step, the procedures of + * doc/technical/guides/DEPLOY_DEBT_ENGINE_CMTAT_V3.0.0.md against CMTAT v3.0.0. + * Each test name maps to a section of the guide. + */ +contract DeployGuideCMTATv300Test is Test { + address internal admin = address(0xA11CE); // engine admin / owner + address internal tokenAdmin = address(0x70AD); // CMTAT DEFAULT_ADMIN_ROLE (implicitly DEBT_ROLE) + address internal debtManager = address(0xDEB7); + address internal creditManager = address(0xC2ED); + address internal multisig = address(0x5AFE); + + /*////////////////////////////////////////////////////////////// + HELPERS + //////////////////////////////////////////////////////////////*/ + + function _attrs() + internal + pure + returns ( + ICMTATConstructor.ERC20Attributes memory erc20, + ICMTATConstructor.ExtraInformationAttributes memory extra, + ICMTATConstructor.Engine memory engines + ) + { + erc20 = ICMTATConstructor.ERC20Attributes("Bond 2030", "BND30", 0); + extra = ICMTATConstructor.ExtraInformationAttributes( + "CH0000000000", IERC1643CMTAT.DocumentInfo("terms", "https://example.com/terms", bytes32(0)), "Bond" + ); + engines = ICMTATConstructor.Engine(IRuleEngine(address(0)), ISnapshotEngine(address(0)), IERC1643(address(0))); + } + + function _deployStandaloneToken() internal returns (CMTATStandaloneDebt token) { + ( + ICMTATConstructor.ERC20Attributes memory erc20, + ICMTATConstructor.ExtraInformationAttributes memory extra, + ICMTATConstructor.Engine memory engines + ) = _attrs(); + token = new CMTATStandaloneDebt(tokenAdmin, erc20, extra, engines); + } + + function _debt(uint256 parValue, string memory issuer) internal pure returns (ICMTATDebt.DebtInformation memory d) { + d.debtIdentifier.issuerName = issuer; + d.debtInstrument.parValue = parValue; + d.debtInstrument.interestRate = 5; + d.debtInstrument.currency = "CHF"; + } + + function _credit(string memory rating) internal pure returns (ICMTATCreditEvents.CreditEvents memory c) { + c = ICMTATCreditEvents.CreditEvents({flagDefault: false, flagRedeemed: false, rating: rating}); + } + + /*////////////////////////////////////////////////////////////// + §4.1 — DebtEngineAccessControl + CMTATStandaloneDebt + //////////////////////////////////////////////////////////////*/ + + function testGuide_4_1_AccessControlWithStandaloneToken() public { + // Step 1 — deploy the engine (no forwarder) + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + assertEq(engine.version(), "0.3.0"); + + // Step 2 — grant the operational roles + vm.startPrank(admin); + engine.grantRole(engine.DEBT_MANAGER_ROLE(), debtManager); + engine.grantRole(engine.CREDIT_EVENTS_MANAGER_ROLE(), creditManager); + vm.stopPrank(); + + // Step 3 — deploy the token + CMTATStandaloneDebt token = _deployStandaloneToken(); + + // Step 4 — write the token's records in the engine BEFORE connecting it + vm.prank(debtManager); + engine.setDebt(address(token), _debt(1000, "Issuer SA")); + vm.prank(creditManager); + engine.setCreditEvents(address(token), _credit("AAA")); + + // Step 5 — connect the token to the engine (token side, DEBT_ROLE) + vm.expectEmit(true, false, false, false, address(token)); + emit DebtEngineModule.DebtEngine(IDebtEngine(address(engine))); + vm.prank(tokenAdmin); + token.setDebtEngine(engine); + + // Step 6 — verify + assertEq(address(token.debtEngine()), address(engine)); + assertTrue(engine.hasDebt(address(token))); + assertTrue(engine.hasCreditEvents(address(token))); + assertEq(token.debt().debtInstrument.parValue, 1000); + assertEq(token.debt().debtIdentifier.issuerName, "Issuer SA"); + assertEq(token.creditEvents().rating, "AAA"); + } + + /*////////////////////////////////////////////////////////////// + §4.2 — DebtEngineOwnable + handover to a multisig + //////////////////////////////////////////////////////////////*/ + + function testGuide_4_2_OwnableWithStandaloneToken() public { + // Step 1 — deploy, owner = deployer key + DebtEngineOwnable engine = new DebtEngineOwnable(admin, address(0)); + + // Step 2 — deploy the token and write its records + CMTATStandaloneDebt token = _deployStandaloneToken(); + vm.startPrank(admin); + engine.setDebt(address(token), _debt(500, "Issuer SA")); + engine.setCreditEvents(address(token), _credit("BBB")); + + // Step 3 — two-step handover to the multisig + engine.transferOwnership(multisig); + vm.stopPrank(); + assertEq(engine.owner(), admin, "nothing moves before acceptance"); + vm.prank(multisig); + engine.acceptOwnership(); + assertEq(engine.owner(), multisig); + + // Step 4 — connect and verify + vm.prank(tokenAdmin); + token.setDebtEngine(engine); + assertEq(token.debt().debtInstrument.parValue, 500); + assertEq(token.creditEvents().rating, "BBB"); + } + + /*////////////////////////////////////////////////////////////// + §4.3 — Upgradeable token behind an ERC-1967 proxy + //////////////////////////////////////////////////////////////*/ + + function testGuide_4_3_UpgradeableTokenThroughProxy() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + + ( + ICMTATConstructor.ERC20Attributes memory erc20, + ICMTATConstructor.ExtraInformationAttributes memory extra, + ICMTATConstructor.Engine memory engines + ) = _attrs(); + CMTATUpgradeableDebt implementation = new CMTATUpgradeableDebt(); + ERC1967Proxy proxy = new ERC1967Proxy( + address(implementation), + abi.encodeWithSignature( + // initialize is overloaded across CMTAT bases: name the debt variant's signature explicitly + "initialize(address,(string,string,uint8),(string,(string,string,bytes32),string),(address,address,address))", + tokenAdmin, + erc20, + extra, + engines + ) + ); + CMTATUpgradeableDebt token = CMTATUpgradeableDebt(address(proxy)); + + // The record is keyed by the PROXY address, the one holders and integrators call + vm.prank(admin); + engine.setDebt(address(proxy), _debt(2000, "Issuer SA")); + vm.prank(tokenAdmin); + token.setDebtEngine(engine); + + assertEq(token.debt().debtInstrument.parValue, 2000); + assertFalse(engine.hasDebt(address(implementation)), "nothing stored for the implementation"); + } + + /*////////////////////////////////////////////////////////////// + §5 — One engine, several tokens + //////////////////////////////////////////////////////////////*/ + + function testGuide_5_OneEngineSeveralTokens() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + CMTATStandaloneDebt tokenA = _deployStandaloneToken(); + CMTATStandaloneDebt tokenB = _deployStandaloneToken(); + + address[] memory tokens = new address[](2); + tokens[0] = address(tokenA); + tokens[1] = address(tokenB); + ICMTATDebt.DebtInformation[] memory debts = new ICMTATDebt.DebtInformation[](2); + debts[0] = _debt(100, "Issuer A"); + debts[1] = _debt(200, "Issuer B"); + + vm.prank(admin); + engine.setDebtBatch(tokens, debts); + + vm.startPrank(tokenAdmin); + tokenA.setDebtEngine(engine); + tokenB.setDebtEngine(engine); + vm.stopPrank(); + + assertEq(tokenA.debt().debtInstrument.parValue, 100); + assertEq(tokenB.debt().debtInstrument.parValue, 200); + } + + /*////////////////////////////////////////////////////////////// + §6 — Order matters: connecting first hides the token's own data + //////////////////////////////////////////////////////////////*/ + + function testGuide_6_ConnectingBeforeWritingHidesLocalData() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + CMTATStandaloneDebt token = _deployStandaloneToken(); + + vm.startPrank(tokenAdmin); + token.setDebt(_debt(1000, "Local")); + assertEq(token.debt().debtInstrument.parValue, 1000); + token.setDebtEngine(engine); // engine has no record yet + vm.stopPrank(); + + assertEq(token.debt().debtInstrument.parValue, 0, "token now reads the engine's empty record"); + assertFalse(engine.hasDebt(address(token))); + } + + /*////////////////////////////////////////////////////////////// + §7 — Operating: update, clear, disconnect, replace + //////////////////////////////////////////////////////////////*/ + + function testGuide_7_Operations() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + CMTATStandaloneDebt token = _deployStandaloneToken(); + + vm.prank(tokenAdmin); + token.setDebt(_debt(1, "Local")); + + vm.prank(admin); + engine.setDebt(address(token), _debt(1000, "Issuer SA")); + vm.prank(tokenAdmin); + token.setDebtEngine(engine); + + // Update a record: the token sees it immediately + vm.prank(admin); + engine.setDebt(address(token), _debt(1100, "Issuer SA")); + assertEq(token.debt().debtInstrument.parValue, 1100); + + // Record a credit event (e.g. default) + vm.prank(admin); + engine.setCreditEvents( + address(token), ICMTATCreditEvents.CreditEvents({flagDefault: true, flagRedeemed: false, rating: "D"}) + ); + assertTrue(token.creditEvents().flagDefault); + + // Clear a record: the token reports an empty record, hasDebt is false + vm.prank(admin); + engine.clearDebt(address(token)); + assertEq(token.debt().debtInstrument.parValue, 0); + assertFalse(engine.hasDebt(address(token))); + + // Setting the same engine again reverts on the token side + vm.expectRevert(DebtEngineModule.CMTAT_DebtEngineModule_SameValue.selector); + vm.prank(tokenAdmin); + token.setDebtEngine(engine); + + // Replace the engine with a new one + DebtEngineAccessControl engine2 = new DebtEngineAccessControl(admin, address(0)); + vm.prank(admin); + engine2.setDebt(address(token), _debt(3000, "Issuer SA")); + vm.prank(tokenAdmin); + token.setDebtEngine(engine2); + assertEq(token.debt().debtInstrument.parValue, 3000); + + // Disconnect: the token falls back to its own DebtModule data + vm.prank(tokenAdmin); + token.setDebtEngine(IDebtEngine(address(0))); + assertEq(token.debt().debtInstrument.parValue, 1); + } + + /*////////////////////////////////////////////////////////////// + §7 — Roles: who can do what + //////////////////////////////////////////////////////////////*/ + + function testGuide_7_RolesAreSeparated() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + CMTATStandaloneDebt token = _deployStandaloneToken(); + bytes32 debtManagerRole = engine.DEBT_MANAGER_ROLE(); + bytes32 creditManagerRole = engine.CREDIT_EVENTS_MANAGER_ROLE(); + + vm.startPrank(admin); + engine.grantRole(debtManagerRole, debtManager); + engine.grantRole(creditManagerRole, creditManager); + vm.stopPrank(); + + // The credit-events manager cannot write debt + vm.expectRevert( + abi.encodeWithSelector( + IAccessControl.AccessControlUnauthorizedAccount.selector, creditManager, debtManagerRole + ) + ); + vm.prank(creditManager); + engine.setDebt(address(token), _debt(1, "x")); + + // An engine manager cannot connect the token: that is the token's DEBT_ROLE + vm.expectRevert( + abi.encodeWithSelector( + IAccessControl.AccessControlUnauthorizedAccount.selector, debtManager, token.DEBT_ROLE() + ) + ); + vm.prank(debtManager); + token.setDebtEngine(engine); + } + + /*////////////////////////////////////////////////////////////// + §8 — Admin handover runbook (RBAC) + //////////////////////////////////////////////////////////////*/ + + function testGuide_8_AdminHandoverRunbook() public { + DebtEngineAccessControl engine = new DebtEngineAccessControl(admin, address(0)); + bytes32 debtManagerRole = engine.DEBT_MANAGER_ROLE(); + + // 1. grant admin to the multisig, 2. renounce, 3. the multisig grants the manager role + vm.startPrank(admin); + engine.grantRole(engine.DEFAULT_ADMIN_ROLE(), multisig); + engine.renounceRole(engine.DEFAULT_ADMIN_ROLE(), admin); + vm.stopPrank(); + vm.prank(multisig); + engine.grantRole(debtManagerRole, admin); + + assertFalse(engine.hasRole(engine.DEFAULT_ADMIN_ROLE(), admin)); + assertEq(engine.getRoleMember(debtManagerRole, 0), admin); + vm.prank(admin); + engine.setDebt(address(0x1234), _debt(1, "x")); + } +} diff --git a/test/script/DeployScripts.t.sol b/test/script/DeployScripts.t.sol new file mode 100644 index 0000000..b04ef69 --- /dev/null +++ b/test/script/DeployScripts.t.sol @@ -0,0 +1,173 @@ +// SPDX-License-Identifier: MPL-2.0 +pragma solidity ^0.8.27; + +import {Test} from "forge-std/Test.sol"; +import {DeployDebtEngine} from "../../script/DeployDebtEngine.s.sol"; +import {ConnectDebtEngine} from "../../script/ConnectDebtEngine.s.sol"; +import {DebtEngineBase} from "../../src/DebtEngineBase.sol"; +import {DebtEngineAccessControl} from "../../src/deployment/DebtEngineAccessControl.sol"; +import {DebtEngineOwnable} from "../../src/deployment/DebtEngineOwnable.sol"; +import {ICMTATDebt} from "CMTAT/interfaces/tokenization/ICMTAT.sol"; +import {IERC1643CMTAT} from "CMTAT/interfaces/tokenization/draft-IERC1643CMTAT.sol"; +import {ISnapshotEngine} from "CMTAT/interfaces/engine/ISnapshotEngine.sol"; +import {IRuleEngine} from "CMTAT/interfaces/engine/IRuleEngine.sol"; +import {IERC1643} from "CMTAT/interfaces/tokenization/draft-IERC1643.sol"; +import {CMTATStandaloneDebt} from "CMTAT/deployment/debt/CMTATStandaloneDebt.sol"; +import {ICMTATConstructor} from "CMTAT/interfaces/technical/ICMTATConstructor.sol"; + +/** + * @dev Tests for script/DeployDebtEngine.s.sol and script/ConnectDebtEngine.s.sol. + * The scripts broadcast from forge's default sender (`DEFAULT_SENDER`), which is the admin when none is given. + */ +contract DeployScriptsTest is Test { + DeployDebtEngine internal deployScript; + ConnectDebtEngine internal connectScript; + + address internal debtManager = address(0xDEB7); + address internal creditManager = address(0xC2ED); + address internal forwarder = address(0xF0F0); + address internal otherAdmin = address(0xA11CE); + + function setUp() public { + deployScript = new DeployDebtEngine(); + connectScript = new ConnectDebtEngine(); + } + + function _cfg(bool ownable, address admin, address fwd, address dm, address cm) + internal + pure + returns (DeployDebtEngine.Config memory) + { + return DeployDebtEngine.Config({ + ownable: ownable, admin: admin, forwarder: fwd, debtManager: dm, creditEventsManager: cm + }); + } + + function _token() internal returns (CMTATStandaloneDebt) { + return new CMTATStandaloneDebt( + DEFAULT_SENDER, + ICMTATConstructor.ERC20Attributes("Bond", "BND", 0), + ICMTATConstructor.ExtraInformationAttributes( + "ISIN", IERC1643CMTAT.DocumentInfo("terms", "https://example.com", bytes32(0)), "info" + ), + ICMTATConstructor.Engine(IRuleEngine(address(0)), ISnapshotEngine(address(0)), IERC1643(address(0))) + ); + } + + /*////////////////////////////////////////////////////////////// + DeployDebtEngine + //////////////////////////////////////////////////////////////*/ + + function testDeployAccessControlDefaults() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, address(0), address(0), address(0), address(0))); + DebtEngineAccessControl rbac = DebtEngineAccessControl(address(engine)); + + assertEq(engine.version(), "0.3.0"); + assertTrue(rbac.hasRole(rbac.DEFAULT_ADMIN_ROLE(), DEFAULT_SENDER), "broadcaster is admin by default"); + assertFalse(rbac.isTrustedForwarder(address(0x1))); + } + + function testDeployAccessControlWithManagersAndForwarder() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, address(0), forwarder, debtManager, creditManager)); + DebtEngineAccessControl rbac = DebtEngineAccessControl(address(engine)); + + assertEq(rbac.getRoleMember(rbac.DEBT_MANAGER_ROLE(), 0), debtManager); + assertEq(rbac.getRoleMember(rbac.CREDIT_EVENTS_MANAGER_ROLE(), 0), creditManager); + assertTrue(rbac.isTrustedForwarder(forwarder)); + + // The granted manager can write + ICMTATDebt.DebtInformation memory info; + info.debtInstrument.parValue = 1; + vm.prank(debtManager); + engine.setDebt(address(0x1234), info); + assertTrue(engine.hasDebt(address(0x1234))); + } + + function testDeployAccessControlForAnotherAdmin() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, otherAdmin, address(0), address(0), address(0))); + DebtEngineAccessControl rbac = DebtEngineAccessControl(address(engine)); + assertTrue(rbac.hasRole(rbac.DEFAULT_ADMIN_ROLE(), otherAdmin)); + assertFalse(rbac.hasRole(rbac.DEFAULT_ADMIN_ROLE(), DEFAULT_SENDER), "broadcaster keeps no role"); + } + + function testDeployOwnable() public { + DebtEngineBase engine = deployScript.deploy(_cfg(true, otherAdmin, address(0), address(0), address(0))); + assertEq(DebtEngineOwnable(address(engine)).owner(), otherAdmin); + assertTrue(DebtEngineOwnable(address(engine)).supportsInterface(0x7f5828d0)); + } + + function testRevertWhenGrantingManagersWithoutBeingAdmin() public { + vm.expectRevert( + abi.encodeWithSelector(DeployDebtEngine.BroadcasterIsNotAdmin.selector, DEFAULT_SENDER, otherAdmin) + ); + deployScript.deploy(_cfg(false, otherAdmin, address(0), debtManager, address(0))); + } + + function testRevertWhenOwnableGivenManagers() public { + vm.expectRevert(DeployDebtEngine.ManagersNeedAccessControlVariant.selector); + deployScript.deploy(_cfg(true, address(0), address(0), debtManager, address(0))); + } + + /// @dev The only test that touches the process environment, so parallel tests cannot race on it. + function testRunReadsEnvironment() public { + vm.setEnv("ENGINE_VARIANT", "ownable"); + vm.setEnv("ENGINE_ADMIN", vm.toString(otherAdmin)); + vm.setEnv("FORWARDER", vm.toString(forwarder)); + vm.setEnv("DEBT_MANAGER", vm.toString(address(0))); + vm.setEnv("CREDIT_EVENTS_MANAGER", vm.toString(address(0))); + + DebtEngineBase engine = deployScript.run(); + assertEq(DebtEngineOwnable(address(engine)).owner(), otherAdmin); + assertTrue(DebtEngineOwnable(address(engine)).isTrustedForwarder(forwarder)); + + vm.setEnv("ENGINE_VARIANT", "proxy"); + vm.expectRevert(abi.encodeWithSelector(DeployDebtEngine.UnknownVariant.selector, "proxy")); + deployScript.readConfig(); + + vm.setEnv("ENGINE_VARIANT", "access-control"); + } + + /*////////////////////////////////////////////////////////////// + ConnectDebtEngine + //////////////////////////////////////////////////////////////*/ + + function testConnectAfterRecordIsWritten() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, address(0), address(0), address(0), address(0))); + CMTATStandaloneDebt token = _token(); + + ICMTATDebt.DebtInformation memory info; + info.debtInstrument.parValue = 1000; + vm.prank(DEFAULT_SENDER); + engine.setDebt(address(token), info); + + connectScript.connect( + ConnectDebtEngine.Config({token: address(token), engine: address(engine), allowEmptyRecord: false}) + ); + + assertEq(address(token.debtEngine()), address(engine)); + assertEq(token.debt().debtInstrument.parValue, 1000); + } + + function testConnectRefusesEmptyRecord() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, address(0), address(0), address(0), address(0))); + CMTATStandaloneDebt token = _token(); + + vm.expectRevert( + abi.encodeWithSelector(ConnectDebtEngine.NoDebtRecordForToken.selector, address(engine), address(token)) + ); + connectScript.connect( + ConnectDebtEngine.Config({token: address(token), engine: address(engine), allowEmptyRecord: false}) + ); + assertEq(address(token.debtEngine()), address(0)); + } + + function testConnectWithEmptyRecordWhenAllowed() public { + DebtEngineBase engine = deployScript.deploy(_cfg(false, address(0), address(0), address(0), address(0))); + CMTATStandaloneDebt token = _token(); + + connectScript.connect( + ConnectDebtEngine.Config({token: address(token), engine: address(engine), allowEmptyRecord: true}) + ); + assertEq(address(token.debtEngine()), address(engine)); + } +}