Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8b6fcb2
Update library and adapt DebtEngine to CMTAT v3.2.0
rya-sge Feb 11, 2026
0511af3
Emit events, check for zero address and other improvements
rya-sge Feb 11, 2026
1c794f1
Create two deployment version: RBAC Access Control and Ownable
rya-sge Feb 11, 2026
832867d
Update surya and changelog
rya-sge Nov 16, 2026
0f754d0
docs: add CLAUDE.md and AGENTS.md agent guide and AI analysis summary
rya-sge Nov 16, 2026
f834fc6
feat: add VersionModule exposing version() and update v0.3.0 changelog
rya-sge Nov 16, 2026
d19ed87
build: pin CMTAT submodule to v3.0.0 and adapt test setup
rya-sge Nov 16, 2026
0f9856a
refactor: make auth hooks view with modifier overrides, use Ownable2S…
rya-sge Nov 16, 2026
fac07f2
docs: add DebtEngine/CMTAT version compatibility table to README
rya-sge Nov 16, 2026
df79202
refactor: single write paths, virtual API, require guards and ERC-165…
rya-sge Nov 16, 2026
705208b
feat: add clearDebt and clearCreditEvents to delete a record and rese…
rya-sge Nov 16, 2026
e7be94b
test: add security analysis (AUDIT/) with threat-model tests and role…
rya-sge Nov 16, 2026
4e01b09
docs: add v0.3.0 Claude security audit report (CLAUDE_AUDIT.md)
rya-sge Nov 16, 2026
adca0d5
Add draft in gitignore + security file
rya-sge Nov 16, 2026
144103d
Update security file
rya-sge Nov 16, 2026
c2be665
docs: add CMTAT v3.0.0 deployment guide with a test that runs each step
rya-sge Nov 16, 2026
ff598d3
feat: add Foundry deployment and connection scripts with tests
rya-sge Nov 16, 2026
3b86328
build: add Hardhat 2 compilation config using the Foundry remappings
rya-sge Nov 17, 2026
9d7fba8
docs: refresh v0.3.0 Slither and Aderyn reports with feedback, audit …
rya-sge Nov 17, 2026
1c19a13
feat: add clearDebt and clearCreditEvents to delete a record and rese…
rya-sge Nov 17, 2026
a895b97
docs: record decision to keep the default admin model and document th…
rya-sge Nov 17, 2026
94d6230
fix: reject address(0) in clearDebt and clearCreditEvents (audit F-4)…
rya-sge Nov 17, 2026
b2bf919
docs: state CMTAT v3.0.0 as the only supported version for v0.3.0
rya-sge Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .claude/skills/cmtat/SKILL.md
Original file line number Diff line number Diff line change
@@ -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
90 changes: 90 additions & 0 deletions .claude/skills/erc173-ownership/SKILL.md
Original file line number Diff line number Diff line change
@@ -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).
Loading
Loading