Skip to content

Update ArtToken & AuctionHouse#36

Merged
mriynyk merged 1 commit into
masterfrom
upd_token_auction
Feb 5, 2026
Merged

Update ArtToken & AuctionHouse#36
mriynyk merged 1 commit into
masterfrom
upd_token_auction

Conversation

@mriynyk

@mriynyk mriynyk commented May 21, 2025

Copy link
Copy Markdown
Collaborator

Token & Auction Protocol Refactoring

Overview

This pull request introduces a major refactoring of the entire smart contract suite. The primary goal of this refactoring is to enhance modularity, improve security, increase readability, and introduce a more robust and reusable architecture for core functionalities like authorization, role management, and deployment.

Key Changes

1. New Authorization System

A sophisticated EIP-712 based authorization system has been implemented, replacing the previous monolithic EIP712 contract. This new system is broken down into three distinct, reusable components:

  • EIP712Domain.sol: An abstract contract that handles the creation and storage of the EIP-712 domain separator.
  • EIP712Signature.sol: A lightweight library for recovering signers from EIP-712 typed-data signatures.
  • Authorization.sol: A mixin that provides a simple and secure way to verify actions that are authorized by an off-chain signature from an account with a specific SIGNER_ROLE.

This separation of concerns makes the authorization logic cleaner, more auditable, and reusable across the protocol.

2. Enhanced Role Management

The role-based access control system has been significantly improved:

  • Roles.sol: A new library that centralizes the definitions of all roles (FINANCIAL_ROLE, PARTNER_ROLE, SIGNER_ROLE) used in the protocol. This improves maintainability and clarity.
  • RoleSystem.sol: The core role system contract has been cleaned up.

3. Improved and Deterministic Deployment

The deployment process has been made more robust, predictable, and transparent:

  • Deployment.sol: A new library that abstracts away low-level deployment logic. It includes a function to deploy upgradeable proxies and a function to deterministically calculate future contract addresses based on the deployer's nonce (as per EIP-1822).
  • Deployer.sol: A dedicated contract for deploying the entire protocol. It uses the Deployment.sol library to deploy contracts in a specific order, allowing contracts to know each other's addresses at deployment time.

4. Core Contract Improvements

Both ArtToken.sol and AuctionHouse.sol have been refactored to use the new modular architecture.

  • Modularity: Both contracts now inherit from EIP712Domain, RoleSystem, and Authorization, making their codebases smaller and more focused on their core business logic.
  • Readability and Documentation: NatSpec documentation has been added or significantly improved across all contracts, interfaces, and libraries. This makes the code much easier to understand and audit.
  • Error Handling: Custom error messages have been simplified and are now more consistent across the protocol. Many internal require functions have been removed in favor of inline checks, improving readability and reducing contract size.
  • Distribution.sol: The Distribution library has been made safer by using OpenZeppelin's Math.mulDiv for calculations and by providing more granular and descriptive error reporting for invalid distribution conditions.

5. Testing Infrastructure

The entire testing suite has been overhauled to reflect the extensive contract changes:

  • New Tests: New test suites have been added for the new utility contracts and functionalities.
  • Updated Tests: All existing tests for ArtToken and AuctionHouse have been updated.
  • Reorganization: Test constants have been moved into a dedicated tests/constants directory, and new test utilities have been added to streamline test setup and execution.

Conclusion

This refactoring represents a major step forward for the protocol, resulting in a codebase that is more secure, maintainable, and easier to build upon. The modular design will facilitate future upgrades and feature additions.

@mriynyk mriynyk force-pushed the upd_token_auction branch 4 times, most recently from 233c3b8 to ab6cada Compare May 28, 2025 16:48
@mriynyk mriynyk force-pushed the upd_token_auction branch from aeac0d0 to 97f902d Compare June 16, 2025 07:01
@mriynyk mriynyk merged commit af76a34 into master Feb 5, 2026
1 check passed
@mriynyk mriynyk deleted the upd_token_auction branch February 5, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant