Skip to content

Commit 153ebbd

Browse files
magicnightclaude
andcommitted
refactor: rename contracts Crucix → CHAOS, add copyright
- CrucixToken.sol → ChaosToken.sol (token name: CHAOS, ticker: CHAOS) - PredictionMarket.sol → ChaosPredictionMarket.sol - Add copyright: (c) 2026 ChaosDevOps@BKK&Estonia - Add @author NatSpec tags and project links - Update deploy script for new contract names - Update frontend ABI exports (CHAOS_TOKEN_ABI, CHAOS_MARKET_ABI) - Backward compat aliases for CRUX_TOKEN_ABI/PREDICTION_MARKET_ABI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 03bed25 commit 153ebbd

5 files changed

Lines changed: 43 additions & 24 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ newspredict/typechain-types/
3232

3333
# OMC state
3434
.omc/
35+
36+
.claude/

newspredict/contracts/PredictionMarket.sol renamed to newspredict/contracts/ChaosPredictionMarket.sol

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: MIT
2+
// Copyright (c) 2026 ChaosDevOps@BKK&Estonia. All rights reserved.
23
pragma solidity ^0.8.24;
34

45
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
@@ -7,13 +8,19 @@ import "@openzeppelin/contracts/access/Ownable.sol";
78
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
89

