Skip to content

API Reference

This section details the public API of the core CommissionRoad contracts.

CommissionRoad

The main entry point for the protocol.

initialize

Initializes the contract with the provided configuration.

solidity
struct CommissionRoadConfiguration {
    address protocolOwner;
    uint256 mintFee;
    CommissionRoadERC721 nftContract;
    ICommissionVault commissionVault;
}

function initialize(CommissionRoadConfiguration memory config) external;

mint / mintTo

Mints a new CommissionRoad NFT ID. The caller must pay the mintFee (in ETH).

solidity
// Mint to msg.sender
function mint() external payable returns (uint256 nftId);

// Mint to a specific address
function mintTo(address to) external payable returns (uint256 nftId);

// Mint with metadata
function mint(CommissionRoadERC721.Metadata memory metadata) external payable returns (uint256 nftId);
function mintTo(address to, CommissionRoadERC721.Metadata memory metadata) external payable returns (uint256 nftId);

commissionCall

Executes a batch of calls to target contracts and collects a commission. This is the primary function for integrating with CommissionRoad.

solidity
struct BatchCallData {
    address target; // The contract to call
    bytes callData; // The data to send
    uint256 value;  // The ETH value to send
}

function commissionCall(
    BatchCallData[] calldata batchCallData,
    uint256 nftId,
    address commissionToken,
    uint256 commission
) external payable;
  • batchCallData: Array of calls to execute.
  • nftId: The ID of the CommissionRoad NFT that will receive the commission.
  • commissionToken: The address of the token to take the commission in (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH).
  • commission: The total commission amount (Protocol Fee + Owner Share).

commissionCallVm

Executes a Weiroll script (commands and state) and collects a commission. Used for complex, dependent transaction flows.

solidity
function commissionCallVm(
    bytes32[] calldata commands,
    bytes[] calldata state,
    uint256 nftId,
    address commissionToken,
    uint256 commission
) external payable;

CommissionVault

Handles fee storage and claiming.

claim / claimTo

Claims collected commissions for a specific NFT ID. Only the owner of the NFT can call this.

solidity
function claim(
    uint256 nftId,
    address[] calldata tokens,
    uint256[] calldata amounts
) external;

function claimTo(
    uint256 nftId,
    address[] calldata tokens,
    uint256[] calldata amounts,
    address destination
) public;
  • nftId: The NFT ID to claim for.
  • tokens: Array of token addresses to claim (ETH or ERC20).
  • amounts: Array of amounts to claim for each token.
  • destination: (claimTo only) Where to send the funds.

depositCommission

Deposits a commission into the vault. Normally called by CommissionRoad, but can be called directly.

solidity
function depositCommission(
    uint256 nftId,
    address token,
    uint256 amount
) external payable;

CommissionRoadERC721

The NFT contract representing CommissionRoad IDs.

tokenURI

Returns the metadata URI for a given token ID.

solidity
function tokenURI(uint256 nftId) public view returns (string memory);

setMetadata

Updates the metadata for an NFT. Only the owner can call this.

solidity
struct Metadata {
    string name;
    string description;
    string imageUrl;
    string ens;
    Socials socials;
}

function setMetadata(uint256 nftId, Metadata memory metadata) public;