Tokenization
Security tokens, utility tokens, token standards, and asset tokenization.
Overview
Tokenization represents real-world assets on the blockchain.
Token Types
| Type | Purpose | Regulation |
|---|---|---|
| Security | Investment | SEC regulated |
| Utility | Access | Less regulated |
| Governance | Voting | Varies |
| Payment | Transactions | Varies |
ERC-20 Token
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
uint256 public constant MAX_SUPPLY = 1000000000 * 10**18;
constructor() ERC20("MyToken", "MTK") {
_mint(msg.sender, MAX_SUPPLY);
}
function mint(address to, uint256 amount) public onlyOwner {
require(totalSupply() + amount <= MAX_SUPPLY);
_mint(to, amount);
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
Security Token (STO)
contract SecurityToken is ERC20, Ownable {
mapping(address => bool) public accredited;
mapping(address => uint256) public vestingSchedule;
modifier onlyAccredited() {
require(accredited[msg.sender], "Not accredited");
_;
}
function transfer(address to, uint256 amount) public override onlyAccredited {
require(vestingSchedule[msg.sender] <= block.timestamp);
super.transfer(to, amount);
}
function whitelist(address investor) public onlyOwner {
accredited[investor] = true;
}
}
Asset Tokenization
# Real estate tokenization
class RealEstateToken:
def __init__(self, property_id, total_shares, value):
self.property_id = property_id
self.total_shares = total_shares
self.value = value
self.share_price = value / total_shares
def tokenize(self):
return {
"property_id": self.property_id,
"total_shares": self.total_shares,
"share_price": self.share_price,
"dividend_yield": self.calculate_yield()
}
def calculate_yield(self):
# Annual rental income
annual_income = self.value * 0.08 # 8% yield
return annual_income / self.total_shares
Token Economics
| Factor | Description |
|---|---|
| Supply | Total tokens |
| Demand | Usage and utility |
| Vesting | Release schedule |
| Burn | Token destruction |
Practice
Create a security token with compliance features.