Skip to content

Commit

Permalink
fix: disable staking pool initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hejkerooo committed Dec 15, 2021
1 parent 5eaa4ec commit 78c7815
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/init.ts
Expand Up @@ -17,6 +17,7 @@ import { DomainsService } from "./modules/domains";
import { AssetsService } from "./modules/assets";
import { ClaimsService } from "./modules/claims";
import { defaultAzureProxyUrl, defaultBridgeUrl, defaultKmsServerUrl } from "./utils";
import { chainConfigs } from "./config";

export async function initWithPrivateKeySigner(privateKey: string, rpcUrl: string) {
const signerService = await fromPrivateKey(privateKey, rpcUrl);
Expand Down Expand Up @@ -49,12 +50,24 @@ export async function init(signerService: SignerService) {
const messagingService = await MessagingService.create(signerService);

async function connectToCacheServer() {
const chainId = signerService.chainId;
const stakingPoolFactoryAddress = chainConfigs()[chainId].stakingPoolFactoryAddress;

const cacheClient = new CacheClient(signerService);
await cacheClient.init();
await cacheClient.login();
const domainsService = await DomainsService.create(signerService, cacheClient);
const stakingService = await StakingService.create(signerService, domainsService);
const stakingPoolService = await StakingFactoryService.create(signerService, domainsService);

const stakingAddressProvided = stakingPoolFactoryAddress && stakingPoolFactoryAddress.length;

const stakingService = stakingAddressProvided
? await StakingService.create(signerService, domainsService)
: null;

const stakingPoolService = stakingAddressProvided
? await StakingFactoryService.create(signerService, domainsService)
: null;

const assetsService = await AssetsService.create(signerService, cacheClient);

async function connectToDidRegistry(
Expand Down
5 changes: 3 additions & 2 deletions src/modules/staking/staking.service.ts
@@ -1,5 +1,5 @@
import { utils, BigNumber, providers } from "ethers";
import { StakingPoolFactory, StakingPool as StakingPoolContract } from "../../../ethers";
import { BigNumber, providers, utils } from "ethers";
import { StakingPool as StakingPoolContract, StakingPoolFactory } from "../../../ethers";
import { StakingPoolFactory__factory } from "../../../ethers/factories/StakingPoolFactory__factory";
import { StakingPool__factory } from "../../../ethers/factories/StakingPool__factory";
import { ERROR_MESSAGES } from "../../errors/ErrorMessages";
Expand Down Expand Up @@ -56,6 +56,7 @@ export class StakingService {
async init() {
const chainId = this._signerService.chainId;
this._stakingPoolFactoryAddress = chainConfigs()[chainId].stakingPoolFactoryAddress;

this._stakingPoolFactory = new StakingPoolFactory__factory(
StakingPoolFactory__factory.createInterface(),
StakingPoolFactory__factory.bytecode,
Expand Down

0 comments on commit 78c7815

Please sign in to comment.