910
/**
10-
* @title PredictionMarket
11-
* @dev On-chain prediction market using CRUX tokens
11+
* @title ChaosPredictionMarket
12+
* @author ChaosDevOps@BKK&Estonia
13+
* @notice On-chain prediction market powered by CHAOS Engine OSINT intelligence
14+
* @dev
1215
* - Markets created by owner (system) or approved creators
1316
* - LMSR pricing computed off-chain, shares tracked on-chain
1417
* - Resolution by owner with automated payout
18+
* - Uses CHAOS token (BEP-20) for all transactions
19+
*
20+
* Part of the CHAOS Engine — Connected Human-Augmented OSINT Suite
21+
* https://github.com/magicnight/chaos-engine
1522
*/
16-
contract PredictionMarket is Ownable, ReentrancyGuard {
23+
contract ChaosPredictionMarket is Ownable, ReentrancyGuard {
1724
using SafeERC20 for IERC20;
1825

1926
IERC20 public token;
@@ -86,7 +93,6 @@ contract PredictionMarket is Ownable, ReentrancyGuard {
8693
require(shares > 0, "Must buy > 0 shares");
8794
require(maxCost > 0, "Max cost must be > 0");
8895

89-
// Transfer tokens from trader (cost computed off-chain, validated by maxCost)
9096
token.safeTransferFrom(msg.sender, address(this), maxCost);
9197

9298
Position storage pos = positions[marketId][msg.sender];
@@ -126,15 +132,13 @@ contract PredictionMarket is Ownable, ReentrancyGuard {
126132

127133
if (market.status == MarketStatus.ResolvedYes) {
128134
require(pos.yesShares > 0, "No winning shares");
129-
// Each winning share pays 1 token
130135
payout = pos.yesShares;
131136
pos.yesShares = 0;
132137
} else if (market.status == MarketStatus.ResolvedNo) {
133138
require(pos.noShares > 0, "No winning shares");
134139
payout = pos.noShares;
135140
pos.noShares = 0;
136141
} else if (market.status == MarketStatus.Cancelled) {
137-
// Refund total cost on cancellation
138142
payout = pos.totalCost;
139143
pos.yesShares = 0;
140144
pos.noShares = 0;
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
// SPDX-License-Identifier: MIT
2+
// Copyright (c) 2026 ChaosDevOps@BKK&Estonia. All rights reserved.
23
pragma solidity ^0.8.24;
34

45
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
56
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
67
import "@openzeppelin/contracts/access/Ownable.sol";
78

89
/**
9-
* @title CrucixToken (CRUX)
10-
* @dev BEP-20 token for the NewsPredict prediction market
10+
* @title ChaosToken (CHAOS)
11+
* @author ChaosDevOps@BKK&Estonia
12+
* @notice BEP-20 utility token for the CHAOS Engine prediction market platform
13+
* @dev
1114
* - Initial supply minted to deployer
1215
* - Owner can mint additional tokens (for rewards/airdrops)
1316
* - Burnable (for market resolution mechanics)
17+
*
18+
* Part of the CHAOS Engine — Connected Human-Augmented OSINT Suite
19+
* https://github.com/magicnight/chaos-engine
1420
*/
15-
contract CrucixToken is ERC20, ERC20Burnable, Ownable {
21+
contract ChaosToken is ERC20, ERC20Burnable, Ownable {
1622
uint8 private constant _decimals = 18;
1723

18-
constructor(uint256 initialSupply) ERC20("Crucix", "CRUX") Ownable(msg.sender) {
24+
constructor(uint256 initialSupply) ERC20("CHAOS", "CHAOS") Ownable(msg.sender) {
1925
_mint(msg.sender, initialSupply * 10 ** _decimals);
2026
}
2127

newspredict/scripts/deploy.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// Copyright (c) 2026 ChaosDevOps@BKK&Estonia. All rights reserved.
12
import hre from "hardhat";
23

34
async function main() {
45
const [deployer] = await hre.network.provider.request({ method: "eth_accounts" }) as string[];
56
console.log("Deployer:", deployer);
67

7-
// 1. Deploy CRUX Token (initial supply: 1 billion)
8-
const tokenArtifact = await hre.artifacts.readArtifact("CrucixToken");
8+
// 1. Deploy CHAOS Token (initial supply: 1 billion)
9+
const tokenArtifact = await hre.artifacts.readArtifact("ChaosToken");
910
const tokenFactory = new hre.ethers.ContractFactory(
1011
tokenArtifact.abi,
1112
tokenArtifact.bytecode
@@ -14,24 +15,24 @@ async function main() {
1415
const token = await tokenFactory.deploy(initialSupply);
1516
await token.waitForDeployment();
1617
const tokenAddress = await token.getAddress();
17-
console.log("CrucixToken deployed:", tokenAddress);
18+
console.log("ChaosToken deployed:", tokenAddress);
1819

19-
// 2. Deploy PredictionMarket
20-
const marketArtifact = await hre.artifacts.readArtifact("PredictionMarket");
20+
// 2. Deploy ChaosPredictionMarket
21+
const marketArtifact = await hre.artifacts.readArtifact("ChaosPredictionMarket");
2122
const marketFactory = new hre.ethers.ContractFactory(
2223
marketArtifact.abi,
2324
marketArtifact.bytecode
2425
);
2526
const market = await marketFactory.deploy(tokenAddress);
2627
await market.waitForDeployment();
2728
const marketAddress = await market.getAddress();
28-
console.log("PredictionMarket deployed:", marketAddress);
29+
console.log("ChaosPredictionMarket deployed:", marketAddress);
2930

3031
console.log("\n=== Deployment Summary ===");
31-
console.log(`CRUX Token: ${tokenAddress}`);
32-
console.log(`PredictionMarket: ${marketAddress}`);
32+
console.log(`CHAOS Token: ${tokenAddress}`);
33+
console.log(`ChaosPredictionMarket: ${marketAddress}`);
3334
console.log(`\nAdd to .env.local:`);
34-
console.log(`NEXT_PUBLIC_CRUX_TOKEN_TESTNET=${tokenAddress}`);
35+
console.log(`NEXT_PUBLIC_CHAOS_TOKEN_TESTNET=${tokenAddress}`);
3536
console.log(`NEXT_PUBLIC_MARKET_CONTRACT_TESTNET=${marketAddress}`);
3637
}
3738

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// Copyright (c) 2026 ChaosDevOps@BKK&Estonia. All rights reserved.
2+
13
// Contract ABIs (simplified for frontend interaction)
2-
export const CRUX_TOKEN_ABI = [
4+
export const CHAOS_TOKEN_ABI = [
35
'function balanceOf(address account) view returns (uint256)',
46
'function approve(address spender, uint256 amount) returns (bool)',
57
'function allowance(address owner, address spender) view returns (uint256)',
@@ -8,7 +10,7 @@ export const CRUX_TOKEN_ABI = [
810
'function symbol() view returns (string)',
911
] as const;
1012

11-
export const PREDICTION_MARKET_ABI = [
13+
export const CHAOS_MARKET_ABI = [
1214
'function buyShares(uint256 marketId, uint8 side, uint256 shares, uint256 maxCost)',
1315
'function claimWinnings(uint256 marketId)',
1416
'function getPosition(uint256 marketId, address trader) view returns (uint256 yesShares, uint256 noShares, uint256 totalCost)',
@@ -17,16 +19,20 @@ export const PREDICTION_MARKET_ABI = [
1719
'event WinningsClaimed(uint256 indexed marketId, address indexed trader, uint256 payout)',
1820
] as const;
1921

22+
// Backward compat aliases
23+
export const CRUX_TOKEN_ABI = CHAOS_TOKEN_ABI;
24+
export const PREDICTION_MARKET_ABI = CHAOS_MARKET_ABI;
25+
2026
// Contract addresses (set after deployment)
2127
export const CONTRACTS = {
2228
// BSC Testnet
2329
97: {
24-
token: process.env.NEXT_PUBLIC_CRUX_TOKEN_TESTNET || '',
30+
token: process.env.NEXT_PUBLIC_CHAOS_TOKEN_TESTNET || '',
2531
market: process.env.NEXT_PUBLIC_MARKET_CONTRACT_TESTNET || '',
2632
},
27-
// BSC Mainnet — using existing deployed token
33+
// BSC Mainnet
2834
56: {
29-
token: process.env.NEXT_PUBLIC_CRUX_TOKEN_MAINNET || '0x5Bde264AD913192929f71c2A5253440fd01CBdf1',
35+
token: process.env.NEXT_PUBLIC_CHAOS_TOKEN_MAINNET || '',
3036
market: process.env.NEXT_PUBLIC_MARKET_CONTRACT_MAINNET || '',
3137
},
3238
} as Record<number, { token: string; market: string }>;

0 commit comments

Comments
 (0)