Skip to content

Commit

Permalink
rename etc to ethereum-classic
Browse files Browse the repository at this point in the history
  • Loading branch information
vic-en committed Jul 25, 2024
1 parent 91a61c0 commit 0f461b5
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import abi from '../ethereum/ethereum.abi.json';
import { logger } from '../../services/logger';
import { Contract, Transaction, Wallet } from 'ethers';
import { EthereumBase } from '../ethereum/ethereum-base';
import { getEthereumConfig as getETCChainConfig } from '../ethereum/ethereum.config';
import { getEthereumConfig as getEthereumClassicChainConfig } from '../ethereum/ethereum.config';
import { Provider } from '@ethersproject/abstract-provider';
import { Chain as Ethereumish } from '../../services/common-interfaces';
import { ConfigManagerV2 } from '../../services/config-manager-v2';
import { EVMController } from '../ethereum/evm.controllers';
import { ETCSwapConfig } from '../../connectors/etcswap/etcswap.config';

export class ETCChain extends EthereumBase implements Ethereumish {
private static _instances: { [name: string]: ETCChain };
export class EthereumClassicChain extends EthereumBase implements Ethereumish {
private static _instances: { [name: string]: EthereumClassicChain };
private _chain: string;
private _gasPrice: number;
private _gasPriceRefreshInterval: number | null;
private _nativeTokenSymbol: string;
public controller;

private constructor(network: string) {
const config = getETCChainConfig('etc', network);
const config = getEthereumClassicChainConfig('ethereum-classic', network);
super(
'etc',
'ethereum-classic',
config.network.chainID,
config.network.nodeURL,
config.network.tokenListSource,
Expand All @@ -42,19 +42,19 @@ export class ETCChain extends EthereumBase implements Ethereumish {
this.controller = EVMController;
}

public static getInstance(network: string): ETCChain {
if (ETCChain._instances === undefined) {
ETCChain._instances = {};
public static getInstance(network: string): EthereumClassicChain {
if (EthereumClassicChain._instances === undefined) {
EthereumClassicChain._instances = {};
}
if (!(network in ETCChain._instances)) {
ETCChain._instances[network] = new ETCChain(network);
if (!(network in EthereumClassicChain._instances)) {
EthereumClassicChain._instances[network] = new EthereumClassicChain(network);
}

return ETCChain._instances[network];
return EthereumClassicChain._instances[network];
}

public static getConnectedInstances(): { [name: string]: ETCChain } {
return ETCChain._instances;
public static getConnectedInstances(): { [name: string]: EthereumClassicChain } {
return EthereumClassicChain._instances;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/etcswap/etcswap.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export namespace ETCSwapConfig {
'etcswap',
['AMM'],
[
{ chain: 'etc', networks: ['mainnet'] },
{ chain: 'ethereum-classic', networks: ['mainnet'] },
],
'EVM',
);
Expand Down
8 changes: 4 additions & 4 deletions src/connectors/etcswap/etcswap.lp.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import {
import * as math from 'mathjs';
import { getAddress } from 'ethers/lib/utils';
import { ETCSwapConfig } from './etcswap.config';
import { ETCChain } from '../../chains/etc/etc';
import { EthereumClassicChain } from '../../chains/ethereum-classic/ethereum-classic';

export const FACTORY = "0x2624E907BcC04f93C8f29d7C7149a8700Ceb8cDC";
export const POOL_INIT = "0x7ea2da342810af3c5a9b47258f990aaac829fe1385a1398feb77d0126a85dbef";

export class ETCSwapLPHelper {
protected chain: ETCChain;
protected chain: EthereumClassicChain;
protected chainId;
private _router: string;
private _nftManager: string;
Expand All @@ -35,7 +35,7 @@ export class ETCSwapLPHelper {
public abiDecoder: any;

constructor(chain: string, network: string) {
this.chain = ETCChain.getInstance(network);
this.chain = EthereumClassicChain.getInstance(network);
this.chainId = this.getChainId(chain, network);
this._router =
ETCSwapConfig.config.etcswapV3SmartOrderRouterAddress(network);
Expand Down Expand Up @@ -111,7 +111,7 @@ export class ETCSwapLPHelper {
}

public getChainId(_chain: string, network: string): number {
return ETCChain.getInstance(network).chainId;
return EthereumClassicChain.getInstance(network).chainId;
}

getPercentage(rawPercent: number | string): Percent {
Expand Down
4 changes: 2 additions & 2 deletions src/network/network.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '../services/connection-manager';
import { Osmosis } from '../chains/osmosis/osmosis';
import { XRPL } from '../chains/xrpl/xrpl';
import { ETCChain } from '../chains/etc/etc';
import { EthereumClassicChain } from '../chains/ethereum-classic/ethereum-classic';

export async function getStatus(
req: StatusRequest
Expand Down Expand Up @@ -116,7 +116,7 @@ export async function getStatus(
osmosisConnections ? Object.values(osmosisConnections) : []
);

const etcConnections = ETCChain.getConnectedInstances();
const etcConnections = EthereumClassicChain.getConnectedInstances();
connections = connections.concat(
etcConnections ? Object.values(etcConnections) : []
);
Expand Down
76 changes: 38 additions & 38 deletions src/services/connection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { QuipuSwap } from '../connectors/quipuswap/quipuswap';
import { Carbonamm } from '../connectors/carbon/carbonAMM';
import { Balancer } from '../connectors/balancer/balancer';
import { ETCSwapLP } from '../connectors/etcswap/etcswap.lp';
import { ETCChain } from '../chains/etc/etc';
import { EthereumClassicChain } from '../chains/ethereum-classic/ethereum-classic';

export type ChainUnion =
| Algorand
Expand All @@ -63,22 +63,22 @@ export type ChainUnion =
export type Chain<T> = T extends Algorand
? Algorand
: T extends Cosmos
? Cosmos
: T extends Ethereumish
? Ethereumish
: T extends Nearish
? Nearish
: T extends Xdcish
? Xdcish
: T extends Tezosish
? Tezosish
: T extends XRPLish
? XRPLish
: T extends KujiraCLOB
? KujiraCLOB
: T extends Osmosis
? Osmosis
: never;
? Cosmos
: T extends Ethereumish
? Ethereumish
: T extends Nearish
? Nearish
: T extends Xdcish
? Xdcish
: T extends Tezosish
? Tezosish
: T extends XRPLish
? XRPLish
: T extends KujiraCLOB
? KujiraCLOB
: T extends Osmosis
? Osmosis
: never;

export class UnsupportedChainException extends Error {
constructor(message?: string) {
Expand Down Expand Up @@ -143,8 +143,8 @@ export async function getChainInstance(
connection = XRPL.getInstance(network);
} else if (chain === 'kujira') {
connection = Kujira.getInstance(network);
} else if (chain === 'etc') {
connection = ETCChain.getInstance(network);
} else if (chain === 'ethereum-classic') {
connection = EthereumClassicChain.getInstance(network);
} else {
connection = undefined;
}
Expand All @@ -168,24 +168,24 @@ export type ConnectorUnion =
export type Connector<T> = T extends Uniswapish
? Uniswapish
: T extends UniswapLPish
? UniswapLPish
: T extends Perpish
? Perpish
: T extends RefAMMish
? RefAMMish
: T extends CLOBish
? CLOBish
: T extends Tinyman
? Tinyman
: T extends Plenty
? Plenty
: T extends XRPLish
? XRPLCLOB
: T extends KujiraCLOB
? KujiraCLOB
: T extends QuipuSwap
? QuipuSwap
: never;
? UniswapLPish
: T extends Perpish
? Perpish
: T extends RefAMMish
? RefAMMish
: T extends CLOBish
? CLOBish
: T extends Tinyman
? Tinyman
: T extends Plenty
? Plenty
: T extends XRPLish
? XRPLCLOB
: T extends KujiraCLOB
? KujiraCLOB
: T extends QuipuSwap
? QuipuSwap
: never;

export async function getConnector<T>(
chain: string,
Expand Down Expand Up @@ -259,7 +259,7 @@ export async function getConnector<T>(
connectorInstance = QuipuSwap.getInstance(network);
} else if (chain === 'ethereum' && connector === 'carbonamm') {
connectorInstance = Carbonamm.getInstance(chain, network);
} else if (chain === 'etc' && connector === 'etcswapLP'
} else if (chain === 'ethereum-classic' && connector === 'etcswapLP'
) {
connectorInstance = ETCSwapLP.getInstance(chain, network)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ networks:
chainID: 61
nodeURL: 'https://etc.rivet.link'
tokenListType: FILE
tokenListSource: /home/gateway/conf/lists/etc.json
tokenListSource: /home/gateway/conf/lists/ethereum-classic.json
nativeCurrencySymbol: 'ETC'
gasPriceRefreshInterval: 60

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/templates/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ configurations:
configurationPath: balancer.yml
schemaPath: cronos-connector-schema.json

$namespace etc:
configurationPath: etc.yml
$namespace ethereum-classic:
configurationPath: ethereum-classic.yml
schemaPath: ethereum-schema.json

$namespace etcswap:
Expand Down

0 comments on commit 0f461b5

Please sign in to comment.