In this task, we aim to design a smart contract on the Ethereum blockchain for an artist. The contract will receive traditional contracts (submitted by the artist) through the artist's wallet. The smart contract should handle profit sharing, ensuring that 20% of bi-weekly total revenues are sent to a collector. Additionally, all service business revenue streams and transactions will be tokenized as NFTs, which can be transferred to the collector.
Artist Wallet: 0xFF915045Dd04514CDC7fc5519786957Cd59d282b
Collector Share: 20% of bi-weekly total revenues.
Revenue Streams: All service business revenue streams will be tokenized as NFTs.
Collector Wallet: Automatically sends 20% of total revenue every two weeks to the collector's wallet.
Encryption: Store and encrypt the submitted traditional contract for added security.
Smart Contract Functions:
Submit Contract: Allow the artist to submit a contract (encrypted).
Create NFTs: Create NFTs representing the revenue streams and transactions.
Distribute Revenue: Automatically distribute 20% of the bi-weekly revenue to the collector.
Encrypt & Store Contract: Encrypt the submitted contract and store it securely on-chain or via IPFS.
Smart Contract Components:
Modifiers: Restrict specific actions (like contract submission) to the artist's wallet.
Events: For logging submitted contracts and revenue distribution.
Bi-weekly Timer: Automated revenue split execution.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract ProfitSharingNFT is ERC721, Ownable, ReentrancyGuard {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdTracker;
address payable public artist = payable(0xFF915045Dd04514CDC7fc5519786957Cd59d282b);
address payable public collector;
uint256 public biWeeklyTimer; // Timestamp for bi-weekly payment
uint256 public totalRevenue;
uint256 public collectorSharePercentage = 20;
struct ContractDetails {
string encryptedContract; // Encrypted contract stored as a hash or cipher text
uint256 timestamp;
}
mapping(uint256 => ContractDetails) public contracts;
mapping(uint256 => uint256) public tokenRevenue; // NFT token revenue share mapping
event ContractSubmitted(uint256 indexed contractId, string encryptedContract, uint256 timestamp);
event RevenueDistributed(uint256 amount, address indexed collector);
event NFTCreated(uint256 tokenId, address indexed owner);
constructor(address payable _collector) ERC721("ArtistRevenueNFT", "ARNFT") {
collector = _collector;
biWeeklyTimer = block.timestamp + 14 days; // Set the timer to two weeks from deployment
}
modifier onlyArtist() {
require(msg.sender == artist, "Only the artist can submit contracts");
_;
}
function submitContract(string memory _encryptedContract) external onlyArtist {
uint256 contractId = _tokenIdTracker.current();
contracts[contractId] = ContractDetails(_encryptedContract, block.timestamp);
_tokenIdTracker.increment();
emit ContractSubmitted(contractId, _encryptedContract, block.timestamp);
}
function createRevenueNFT() external onlyArtist returns (uint256) {
uint256 newTokenId = _tokenIdTracker.current();
_mint(artist, newTokenId); // Mint NFT to the artist's address
_tokenIdTracker.increment();
emit NFTCreated(newTokenId, artist);
return newTokenId;
}
function depositRevenue() external payable onlyOwner {
totalRevenue += msg.value;
uint256 collectorShare = (msg.value * collectorSharePercentage) / 100;
tokenRevenue[_tokenIdTracker.current() - 1] += msg.value; // Add revenue to the latest NFT
}
function distributeRevenue() external nonReentrant {
require(block.timestamp >= biWeeklyTimer, "Bi-weekly time period has not passed yet");
uint256 collectorShare = (totalRevenue * collectorSharePercentage) / 100;
require(collectorShare <= address(this).balance, "Insufficient balance to distribute");
collector.transfer(collectorShare);
emit RevenueDistributed(collectorShare, collector);
// Reset the timer and total revenue
totalRevenue = 0;
biWeeklyTimer = block.timestamp + 14 days;
}
}
Artist and Collector Addresses: The artist and collector addresses are hardcoded into the contract. Only the artist can submit contracts and create NFTs.
Submit Contract: The submitContract function allows the artist to submit a traditional contract, which will be encrypted and stored on-chain.
NFT Creation: The createRevenueNFT function mints NFTs that represent a portion of the revenue streams. Each NFT has a unique ID and is associated with a specific revenue stream.
Revenue Distribution: The contract allows deposits of revenue through the depositRevenue function. Bi-weekly, the distributeRevenue function calculates and sends 20% of the total revenue to the collector’s address.
Bi-weekly Timer: The contract is designed to distribute revenue every two weeks using a timer mechanism. Once the timer expires, the collector is paid their share, and the timer resets.
Contract Submission: The artist submits an encrypted contract (could be IPFS or other forms of storage). This contract is linked to a revenue-generating NFT.
NFTs as Revenue Streams: Each NFT represents a business revenue stream, tracked within the smart contract.
Automatic Revenue Sharing: Every two weeks, the smart contract automatically
—————————————-
FOR THE CULTURE
MINTED ARTWORK - SHAPE - Devil’s C o n tr a ct - KunTa BLeU - 2024 - via HIGHLIGHT XYZ https://highlight.xyz/mint/shape:0xCb615AF9828584Ef4084E2a51c0E20cfaE6a283f:fe8d431eecb73a995b2a039cc76238b1/t/6
Please authenticate to join the conversation.
In Review
💡 Fun Ideas
Over 1 year ago

King Kunta
Get notified by email when there are changes.
In Review
💡 Fun Ideas
Over 1 year ago

King Kunta
Get notified by email when there are changes.