ichaingov-smart-contract-generator
v1.0.1
Published
ichaingov smart contract generator — generates governance contracts from config.json
Downloads
271
Readme
ichaingov-contract-generator
Generates and deploys governance contracts for gateway-based interoperability systems from a single config.json file.
Overview
ichaingov-smart-contract-generator automates the creation of a complete on-chain governance framework designed for gateway interoperability systems like those described in the Secure Asset Transfer Protocol (SATP). It produces all the necessary Solidity contracts, configuration, and deployment scripts, allowing a DAO to manage protocol parameters and gateway registration.
The generated contracts use and extend OpenZeppelin's contracts, it implements multiple voting systems and an optional timelock.
Generated Contracts
The CLI creates the following smart contracts:
| Contract | Description |
|----------|-------------|
| Token | ERC20 token with vote delegation (ERC20Votes). Used for governance voting power. |
| GovernanceTL | Main governor contract inheriting Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, and GovernorTimelockControl. Supports three voting systems: TokenBased, Quadratic, and WeightedReputation. |
| Timelock | OpenZeppelin TimelockController that enforces a delay between proposal passing and execution. Optional — controlled by config.json. |
| GatewayRegistry | Ownable contract storing on-chain identities of organizations and their gateways. |
| PolicyRegistry | Simple key-value store for protocol parameters. Only the governor can modify it, ensuring all changes go through on-chain governance. |
Quick Start
npx ichaingov-smart-contract-generatorIf no config.json is present in the current directory, a template will be copied automatically. Edit it to match your DAO's requirements and run the command again.
Configuration
All settings are read from a config.json file. Below is a complete example:
{
"name": "MyDAO",
"tokenomics": {
"name": "MyToken",
"symbol": "MTK",
"supply": 1000000,
"defaultMemberTokens": 1000
},
"organizations": [
{
"address": "0x...",
"name": "Org A",
"reputation": 0,
"gateways": ["0x..."]
}
],
"governance": {
"votingDelay": 1,
"votingPeriod": 5,
"proposalThreshold": 0,
"quorumFraction": 0,
"votingSystem": "token-based"
},
"timelock": {
"enabled": true,
"minDelay": 0
},
"protocolParameters": [
{ "key": "satp.version", "value": "v02" }
]
}votingSystemaccepts:token-based,quadratic,weighted-reputation.
Important Notes
- EVM target: The generated Hardhat config uses
evmVersion: "cancun". This is required because OpenZeppelin v5.6+ uses themcopyopcode. If you have an existing config, ensure the same EVM version is set.
The thesis addresses governance challenges in gateway-based interoperability systems, proposing a decentralized governance framework for protocols like SATP. The smart contracts generated by this tool form the on-chain layer of that framework, while an external integration layer listens to DAO events to update gateway configurations automatically.
For more details on the architecture, voting systems, and the integration with SATP, refer to the full thesis document.
