Skip to content

Commit e130743

Browse files
authored
chore(contract_manager): cleanup (#2811)
- Purge some entropy contracts - Remove EvmExpressRelayContract type - Fix shell script
1 parent 6ba707b commit e130743

File tree

7 files changed

+11
-329
lines changed

7 files changed

+11
-329
lines changed

contract_manager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
],
3232
"scripts": {
3333
"build": "tsc",
34-
"shell": "ts-node ./src/shell.ts",
34+
"shell": "ts-node ./src/node/utils/shell.ts",
3535
"fix:lint": "eslint src/ scripts/ --fix --max-warnings 0",
3636
"fix:format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.ts\"",
3737
"test:lint": "eslint src/ scripts/ --max-warnings 0",

contract_manager/src/core/contracts/evm.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { WormholeContract } from "./wormhole";
77
import { TokenQty } from "../token";
88
import {
99
EXECUTOR_ABI,
10-
EXPRESS_RELAY_ABI,
1110
EXTENDED_ENTROPY_ABI,
1211
EXTENDED_PYTH_ABI,
1312
WORMHOLE_ABI,
@@ -413,93 +412,6 @@ export class EvmEntropyContract extends Storable {
413412
}
414413
}
415414

416-
export class EvmExpressRelayContract extends Storable {
417-
static type = "EvmExpressRelayContract";
418-
419-
constructor(
420-
public chain: EvmChain,
421-
public address: string,
422-
) {
423-
super();
424-
}
425-
426-
getId(): string {
427-
return `${this.chain.getId()}_${this.address}`;
428-
}
429-
430-
getChain(): EvmChain {
431-
return this.chain;
432-
}
433-
434-
getType(): string {
435-
return EvmExpressRelayContract.type;
436-
}
437-
438-
async getVersion(): Promise<string> {
439-
const contract = this.getContract();
440-
return contract.methods.version().call();
441-
}
442-
443-
static fromJson(
444-
chain: Chain,
445-
parsed: { type: string; address: string },
446-
): EvmExpressRelayContract {
447-
if (parsed.type !== EvmExpressRelayContract.type)
448-
throw new Error("Invalid type");
449-
if (!(chain instanceof EvmChain))
450-
throw new Error(`Wrong chain type ${chain}`);
451-
return new EvmExpressRelayContract(chain, parsed.address);
452-
}
453-
454-
async generateSetRelayerPayload(relayer: string): Promise<Buffer> {
455-
const contract = this.getContract();
456-
const data = contract.methods.setRelayer(relayer).encodeABI();
457-
return this.chain.generateExecutorPayload(
458-
await this.getOwner(),
459-
this.address,
460-
data,
461-
);
462-
}
463-
464-
async getOwner(): Promise<string> {
465-
const contract = this.getContract();
466-
return contract.methods.owner().call();
467-
}
468-
469-
async getExecutorContract(): Promise<EvmExecutorContract> {
470-
const owner = await this.getOwner();
471-
return new EvmExecutorContract(this.chain, owner);
472-
}
473-
474-
async getPendingOwner(): Promise<string> {
475-
const contract = this.getContract();
476-
return contract.methods.pendingOwner().call();
477-
}
478-
479-
async getRelayer(): Promise<string> {
480-
const contract = this.getContract();
481-
return contract.methods.getRelayer().call();
482-
}
483-
484-
async getRelayerSubwallets(): Promise<string[]> {
485-
const contract = this.getContract();
486-
return contract.methods.getRelayerSubwallets().call();
487-
}
488-
489-
toJson() {
490-
return {
491-
chain: this.chain.getId(),
492-
address: this.address,
493-
type: EvmExpressRelayContract.type,
494-
};
495-
}
496-
497-
getContract() {
498-
const web3 = this.chain.getWeb3();
499-
return new web3.eth.Contract(EXPRESS_RELAY_ABI, this.address);
500-
}
501-
}
502-
503415
export class EvmExecutorContract {
504416
constructor(
505417
public chain: EvmChain,

contract_manager/src/core/contracts/evm_abis.ts

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -63,164 +63,6 @@ export const OWNABLE_ABI = [
6363
},
6464
] as any; // eslint-disable-line @typescript-eslint/no-explicit-any
6565

66-
export const EXPRESS_RELAY_ABI = [
67-
{
68-
type: "function",
69-
name: "getAdmin",
70-
inputs: [],
71-
outputs: [
72-
{
73-
name: "",
74-
type: "address",
75-
internalType: "address",
76-
},
77-
],
78-
stateMutability: "view",
79-
},
80-
{
81-
type: "function",
82-
name: "getFeeProtocol",
83-
inputs: [
84-
{
85-
name: "feeRecipient",
86-
type: "address",
87-
internalType: "address",
88-
},
89-
],
90-
outputs: [
91-
{
92-
name: "",
93-
type: "uint256",
94-
internalType: "uint256",
95-
},
96-
],
97-
stateMutability: "view",
98-
},
99-
{
100-
type: "function",
101-
name: "getFeeProtocolDefault",
102-
inputs: [],
103-
outputs: [
104-
{
105-
name: "",
106-
type: "uint256",
107-
internalType: "uint256",
108-
},
109-
],
110-
stateMutability: "view",
111-
},
112-
{
113-
type: "function",
114-
name: "getFeeRelayer",
115-
inputs: [],
116-
outputs: [
117-
{
118-
name: "",
119-
type: "uint256",
120-
internalType: "uint256",
121-
},
122-
],
123-
stateMutability: "view",
124-
},
125-
{
126-
type: "function",
127-
name: "getFeeSplitPrecision",
128-
inputs: [],
129-
outputs: [
130-
{
131-
name: "",
132-
type: "uint256",
133-
internalType: "uint256",
134-
},
135-
],
136-
stateMutability: "view",
137-
},
138-
{
139-
type: "function",
140-
name: "getRelayer",
141-
inputs: [],
142-
outputs: [
143-
{
144-
name: "",
145-
type: "address",
146-
internalType: "address",
147-
},
148-
],
149-
stateMutability: "view",
150-
},
151-
{
152-
type: "function",
153-
name: "getRelayerSubwallets",
154-
inputs: [],
155-
outputs: [
156-
{
157-
name: "",
158-
type: "address[]",
159-
internalType: "address[]",
160-
},
161-
],
162-
stateMutability: "view",
163-
},
164-
{
165-
type: "function",
166-
name: "setFeeProtocol",
167-
inputs: [
168-
{
169-
name: "feeRecipient",
170-
type: "address",
171-
internalType: "address",
172-
},
173-
{
174-
name: "feeSplit",
175-
type: "uint256",
176-
internalType: "uint256",
177-
},
178-
],
179-
outputs: [],
180-
stateMutability: "nonpayable",
181-
},
182-
{
183-
type: "function",
184-
name: "setFeeProtocolDefault",
185-
inputs: [
186-
{
187-
name: "feeSplit",
188-
type: "uint256",
189-
internalType: "uint256",
190-
},
191-
],
192-
outputs: [],
193-
stateMutability: "nonpayable",
194-
},
195-
{
196-
type: "function",
197-
name: "setFeeRelayer",
198-
inputs: [
199-
{
200-
name: "feeSplit",
201-
type: "uint256",
202-
internalType: "uint256",
203-
},
204-
],
205-
outputs: [],
206-
stateMutability: "nonpayable",
207-
},
208-
{
209-
type: "function",
210-
name: "setRelayer",
211-
inputs: [
212-
{
213-
name: "relayer",
214-
type: "address",
215-
internalType: "address",
216-
},
217-
],
218-
outputs: [],
219-
stateMutability: "nonpayable",
220-
},
221-
...OWNABLE_ABI,
222-
] as any; // eslint-disable-line @typescript-eslint/no-explicit-any
223-
22466
export const EXTENDED_ENTROPY_ABI = [
22567
{
22668
inputs: [],

contract_manager/src/node/utils/shell.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const service = tsNode.create({ ...repl.evalAwarePartialHost });
55
repl.setService(service);
66
repl.start();
77
repl.evalCode(
8-
"import { loadHotWallet, Vault } from './src/governance';" +
9-
"import { SuiChain, CosmWasmChain, AptosChain, EvmChain, StarknetChain } from './src/chains';" +
10-
"import { SuiPriceFeedContract } from './src/contracts/sui';" +
11-
"import { CosmWasmWormholeContract, CosmWasmPriceFeedContract } from './src/contracts/cosmwasm';" +
12-
"import { EvmWormholeContract, EvmPriceFeedContract, EvmEntropyContract, EvmExpressRelayContract } from './src/contracts/evm';" +
13-
"import { AptosWormholeContract, AptosPriceFeedContract } from './src/contracts/aptos';" +
14-
"import { StarknetPriceFeedContract } from './src/contracts/starknet';" +
15-
"import { DefaultStore } from './src/store';" +
16-
"import { toPrivateKey } from './src/base';" +
8+
"import { loadHotWallet, Vault } from './src/node/utils/governance';" +
9+
"import { SuiChain, CosmWasmChain, AptosChain, EvmChain, StarknetChain } from './src/core/chains';" +
10+
"import { SuiPriceFeedContract } from './src/core/contracts/sui';" +
11+
"import { CosmWasmWormholeContract, CosmWasmPriceFeedContract } from './src/core/contracts/cosmwasm';" +
12+
"import { EvmWormholeContract, EvmPriceFeedContract, EvmEntropyContract } from './src/core/contracts/evm';" +
13+
"import { AptosWormholeContract, AptosPriceFeedContract } from './src/core/contracts/aptos';" +
14+
"import { StarknetPriceFeedContract } from './src/core/contracts/starknet';" +
15+
"import { DefaultStore } from './src/node/utils/store';" +
16+
"import { toPrivateKey } from './src/core/base';" +
1717
"DefaultStore",
1818
);

contract_manager/src/node/utils/store.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
FuelWormholeContract,
2525
WormholeContract,
2626
FuelPriceFeedContract,
27-
EvmExpressRelayContract,
2827
TonPriceFeedContract,
2928
TonWormholeContract,
3029
IotaWormholeContract,
@@ -50,7 +49,6 @@ export class Store {
5049
public entropy_contracts: Record<string, EvmEntropyContract> = {};
5150
public pulse_contracts: Record<string, EvmPulseContract> = {};
5251
public wormhole_contracts: Record<string, WormholeContract> = {};
53-
public express_relay_contracts: Record<string, EvmExpressRelayContract> = {};
5452
public tokens: Record<string, Token> = {};
5553
public vaults: Record<string, Vault> = {};
5654

@@ -168,7 +166,6 @@ export class Store {
168166
[AptosPriceFeedContract.type]: AptosPriceFeedContract,
169167
[AptosWormholeContract.type]: AptosWormholeContract,
170168
[EvmEntropyContract.type]: EvmEntropyContract,
171-
[EvmExpressRelayContract.type]: EvmExpressRelayContract,
172169
[EvmWormholeContract.type]: EvmWormholeContract,
173170
[FuelPriceFeedContract.type]: FuelPriceFeedContract,
174171
[FuelWormholeContract.type]: FuelWormholeContract,
@@ -202,8 +199,6 @@ export class Store {
202199
);
203200
if (chainContract instanceof EvmEntropyContract) {
204201
this.entropy_contracts[chainContract.getId()] = chainContract;
205-
} else if (chainContract instanceof EvmExpressRelayContract) {
206-
this.express_relay_contracts[chainContract.getId()] = chainContract;
207202
} else if (chainContract instanceof WormholeContract) {
208203
this.wormhole_contracts[chainContract.getId()] = chainContract;
209204
} else {

0 commit comments

Comments
 (0)