Usual Tech Docs
Usual WebsiteGeneral DocsContract DeploymentsAuditsAccess dApp
  • 🚀GM GM
    • Usual Tech Hub
  • 🔭Overview
    • Usual Protocol Primer
    • Features
      • Mint & Redeem Engine
      • USD0
      • USD0++
      • USUAL
      • USUAL*
      • USUALx (USUAL staking)
      • USUAL distribution
      • USUAL Airdrop
      • Usual USD0++ Investment Vault
    • Architecture
      • Role Management
      • USUAL Distribution Model
  • ⛓️Smart Contracts
    • Protocol Contracts
      • DaoCollateral
      • Swapper Engine
      • USUAL staking
      • USUAL* Vested Allocation Staking
      • USUAL Distribution
        • Distribution Module
        • Yield Module
      • Airdrop Module
    • Token Contracts
      • USD0
      • USD0++
      • USUAL
      • USUAL*
      • USUALx
      • Usual USD0++ Investment Vault
        • VaultRouter
    • Utility Contracts
      • ClassicalOracle
      • Abstract Oracle
      • Chainlink Oracles
      • Pyth Oracles
      • RedStone Oracles
    • Real World Assets
      • USYC (by Hashnote)
      • M (by M0)
        • UsualM
      • USDtb
    • Contract Deployments
  • 🛡️Security & Audits
    • Security Practices
    • Testing Framework
    • Monitoring Framework
    • Audits
    • Bug Bounty
  • 🧩Integrations
    • Integrate USD0++
      • Reward redistribution by integration partner
      • Claim Address Redirect
      • Daily Distribution powered by Brevis (coming soon)
  • 📚Resources
    • Community & Support
    • References
  • 📖Support
    • FAQ
    • Glossary
  • ⚖️Legal
    • Terms of Services
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • High-Level Overview
  • Contract Summary
  • Functions Description
  • Functionality Breakdown
  • SC-Flows
  • Constants
  • Safeguards Implementation

Was this helpful?

  1. Smart Contracts
  2. Real World Assets
  3. M (by M0)

UsualM

High-Level Overview

The UsualM smart contract manages the UsualM ERC20 Token and acts as a wrapped version of the WrappedM token (wrapped version of the M token). It allows users to wrap WrappedM tokens into UsualM, adding enhanced functionality such as pausability, blacklist enforcement, and mint cap restrictions. It also supports permits and implements role-based access control to ensure secure operations.

This contract is specifically designed to interact with the WrappedM token while enforcing access control through a Registry Access Contract. Key features include wrapping, unwrapping, minting, and pausing operations.

Contract Summary

UsualM is an ERC-20 token with additional features that provide security and operational flexibility. It integrates with OpenZeppelin upgradeable modules for pausability and permit-based approvals. Moreover, it enforces blacklist restrictions to prevent interactions with malicious or sanctioned addresses and limits the maximum supply via a configurable mint cap.

Inherited Contracts

  • ERC20PausableUpgradeable: Enables pausability of token transfers, ensuring operations can be halted in emergencies.

  • ERC20PermitUpgradeable: Supports gasless approvals through EIP-2612 signatures, enabling off-chain approval of token transfers.

  • ERC20Upgradeable: Provides the core ERC-20 token implementation.

Functions Description

Public/External Functions

  • wrap(address recipient, uint256 amount): Wraps the specified amount of WrappedM tokens into UsualM tokens for the recipient.

  • wrapWithPermit(address recipient, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s): Wraps WrappedM tokens using a permit signature for approval, enabling gasless wrapping.

  • unwrap(address recipient, uint256 amount): Unwraps UsualM tokens into WrappedM tokens, subject to role checks on the caller.

  • setMintCap(uint256 newMintCap): Updates the mint cap for the token. Callable only by accounts with the USUAL_M_MINTCAP_ALLOCATOR role.

  • pause(): Pauses all token transfers. Callable only by accounts with the USUAL_M_PAUSE role.

  • unpause(): Resumes all token transfers. Callable only by accounts with the USUAL_M_UNPAUSE role.

  • blacklist(address account): Blacklists an address, preventing it from interacting with the token. Callable only by accounts with the BLACKLIST_ROLE.

  • unBlacklist(address account): Removes an address from the blacklist. Callable only by accounts with the BLACKLIST_ROLE.

Functionality Breakdown

SC-Flows

Key Functionalities

  • Wrapping: Users can wrap WrappedM tokens into UsualM, making use of enhanced token features.

  • Unwrapping: Users can unwrap UsualM tokens back into WrappedM, subject to role checks.

  • Mint Cap Enforcement: Ensures that the total supply of UsualM tokens does not exceed the configured mint cap.

  • Blacklist Enforcement: Prevents blacklisted addresses from participating in token transfers.

  • Pausability: Allows administrators to halt all token transfers during emergencies.

Constants

  • USUAL_M_UNWRAP: Role required to unwrap tokens.

  • USUAL_M_PAUSE: Role required to pause the contract.

  • USUAL_M_UNPAUSE: Role required to unpause the contract.

  • USUAL_M_MINTCAP_ALLOCATOR: Role required to update the mint cap.

  • BLACKLIST_ROLE: Role required to blacklist/unblacklist accounts.

Safeguards Implementation

  • Pausability: The contract integrates pausability to ensure all token transfers can be halted in emergencies. Only accounts with the appropriate roles can pause/unpause the contract.

  • Role-Based Access Control: Sensitive operations such as pausing, unwrapping, blacklisting, and updating the mint cap are restricted to accounts with specific roles. This ensures that only authorized entities can perform these operations.

  • Mint Cap Enforcement: The total supply of UsualM tokens is capped by a configurable limit, ensuring supply control.

  • Blacklist Enforcement: The contract prevents interactions with blacklisted addresses, safeguarding the token economy from malicious actors.

PreviousM (by M0)NextUSDtb

Last updated 5 months ago

Was this helpful?

⛓️