Documentation Portal
Project Home
  • Core Documentation
    • Overview
    • Whitepaper
      • Abstract
      • I. Introduction
      • II. Protocol
        • II.I Operation
          • II.I.I Generation of M
          • II.I.II Protocol Fees
          • II.I.III Cancel and Freeze
          • II.I.IV Retrieving Free Collateral
          • II.I.V The Earn Mechanism
          • II.I.VI Removing a Permissioned Actor
          • II.I.VII Example Interactions and Flows
        • II.II Governance Controlled Protocol Actors
        • II.III Governance Controlled Protocol Parameters
      • III. Governance
        • III.I Inputs
        • III.II Operation
          • III.II.I Epochs
          • III.II.II Proposals
            • III.II.II.I Standard Proposals
            • III.II.II.II POWER Threshold Proposals
            • III.II.II.III ZERO Threshold Proposals
            • III.II.II.IV Proposal Matrix
          • III.II.III Checkpoints and Voting
          • III.II.IV Proposing
          • III.II.V Inflation Mechanics
          • III.II.VI Dutch Auction
          • III.II.VII Delegation
          • III.II.VIII ZERO Claiming of Residual Value
        • III.III Governance Controlled TTG Parameters
        • III.IV Immutable TTG Parameters
        • III.V Immutable POWER Parameters
        • III.VI Immutable ZERO Parameters
      • IV. The M0 Economy
        • IV.I Minters
        • IV.II Validators
        • IV.III Earners
      • V. Off-Chain Ecosystem
        • V.I Guidance
        • V.II Off-Chain Actors and Components
    • Adopted Guidance
      • Adopted Guidance v1.30
        • 1. Description of the Adopted Guidance
          • 1.1. Purpose of the Adopted Guidance
          • 1.2. Change Process for the Adopted Guidance
        • 2. Ecosystem Description
          • 2.1. Actors
          • 2.2. Mandatory Contracts
          • 2.3. Duty of Transparency
          • 2.4. Core Operational Flows
            • 2.4.1. Update Collateral Process
            • 2.4.2. Minting M
            • 2.4.3. Retrieval of Collateral
          • 2.5. High-Risk Jurisdictions
        • 3. Eligible Collateral
          • 3.1. Criteria for Eligible Collateral
          • 3.2. Valuation Policy for Eligible Collateral
          • 3.3. Collateral Storage
          • 3.4. Approved Jurisdictions
            • 3.4.1. Bankruptcy Remoteness
            • 3.4.2. Non-Petition and Non-Seizure Provisions
            • 3.4.3. Priority of Payments and Subordination
            • 3.4.4. Regulatory Compliance
            • 3.4.5. Legal and Regulatory Framework
            • 3.4.6. Political Stability
            • 3.4.7. Dispute Resolution
            • 3.4.8. Asset Segregation
            • 3.4.9. Limited Recourse
            • 3.4.10. Investor Protection
            • 3.4.11. Operational Infrastructure
            • 3.4.12. Custody Relationship
            • 3.4.13. Audit
        • 4. SPV Operators
          • 4.1. Contact Information of Currently Approved SPV Operators
          • 4.2. Eligibility Criteria for Approved SPV Operators
          • 4.3. Obligations of SPV Operators
            • 4.3.1. Obligations in the Normal Course of Business
            • 4.3.2. Obligations Outside of the Normal Course of Business
              • 4.3.2.1. Amicable Wind Down Process
              • 4.3.2.2. Non-Amicable Wind Down Process
              • 4.3.2.3. Minter Insolvency
              • 4.3.2.4. Unauthorized Termination of Minter – SPV Operator Agreement
            • 4.3.3. Operational Obligations of SPV Operators
              • 4.3.3.1. Co-signature of the SPV for significant payments
              • 4.3.3.2. Cooperation with Validators
              • 4.3.3.3. Maintenance of Administrative Buffer
              • 4.3.3.4. No Wire Back Instructions
          • 4.4. Guidelines for Submission of Approval Requests
        • 5. Validators
          • 5.1. Contact Information of Currently Permissioned Validators
          • 5.2. Eligibility Criteria for Permissioned Validators
          • 5.3. Obligations of Validators
          • 5.4. Guidelines for Submission of Permissioning Requests
        • 6. BD Minters and Minters
          • 6.1. Contact Information of Currently Permissioned Minters
          • 6.2. Eligibility Criteria for Permissioned Minters
          • 6.3. Obligations of Minters
          • 6.4. BD Minter and Minter Compliance Requirements
          • 6.5. Guidelines for Submission of Permissioning Requests
        • Adopted Guidance PDF Version
      • Adopted Guidance v1.20 (deprecated)
        • Adopted Guidance PDF Version
    • Glossary
    • Disclosures
    • Whitepaper PDF Version
  • Technical Documentation
    • Protocol Technical Specification
      • Main Invariants
      • Variables
        • Protocol Variables Controlled by TTG
        • Protocol Variables And Definitions
        • Protocol Variables Used For Interest Accruals
      • Protocol And M Token Actors And Actions
        • Protocol Core Functions
          • Minter Gateway
            • updateCollateral
            • proposeMint
            • mintM
            • cancelMint
            • freezeMinter
            • burnM
            • proposeRetrieval
            • activateMinter
            • deactivateMinter
          • M Token
            • startEarning
            • stopEarning
            • transfer
          • Interest Calculations And Indices
            • MinterGateway.updateIndex
            • MinterGateway.currentIndex
            • MToken.updateIndex
            • MToken.currentIndex
            • activeOwedM
          • Interest Rate Models
            • Stable Earner Interest Rate Model Contract
            • Minter Interest Rate Model Contract
    • TTG Technical Specification
      • Main Invariants
      • Core Architecture
        • 1. Registrar
          • Registrar Variables and Getters
          • Registrar Core Functions
        • 2. TTG Governors
          • Matrix Of TTG Proposals
          • 2.1 Standard Governor
            • Variables And Getters
            • Governor Proposal State Transitions
            • Core Functions
            • Core Governance Proposals
          • 2.2 Emergency Governor
            • Emergency Governor Variables And Getters
            • Governor Proposal State Transitions
            • Core functions
              • propose(targets[], values[], callDatas[], description): proposalId
              • castVote(proposalId, support): weight
              • castVotes(proposalIds[], supports): weight
              • execute(targets[], values[], callDatas[], description): proposalId
              • setThresholdRatio(newThresholdRatio)
              • getProposal(proposalId)
              • state(proposalId)
            • Core Governance Proposals
          • 2.3 ZERO Governor
            • Variables And Getters
            • Core Functions
            • Core Governance Proposals
        • 3. POWER Token
          • Variables And Getters
          • POWER Token Core Functions
        • 4. ZERO Token
          • ZERO Token Core Functions
        • 5. Distribution Vault
          • Variables And Getters
          • Core Functions
    • Source Code Reference
      • Protocol
        • Protocol Contracts
          • Core Protocol Contracts
            • MToken
            • MinterGateway
          • Abstract Protocol Contracts
            • ContinuousIndexing
          • Protocol Interfaces
            • IContinuousIndexing
            • IMToken
            • IMinterGateway
            • IRateModel
            • ITTGRegistrar
          • Libs
            • ContinuousIndexingMath
            • TTGRegistrarReader
          • Rate Models
            • Contracts
              • EarnerRateModel
              • MinterRateModel
            • Interfaces
              • IEarnerRateModel
              • IMinterRateModel
      • TTG
        • TTG Contracts
          • Core TTG Contracts
            • DistributionVault
            • Registrar
            • Governors
              • EmergencyGovernor
              • StandardGovernor
              • ZeroGovernor
            • Tokens
              • PowerBootstrapToken
              • PowerToken
              • ZeroToken
          • Abstract TTG Contracts
            • ERC5805
            • Governors
              • BatchGovernor
              • ThresholdGovernor
            • Tokens
              • EpochBasedInflationaryVoteToken
              • EpochBasedVoteToken
            • Interfaces
              • IBatchGovernor
              • IERC5805
              • IERC6372
              • IEpochBasedInflationaryVoteToken
              • IEpochBasedVoteToken
              • IGovernor
              • IThresholdGovernor
          • Deployers
            • EmergencyGovernorDeployer
            • PowerTokenDeployer
            • StandardGovernorDeployer
          • TTG Interfaces
            • IDistributionVault
            • IRegistrar
            • Deployers
              • IDeployer
              • IEmergencyGovernorDeployer
              • IPowerTokenDeployer
              • IStandardGovernorDeployer
            • Governors
              • IEmergencyGovernor
              • IStandardGovernor
              • IZeroGovernor
            • Tokens
              • IPowerBootstrapToken
              • IPowerToken
              • IZeroToken
          • Libs
            • PureEpochs
      • Common
        • Contracts
          • Main
            • ContractHelper
            • ERC20Extended
            • ERC3009
            • ERC712Extended
            • StatefulERC712
          • Interfaces
            • IERC1271
            • IERC20
            • IERC20Extended
            • IERC3009
            • IERC712
            • IERC712Extended
            • IStatefulERC712
          • Libs
            • SignatureChecker
            • UIntMath
    • 🏁Audits
    • 🔛Deployments
