Skip to content

StoreOwnership Contract

The StoreOwnership contract is an abstract contract that extends the RegistryStore and provides functionality related to store ownership.

Functions

  • storeRegistry()

  • Visibility: internal view

  • Returns: IStoreRegistry
  • Description: This function retrieves the IStoreRegistry instance from the registry contract using the RegistryStoreLibrary.STORE_REGISTRY_KEY.

Modifiers

  • onlyStoreOwner(uint256 storeId)

  • Description: Ensures that the caller is the owner of the specified store.

  • Parameters:
    • storeId - The ID of the store.
  • Reverts:
    • NotOwnerOfStore - If the caller is not the owner of the specified store.

SplitsRegistry Contract

The SplitsRegistry contract extends several other contracts, adding the ability to manage the split of revenue between multiple recipients for a given store.

Inherited Contracts

  • Initializable: Ensures that the contract can only be initialized once.
  • Storage: Provides the storage structure for store splits.
  • Operations: Handles the logic for setting and validating store splits.
  • StoreOwnership: Provides ownership verification for stores.
  • Permissions: Manages permissions for function execution.
  • NoETH: Prevents ETH from being sent to this contract.

Functions - Inheriteed Contracts

  • initialize(address _registryAddress)

  • Visibility: external

  • Description: Initializes the contract with the address of the registry store. This function can only be called once.
  • Parameters:
    • _registryAddress: The address of the registry store.
  • Reverts:

    • CantSetZeroAddress: If the provided _registryAddress is a zero address.
  • setStoreSplit(uint256 storeId, address[] calldata recipients, uint64[] calldata amounts)

  • Visibility: public

  • Description: Sets the revenue split for a store by defining recipients and their respective split percentages.
  • Parameters:
    • storeId: The ID of the store.
    • recipients: An array of recipient addresses.
    • amounts: An array of percentages corresponding to each recipient's share.
  • Reverts:
    • NotOwnerOfStore: If the caller is not the owner of the specified store.

Operations Contract

The Operations contract provides the logic and validation for setting store splits.

Modifiers - Operations

  • splitValidation(address[] calldata recipients, uint64[] calldata amounts)

  • Description: Ensures that the number of recipients matches the number of amounts and that the total percentage does not exceed 100%.

  • Parameters:
    • recipients: An array of recipient addresses.
    • amounts: An array of percentage splits.
  • Reverts:
    • MismatchedRecipientsAndPercentages: If the number of recipients does not match the number of amounts.
    • SplitPercentagesExceed100: If the total percentage exceeds 100%.

Functions - Operations

  • _setStoreSplit(uint256 storeId, address[] calldata recipients, uint64[] calldata amounts)

  • Visibility: internal

  • Description: Internally sets the revenue split for a given store.
  • Parameters:
    • storeId: The ID of the store.
    • recipients: An array of recipient addresses.
    • amounts: An array of percentage splits.

Storage Contract

The Storage contract provides the storage mechanism for store splits.

Variables

  • storeSplits: A mapping from store ID to the recipients and their respective split percentages.

Functions - Storage

  • getStoreSplits(uint256 storeId)

  • Visibility: public view

  • Returns: address[] memory, uint64[] memory
  • Description: Returns the recipients and their split percentages for a given store.
  • Parameters:
    • storeId: The ID of the store.