Webpack / contracts

This commit is contained in:
Aleksandr Kraiz
2022-05-29 18:33:23 +04:00
parent d9294673b5
commit 9e8b90e477
31 changed files with 98 additions and 5805 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable camelcase */
import { ERC20__factory } from '@orionprotocol/contracts/ethers';
import { ethers } from 'ethers';
import invariant from 'tiny-invariant';
import { ERC20__factory } from '../artifacts/contracts';
const checkIsToken = async (address: string, provider?: ethers.providers.Provider) => {
invariant(provider, 'No provider for token checking');

View File

@@ -1,6 +1,9 @@
import { ERC20__factory } from '@orionprotocol/contracts/ethers';
import type { Exchange } from '@orionprotocol/contracts/ethers';
import BigNumber from 'bignumber.js';
import { ethers } from 'ethers';
import { contracts, utils } from '..';
import { utils } from '..';
import { INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION } from '../constants';
import { OrionAggregator } from '../services/OrionAggregator';
@@ -9,7 +12,7 @@ export default async function getBalance(
asset: string,
assetAddress: string,
walletAddress: string,
exchangeContract: contracts.Exchange,
exchangeContract: Exchange,
provider: ethers.providers.Provider,
) {
const assetIsNativeCryptocurrency = assetAddress === ethers.constants.AddressZero;
@@ -19,7 +22,7 @@ export default async function getBalance(
let denormalizedAssetInWalletBalance: BigNumber | undefined;
if (!assetIsNativeCryptocurrency) {
const assetContract = contracts.ERC20__factory.connect(assetAddress, provider);
const assetContract = ERC20__factory.connect(assetAddress, provider);
const assetDecimals = await assetContract.decimals();
assetWalletBalance = await assetContract.balanceOf(walletAddress);

View File

@@ -1,6 +1,6 @@
import type { Exchange } from '@orionprotocol/contracts/ethers';
import BigNumber from 'bignumber.js';
import { ethers } from 'ethers';
import { contracts } from '..';
import { OrionAggregator } from '../services/OrionAggregator';
import getBalance from './getBalance';
@@ -8,7 +8,7 @@ export default async (
balancesRequired: Partial<Record<string, string>>,
orionAggregator: OrionAggregator,
walletAddress: string,
exchangeContract: contracts.Exchange,
exchangeContract: Exchange,
provider: ethers.providers.Provider,
) => {
const balances = await Promise.all(