Create and execute legal-style agreements on-chain with automated enforcement of terms
Status: ✅ Live & Verified
| Contract | Address | Explorer |
|---|---|---|
| ChainReCovenant | 0x3A8527E43beC82415bF8A1C1aa0b072F7b49c24f |
View on BaseScan |
| CovenantFactory | 0x000811CA5CdfB8CeDAd90E399252c8216f70b6D7 |
View on BaseScan |
- Network: Base (Chain ID: 8453)
- Verification: ✅ Source code verified on BaseScan
- Deployment Date: December 7, 2025
ChainReCovenant is a comprehensive Solidity smart contract that enables parties to create binding, legally-styled agreements on the blockchain with automated term enforcement. This contract provides a trustless framework for multi-party agreements with built-in dispute resolution and penalty enforcement mechanisms.
- Multi-Party Agreements: Support for 2 or more parties in any agreement
- Digital Signatures: On-chain signing mechanism for all parties
- Collateral Management: Automated collateral deposits and withdrawals
- Term Enforcement: Automated enforcement of agreement terms
- Breach Detection: Automatic detection and penalty enforcement for breached terms
- Dispute Resolution: Built-in dispute raising and resolution system
- Payment Obligations: Enforce payment terms with automatic verification
- Milestone-Based: Track and verify milestone completion
- Deadline Enforcement: Time-bound obligations with automatic breach detection
- Collateral Requirements: Mandatory deposits for agreement participation
- Penalty Clauses: Automated penalty enforcement on breach
- Custom Conditions: Flexible term definitions
- ✅ Trustless: No intermediary required
- ✅ Transparent: All terms visible on-chain
- ✅ Immutable: Terms cannot be altered after activation
- ✅ Automated: Self-executing agreements
- ✅ Secure: Collateral-backed enforcement
- ✅ Auditable: Complete history of all actions
1. PENDING → Created, awaiting signatures
2. ACTIVE → All parties signed, terms being enforced
3. COMPLETED → All obligations fulfilled
4. BREACHED → Terms violated
5. CANCELLED → Agreement cancelled before activation
- Parties: Multiple participants with signing capabilities
- Terms: Flexible term definitions with various types
- Status: Lifecycle tracking
- Collateral: Deposit and withdrawal management
- Auto-enforcement: Optional automated penalty enforcement
Payment: Payment obligationsMilestone: Milestone completion requirementsDeadline: Time-based deadlinesCollateral: Collateral requirementsPenalty: Penalty clauses for violationsCondition: Custom conditions
// 1. Create agreement with parties
uint256 agreementId = createAgreement(
"Service Agreement",
"Web development services agreement",
[address1, address2],
["Client", "Developer"],
true // auto-enforce
);
// 2. Add terms
addTerms(
agreementId,
[TermType.Payment, TermType.Deadline],
["Payment for services", "Project completion deadline"],
[1 ether, 0], // values
[0, deadline_timestamp], // deadlines
[address1, address2] // enforcers
);
// 3. Parties sign
signAgreement(agreementId); // with collateral: {value: 0.5 ether}// Fulfill a payment term
fulfillTerm(agreementId, termIndex, {value: 1 ether});
// Fulfill a milestone term
fulfillTerm(agreementId, termIndex);// Report a breach
reportBreach(agreementId, termIndex, "Deadline not met");
// Automatic penalty enforcement (if auto-enforce enabled)
// Penalties are automatically deducted from collateral// Raise a dispute
raiseDispute(agreementId, "Disagreement on milestone completion");
// Resolve dispute (only contract owner/arbitrator)
resolveDispute(agreementId, disputeIndex, "Resolution details");// Deposit collateral (during signing)
signAgreement(agreementId, {value: 1 ether});
// Withdraw collateral (after completion)
withdrawCollateral(agreementId);The contract emits comprehensive events for tracking:
AgreementCreated: New agreement createdPartySigned: Party signed the agreementAgreementActivated: All parties signed, agreement activeTermFulfilled: Term fulfilled by a partyAgreementCompleted: All terms fulfilledAgreementBreached: Agreement breachedCollateralDeposited: Collateral depositedCollateralWithdrawn: Collateral withdrawnDisputeRaised: Dispute raisedDisputeResolved: Dispute resolvedPenaltyEnforced: Penalty enforced
Query agreement data:
// Get agreement details
getAgreement(agreementId)
// Get party information
getParty(agreementId, partyIndex)
// Get term details
getTerm(agreementId, termIndex)
// Get user's agreements
getUserAgreements(userAddress)
// Check party status
isPartyToAgreement(agreementId, address)
// Get dispute count
getDisputeCount(agreementId)
// Get total agreements
getTotalAgreements()- ✅ Access Control: Only authorized parties can execute functions
- ✅ Reentrancy Protection: Safe fund transfers
- ✅ Input Validation: Comprehensive parameter checking
- ✅ State Management: Proper lifecycle state transitions
- ✅ Emergency Functions: Owner can pause in emergencies
- Freelance contracts
- Consulting agreements
- Professional services
- Partnership agreements
- Vendor contracts
- Supply agreements
- Lease agreements
- Purchase agreements
- Property management
- Employment contracts
- Non-compete agreements
- Performance-based compensation
- Loan agreements
- Investment contracts
- Escrow arrangements
- Solidity ^0.8.20
- Hardhat / Foundry
- Node.js
# Deploy to local network
npx hardhat run scripts/deploy.js --network localhost
# Deploy to testnet
npx hardhat run scripts/deploy.js --network sepolia
# Deploy to mainnet
npx hardhat run scripts/deploy.js --network mainnet# Run tests
npx hardhat test
# Run coverage
npx hardhat coverageMIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or contributions:
- GitHub Issues: Create an issue
- GitHub Discussions: Start a discussion
Built with ❤️ for trustless, automated legal agreements on-chain