Are You an Ambitious Entrepreneur Aspiring to Launch a World-Class Web3 Project? GRAB your WEB3 EXPERT CONSULTATION!
Book a Session!

dRoyalty – Royalty Management on Smart Contracts

Introduction to Royalty Management on Smart Contracts

This is the boilerplate smart contract library showcasing transparent royalty management and royalty distribution through smart contracts. It is applicable for most of the digital products, with the triggering of royalty distribution happening upon every purchase or consumption of the digital product.


dRoyalty Smart Contract Components

Management is a base smart contract which manages references and permissions of other smart contracts. Its basic functionality includes:

  • registerContract(uint256 _key, address _target) – register _target contract to specified _key
  • setPermission(address _address, uint256 _permission, bool _value) – set or unset _permission to make some actions for _address

And other functions allowing to manage and check state variables.

Managed – a parent contract for platform-related smart contracts, except Management. It is aimed at keeping the actual Management contract address and interacting with all other contracts through the Management contract.

Constants is a contract designed for storing constants indicating contracts and their permission to perform certain actions.

Royalty is the ERC-721-based smart contract extended with DigitalAsset structure to store additional info for an asset. It has a function to create/register a new asset. It emits a DigitalAssetRegistered event.

Asset Purchase is a smart contract that receives ethers to buy the license for the exact asset (it has the function called purchaseDigitalAsset(uint256 _digitalAssetId) and emits event (interacts with royalty through management):

event AssetUsagePurchased(
uint256 indexed digitalAssetId,
address indexed buyer,
uint256 amount,
uint256 purchasingTimestamp
); to prove license buying.

Cashier is a smart contract responsible for managing funds flowing through the platform. Within it, function recordPurchase(uint256 _digitalAssetId) public payable – receives and transfers ethers to asset owner and platform-related address from Asset Purchase contract paid to buy a license; function forwardEthersToHolder() public payable – receives and transfers ethers from Royalty contract paid to register new asset.

Use Flow and Roles

There are five main roles (the ether address of the user) which interact with smart contract:

  1. Platform-related Ethereum address to sign a transaction.
  2. Owner address of the platform – can manage contracts and state variables.
  3. Platform revenue holder address – receives all the Ethers earned by the platform.
  4. Digital assets owner – receives royalty.
  5. Digital assets license’s buyer address.

dRoyalty flow

Screenshots of Interaction with Smart Contracts

To create new Digital Asset property the owner needs to transfer Ethers amount equal to registration fee among with hash data to Royalty contract address:

creating new Asset with Metamask

The hash data contains createDigitalAssets functions with signed sender address, registration fee amount, URI and the current timestamp:
dSoyalty smart contract KYC

When a transaction is successful the new token will be created:

new token created with Metamask

Using ID and price of needed asset the buyer has to run function purchaseDigitalAsset of AssetPurchase contract.

The proof of license is event.

proof of license is event


+1-209-813-2474 |  25 Belle Avenue, San Rafael