Skip to content

Commit

Permalink
refactor: Simplify inventory client parsing
Browse files Browse the repository at this point in the history
This helps to drop an UMA dependency, and is arguably nicer because it
doesn't corce the js Object to and from a string type.
  • Loading branch information
pxrl committed Oct 2, 2023
1 parent 2da16b5 commit f0d582d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/relayer/RelayerConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumber, toBNWei, assert, toBN, replaceAddressCase, ethers } from "../utils";
import { BigNumber, toBNWei, assert, toBN, ethers } from "../utils";
import { CommonConfig, ProcessEnv } from "../common";
import * as Constants from "../common/Constants";
import { InventoryConfig } from "../interfaces";
Expand Down Expand Up @@ -65,7 +65,9 @@ export class RelayerConfig extends CommonConfig {
this.slowDepositors = SLOW_DEPOSITORS
? JSON.parse(SLOW_DEPOSITORS).map((depositor) => ethers.utils.getAddress(depositor))
: [];
this.inventoryConfig = RELAYER_INVENTORY_CONFIG ? JSON.parse(RELAYER_INVENTORY_CONFIG) : {};
this.inventoryConfig = JSON.parse(
RELAYER_INVENTORY_CONFIG?.replace(/0x[a-fA-F0-9]{40}/g, ethers.utils.getAddress) ?? "{}"
);
this.minRelayerFeePct = toBNWei(MIN_RELAYER_FEE_PCT || Constants.RELAYER_MIN_FEE_PCT);

if (Object.keys(this.inventoryConfig).length > 0) {
Expand Down
2 changes: 0 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export {
export type { Block, TransactionResponse, TransactionReceipt, Provider } from "@ethersproject/abstract-provider";

export { config } from "dotenv";

export { replaceAddressCase } from "@uma/common";
export { Logger } from "@uma/financial-templates-lib";

// TypeChain exports used in the bot.
Expand Down

0 comments on commit f0d582d

Please sign in to comment.