Overview
Smart Common refers to smart creative commons (including dApps, EIPs, AI, papers, technical standards, etc.) published under the SCC0 license, possessing their own valuation tokens, and enabling developers to receive awards based on DAism's consensus Proof of Value (PoV).
To simplify applications, The menu "Smart Commons' is also a workstation for the developer(s) to manage its versions and awards (tips).
{
{
string name; // Smart Common name, unique, cannot have the same name as other Smart Commons.
string symbol; // Smart Common token name, unique, cannot have the same name as other Smart Common tokens.
string desc; // Smart Common description.
address manager; // Smart Common manager.
uint16 version; // Smart Common version number, starting from 1 when minted.
string SC_Type // Type of Smart Common.
},
address[] calldata _members, // List of members.
uint16[] calldata _dividendRights, // Member voting rights (dividend rights), corresponding one-to-one with _members.
uint16 _strategy, // Proposal voting pass rate. One hundred percent (unanimous) is 2 to the power of 16 minus 1 (65535), can be changed by proposals.
uint32 _lifetime, // Proposal lifespan, in seconds, starting from proposal creation, invalidated if not completed within this time.
uint32 _coolingPeriod // Proposal cooling period, in seconds, starting from proposal creation, no new proposals can be created until this period has passed. Note: Cooling period must be greater than the lifespan.
{
string filetype // File extension for the logo, must be svg.
string fileContent // Pure text content of the svg.
}
}
If your smart contract is an EIP or a paper, you'd better to read Applying Proof of Value (PoV) to EIPs or AI Applying PoV Value Proof to EIPs, AI Fields or anything else to understand the award mechanism brought by PoV.
- We recommend writing the EIP or paper as HTML source code in the smart contract:
function eipContent() external view returns(string memory);
- If it is an EIP already published on GitHub, such as ERC-2569, you can replace the EIP's HTML source code with a link to the EIP content (published on eips.ethereum.org, or github). For instance, the address could be https://eips.ethereum.org/EIPS/erc-2569. Additionally, the author should include an address in the original EIP that matches the owner address written in the smart contract. For example:
owner = your ethereum account
- For non-dApp types of Smart Commons, pay attention to the exclusive naming method of the valuation token when minting. Relevant content (section "Naming Valuation Tokens") is at the bottom of this article.
Minting a Smart Common on DAism
- Only the owner of the smart contract can mint a Smart Common, please deploy your smart contract on Ethereum Mainnet first.
- The contract that mints the Smart Common can be any smart contract. Each contract address could create only one Smart Common.
- When minting a Smart Common, you can also mint any set of Honor Tokens (a type of NFT commemorating the birth of your Smart Common). The number can be N times the number of dividend members of your Smart Common. Ensure that your smart contract has the necessary interface calling codes in advance.
- Due to the high cost of Ethereum gas, it is recommended that the logo is a SVG vector graphic below 2K.
Smart Contract Example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IDAismInterface.sol";
contract ThreeDapp {
address public daismRegistrar;
address public nftAddress;
address public owner;
constructor(address daismRegistrar_, address nftAddress_) {
require(daismRegistrar == address(0) && nftAddress == address(0));
daismRegistrar = daismRegistrar_;
nftAddress = nftAddress_;
owner = tx.origin;
}
function ownerOf() public view returns(address) {
return owner;
}
function mintSCandNFT(
IDAismInterface.SCInfo memory _SCInfo,
address[] calldata _members,
uint16[] calldata _dividendRights,
uint16 _strategy,
uint32 _lifetime,
uint32 _coolingPeriod,
IDAismInterface.File memory _logo,
uint256 _num
) public returns(uint256[][] memory) {
uint256 scId = IDAismInterface(daismRegistrar).createSC(_SCInfo, _members, _dividendRights, _strategy, _lifetime, _coolingPeriod, _logo);
return IDAismInterface(nftAddress).mintBatch(scId, _members, _num);
}
function createSC(
IDAismInterface.SCInfo memory _SCInfo,
address[] calldata _members,
uint16[] calldata _dividendRights,
uint16 _strategy,
uint32 _lifetime,
uint32 _coolingPeriod,
IDAismInterface.File memory _logo
) external returns(uint) {
return IDAismInterface(daismRegistrar).createSC(_SCInfo, _members, _dividendRights, _strategy, _lifetime, _coolingPeriod, _logo);
}
}
// IDAismInterface interface
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IDAismInterface {
struct SCInfo {
string name; // The name of the SC.
string symbol; // The symbol of the SC.
string desc; // The description of the SC.
address manager; // The address of the SC manager.
uint16 version; // The version of the SC.
string SC_Type;
}
struct File {
string fileType;
string fileContent;
}
function creator(uint256 _scId) external view returns (address);
function SCLogo() external view returns(address);
function SCInfos(uint SC_id) external view returns (SCInfo memory);
function getLogo(uint SC_id) external view returns (File memory);
function ownerOf() external view returns(address);
function toProxy(uint256 _scId) external view returns (address);
function createSC(
SCInfo memory _SCInfo,
address[] calldata _members,
uint16[] calldata _dividendRights,
uint16 _strategy,
uint32 _lifetime,
uint32 _coolingPeriod,
File memory _logo
) external returns(uint);
function mintBatch(uint256 _scId, address[] calldata _to, uint256 _num) external returns(uint256[][] memory);
}
Example of Deploying and Minting a Smart Common with Hardhat
const fs = require('fs');
const { ethers } = require('hardhat');
async function main() {
await hre.run('compile');
const [owner] = await ethers.getSigners();
// Contract name / Please replace with your contract
const contractName = 'ThreeDapp';
// Please replace with the latest address, the current address is in the sample code of the mint Smart Common window.
const daismRegistrar_ = '0x4E0430f2ad966861846245340b1bA64b829AA069';
// Please replace with the latest address, the current address is in the sample code of the mint Smart Common window.
const nftAddress_ = '0xDcf063A9E95318e0Abf8dAAAC1f146ad83C844d8';
// Deploy contract
const contractObj1 = await daism_deploy(owner, contractName, [daismRegistrar_, nftAddress_]);
// Mint DAism's Smart Common
let res = await contractObj1.createSC(
['Name1', 'TokenName1', 'Description1', owner.address, 1, 'dApp'], // DAism's SC (see the structure description above), note: name and token name must be unique.
[owner.address], // List of members
[10], // Member voting rights (dividend rights), cannot be 1, 2, 3, because these three numbers have special uses.
(2 ** 16 - 1), // Proposal voting pass rate, 100% (unanimous)
7 * 24 * 3600, // Lifespan is 7 days
9 * 24 * 3600, // Cooling period is 9 days
['svg', '<svg fill="#f7861c" height="24" viewBox="113.789 0 24.088 24" width="24.088" xmlns="http://www.w3.org/2000/svg"><path d="M134.613 6.85h-3.499l-2.035-2.009-.006-.006-.004-.003a1.698 1.698 0 00-1.189-.482h-4.23c-.491 0-.93.209-1.238.539l-.003-.005-1.991 1.966h-3.571c-.935 0-1.691.747-1.691 1.667v10c0 .92.757 1.668 1.691 1.668h17.768a1.68 1.68 0 001.691-1.668v-10a1.682 1.682 0 00-1.693-1.667zm.846 11.668a.843.843 0 01-.846.834h-17.768a.841.841 0 01-.846-.834v-10c0-.459.38-.833.846-.833h3.922l.248-.245 1.024-1.011.021.062.971-1.035a.843.843 0 01.618-.271h4.23c.223 0 .435.086.602.247l2.033 2.008.247.245H134.613c.465 0 .846.374.846.833z"/><path d="M125.729 9.351c-2.104 0-3.808 1.678-3.808 3.749 0 2.072 1.703 3.752 3.808 3.752 2.104 0 3.808-1.68 3.808-3.752s-1.704-3.749-3.808-3.749zm0 6.667c-1.633 0-2.962-1.31-2.962-2.918s1.329-2.916 2.962-2.916 2.961 1.307 2.961 2.916-1.328 2.918-2.961 2.918z"/></svg>']
);
console.log('createSC hash: ' + res.hash);
await res.wait();
console.log("createSC success");
// Note: A dApp can only mint once, so a new dApp needs to be deployed again here.
const contractObj2 = await daism_deploy(owner, contractName, [daismRegistrar_, nftAddress_]);
res = await contractObj2.mintSCandNFT(
['Name2', 'TokenName2', 'Description2', owner.address, 1, 'dApp'], // DAism's SC (see the structure description above), note: name and token name must be unique.
[owner.address], // List of members
[10], // Member voting rights (dividend rights), cannot be 1, 2, 3, because these three numbers have special uses.
(2 ** 16 - 1), // Proposal voting pass rate, 100% (unanimous)
7 * 24 * 3600, // Lifespan is 7 days
9 * 24 * 3600, // Cooling period is 9 days
['svg', '<svg fill="#f7861c" height="24" viewBox="113.789 0 24.088 24" width="24.088" xmlns="http://www.w3.org/2000/svg"><path d="M134.613 6.85h-3.499l-2.035-2.009-.006-.006-.004-.003a1.698 1.698 0 00-1.189-.482h-4.23c-.491 0-.93.209-1.238.539l-.003-.005-1.991 1.966h-3.571c-.935 0-1.691.747-1.691 1.667v10c0 .92.757 1.668 1.691 1.668h17.768a1.68 1.68 0 001.691-1.668v-10a1.682 1.682 0 00-1.693-1.667zm.846 11.668a.843.843 0 01-.846.834h-17.768a.841.841 0 01-.846-.834v-10c0-.459.38-.833.846-.833h3.922l.248-.245 1.024-1.011.021.062.971-1.035a.843.843 0 01.618-.271h4.23c.223 0 .435.086.602.247l2.033 2.008.247.245H134.613c.465 0 .846.374.846.833z"/><path d="M125.729 9.351c-2.104 0-3.808 1.678-3.808 3.749 0 2.072 1.703 3.752 3.808 3.752 2.104 0 3.808-1.68 3.808-3.752s-1.704-3.749-3.808-3.749zm0 6.667c-1.633 0-2.962-1.31-2.962-2.918s1.329-2.916 2.962-2.916 2.961 1.307 2.961 2.916-1.328 2.918-2.961 2.918z"/></svg>'],
2 // Each member mints two Honor Tokens.
);
console.log('threeDapp.mintScAndNFT hash: ' + res.hash);
await res.wait();
console.log("mintScAndNFT success");
console.log("--------------END--------------");
}
// Deploy contract
async function daism_deploy(signer, contractName, paras = []) {
const factory = await ethers.getContractFactory(contractName, signer);
const product = await factory.deploy.apply(factory, paras);
await product.waitForDeployment();
const contract_address = await product.getAddress();
console.log('Deploy: ' + contractName + ' : ' + contract_address);
return await ethers.getContractAt(contractName, contract_address, signer);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Example of Minting a Smart Common on DAism's Webpage
First, deploy a smart contract capable of calling the mint Smart Common contract (e.g., your dApp). Obtain the deployment address of this smart contract or dApp.
Fill in the corresponding information on the webpage and mint, as shown in the image below:
Naming Valuation Tokens
We refer to common methods in operating systems Unix and Windows, namely:
- The classification of Smart Commons is reflected in the name of the valuation token.
- The naming of the valuation token refers to the method in computer operating systems, which is divided into two parts by ".":
- The naming of valuation tokens for dApps does not have a ".extension". For example: DAI.
- The naming rule for valuation tokens of any other category is "XXXX.extension". For example: UL.eip (indicating that its Smart Common is an EIP). Or: ALOHA.ai (indicating it is an AI project). The extension is recommended to be lowercase to make the preceding name stand out. Anyone can arbitrarily set the extension of his/her Smart Common—this is a decentralized naming convention. Of course, if others have already made a flawless naming in a category, it is hoped that subsequent developers will follow it.