Powered by GitBook

M0 Project

  • Home
  • Research

Legal

  • Terms & Conditions
  • Privacy Policy

Copyright 2025 M0 Foundation

On this page
  • State Variables
  • TRANSFER_WITH_AUTHORIZATION_TYPEHASH
  • RECEIVE_WITH_AUTHORIZATION_TYPEHASH
  • CANCEL_AUTHORIZATION_TYPEHASH
  • authorizationState
  • Functions
  • constructor
  • transferWithAuthorization
  • transferWithAuthorization
  • transferWithAuthorization
  • receiveWithAuthorization
  • receiveWithAuthorization
  • receiveWithAuthorization
  • cancelAuthorization
  • cancelAuthorization
  • cancelAuthorization
  • _transferWithAuthorization
  • _receiveWithAuthorization
  • _cancelAuthorization
  • _transfer
  • _getTransferWithAuthorizationDigest
  • _getReceiveWithAuthorizationDigest
  • _getCancelAuthorizationDigest
  • _revertIfAuthorizationAlreadyUsed
  1. Technical Documentation
  2. Source Code Reference
  3. Common
  4. Contracts
  5. Main

ERC3009

PreviousERC20ExtendedNextERC712Extended

Inherits: IERC3009, StatefulERC712

Author: M^0 Labs

