Skip to content

feat: Nonce replay protection, guild escrows, royalty enforcement, AI agent fusion (#983, #984, #991, #992) - #1091

Merged
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
khalyaro:feature/khalyaro-defi
Aug 26, 2026
Merged

feat: Nonce replay protection, guild escrows, royalty enforcement, AI agent fusion (#983, #984, #991, #992)#1091
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
khalyaro:feature/khalyaro-defi

Conversation

@khalyaro

@khalyaro khalyaro commented Aug 26, 2026

Copy link
Copy Markdown

khalyaro - Security & AI Features

Issues Addressed

Closes #983 - Nonce Replay Protection

  • Sequential nonce system preventing replay attacks
  • Each address tracks its own nonce sequence
  • Nonces must be used in exact order (last + 1)
  • Used nonces are permanently marked

Closes #984 - Guild Escrow Splits

  • Guild system with treasury and member management
  • Per-game escrow creation from guild treasury
  • Automatic even distribution to guild members
  • Configurable guild share in basis points

Closes #991 - Royalty Enforcement

  • Configurable platform and creator royalties
  • Maximum royalty cap enforcement
  • Automatic royalty distribution on game completion
  • Payment tracking per game

Closes #992 - AI Agent Fusion

  • Create AI agents with strength ratings
  • Fuse two agents to create stronger agent
  • Fused agents get strength bonus (+100)
  • Agent deactivation after fusion

Changes Made

Contracts

  • contracts/game_contract/src/lib.rs - Added all 4 features

Technical Details

Nonce Validation

if nonce != last_nonce + 1 {
    return Err(ContractError::InvalidNonce);
}

Guild Distribution

let per_member = escrow.amount / guild.members.len() as i128;
for member in guild.members.iter() {
    token_client.transfer(&contract, &member, &per_member);
}

Royalty Calculation

platform_amount = total_amount * platform_royalty_bips / 10000;
creator_amount = total_amount * creator_royalty_bips / 10000;

Fusion Formula

fused_strength = (agent_a.strength + agent_b.strength) / 2 + 100;

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@khalyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chinweobtagaz
chinweobtagaz merged commit 295d412 into OpenKnight-Foundation:main Aug 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants