Technical Reference Overview
Overview
Media Protocol is a binary smart contract system comprised of many libraries, which together make the Core and Periphery.
The Core contracts defines the storage and logic of market initialization, provider management, deal management, and all the interactions involving the respective functionalities therein. It also provides fundamental safety guarantees for all parties interacting with the Media Protocol.
Periphery contracts interact with the Core contracts but are not part of the core. They are designed to provide methods of interacting with the core that increase clarity and user safety.
Externally available functions are all viewable in the reference documentation for each contract.
Core Contracts
Marketplace
| Marketplace Technical Reference
The Marketplace smart contract is the core contract for the Media Protocol. Its capabilities include initializing and setting up new marketplaces, registering, updating, and unregistering providers, as well as creating, updating, and cancelling offers and on-going deals.
The contract provides a structured and secure environment for registered providers to list their offers and for consumers to engage with these offers by creating deals. It also provides a billing system for providers to collect payments from clients.
Marketplace Participants
- Owners: The initializers of the marketplaces instances. Owner are able to modify their marketplaces' parameters such as transaction fees and required stake for providers. Given the permissionless nature of the protocol, owners can't ban providers offers or deals, but these can be filtered in their UIs.
- Providers: Entities or individuals that offer specific services or goods in a marketplace.
- Clients: Entities or individuals that take offers for specific services or goods in a marketplace.
Marketplace Management
Admins can perform the following operations on the marketplace contract:
- Set protocolFeeTo: Sets the wallet receiving the fees generated by the protocol.
- Set protocolFeeRate: Sets the rate percentage of the fees generated by the protocol (from 1% to 10%).
- Grant Roles: Grants roles to specific addresses.
Owners can perform the following operations on their initialized marketplaces:
- Set marketFeeTo: Sets the wallet receiving the fees generated by the marketplace.
- Set marketFeeRate: Sets the rate percentage of the fees generated by the marketplace (from 1% to 10%).
- Set REQUIRED_STAKE: Sets the required amount of LP MEDIA tokens required to become a provider.
- Transfer Ownership: Transfers the ownership of the marketplace to another address.
Provider Management
-
Register: Providers can register in specific marketplaces by staking a Uniswap V3 Position NFT representing a minimum liquidity value as set by the owner of that marketplace. To mint these NFTs, users must contribute liquidity to the MEDIA/ETH pair on Uniswap V3.
-
Update settings: Update provider settings, including public encryption key, profile, or current stake.
-
Unregister: Providers without current open deals can safely unregister and retrieve their UNI-V3-POS NFTs.
Offer Management
Offers are the specific goods or services that providers put forth in the marketplace. Providers can perform the following operations on the marketplaces they are registered:
- Create Offers: A provider can create an offer detailing what they are providing, its cost, and other essential parameters.
- Updating an Offer: Providers have the flexibility to adjust their offers based on changing circumstances or market demands. On-going deals are not affected by these changes.
- Deleting an Offer: Offers can be deleted by providers at any time. On-going deals are not affected by these changes.
Deal Management
Deals represent the agreement between a provider and a client. Both providers and clients can perform operations to deals.
- Creating a Deal: Client can take offers from providers, creating deals. If these offers are set to be auto-accepted by the provider, then the billing starts capturing the terms agreed upon. If not, then the provider must accept the deal before the billing starts.
- Collecting a Deal: Providers can collect the payments for the amount due by clients.
- Cancelling a Deal: In situations where a deal is no longer needed or has been finished, it can be canceled. If there's outstanding balance, it would be sent proportionally to both client and provider in relation to the time elapsed and price per second.
- Deposit more balance: Clients can deposit more balance to deals to add more time for that specific deal if the deal is not set to single billing period.