Inherits from ERC712 and StatefulERC712.

State Variables

TRANSFER_WITH_AUTHORIZATION_TYPEHASH

Returns transferWithAuthorization typehash.

keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")

bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
    0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;

RECEIVE_WITH_AUTHORIZATION_TYPEHASH

Returns receiveWithAuthorization typehash.

keccak256("ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")

bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH =
    0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;

CANCEL_AUTHORIZATION_TYPEHASH

Returns cancelAuthorization typehash.

keccak256("CancelAuthorization(address authorizer,bytes32 nonce)")

bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH =
    0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;

authorizationState

Returns the state of an authorization.

Nonces are randomly generated 32-byte data unique to the authorizer's address

mapping(address authorizer => mapping(bytes32 nonce => bool isNonceUsed)) public authorizationState;

Functions

constructor

Construct the ERC3009 contract.

constructor(string memory name_) StatefulERC712(name_);

Parameters

Name
Type
Description

name_

string

The name of the contract.

transferWithAuthorization

Execute a transfer with a signed authorization.

function transferWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    bytes memory signature_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

signature_

bytes

transferWithAuthorization

Execute a transfer with a signed authorization.

function transferWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    bytes32 r_,
    bytes32 vs_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

r_

bytes32

vs_

bytes32

transferWithAuthorization

Execute a transfer with a signed authorization.

function transferWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

v_

uint8

r_

bytes32

s_

bytes32

receiveWithAuthorization

Receive a transfer with a signed authorization from the payer.

This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)

function receiveWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    bytes memory signature_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

signature_

bytes

receiveWithAuthorization

Receive a transfer with a signed authorization from the payer.

This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)

function receiveWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    bytes32 r_,
    bytes32 vs_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

r_

bytes32

vs_

bytes32

receiveWithAuthorization

Receive a transfer with a signed authorization from the payer.

This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)

function receiveWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
) external;

Parameters

Name
Type
Description

from_

address

to_

address

value_

uint256

validAfter_

uint256

validBefore_

uint256

nonce_

bytes32

v_

uint8

r_

bytes32

s_

bytes32

cancelAuthorization

Attempt to cancel an authorization.

function cancelAuthorization(address authorizer_, bytes32 nonce_, bytes memory signature_) external;

Parameters

Name
Type
Description

authorizer_

address

