A time-locked vault protocol built on the Stacks blockchain using Clarity 4 features.
timefi-protocol/
├── contracts/
│ └── timefi-vault.clar # Main vault contract
├── settings/ # Network configuration
└── tests/ # Contract tests
- Create Vaults - Deposit STX with time-lock
- Withdraw - Claim funds after lock period
- Bot Approval - Approve automated trading bots via
contract-hash? - Fee Collection - 0.5% fee on deposits
stacks-block-time- For unlock time calculationcontract-hash?- For bot verification
- Clarinet installed
- Node.js 18+
# Install dependencies
npm install
# Check contracts
clarinet check
# Run tests
clarinet test
# Start devnet
clarinet devnet start| Function | Parameters | Description |
|---|---|---|
create-vault |
(amount uint) (lock-secs uint) |
Create a new time-locked vault |
withdraw |
(id uint) |
Withdraw from an unlocked vault |
approve-bot |
(bot principal) |
Approve a trading bot contract |
| Function | Parameters | Description |
|---|---|---|
get-vault |
(id uint) |
Get vault details |
is-active |
(id uint) |
Check if vault is active |
is-bot |
(sender principal) |
Check if sender is approved bot |
MIN_DEPOSIT: 10,000 microSTX (0.01 STX)
MIN_LOCK: 3,600 seconds (1 hour)
MAX_LOCK: 31,536,000 seconds (1 year)
FEE_BPS: 50 (0.5%)MIT License