Blockchain Management
Purpose
Guide blockchain-specific project management covering DAO governance, multi-sig operations, treasury management, and tokenomics engineering. This skill enforces web3-specific methodology (audit-first, progressive decentralization) distinct from traditional software project management.
Agent Protocol
Trigger
"blockchain management", "DAO governance", "Compound Governor", "Snapshot vote", "Tally", "multi-sig", "Gnosis Safe", "timelock", "treasury management", "tokenomics", "token supply", "vesting", "token emission", "web3 project management", "blockchain project methodology", "progressive decentralization", "audit-first", "community governance", "DAO operations", "token launch", "airdrop", "LBP", "IDO", "IEO", "governance attack", "flash loan attack", "DAO legal structure", "Wyoming DAO", "legal wrappers", "contributor compensation", "vesting contract", "streaming", "Sablier", "LlamaPay", "treasury diversification", "yield farming", "on-chain payroll", "delegate", "delegation", "quorum", "proposal lifecycle", "proposer bond", "governance token", "veToken", "vote escrow"
Input Context
- Blockchain platform (Ethereum/Solana/Cosmos)
- Governance framework preference (Compound/OpenZeppelin/Aave)
- Multi-sig configuration (signer count, threshold)
- Tokenomics parameters (supply cap, emission rate, distribution splits)
- Team and community structure (core team, investors, community treasury)
- Legal jurisdiction and entity structure (if applicable)
Output Artifact
Governance architecture specification including:
- Contract architecture (governor, timelock, token)
- Multi-sig configuration and signing policy
- Tokenomics model with emission schedule
- Treasury allocation and vesting schedule
- Operational procedures and emergency plans
Response Format
- Governance model: on-chain vs off-chain, token-weighted vs quadratic, quorum requirements
- Operational security: multisig configuration, signing policies, key management
- Treasury strategy: allocation, vesting, diversification, yield generation
- Token economics: supply model, distribution, incentives, emission schedule
- Project methodology: development lifecycle, audit gates, community involvement
Completion Criteria
- Governance contract architecture is fully specified with all parameters
- Multi-sig setup includes signer roles, thresholds, and key management procedures
- Tokenomics model includes supply schedule, emission curve, and distribution plan
- Treasury strategy covers vesting schedules, diversification, and yield optimization
- Emergency procedures include pause mechanisms, guardian roles, and communication plans
Max Response Length
4000 tokens
Workflow
Phase 1: Governance Framework Selection
- Determine on-chain vs off-chain governance based on protocol maturity and community size
- Select governance framework: OpenZeppelin Governor (modular), Compound GovernorBravo (proven), or Aave v2 (efficient)
- Configure voting parameters: voting delay (1-3 days), voting period (3-7 days), proposal threshold (0.1-1% supply), quorum (4-20% supply)
- Select voting mechanism: token-weighted, quadratic, or conviction-based depending on governance goals
- Design timelock: minimum 48h for parameter changes, 7d for critical upgrades
Phase 2: Multi-Sig Infrastructure
- Determine signer set: 3/5 for operations, 5/9 for treasury, 7/12 for protocol upgrades
- Select multi-sig platform: Gnosis Safe (EVM), Squads (Solana), or custom
- Define signing policies: threshold requirements per operation type, hardware wallet mandates
- Establish key management: geographic distribution, social recovery, backup procedures
- Implement timelock integration: multi-sig proposes → timelock enforces delay → execution
Phase 3: Tokenomics and Treasury
- Design token supply model: fixed cap, inflationary, or algorithmic based on protocol goals
- Define emission schedule: halving curve, exponential decay, or linear emission
- Create distribution plan: team vesting (1y cliff, 3-4y linear), investors, treasury, community rewards
- Design staking mechanics: lock duration tiers, reward distribution algorithm, unbonding period
- Establish treasury strategy: diversification targets, yield generation, spending policies
Phase 4: Operational Procedures
- Implement monitoring: proposal health dashboard, delegate tracking, timelock watchers
- Set up communication channels: governance forum, Discord, emergency notification
- Create emergency response plan: guardian pause, communication template, fork coordination
- Establish audit schedule: annual comprehensive audit, quarterly parameter review
Phase 5: Progressive Decentralization
- Start centralized: core team controls multi-sig with timelock
- Transition control: hand over governance token control, one module at a time
- Community governance: full on-chain governance with timelock, guardian emergency role
- Ongoing evolution: governance parameter adjustment via protocol itself
- Sunset centralized privileges: renounce or revoke admin roles after proven stability
Architecture / Decision Trees
Governance Framework Comparison
| Feature |
OpenZeppelin Governor |
Compound GovernorBravo |
Aave v2 |
| Modularity |
High (pluggable modules) |
Low (monolithic) |
Medium |
| Gas efficiency |
Medium |
High |
Very High |
| Timelock integration |
Native (ITimelock) |
Separate Timelock |
Separate |
| Vote delegation |
Built-in (ERC20Votes) |
Built-in |
Manual |
| Proposal types |
Multiple actions |
Single action batch |
Multiple actions |
| Cancelation |
Proposer + guardian |
Proposer only |
Admin only |
| Upgradeability |
Modular/Replaceable |
Complex (proxy migration) |
Not designed for upgrade |
Token Supply Decision Tree
Decide: Token Supply Model
├── Need predictable scarcity?
│ ├── YES → Fixed supply with halving (Bitcoin model)
│ │ ├── Total cap: 10M-100B tokens
│ │ ├── Halving interval: 210000-1051200 blocks
│ │ └── Risk: No inflation to fund ongoing development
│ └── NO → Evaluate inflation goals
│ ├── Validator rewards needed?
│ │ ├── YES → Inflationary with decay
│ │ │ ├── Initial inflation: 5-15% annually
│ │ │ ├── Decay: Exponential over 5-10 years
│ │ │ └── Target: Approach 0-2% terminal inflation
│ │ └── NO → Fixed supply or rebase
│ └── Stable purchasing power needed?
│ ├── YES → Rebase/algorithmic (high risk)
│ └── NO → Fixed supply with fee burn
Token Launch Strategy Decision Tree
Decide: Token Launch Method
├── Need broad distribution + price discovery?
│ ├── YES → LBP (Fjord/Copper)
│ │ ├── Advantages: Fair price discovery, anti-bot
│ │ ├── Duration: 24-72 hours
│ │ └── Weight: Start 2-4x, decay to 1x
│ └── NO → Evaluate community goals
├── Building on existing community?
│ ├── YES → Airdrop
│ │ ├── Eligibility: Active users, early adopters, NFT holders
│ │ ├── Distribution: Merkle tree (gas efficient)
│ │ └── Cliff: 3-6 months before claim, linear unlock
│ └── NO → Check capital raise needs
├── Need initial capital?
│ ├── YES → IDO via launchpad (Sushi MISO, Fjord)
│ │ ├── Raise: $100K-5M
│ │ └── Liquidity: Pair with ETH/USDC, lock LP tokens
│ └── NO → Direct listing on DEX
└── Institutional + regulatory compliant?
└── IEO on centralized exchange (Binance, Coinbase)
└── Compliance: KYC/AML, jurisdiction restrictions
DAO Legal Entity Decision Tree
Decide: DAO Legal Structure
├── Operating in US?
│ ├── Wyoming DAO LLC
│ │ ├── Best for: US-based DAOs
│ │ ├── Liability protection: Yes (LLC shield)
│ │ └── Cost: ~$1,500 registration + annual report
│ ├── Delaware C-Corp
│ │ └── Best for: Raising venture capital alongside token
│ └── Unincorporated DAO
│ └── Risk: Personal liability for members (court dependent)
├── Operating in EU?
│ ├── Malta (MFSA framework)
│ ├── Switzerland (Ethereum Foundation model)
│ └── Cayman Islands foundation
└── Multi-jurisdiction?
└── Legal wrapper + token issuer in separate jurisdictions
Common Pitfalls
- Governance attack via flash loan: Without block-snapshot voting power, attackers can borrow governance tokens, vote, and return them in one block. Always use
getPastVotes with block-number snapshot.
- Timelock bypass through self-governance: If the governor can modify its own timelock address or delay, a malicious proposal can set timelock to zero and execute immediately. Make timelock delay immutable or require supermajority to change.
- Quorum too low: A quorum floor below 1% of supply with low voter participation enables hostile takeover. Use dynamic quorum that scales with total supply.
- Vesting cliff not enforced: If tokens are transferred before cliff, contributors exit early. Use escrow contracts that enforce cliff at the contract level, not just in legal agreements.
- Treasury diversification delay: Holding >50% of treasury in the protocol's own token creates systemic risk during market downturns. Diversify treasury into stable assets immediately after token launch.
- Emission schedule mutability without supermajority: If a simple majority can change emission rates, the protocol is vulnerable to governance capture. Require 66%+ supermajority for emission parameter changes.
- No emergency pause mechanism: During exploits, hours of timelock delay can mean total loss. Implement guardian multi-sig with ability to pause critical functions (not execute arbitrary code).
- Ignoring L1→L2 governance coordination: Cross-chain deployments require hub-and-spoke governance model, not independent governance per chain.
- Airdrop sybil farming: Without anti-sybil measures (on-chain activity scoring, Gitcoin Passport, minimum tx count), airdrops get extracted by bots.
- LBP ending slippage: LBP pools without sufficient final weight protection can be manipulated at close. Set minimum price floor or use gradual weight decay to zero.
- Vote delegation centralization: If top 10 delegates hold >50% of voting power, the DAO is effectively centralized. Implement delegation caps, quadratic voting, or conviction voting.
- Proposal spam: Without proposer bond, low-quality or malicious proposals overwhelm governance. Bond must be high enough to deter spam but low enough for legitimate proposers.
- Treasury yield overexposure: Putting >30% of treasury in a single yield protocol creates counter-party risk. Diversify across 5+ independent protocols and asset classes.
- Token-weighted governance with whale dominance: Pure token-weighted voting concentrates power in early investors. Consider quadratic voting (more equitable) or conviction voting (long-term aligned).
Best Practices
Governance Design
- Use OpenZeppelin Governor for new projects (modular, audited, actively maintained)
- Always snapshot voting power at proposal block (prevent flash loan attacks)
- Implement dynamic quorum that adjusts based on historical participation
- Require proposer bond (100-10,000 tokens) to prevent spam proposals
- Add cancelation role for guardian multi-sig with 48h timelock override
- Use EIP-712 for off-chain vote delegation (Snapshot compatibility)
- Implement governor toggle for pause during migration or emergency
Multi-Sig Operations
- Minimum 3/5 for non-critical, 5/9 for treasury, 7/12 for protocol upgrades
- Geographic distribution of signers across different jurisdictions
- Hardware wallets (Ledger/Trezor) for all treasury signers
- Quarterly key signing ceremonies with backup verification
- Social recovery setup for lost keys
- Simulate transaction on Tenderly before mainnet execution
- Rotate signers annually and after any security incident
Tokenomics Engineering
- Total supply should be determined by security budget requirements, not arbitrary caps
- Use exponential decay emission curves for smooth transitions
- Team vesting: 1-year cliff minimum, 3-4 year linear vesting
- Treasury allocation: 20-40% of total supply, released over 4+ years
- Community rewards: 30-50% of total supply for ecosystem growth
- Airdrop: 5-15% of total supply, targeting active protocol users
- Liquidity seeding: 5-10%, with LP tokens locked or in incentivized pools
Treasury Management
- Target allocation: 40% stablecoins, 30% blue-chip crypto (ETH/BTC), 20% LP positions, 10% yield-bearing
- Use streaming protocols (Sablier, LlamaPay) for ongoing contributor payments
- Diversify yield sources: 5+ protocols across lending, LP, RWA
- Implement spending policy: ≤5% of treasury per quarter without governance vote
- Maintain 12-month operating runway in stable assets at all times
- Use ZK-proofs for private treasury reporting (if needed)
Proposal Lifecycle Template
- Temperature check: 5-day Snapshot vote (off-chain, signaling only)
- Formal proposal: On-chain proposal with full calldata + description hash
- Voting period: 3-7 days depending on governance framework
- Timelock queue: 48h minimum after vote passes
- Execution: After timelock delay expires, anyone can execute
- Post-execution monitoring: 7-day watch period for anomalous behavior
Compared With
| Aspect |
Traditional PM |
Web3 PM |
| Decision making |
Centralized (management) |
Distributed (token vote) |
| Upgrade process |
CI/CD pipeline |
Governance proposal + timelock |
| Incident response |
Central authority can act immediately |
Timelock delays response |
| Funding |
Budget allocation |
Treasury management + token emission |
| Stakeholder alignment |
Shareholder value |
Token holder alignment |
| Security model |
Perimeter defense |
Economic security + code audits |
| Transparency |
Internal reporting |
On-chain transparency |
DAO Tooling Comparison
| Tool |
Category |
Chain |
Key Feature |
| Tally |
Governance dashboard |
Multi-chain |
Proposal creation + voting |
| Snapshot |
Off-chain voting |
Multi-chain |
Gasless signaling votes |
| Gnosis Safe |
Multi-sig |
EVM |
Modular security modules |
| Zodiac |
DAO modules |
EVM |
Reality.eth, exit, bridge modules |
| Aragon |
DAO framework |
EVM |
Modular OSx framework |
| Syndicate |
Investment DAOs |
EVM |
On-chain fund management |
| Utopia |
Contributor mgmt |
EVM |
Role-based access for teams |
| Juicy |
Contributor mgmt |
EVM |
Stream + role management |
| Sablier |
Payment streaming |
EVM |
Real-time money streaming |
| LlamaPay |
Payment streaming |
Multi-chain |
Vesting + streaming |
| Coordinape |
Compensation |
EVM |
Peer-to-peer reward allocation |
| SourceCred |
Contribution tracking |
Off-chain |
Graph-based cred scoring |
| DeepDAO |
DAO analytics |
Off-chain |
Governance health metrics |
Performance Considerations
- Governance gas costs: Each vote cast costs ~50-100k gas. With 10,000 voters, a single proposal cycle costs 0.5-1 ETH in gas
- Optimization: Batch vote casting with EIP-712 signatures and delegated relayer
- Snapshot for signaling: Off-chain voting reduces costs by 1000x for non-binding votes
- L2 deployment: Deploy governance on L2 (Arbitrum/Optimism) with cross-chain message relay to L1 for execution
- Proposer bond recovery: Gas for executing cancelation should be recoverable from bond
- Timelock gas: A single timelock execute can cost 200k-500k gas depending on action count
Operations & Maintenance
Monitoring Requirements
- Proposal tracker: Real-time dashboard of active proposals, quorum progress, voting deadline
- Delegate tracker: Large delegation changes (>1% supply) trigger alert
- Timelock watcher: Monitor queued transactions, execute when delay expires
- Treasury tracker: Portfolio allocation, yield rates, spending velocity
- Cross-chain monitor: Bridge delays, message failures for multi-chain governance
- Signer activity: Track multi-sig signer participation rates (inactive signers should rotate out)
Maintenance Schedule
- Weekly: Check pending proposals, execute queued transactions
- Monthly: Review treasury allocation, rebalance if needed
- Quarterly: Governance parameter review (quorum, delay, threshold)
- Annual: Comprehensive security audit of governance contracts
- Emergency: Immediate pause and assessment for critical vulnerabilities
- Signer rotation: Every 6-12 months or after any hardware wallet sunset
Emergency Response Playbook
- Detect: Monitors flag anomalous on-chain activity (large transfers, unexpected proposals)
- Assess: Guardian multi-sig evaluates severity (30-minute window)
- Pause: Guardian pauses affected contracts via timelock override
- Communicate: Pre-prepared message template → Discord/Twitter/Governance forum
- Mitigate: Emergency proposal with fix (requires timelock delay)
- Resume: Governance vote to unpause + validate fix
- Post-mortem: Public incident report within 7 days
Rules
- Block-snapshot voting power is mandatory—never allow current-balance voting
- Timelock minimum 48 hours for parameter changes, 7 days for critical/upgrade proposals
- Guardian multi-sig can pause but NEVER execute arbitrary code without governance approval
- Quorum must be dynamic (percentage of supply) not static number
- Team/investor tokens must have smart-contract-enforced vesting with cliff
- Treasury must hold <50% in protocol's own token after 6 months of launch
- Emission parameter changes require supermajority (66%+) and extended timelock (14d+)
- All governance contracts must have emergency pause mechanism with guardian role
- Cross-chain governance requires hub-and-spoke architecture, not independent governance per chain
- Proposer bond is mandatory to prevent proposal spam and griefing
- Vote delegation changes during active proposal must use snapshot voting power
- Governance upgrades require two-phase: propose timelock change then execute
- Maximum gas per proposal execution block: 10M gas for mainnet L1
- Off-chain proposal metadata must be bound to on-chain calldata via description hash
- Liquid staking derivatives used in governance must handle depeg scenarios
- All governance parameter changes must emit events with old/new values for off-chain indexers
- Contributor compensation must be on-chain (streaming or vesting), not discretionary
- Airdrop claims must use Merkle tree verification with anti-sybil filtering
- Treasury yield positions must have withdrawal to stable assets in <7 days (no long locks)
- Signer set must have >50% turnover every 12 months to prevent key concentration risk
- Governance forum discussions must have minimum 72-hour discussion period before on-chain proposal
- Proposal descriptions must include clear success criteria and risk assessment
- All timelock delays must be measured in blocks (not seconds) for fork consistency
- Multisig transaction hashes must be verified against Tenderly simulation before signing
- Token launches must have anti-bot protection (weighted LBP, Merkle-whitelist, or Proof-of-Humanity)
Implementation Examples
Governor Contract (OpenZeppelin — Minimal)
contract MyGovernor is
Governor,
GovernorSettings,
GovernorCompatibilityBravo,
GovernorVotesQuorumFraction,
GovernorTimelockControl,
GovernorPreventLateQuorum
{
constructor(
IVotes _token,
TimelockController _timelock,
uint256 _votingDelay, // blocks before voting starts
uint256 _votingPeriod, // duration in blocks
uint256 _quorumPercent // e.g., 4 = 4% of supply
)
Governor("MyGovernor")
GovernorSettings(_votingDelay, _votingPeriod, 0) // proposal threshold = 0
GovernorVotesQuorumFraction(_quorumPercent)
GovernorPreventLateQuorum(1 days)
GovernorTimelockControl(_timelock)
{}
// Required overrides
function votingDelay() public view override(IGovernor, GovernorSettings) returns (uint256) {
return super.votingDelay();
}
function votingPeriod() public view override(IGovernor, GovernorSettings) returns (uint256) {
return super.votingPeriod();
}
function quorum(uint256 blockNumber) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) {
return super.quorum(blockNumber);
}
function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) {
return super._executor();
}
function supportsInterface(bytes4 interfaceId) public view override(Governor, GovernorTimelockControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
function proposalNeedsQueuing(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (bool) {
return super.proposalNeedsQueuing(proposalId);
}
}
Timelock Controller with Multi-Sig Guardian
// Timelock with guardian override for emergency pause
contract ProtectedTimelock is TimelockController {
address public guardian;
modifier onlyGuardian() {
require(msg.sender == guardian, "Not guardian");
_;
}
constructor(
uint256 minDelay,
address[] memory proposers,
address[] memory executors,
address _guardian
) TimelockController(minDelay, proposers, executors, _guardian) {
guardian = _guardian;
}
// Guardian can cancel malicious proposals before delay expires
// But CANNOT execute arbitrary code
function guardianCancel(bytes32 id) external onlyGuardian {
_cancel(id);
}
// Guardian can pause all operations
bool public paused;
function pause() external onlyGuardian { paused = true; }
function unpause() external onlyGuardian { paused = false; }
function execute(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt
) public payable override {
require(!paused, "System paused");
super.execute(target, value, data, predecessor, salt);
}
}
Vesting Contract (Team/Investor Tokens)
contract VestingEscrow {
IERC20 public token;
address public beneficiary;
uint256 public totalAmount;
uint256 public startTime;
uint256 public cliffDuration;
uint256 public totalDuration;
uint256 public released;
constructor(
address _token,
address _beneficiary,
uint256 _totalAmount,
uint256 _startTime,
uint256 _cliffDuration,
uint256 _totalDuration
) {
token = IERC20(_token);
beneficiary = _beneficiary;
totalAmount = _totalAmount;
startTime = _startTime;
cliffDuration = _cliffDuration;
totalDuration = _totalDuration;
}
// Computable vesting schedule — transparent and immutable
function releasableAmount() public view returns (uint256) {
if (block.timestamp < startTime + cliffDuration) return 0;
if (block.timestamp >= startTime + totalDuration) return totalAmount - released;
uint256 elapsed = block.timestamp - startTime;
return (totalAmount * elapsed) / totalDuration - released;
}
function release() external {
uint256 amount = releasableAmount();
require(amount > 0, "No tokens to release");
released += amount;
token.safeTransfer(beneficiary, amount);
emit Released(beneficiary, amount);
}
event Released(address indexed beneficiary, uint256 amount);
}
Treasury Rebalancing Strategy
contract TreasuryManager {
using SafeERC20 for IERC20;
// Target allocation: 40% stablecoin, 30% ETH/BTC, 20% LP, 10% yield
struct Allocation {
uint256 stablePercent; // e.g., 4000 = 40.00%
uint256 blueChipPercent; // e.g., 3000 = 30.00%
uint256 lpPercent; // e.g., 2000 = 20.00%
uint256 yieldPercent; // e.g., 1000 = 10.00%
}
Allocation public targetAllocation;
uint256 public rebalanceThreshold = 500; // 5% deviation triggers rebalance
// Yield positions across protocols for diversification
IYieldProvider[] public yieldProviders;
function rebalance() external onlyRole(GOVERNOR_ROLE) {
uint256 totalUSD = getTotalUSD();
uint256 stableValue = getStableValue();
uint256 blueChipValue = getBlueChipValue();
uint256 lpValue = getLPValue();
uint256 yieldValue = getYieldValue();
// Check deviation from target
uint256 stablePct = stableValue * 10000 / totalUSD;
require(
absDiff(stablePct, targetAllocation.stablePercent) > rebalanceThreshold ||
absDiff(blueChipValue * 10000 / totalUSD, targetAllocation.blueChipPercent) > rebalanceThreshold,
"Within threshold"
);
// Execute rebalancing swaps via DEX aggregator (1inch/Paraswap)
_executeSwaps();
}
function absDiff(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a - b : b - a;
}
}
Delegate Voting System
contract DelegateVoting is ERC20Votes {
// Token holders can delegate voting power to any address
function delegateTo(address delegatee) external {
_delegate(msg.sender, delegatee);
}
// Snapshot voting power at a specific block
function getVotingPower(address account, uint256 blockNumber) public view returns (uint256) {
return getPastVotes(account, blockNumber);
}
// Prevent flash loan attacks — uses block snapshot, not current balance
// This is enforced by ERC20Votes: getPastVotes reads from checkpoint at blockNumber
}
// Combined with Governor:
// Governor uses token.getPastVotes(account, proposalSnapshot(proposalId))
// This ensures voting power was locked at proposal block — flash loan cannot influence it
Cross-Chain Governance (Hub-and-Spoke)
// Hub chain (L1): Governor + Timelock
// Spoke chains (L2, sidechains): Bridge adapters
contract CrossChainGovernor is Governor {
using CrossChainEnabled for address;
// Execute governance actions on spoke chains via bridge
function proposeAndExecuteCrossChain(
address target,
uint256 value,
bytes memory data,
uint256 dstChainId,
bytes memory adapterParams
) external onlyGovernance {
// Queue on hub timelock
_queueOperation(target, value, data, bytes32(0), bytes32(dstChainId));
// Send cross-chain message to spoke
ILayerZeroEndpoint(endpoint).send{value: msg.value}(
dstChainId,
trustedRemoteLookup[dstChainId],
abi.encode(target, value, data),
payable(msg.sender),
address(0x0),
adapterParams
);
}
// Received from spoke chain: execute with hub governance approval
function receiveFromSpoke(bytes memory message) external {
(address target, uint256 value, bytes memory data) = abi.decode(message, (address, uint256, bytes));
// Verify spoke chain message carries hub governance weight
// Only execute if corresponding hub proposal passed and timelock expired
_execute(target, value, data);
}
}
Airdrop Merkle Distributor
contract AirdropDistributor {
IERC20 public token;
bytes32 public merkleRoot;
uint256 public claimStart;
uint256 public claimEnd;
// Tracks claimed addresses
mapping(address => bool) public isClaimed;
constructor(
address _token,
bytes32 _merkleRoot,
uint256 _claimStart,
uint256 _claimEnd
) {
token = IERC20(_token);
merkleRoot = _merkleRoot;
claimStart = _claimStart;
claimEnd = _claimEnd;
}
function claim(
uint256 amount,
bytes32[] calldata merkleProof
) external {
require(block.timestamp >= claimStart, "Claim not started");
require(block.timestamp <= claimEnd, "Claim ended");
require(!isClaimed[msg.sender], "Already claimed");
// Verify Merkle proof
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
require(MerkleProof.verify(merkleProof, merkleRoot, leaf), "Invalid proof");
isClaimed[msg.sender] = true;
require(token.transfer(msg.sender, amount), "Transfer failed");
emit Claimed(msg.sender, amount);
}
event Claimed(address indexed claimant, uint256 amount);
}
Contributor Payment Streaming (Sablier-style)
contract PaymentStream {
IERC20 public token;
address public sender;
address public recipient;
uint256 public totalAmount;
uint256 public startTime;
uint256 public stopTime;
uint256 public withdrawn;
modifier onlySender() { require(msg.sender == sender, "Not sender"); _; }
modifier onlyRecipient() { require(msg.sender == recipient, "Not recipient"); _; }
constructor(
address _token,
address _recipient,
uint256 _totalAmount,
uint256 _duration
) {
token = IERC20(_token);
sender = msg.sender;
recipient = _recipient;
totalAmount = _totalAmount;
startTime = block.timestamp;
stopTime = block.timestamp + _duration;
token.safeTransferFrom(msg.sender, address(this), _totalAmount);
}
function withdrawable() public view returns (uint256) {
if (block.timestamp <= startTime) return 0;
if (block.timestamp >= stopTime) return totalAmount - withdrawn;
uint256 elapsed = block.timestamp - startTime;
uint256 duration = stopTime - startTime;
return (totalAmount * elapsed) / duration - withdrawn;
}
function withdraw() external onlyRecipient {
uint256 amount = withdrawable();
require(amount > 0, "Nothing to withdraw");
withdrawn += amount;
token.safeTransfer(recipient, amount);
}
function cancel() external onlySender {
token.safeTransfer(sender, totalAmount - withdrawn);
}
// Governance: % of tokens with streaming creates predictable sell pressure
// Calculate daily sell volume = totalStreamingAmount / averageStreamDuration
}
Performance Considerations
- Governance gas costs: Each vote cast costs ~50-100k gas. With 10,000 voters, a single proposal cycle costs 0.5-1 ETH in gas
- Optimization: Batch vote casting with EIP-712 signatures and delegated relayer
- Snapshot for signaling: Off-chain voting reduces costs by 1000x for non-binding votes
- L2 deployment: Deploy governance on L2 (Arbitrum/Optimism) with cross-chain message relay to L1 for execution
- Proposer bond recovery: Gas for executing cancelation should be recoverable from bond
- Timelock gas: A single timelock execute can cost 200k-500k gas depending on action count
References
- references/blockchain-management-advanced.md — Blockchain Management Advanced Topics
- references/blockchain-management-fundamentals.md — Blockchain Management Fundamentals
- references/dao-governance.md — DAO Governance
- references/dao-operations-lifecycle.md — DAO Operations Lifecycle
- references/multi-sig-operations.md — Multi-Sig Operations
- references/project-methodology.md — Web3 Project Methodology
- references/token-engineering-and-emissions.md — Token Engineering & Emissions
- references/tokenomics-design.md — Tokenomics Design
- references/treasury-management.md — Treasury Management
Handoff
blockchain-management → blockchain-tokenomics (for deep token model implementation)
blockchain-management → blockchain-security (for audit and governance security)
1---2name: blockchain-management3description: Use this skill when asked about blockchain project management, DAO governance, multi-sig operations, treasury management, tokenomics design, and web3 project methodology. Languages: Solidity, TypeScript, Python. Covers DAO governance frameworks (Compound Governor, Aave, Snapshot, Tally), multi-sig wallet operations (Gnosis Safe, Timelock, proposal lifecycle), treasury management (vesting, streaming, diversification, yield), tokenomics design (supply schedule, inflation, staking rewards, emission curve), and web3-specific project methodology (audit-first, progressive decentralization, community governance). For standard management practices (agile, scrum, kanban, risk management, stakeholder management, OKR/KPI), reference shared skills from skills/management/. Do NOT use for: standard project management (use skills/management/pm), team operations (use skills/management/agile-scrum-kanban), cost analysis (use skills/management/cost-benefit), or technical blockchain development (use other blockchain-* skills).4license: MIT5---67# Blockchain Management89## Purpose10Guide blockchain-specific project management covering DAO governance, multi-sig operations, treasury management, and tokenomics engineering. This skill enforces web3-specific methodology (audit-first, progressive decentralization) distinct from traditional software project management.1112## Agent Protocol1314### Trigger15"blockchain management", "DAO governance", "Compound Governor", "Snapshot vote", "Tally", "multi-sig", "Gnosis Safe", "timelock", "treasury management", "tokenomics", "token supply", "vesting", "token emission", "web3 project management", "blockchain project methodology", "progressive decentralization", "audit-first", "community governance", "DAO operations", "token launch", "airdrop", "LBP", "IDO", "IEO", "governance attack", "flash loan attack", "DAO legal structure", "Wyoming DAO", "legal wrappers", "contributor compensation", "vesting contract", "streaming", "Sablier", "LlamaPay", "treasury diversification", "yield farming", "on-chain payroll", "delegate", "delegation", "quorum", "proposal lifecycle", "proposer bond", "governance token", "veToken", "vote escrow"1617### Input Context18- Blockchain platform (Ethereum/Solana/Cosmos)19- Governance framework preference (Compound/OpenZeppelin/Aave)20- Multi-sig configuration (signer count, threshold)21- Tokenomics parameters (supply cap, emission rate, distribution splits)22- Team and community structure (core team, investors, community treasury)23- Legal jurisdiction and entity structure (if applicable)2425### Output Artifact26Governance architecture specification including:27- Contract architecture (governor, timelock, token)28- Multi-sig configuration and signing policy29- Tokenomics model with emission schedule30- Treasury allocation and vesting schedule31- Operational procedures and emergency plans3233### Response Format341. **Governance model**: on-chain vs off-chain, token-weighted vs quadratic, quorum requirements352. **Operational security**: multisig configuration, signing policies, key management363. **Treasury strategy**: allocation, vesting, diversification, yield generation374. **Token economics**: supply model, distribution, incentives, emission schedule385. **Project methodology**: development lifecycle, audit gates, community involvement3940### Completion Criteria41- Governance contract architecture is fully specified with all parameters42- Multi-sig setup includes signer roles, thresholds, and key management procedures43- Tokenomics model includes supply schedule, emission curve, and distribution plan44- Treasury strategy covers vesting schedules, diversification, and yield optimization45- Emergency procedures include pause mechanisms, guardian roles, and communication plans4647### Max Response Length484000 tokens4950## Workflow5152### Phase 1: Governance Framework Selection531. Determine on-chain vs off-chain governance based on protocol maturity and community size542. Select governance framework: OpenZeppelin Governor (modular), Compound GovernorBravo (proven), or Aave v2 (efficient)553. Configure voting parameters: voting delay (1-3 days), voting period (3-7 days), proposal threshold (0.1-1% supply), quorum (4-20% supply)564. Select voting mechanism: token-weighted, quadratic, or conviction-based depending on governance goals575. Design timelock: minimum 48h for parameter changes, 7d for critical upgrades5859### Phase 2: Multi-Sig Infrastructure606. Determine signer set: 3/5 for operations, 5/9 for treasury, 7/12 for protocol upgrades617. Select multi-sig platform: Gnosis Safe (EVM), Squads (Solana), or custom628. Define signing policies: threshold requirements per operation type, hardware wallet mandates639. Establish key management: geographic distribution, social recovery, backup procedures6410. Implement timelock integration: multi-sig proposes → timelock enforces delay → execution6566### Phase 3: Tokenomics and Treasury6711. Design token supply model: fixed cap, inflationary, or algorithmic based on protocol goals6812. Define emission schedule: halving curve, exponential decay, or linear emission6913. Create distribution plan: team vesting (1y cliff, 3-4y linear), investors, treasury, community rewards7014. Design staking mechanics: lock duration tiers, reward distribution algorithm, unbonding period7115. Establish treasury strategy: diversification targets, yield generation, spending policies7273### Phase 4: Operational Procedures7416. Implement monitoring: proposal health dashboard, delegate tracking, timelock watchers7517. Set up communication channels: governance forum, Discord, emergency notification7618. Create emergency response plan: guardian pause, communication template, fork coordination7719. Establish audit schedule: annual comprehensive audit, quarterly parameter review7879### Phase 5: Progressive Decentralization8020. Start centralized: core team controls multi-sig with timelock8121. Transition control: hand over governance token control, one module at a time8222. Community governance: full on-chain governance with timelock, guardian emergency role8323. Ongoing evolution: governance parameter adjustment via protocol itself8424. Sunset centralized privileges: renounce or revoke admin roles after proven stability8586## Architecture / Decision Trees8788### Governance Framework Comparison8990| Feature | OpenZeppelin Governor | Compound GovernorBravo | Aave v2 |91|---|---|---|---|92| Modularity | High (pluggable modules) | Low (monolithic) | Medium |93| Gas efficiency | Medium | High | Very High |94| Timelock integration | Native (ITimelock) | Separate Timelock | Separate |95| Vote delegation | Built-in (ERC20Votes) | Built-in | Manual |96| Proposal types | Multiple actions | Single action batch | Multiple actions |97| Cancelation | Proposer + guardian | Proposer only | Admin only |98| Upgradeability | Modular/Replaceable | Complex (proxy migration) | Not designed for upgrade |99100### Token Supply Decision Tree101102```103Decide: Token Supply Model104├── Need predictable scarcity?105│ ├── YES → Fixed supply with halving (Bitcoin model)106│ │ ├── Total cap: 10M-100B tokens107│ │ ├── Halving interval: 210000-1051200 blocks108│ │ └── Risk: No inflation to fund ongoing development109│ └── NO → Evaluate inflation goals110│ ├── Validator rewards needed?111│ │ ├── YES → Inflationary with decay112│ │ │ ├── Initial inflation: 5-15% annually113│ │ │ ├── Decay: Exponential over 5-10 years114│ │ │ └── Target: Approach 0-2% terminal inflation115│ │ └── NO → Fixed supply or rebase116│ └── Stable purchasing power needed?117│ ├── YES → Rebase/algorithmic (high risk)118│ └── NO → Fixed supply with fee burn119```120121### Token Launch Strategy Decision Tree122123```124Decide: Token Launch Method125├── Need broad distribution + price discovery?126│ ├── YES → LBP (Fjord/Copper)127│ │ ├── Advantages: Fair price discovery, anti-bot128│ │ ├── Duration: 24-72 hours129│ │ └── Weight: Start 2-4x, decay to 1x130│ └── NO → Evaluate community goals131├── Building on existing community?132│ ├── YES → Airdrop133│ │ ├── Eligibility: Active users, early adopters, NFT holders134│ │ ├── Distribution: Merkle tree (gas efficient)135│ │ └── Cliff: 3-6 months before claim, linear unlock136│ └── NO → Check capital raise needs137├── Need initial capital?138│ ├── YES → IDO via launchpad (Sushi MISO, Fjord)139│ │ ├── Raise: $100K-5M140│ │ └── Liquidity: Pair with ETH/USDC, lock LP tokens141│ └── NO → Direct listing on DEX142└── Institutional + regulatory compliant?143 └── IEO on centralized exchange (Binance, Coinbase)144 └── Compliance: KYC/AML, jurisdiction restrictions145```146147### DAO Legal Entity Decision Tree148149```150Decide: DAO Legal Structure151├── Operating in US?152│ ├── Wyoming DAO LLC153│ │ ├── Best for: US-based DAOs154│ │ ├── Liability protection: Yes (LLC shield)155│ │ └── Cost: ~$1,500 registration + annual report156│ ├── Delaware C-Corp157│ │ └── Best for: Raising venture capital alongside token158│ └── Unincorporated DAO159│ └── Risk: Personal liability for members (court dependent)160├── Operating in EU?161│ ├── Malta (MFSA framework)162│ ├── Switzerland (Ethereum Foundation model)163│ └── Cayman Islands foundation164└── Multi-jurisdiction?165 └── Legal wrapper + token issuer in separate jurisdictions166```167168## Common Pitfalls1691701. **Governance attack via flash loan**: Without block-snapshot voting power, attackers can borrow governance tokens, vote, and return them in one block. Always use `getPastVotes` with block-number snapshot.1712. **Timelock bypass through self-governance**: If the governor can modify its own timelock address or delay, a malicious proposal can set timelock to zero and execute immediately. Make timelock delay immutable or require supermajority to change.1723. **Quorum too low**: A quorum floor below 1% of supply with low voter participation enables hostile takeover. Use dynamic quorum that scales with total supply.1734. **Vesting cliff not enforced**: If tokens are transferred before cliff, contributors exit early. Use escrow contracts that enforce cliff at the contract level, not just in legal agreements.1745. **Treasury diversification delay**: Holding >50% of treasury in the protocol's own token creates systemic risk during market downturns. Diversify treasury into stable assets immediately after token launch.1756. **Emission schedule mutability without supermajority**: If a simple majority can change emission rates, the protocol is vulnerable to governance capture. Require 66%+ supermajority for emission parameter changes.1767. **No emergency pause mechanism**: During exploits, hours of timelock delay can mean total loss. Implement guardian multi-sig with ability to pause critical functions (not execute arbitrary code).1778. **Ignoring L1→L2 governance coordination**: Cross-chain deployments require hub-and-spoke governance model, not independent governance per chain.1789. **Airdrop sybil farming**: Without anti-sybil measures (on-chain activity scoring, Gitcoin Passport, minimum tx count), airdrops get extracted by bots.17910. **LBP ending slippage**: LBP pools without sufficient final weight protection can be manipulated at close. Set minimum price floor or use gradual weight decay to zero.18011. **Vote delegation centralization**: If top 10 delegates hold >50% of voting power, the DAO is effectively centralized. Implement delegation caps, quadratic voting, or conviction voting.18112. **Proposal spam**: Without proposer bond, low-quality or malicious proposals overwhelm governance. Bond must be high enough to deter spam but low enough for legitimate proposers.18213. **Treasury yield overexposure**: Putting >30% of treasury in a single yield protocol creates counter-party risk. Diversify across 5+ independent protocols and asset classes.18314. **Token-weighted governance with whale dominance**: Pure token-weighted voting concentrates power in early investors. Consider quadratic voting (more equitable) or conviction voting (long-term aligned).184185## Best Practices186187### Governance Design188- Use OpenZeppelin Governor for new projects (modular, audited, actively maintained)189- Always snapshot voting power at proposal block (prevent flash loan attacks)190- Implement dynamic quorum that adjusts based on historical participation191- Require proposer bond (100-10,000 tokens) to prevent spam proposals192- Add cancelation role for guardian multi-sig with 48h timelock override193- Use EIP-712 for off-chain vote delegation (Snapshot compatibility)194- Implement governor toggle for pause during migration or emergency195196### Multi-Sig Operations197- Minimum 3/5 for non-critical, 5/9 for treasury, 7/12 for protocol upgrades198- Geographic distribution of signers across different jurisdictions199- Hardware wallets (Ledger/Trezor) for all treasury signers200- Quarterly key signing ceremonies with backup verification201- Social recovery setup for lost keys202- Simulate transaction on Tenderly before mainnet execution203- Rotate signers annually and after any security incident204205### Tokenomics Engineering206- Total supply should be determined by security budget requirements, not arbitrary caps207- Use exponential decay emission curves for smooth transitions208- Team vesting: 1-year cliff minimum, 3-4 year linear vesting209- Treasury allocation: 20-40% of total supply, released over 4+ years210- Community rewards: 30-50% of total supply for ecosystem growth211- Airdrop: 5-15% of total supply, targeting active protocol users212- Liquidity seeding: 5-10%, with LP tokens locked or in incentivized pools213214### Treasury Management215- Target allocation: 40% stablecoins, 30% blue-chip crypto (ETH/BTC), 20% LP positions, 10% yield-bearing216- Use streaming protocols (Sablier, LlamaPay) for ongoing contributor payments217- Diversify yield sources: 5+ protocols across lending, LP, RWA218- Implement spending policy: ≤5% of treasury per quarter without governance vote219- Maintain 12-month operating runway in stable assets at all times220- Use ZK-proofs for private treasury reporting (if needed)221222### Proposal Lifecycle Template2231. **Temperature check**: 5-day Snapshot vote (off-chain, signaling only)2242. **Formal proposal**: On-chain proposal with full calldata + description hash2253. **Voting period**: 3-7 days depending on governance framework2264. **Timelock queue**: 48h minimum after vote passes2275. **Execution**: After timelock delay expires, anyone can execute2286. **Post-execution monitoring**: 7-day watch period for anomalous behavior229230## Compared With231232| Aspect | Traditional PM | Web3 PM |233|---|---|---|234| Decision making | Centralized (management) | Distributed (token vote) |235| Upgrade process | CI/CD pipeline | Governance proposal + timelock |236| Incident response | Central authority can act immediately | Timelock delays response |237| Funding | Budget allocation | Treasury management + token emission |238| Stakeholder alignment | Shareholder value | Token holder alignment |239| Security model | Perimeter defense | Economic security + code audits |240| Transparency | Internal reporting | On-chain transparency |241242## DAO Tooling Comparison243244| Tool | Category | Chain | Key Feature |245|---|---|---|---|246| Tally | Governance dashboard | Multi-chain | Proposal creation + voting |247| Snapshot | Off-chain voting | Multi-chain | Gasless signaling votes |248| Gnosis Safe | Multi-sig | EVM | Modular security modules |249| Zodiac | DAO modules | EVM | Reality.eth, exit, bridge modules |250| Aragon | DAO framework | EVM | Modular OSx framework |251| Syndicate | Investment DAOs | EVM | On-chain fund management |252| Utopia | Contributor mgmt | EVM | Role-based access for teams |253| Juicy | Contributor mgmt | EVM | Stream + role management |254| Sablier | Payment streaming | EVM | Real-time money streaming |255| LlamaPay | Payment streaming | Multi-chain | Vesting + streaming |256| Coordinape | Compensation | EVM | Peer-to-peer reward allocation |257| SourceCred | Contribution tracking | Off-chain | Graph-based cred scoring |258| DeepDAO | DAO analytics | Off-chain | Governance health metrics |259260## Performance Considerations261262- **Governance gas costs**: Each vote cast costs ~50-100k gas. With 10,000 voters, a single proposal cycle costs 0.5-1 ETH in gas263- **Optimization**: Batch vote casting with EIP-712 signatures and delegated relayer264- **Snapshot for signaling**: Off-chain voting reduces costs by 1000x for non-binding votes265- **L2 deployment**: Deploy governance on L2 (Arbitrum/Optimism) with cross-chain message relay to L1 for execution266- **Proposer bond recovery**: Gas for executing cancelation should be recoverable from bond267- **Timelock gas**: A single timelock execute can cost 200k-500k gas depending on action count268269## Operations & Maintenance270271### Monitoring Requirements272- **Proposal tracker**: Real-time dashboard of active proposals, quorum progress, voting deadline273- **Delegate tracker**: Large delegation changes (>1% supply) trigger alert274- **Timelock watcher**: Monitor queued transactions, execute when delay expires275- **Treasury tracker**: Portfolio allocation, yield rates, spending velocity276- **Cross-chain monitor**: Bridge delays, message failures for multi-chain governance277- **Signer activity**: Track multi-sig signer participation rates (inactive signers should rotate out)278279### Maintenance Schedule280- **Weekly**: Check pending proposals, execute queued transactions281- **Monthly**: Review treasury allocation, rebalance if needed282- **Quarterly**: Governance parameter review (quorum, delay, threshold)283- **Annual**: Comprehensive security audit of governance contracts284- **Emergency**: Immediate pause and assessment for critical vulnerabilities285- **Signer rotation**: Every 6-12 months or after any hardware wallet sunset286287### Emergency Response Playbook2881. **Detect**: Monitors flag anomalous on-chain activity (large transfers, unexpected proposals)2892. **Assess**: Guardian multi-sig evaluates severity (30-minute window)2903. **Pause**: Guardian pauses affected contracts via timelock override2914. **Communicate**: Pre-prepared message template → Discord/Twitter/Governance forum2925. **Mitigate**: Emergency proposal with fix (requires timelock delay)2936. **Resume**: Governance vote to unpause + validate fix2947. **Post-mortem**: Public incident report within 7 days295296## Rules2972981. Block-snapshot voting power is mandatory—never allow current-balance voting2992. Timelock minimum 48 hours for parameter changes, 7 days for critical/upgrade proposals3003. Guardian multi-sig can pause but NEVER execute arbitrary code without governance approval3014. Quorum must be dynamic (percentage of supply) not static number3025. Team/investor tokens must have smart-contract-enforced vesting with cliff3036. Treasury must hold <50% in protocol's own token after 6 months of launch3047. Emission parameter changes require supermajority (66%+) and extended timelock (14d+)3058. All governance contracts must have emergency pause mechanism with guardian role3069. Cross-chain governance requires hub-and-spoke architecture, not independent governance per chain30710. Proposer bond is mandatory to prevent proposal spam and griefing30811. Vote delegation changes during active proposal must use snapshot voting power30912. Governance upgrades require two-phase: propose timelock change then execute31013. Maximum gas per proposal execution block: 10M gas for mainnet L131114. Off-chain proposal metadata must be bound to on-chain calldata via description hash31215. Liquid staking derivatives used in governance must handle depeg scenarios31316. All governance parameter changes must emit events with old/new values for off-chain indexers31417. Contributor compensation must be on-chain (streaming or vesting), not discretionary31518. Airdrop claims must use Merkle tree verification with anti-sybil filtering31619. Treasury yield positions must have withdrawal to stable assets in <7 days (no long locks)31720. Signer set must have >50% turnover every 12 months to prevent key concentration risk31821. Governance forum discussions must have minimum 72-hour discussion period before on-chain proposal31922. Proposal descriptions must include clear success criteria and risk assessment32023. All timelock delays must be measured in blocks (not seconds) for fork consistency32124. Multisig transaction hashes must be verified against Tenderly simulation before signing32225. Token launches must have anti-bot protection (weighted LBP, Merkle-whitelist, or Proof-of-Humanity)323324## Implementation Examples325326### Governor Contract (OpenZeppelin — Minimal)327```solidity328contract MyGovernor is329 Governor,330 GovernorSettings,331 GovernorCompatibilityBravo,332 GovernorVotesQuorumFraction,333 GovernorTimelockControl,334 GovernorPreventLateQuorum335{336 constructor(337 IVotes _token,338 TimelockController _timelock,339 uint256 _votingDelay, // blocks before voting starts340 uint256 _votingPeriod, // duration in blocks341 uint256 _quorumPercent // e.g., 4 = 4% of supply342 )343 Governor("MyGovernor")344 GovernorSettings(_votingDelay, _votingPeriod, 0) // proposal threshold = 0345 GovernorVotesQuorumFraction(_quorumPercent)346 GovernorPreventLateQuorum(1 days)347 GovernorTimelockControl(_timelock)348 {}349350 // Required overrides351 function votingDelay() public view override(IGovernor, GovernorSettings) returns (uint256) {352 return super.votingDelay();353 }354 function votingPeriod() public view override(IGovernor, GovernorSettings) returns (uint256) {355 return super.votingPeriod();356 }357 function quorum(uint256 blockNumber) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) {358 return super.quorum(blockNumber);359 }360 function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) {361 return super._executor();362 }363 function supportsInterface(bytes4 interfaceId) public view override(Governor, GovernorTimelockControl) returns (bool) {364 return super.supportsInterface(interfaceId);365 }366 function proposalNeedsQueuing(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (bool) {367 return super.proposalNeedsQueuing(proposalId);368 }369}370```371372### Timelock Controller with Multi-Sig Guardian373```solidity374// Timelock with guardian override for emergency pause375contract ProtectedTimelock is TimelockController {376 address public guardian;377378 modifier onlyGuardian() {379 require(msg.sender == guardian, "Not guardian");380 _;381 }382383 constructor(384 uint256 minDelay,385 address[] memory proposers,386 address[] memory executors,387 address _guardian388 ) TimelockController(minDelay, proposers, executors, _guardian) {389 guardian = _guardian;390 }391392 // Guardian can cancel malicious proposals before delay expires393 // But CANNOT execute arbitrary code394 function guardianCancel(bytes32 id) external onlyGuardian {395 _cancel(id);396 }397398 // Guardian can pause all operations399 bool public paused;400 function pause() external onlyGuardian { paused = true; }401 function unpause() external onlyGuardian { paused = false; }402403 function execute(404 address target,405 uint256 value,406 bytes calldata data,407 bytes32 predecessor,408 bytes32 salt409 ) public payable override {410 require(!paused, "System paused");411 super.execute(target, value, data, predecessor, salt);412 }413}414```415416### Vesting Contract (Team/Investor Tokens)417```solidity418contract VestingEscrow {419 IERC20 public token;420 address public beneficiary;421 uint256 public totalAmount;422 uint256 public startTime;423 uint256 public cliffDuration;424 uint256 public totalDuration;425426 uint256 public released;427428 constructor(429 address _token,430 address _beneficiary,431 uint256 _totalAmount,432 uint256 _startTime,433 uint256 _cliffDuration,434 uint256 _totalDuration435 ) {436 token = IERC20(_token);437 beneficiary = _beneficiary;438 totalAmount = _totalAmount;439 startTime = _startTime;440 cliffDuration = _cliffDuration;441 totalDuration = _totalDuration;442 }443444 // Computable vesting schedule — transparent and immutable445 function releasableAmount() public view returns (uint256) {446 if (block.timestamp < startTime + cliffDuration) return 0;447 if (block.timestamp >= startTime + totalDuration) return totalAmount - released;448449 uint256 elapsed = block.timestamp - startTime;450 return (totalAmount * elapsed) / totalDuration - released;451 }452453 function release() external {454 uint256 amount = releasableAmount();455 require(amount > 0, "No tokens to release");456 released += amount;457 token.safeTransfer(beneficiary, amount);458 emit Released(beneficiary, amount);459 }460461 event Released(address indexed beneficiary, uint256 amount);462}463```464465### Treasury Rebalancing Strategy466```solidity467contract TreasuryManager {468 using SafeERC20 for IERC20;469470 // Target allocation: 40% stablecoin, 30% ETH/BTC, 20% LP, 10% yield471 struct Allocation {472 uint256 stablePercent; // e.g., 4000 = 40.00%473 uint256 blueChipPercent; // e.g., 3000 = 30.00%474 uint256 lpPercent; // e.g., 2000 = 20.00%475 uint256 yieldPercent; // e.g., 1000 = 10.00%476 }477478 Allocation public targetAllocation;479 uint256 public rebalanceThreshold = 500; // 5% deviation triggers rebalance480481 // Yield positions across protocols for diversification482 IYieldProvider[] public yieldProviders;483484 function rebalance() external onlyRole(GOVERNOR_ROLE) {485 uint256 totalUSD = getTotalUSD();486 uint256 stableValue = getStableValue();487 uint256 blueChipValue = getBlueChipValue();488 uint256 lpValue = getLPValue();489 uint256 yieldValue = getYieldValue();490491 // Check deviation from target492 uint256 stablePct = stableValue * 10000 / totalUSD;493 require(494 absDiff(stablePct, targetAllocation.stablePercent) > rebalanceThreshold ||495 absDiff(blueChipValue * 10000 / totalUSD, targetAllocation.blueChipPercent) > rebalanceThreshold,496 "Within threshold"497 );498499 // Execute rebalancing swaps via DEX aggregator (1inch/Paraswap)500 _executeSwaps();501 }502503 function absDiff(uint256 a, uint256 b) internal pure returns (uint256) {504 return a > b ? a - b : b - a;505 }506}507```508509### Delegate Voting System510```solidity511contract DelegateVoting is ERC20Votes {512 // Token holders can delegate voting power to any address513 function delegateTo(address delegatee) external {514 _delegate(msg.sender, delegatee);515 }516517 // Snapshot voting power at a specific block518 function getVotingPower(address account, uint256 blockNumber) public view returns (uint256) {519 return getPastVotes(account, blockNumber);520 }521522 // Prevent flash loan attacks — uses block snapshot, not current balance523 // This is enforced by ERC20Votes: getPastVotes reads from checkpoint at blockNumber524}525526// Combined with Governor:527// Governor uses token.getPastVotes(account, proposalSnapshot(proposalId))528// This ensures voting power was locked at proposal block — flash loan cannot influence it529```530531### Cross-Chain Governance (Hub-and-Spoke)532```solidity533// Hub chain (L1): Governor + Timelock534// Spoke chains (L2, sidechains): Bridge adapters535536contract CrossChainGovernor is Governor {537 using CrossChainEnabled for address;538539 // Execute governance actions on spoke chains via bridge540 function proposeAndExecuteCrossChain(541 address target,542 uint256 value,543 bytes memory data,544 uint256 dstChainId,545 bytes memory adapterParams546 ) external onlyGovernance {547 // Queue on hub timelock548 _queueOperation(target, value, data, bytes32(0), bytes32(dstChainId));549550 // Send cross-chain message to spoke551 ILayerZeroEndpoint(endpoint).send{value: msg.value}(552 dstChainId,553 trustedRemoteLookup[dstChainId],554 abi.encode(target, value, data),555 payable(msg.sender),556 address(0x0),557 adapterParams558 );559 }560561 // Received from spoke chain: execute with hub governance approval562 function receiveFromSpoke(bytes memory message) external {563 (address target, uint256 value, bytes memory data) = abi.decode(message, (address, uint256, bytes));564565 // Verify spoke chain message carries hub governance weight566 // Only execute if corresponding hub proposal passed and timelock expired567 _execute(target, value, data);568 }569}570```571572### Airdrop Merkle Distributor573```solidity574contract AirdropDistributor {575 IERC20 public token;576 bytes32 public merkleRoot;577 uint256 public claimStart;578 uint256 public claimEnd;579580 // Tracks claimed addresses581 mapping(address => bool) public isClaimed;582583 constructor(584 address _token,585 bytes32 _merkleRoot,586 uint256 _claimStart,587 uint256 _claimEnd588 ) {589 token = IERC20(_token);590 merkleRoot = _merkleRoot;591 claimStart = _claimStart;592 claimEnd = _claimEnd;593 }594595 function claim(596 uint256 amount,597 bytes32[] calldata merkleProof598 ) external {599 require(block.timestamp >= claimStart, "Claim not started");600 require(block.timestamp <= claimEnd, "Claim ended");601 require(!isClaimed[msg.sender], "Already claimed");602603 // Verify Merkle proof604 bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));605 require(MerkleProof.verify(merkleProof, merkleRoot, leaf), "Invalid proof");606607 isClaimed[msg.sender] = true;608 require(token.transfer(msg.sender, amount), "Transfer failed");609 emit Claimed(msg.sender, amount);610 }611612 event Claimed(address indexed claimant, uint256 amount);613}614```615616### Contributor Payment Streaming (Sablier-style)617```solidity618contract PaymentStream {619 IERC20 public token;620 address public sender;621 address public recipient;622 uint256 public totalAmount;623 uint256 public startTime;624 uint256 public stopTime;625 uint256 public withdrawn;626627 modifier onlySender() { require(msg.sender == sender, "Not sender"); _; }628 modifier onlyRecipient() { require(msg.sender == recipient, "Not recipient"); _; }629630 constructor(631 address _token,632 address _recipient,633 uint256 _totalAmount,634 uint256 _duration635 ) {636 token = IERC20(_token);637 sender = msg.sender;638 recipient = _recipient;639 totalAmount = _totalAmount;640 startTime = block.timestamp;641 stopTime = block.timestamp + _duration;642643 token.safeTransferFrom(msg.sender, address(this), _totalAmount);644 }645646 function withdrawable() public view returns (uint256) {647 if (block.timestamp <= startTime) return 0;648 if (block.timestamp >= stopTime) return totalAmount - withdrawn;649650 uint256 elapsed = block.timestamp - startTime;651 uint256 duration = stopTime - startTime;652 return (totalAmount * elapsed) / duration - withdrawn;653 }654655 function withdraw() external onlyRecipient {656 uint256 amount = withdrawable();657 require(amount > 0, "Nothing to withdraw");658 withdrawn += amount;659 token.safeTransfer(recipient, amount);660 }661662 function cancel() external onlySender {663 token.safeTransfer(sender, totalAmount - withdrawn);664 }665666 // Governance: % of tokens with streaming creates predictable sell pressure667 // Calculate daily sell volume = totalStreamingAmount / averageStreamDuration668}669```670671## Performance Considerations672673- **Governance gas costs**: Each vote cast costs ~50-100k gas. With 10,000 voters, a single proposal cycle costs 0.5-1 ETH in gas674- **Optimization**: Batch vote casting with EIP-712 signatures and delegated relayer675- **Snapshot for signaling**: Off-chain voting reduces costs by 1000x for non-binding votes676- **L2 deployment**: Deploy governance on L2 (Arbitrum/Optimism) with cross-chain message relay to L1 for execution677- **Proposer bond recovery**: Gas for executing cancelation should be recoverable from bond678- **Timelock gas**: A single timelock execute can cost 200k-500k gas depending on action count679680## References681- references/blockchain-management-advanced.md — Blockchain Management Advanced Topics682- references/blockchain-management-fundamentals.md — Blockchain Management Fundamentals683- references/dao-governance.md — DAO Governance684- references/dao-operations-lifecycle.md — DAO Operations Lifecycle685- references/multi-sig-operations.md — Multi-Sig Operations686- references/project-methodology.md — Web3 Project Methodology687- references/token-engineering-and-emissions.md — Token Engineering & Emissions688- references/tokenomics-design.md — Tokenomics Design689- references/treasury-management.md — Treasury Management690691## Handoff692blockchain-management → blockchain-tokenomics (for deep token model implementation)693blockchain-management → blockchain-security (for audit and governance security)