nonce_

bytes32

signature_

bytes

cancelAuthorization

Attempt to cancel an authorization.

function cancelAuthorization(address authorizer_, bytes32 nonce_, bytes32 r_, bytes32 vs_) external;

Parameters

Name
Type
Description

authorizer_

address

nonce_

bytes32

r_

bytes32

vs_

bytes32

cancelAuthorization

Attempt to cancel an authorization.

function cancelAuthorization(address authorizer_, bytes32 nonce_, uint8 v_, bytes32 r_, bytes32 s_) external;

Parameters

Name
Type
Description

authorizer_

address

nonce_

bytes32

v_

uint8

r_

bytes32

s_

bytes32

_transferWithAuthorization

Common transfer function used by transferWithAuthorization and _receiveWithAuthorization.

function _transferWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_
) internal;

Parameters

Name
Type
Description

from_

address

Payer's address (Authorizer).

to_

address

Payee's address.

value_

uint256

Amount to be transferred.

validAfter_

uint256

The time after which this is valid (unix time).

validBefore_

uint256

The time before which this is valid (unix time).

nonce_

bytes32

Unique nonce.

_receiveWithAuthorization

Common receive function used by receiveWithAuthorization.

function _receiveWithAuthorization(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_
) internal;

Parameters

Name
Type
Description

from_

address

Payer's address (Authorizer).

to_

address

Payee's address.

value_

uint256

Amount to be transferred.

validAfter_

uint256

The time after which this is valid (unix time).

validBefore_

uint256

The time before which this is valid (unix time).

nonce_

bytes32

Unique nonce.

_cancelAuthorization

Common cancel function used by cancelAuthorization.

function _cancelAuthorization(address authorizer_, bytes32 nonce_) internal;

Parameters

Name
Type
Description

authorizer_

address

Authorizer's address.

nonce_

bytes32

Nonce of the authorization.

_transfer

Internal ERC20 transfer function that needs to be implemented by the inheriting contract.

function _transfer(address sender_, address recipient_, uint256 amount_) internal virtual;

Parameters

Name
Type
Description

sender_

address

The sender's address.

recipient_

address

The recipient's address.

amount_

uint256

The amount to be transferred.

_getTransferWithAuthorizationDigest

Returns the internal EIP-712 digest of a transferWithAuthorization call.

function _getTransferWithAuthorizationDigest(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_
) internal view returns (bytes32);

Parameters

Name
Type
Description

from_

address

Payer's address (Authorizer).

to_

address

Payee's address.

value_

uint256

Amount to be transferred.

validAfter_

uint256

The time after which this is valid (unix time).

validBefore_

uint256

The time before which this is valid (unix time).

nonce_

bytes32

Unique nonce.

Returns

Name
Type
Description

<none>

bytes32

The internal EIP-712 digest.

_getReceiveWithAuthorizationDigest

Returns the internal EIP-712 digest of a receiveWithAuthorization call.

function _getReceiveWithAuthorizationDigest(
    address from_,
    address to_,
    uint256 value_,
    uint256 validAfter_,
    uint256 validBefore_,
    bytes32 nonce_
) internal view returns (bytes32);

Parameters

Name
Type
Description

from_

address

Payer's address (Authorizer).

to_

address

Payee's address.

value_

uint256

Amount to be transferred.

validAfter_

uint256

The time after which this is valid (unix time).

validBefore_

uint256

The time before which this is valid (unix time).

nonce_

bytes32

Unique nonce.

Returns

Name
Type
Description

<none>

bytes32

The internal EIP-712 digest.

_getCancelAuthorizationDigest

Returns the internal EIP-712 digest of a cancelAuthorization call.

function _getCancelAuthorizationDigest(address authorizer_, bytes32 nonce_) internal view returns (bytes32);

Parameters

Name
Type
Description

authorizer_

address

Authorizer's address.

nonce_

bytes32

Nonce of the authorization.

Returns

Name
Type
Description

<none>

bytes32

The internal EIP-712 digest.

_revertIfAuthorizationAlreadyUsed

Reverts if the authorization is already used.

function _revertIfAuthorizationAlreadyUsed(address authorizer_, bytes32 nonce_) internal view;

Parameters

Name
Type
Description

authorizer_

address

The authorizer's address.

nonce_

bytes32

The nonce of the authorization.

Git Source