Smart Contract Templates
Production-ready smart contract templates for tokenization, compliance, and asset management. Save development time with our audited and gas-optimized contract library.
Contract Templates
Choose from our collection of enterprise-grade smart contract templates
Security Token Contract
Security TokenERC-1400 compliant security token with transfer restrictions and compliance features.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@bloklab/contracts/token/SecurityToken.sol";
import "@bloklab/contracts/compliance/TransferRestrictions.sol";
contract MySecurityToken is SecurityToken {
constructor(
string memory name,
string memory symbol,
uint256 totalSupply
) SecurityToken(name, symbol, totalSupply) {
// Initialize your token here
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal override {
super._beforeTokenTransfer(from, to, amount);
// Add custom compliance checks
}
}
Asset Tokenization Contract
Asset TokenReal-world asset tokenization with ownership verification and fractional ownership support.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@bloklab/contracts/token/AssetToken.sol";
import "@bloklab/contracts/ownership/AssetOwnership.sol";
contract RealEstateToken is AssetToken {
struct Property {
string propertyId;
string location;
uint256 valuation;
bool verified;
}
mapping(uint256 => Property) public properties;
constructor() AssetToken("Real Estate Token", "RET") {}
function tokenizeProperty(
string memory propertyId,
string memory location,
uint256 valuation,
uint256 tokenSupply
) external onlyOwner {
uint256 tokenId = _nextTokenId();
properties[tokenId] = Property(propertyId, location, valuation, false);
_mint(msg.sender, tokenId, tokenSupply, "");
}
}
Vesting Contract
UtilityToken vesting schedule with cliff and linear vesting options.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@bloklab/contracts/vesting/TokenVesting.sol";
contract TeamTokenVesting is TokenVesting {
mapping(address => VestingSchedule) public vestingSchedules;
struct VestingSchedule {
uint256 totalAmount;
uint256 cliffDuration;
uint256 vestingDuration;
uint256 startTime;
uint256 releasedAmount;
}
constructor(IERC20 _token) TokenVesting(_token) {}
function createVestingSchedule(
address beneficiary,
uint256 totalAmount,
uint256 cliffDuration,
uint256 vestingDuration
) external onlyOwner {
vestingSchedules[beneficiary] = VestingSchedule({
totalAmount: totalAmount,
cliffDuration: cliffDuration,
vestingDuration: vestingDuration,
startTime: block.timestamp,
releasedAmount: 0
});
}
}
Compliance Contract
ComplianceAutomated compliance checking for regulatory requirements.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@bloklab/contracts/compliance/ComplianceRules.sol";
import "@bloklab/contracts/registry/InvestorRegistry.sol";
contract TokenCompliance is ComplianceRules {
InvestorRegistry public investorRegistry;
mapping(address => bool) public accreditedInvestors;
uint256 public maxInvestors = 500;
uint256 public currentInvestorCount;
constructor(address _investorRegistry) {
investorRegistry = InvestorRegistry(_investorRegistry);
}
function checkTransferCompliance(
address from,
address to,
uint256 amount
) external view override returns (bool) {
// Check investor accreditation
if (!accreditedInvestors[to] && to != address(0)) {
return false;
}
// Check investor limit
if (balanceOf(to) == 0 && currentInvestorCount >= maxInvestors) {
return false;
}
return true;
}
}
Template Features
Every template is built with enterprise-grade standards and best practices
Security Audited
All templates are thoroughly audited for security vulnerabilities by leading blockchain security firms.
Gas Optimized
Optimized for minimal gas consumption with efficient code patterns and best practices.
Compliance Ready
Built-in compliance controls and regulatory features for enterprise deployment.
Production Tested
Battle-tested templates used in production environments with proven track records.
Highly Customizable
Flexible architecture allowing easy customization to meet specific business requirements.
Well Documented
Comprehensive documentation with implementation guides and best practice examples.