Files
orionprotocol-sdk/src/OrionUnit/index.ts
Aleksandr Kraiz ec79f47cef Minor fix
2022-04-24 01:47:12 +04:00

46 lines
1.3 KiB
TypeScript

import { ethers } from 'ethers';
import { OrionAggregator } from '../services/OrionAggregator';
import { OrionBlockchain } from '../services/OrionBlockchain';
import { PriceFeed } from '../services/PriceFeed';
import { SupportedChainId } from '../types';
import Exchange from './Exchange';
import FarmingManager from './FarmingManager';
export default class OrionUnit {
public readonly env: string;
public readonly chainId: SupportedChainId;
public readonly provider: ethers.providers.StaticJsonRpcProvider;
public readonly orionBlockchain: OrionBlockchain;
public readonly orionAggregator: OrionAggregator;
public readonly priceFeed: PriceFeed;
public readonly exchange: Exchange;
public readonly farmingManager: FarmingManager;
public readonly apiUrl: string;
constructor(
chainId: SupportedChainId,
rpc: string,
env: string,
apiUrl: string,
) {
this.chainId = chainId;
this.provider = new ethers.providers.StaticJsonRpcProvider(rpc);
this.env = env;
this.apiUrl = apiUrl;
this.orionBlockchain = new OrionBlockchain(apiUrl);
this.orionAggregator = new OrionAggregator(apiUrl, chainId);
this.priceFeed = new PriceFeed(apiUrl);
this.exchange = new Exchange(this);
this.farmingManager = new FarmingManager(this);
}
}