Skip to content

Commit f6ceb33

Browse files
committed
some cleaning
1 parent be14139 commit f6ceb33

4 files changed

Lines changed: 36 additions & 118 deletions

File tree

TS-Example/.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ============================================================================
2+
# REQUIRED ENVIRONMENT VARIABLES
3+
# ============================================================================
4+
5+
# Your Ethereum private key (required for signing transactions)
6+
# IMPORTANT: Never commit your actual private key to version control!
7+
#
8+
# Instructions:
9+
# 1. Copy this file to .env: cp .env.example .env
10+
# 2. Add your private key below (with or without 0x prefix)
11+
PRIVATE_KEY=

TS-Example/env.example

Lines changed: 0 additions & 26 deletions
This file was deleted.

TS-Example/index.ts

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -267,91 +267,6 @@ const createTotalSplit = async (totalSplitConfig: {
267267
throw err;
268268
}
269269
};
270-
271-
/**
272-
* Creates a cluster definition with rewards split configuration
273-
* @param clusterName Name of the cluster
274-
* @param ovmAddress OVM withdrawal address
275-
* @param splitterAddress Splitter fee recipient address
276-
* @param numValidators Number of validators in the cluster
277-
* @param numOperators Number of operators in the cluster
278-
* @returns The config hash of the created cluster definition
279-
*/
280-
const createRewardsSplitCluster = async (
281-
clusterName: string,
282-
ovmAddress: string,
283-
splitterAddress: string,
284-
numValidators: number = 3,
285-
numOperators: number = 4,
286-
): Promise<string> => {
287-
try {
288-
// Create operators array with empty addresses for solo cluster
289-
const operators = Array.from({ length: numOperators }, () => ({
290-
address: "",
291-
}));
292-
293-
// Create validators array - all validators use the same OVM and splitter addresses
294-
const validators = Array.from({ length: numValidators }, () => ({
295-
withdrawal_address: ovmAddress,
296-
fee_recipient_address: splitterAddress,
297-
}));
298-
299-
const clusterConfig = {
300-
name: clusterName,
301-
operators,
302-
validators,
303-
};
304-
305-
const configHash = await client.createClusterDefinition(clusterConfig);
306-
return configHash;
307-
} catch (err) {
308-
console.log(err, "err");
309-
throw err;
310-
}
311-
};
312-
313-
/**
314-
* Creates a cluster definition with total split configuration
315-
* @param clusterName Name of the cluster
316-
* @param ovmAddress OVM withdrawal address
317-
* @param splitterAddress Splitter fee recipient address
318-
* @param numValidators Number of validators in the cluster
319-
* @param numOperators Number of operators in the cluster
320-
* @returns The config hash of the created cluster definition
321-
*/
322-
const createTotalSplitCluster = async (
323-
clusterName: string,
324-
ovmAddress: string,
325-
splitterAddress: string,
326-
numValidators: number = 3,
327-
numOperators: number = 4,
328-
): Promise<string> => {
329-
try {
330-
// Create operators array with empty addresses for solo cluster
331-
const operators = Array.from({ length: numOperators }, () => ({
332-
address: "",
333-
}));
334-
335-
// Create validators array - all validators use the same OVM and splitter addresses
336-
const validators = Array.from({ length: numValidators }, () => ({
337-
withdrawal_address: ovmAddress,
338-
fee_recipient_address: splitterAddress,
339-
}));
340-
341-
const clusterConfig = {
342-
name: clusterName,
343-
operators,
344-
validators,
345-
};
346-
347-
const configHash = await client.createClusterDefinition(clusterConfig);
348-
return configHash;
349-
} catch (err) {
350-
console.log(err, "err");
351-
throw err;
352-
}
353-
};
354-
355270
/**
356271
* Activates cluster by depositing 32 ethers
357272
* @param clusterLock The cluster lock that contains the validator to be activated

TS-Example/test-splits.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* ============================================================================
3+
* SETUP INSTRUCTIONS
4+
* ============================================================================
5+
*
6+
* Before running this script:
7+
* 1. Copy .env.example to .env:
8+
* cp .env.example .env
9+
*
10+
* 2. Edit .env and add your PRIVATE_KEY:
11+
* PRIVATE_KEY=your_private_key_here
12+
*
13+
* 3. Run the script:
14+
* yarn test:splits
15+
*
16+
* ============================================================================
17+
*/
18+
119
import { ethers, JsonRpcProvider } from 'ethers';
220
import { Client } from '@obolnetwork/obol-sdk';
321
import dotenv from 'dotenv';
@@ -9,17 +27,17 @@ dotenv.config();
927
// ============================================================================
1028

1129
// Network Configuration
12-
const CHAIN_ID = Number(process.env.CHAIN_ID) || 560048; // Hoodi
13-
const BASE_URL = process.env.BASE_URL || 'https://obol-api-nonprod-dev.dev.obol.tech';
14-
const RPC_URL = process.env.RPC_HOODI || process.env.RPC_URL || 'https://ethereum-hoodi-rpc.publicnode.com';
30+
const CHAIN_ID = 560048; // Hoodi
31+
const BASE_URL = 'https://obol-api-nonprod-dev.dev.obol.tech';
32+
const RPC_URL = 'https://ethereum-hoodi-rpc.publicnode.com';
1533

1634
// Cluster Names
17-
const CLUSTER_NAME_REWARDS_SPLIT = process.env.CLUSTER_NAME_REWARDS_SPLIT || 'testOVMRewardsSplit';
18-
const CLUSTER_NAME_TOTAL_SPLIT = process.env.CLUSTER_NAME_TOTAL_SPLIT || 'testOVMTotalSplit';
35+
const CLUSTER_NAME_REWARDS_SPLIT = 'testOVMRewardsSplit';
36+
const CLUSTER_NAME_TOTAL_SPLIT = 'testOVMTotalSplit';
1937

2038
// Cluster Configuration
21-
const NUM_VALIDATORS = Number(process.env.NUM_VALIDATORS) || 3;
22-
const NUM_OPERATORS = Number(process.env.NUM_OPERATORS) || 4;
39+
const NUM_VALIDATORS = 3;
40+
const NUM_OPERATORS = 4;
2341

2442
// OVM Rewards Split Configuration
2543
// Note: Percentages must sum to 99% (not 100%) because RAF automatically adds 1%

0 commit comments

Comments
 (0)