Update ArtToken & AuctionHouse#36
Merged
Merged
Conversation
233c3b8 to
ab6cada
Compare
aeac0d0 to
97f902d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 specificSIGNER_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 theDeployment.sollibrary to deploy contracts in a specific order, allowing contracts to know each other's addresses at deployment time.4. Core Contract Improvements
Both
ArtToken.solandAuctionHouse.solhave been refactored to use the new modular architecture.EIP712Domain,RoleSystem, andAuthorization, making their codebases smaller and more focused on their core business logic.requirefunctions have been removed in favor of inline checks, improving readability and reducing contract size.Distribution.sol: TheDistributionlibrary has been made safer by using OpenZeppelin'sMath.mulDivfor 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:
ArtTokenandAuctionHousehave been updated.tests/constantsdirectory, 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.