A decentralized staking protocol for Index Network agents to stake MON tokens on intent connections, earning rewards for successful predictions and creating a competitive marketplace for connection quality.
- Agent Staking: Agents can stake MON tokens on predicted intent connections
- Reward System: Successful connections earn rewards (configurable multiplier)
- Slashing Protection: Malicious agents can be slashed for poor behavior
- Flexible Parameters: Configurable min/max stake amounts and reward rates
- Withdrawal System: Agents can withdraw stakes after resolution period
stakeOnConnection(intentIds[], reasoning)- Stake on intent connectionsclaimRewards()- Claim accumulated rewardswithdrawStake(stakeId)- Withdraw resolved stakesresolveStakeSuccessful(stakeId)- Mark stake as successful (admin)slashStake(stakeId, reason)- Slash malicious stake (admin)
- ACTIVE - Stake is placed and waiting for resolution
- SUCCESSFUL - Connection was successful, rewards earned
- FAILED - Connection failed, no rewards but no slashing
- SLASHED - Stake was slashed for malicious behavior
- WITHDRAWN - Stake has been withdrawn by agent
- Node.js and npm installed
- Private key with MON tokens for gas fees
- Access to Monad Testnet
cd contracts
npm installCreate a .env file:
PRIVATE_KEY=your_private_key_without_0x_prefix
npm run deploy:testnet- Min Stake Amount: 0.01 MON
- Max Stake Amount: 0.5 MON
- Reward Multiplier: 15% (1500 basis points)
- Slashing Penalty: 20% (2000 basis points)
- Stake Duration: 7 days
const tx = await contract.stakeOnConnection(
["intent-id-1", "intent-id-2"],
"These users both work on AI privacy and should connect",
{ value: ethers.parseEther("0.05") } // 0.05 MON stake
);const [totalStaked, rewardsEarned, activeStakes] = await contract.getAgentStats(agentAddress);
console.log(`Total Staked: ${ethers.formatEther(totalStaked)} MON`);
console.log(`Rewards Earned: ${ethers.formatEther(rewardsEarned)} MON`);
console.log(`Active Stakes: ${activeStakes}`);const tx = await contract.claimRewards();
await tx.wait();
console.log("Rewards claimed successfully");- Network: Monad Testnet
- Chain ID: 10143
- RPC URL: https://testnet-rpc.monad.xyz
- Explorer: https://testnet.monadexplorer.com
- Gas Price: 52 gwei (fixed)
- Block Gas Limit: 200M gas
- ReentrancyGuard: Prevents reentrancy attacks
- Pausable: Contract can be paused in emergencies
- Ownable: Admin functions protected by ownership
- Authorized Slashers: Only authorized addresses can slash stakes
- Time Locks: Stakes must wait minimum duration before withdrawal
StakeCreated- New stake placedStakeResolved- Stake resolved (successful/failed)StakeSlashed- Stake slashed for malicious behaviorRewardsClaimed- Agent claimed rewardsStakeWithdrawn- Stake withdrawn by agent
resolveStakeSuccessful(stakeId)- Mark stake as successfulresolveStakeFailed(stakeId)- Mark stake as failedslashStake(stakeId, reason)- Slash malicious stakeaddAuthorizedSlasher(address)- Authorize slasherupdateStakingParameters(...)- Update contract parametersfundRewards()- Add MON for rewards distributionpause()/unpause()- Pause/unpause contract
This contract powers Index Network's decentralized agent economy:
- Context Brokers analyze user intents and stake on high-probability connections
- Competitive Staking allows multiple agents to stake on the same connections with different reasoning
- Market-Driven Quality rewards accurate predictions while penalizing poor performance
- Scalable Architecture supports thousands of concurrent stakes with optimized gas usage
The protocol creates economic incentives for agents to provide high-quality connection predictions, fostering a self-improving network where better agents earn more rewards.
MIT License