mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-04 03:58:00 +03:00
Webpack / contracts
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
/* eslint-disable max-len */
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { ethers } from 'ethers';
|
||||
import { Exchange__factory } from '@orionprotocol/contracts/ethers';
|
||||
import getBalances from '../../utils/getBalances';
|
||||
import BalanceGuard from '../../BalanceGuard';
|
||||
import OrionUnit from '..';
|
||||
import { contracts, utils } from '../..';
|
||||
import { utils } from '../..';
|
||||
import {
|
||||
DEPOSIT_ERC20_GAS_LIMIT, DEPOSIT_ETH_GAS_LIMIT, INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION,
|
||||
} from '../../constants';
|
||||
@@ -43,7 +44,7 @@ export default async function deposit({
|
||||
|
||||
const nativeCryptocurrency = getNativeCryptocurrency(assetToAddress);
|
||||
|
||||
const exchangeContract = contracts.Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const exchangeContract = Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const gasPriceWei = await simpleFetch(orionBlockchain.getGasPriceWei)();
|
||||
|
||||
const assetAddress = assetToAddress[asset];
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
/* eslint-disable max-len */
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { ethers } from 'ethers';
|
||||
import { Exchange__factory } from '@orionprotocol/contracts/ethers';
|
||||
import getBalances from '../../utils/getBalances';
|
||||
import BalanceGuard from '../../BalanceGuard';
|
||||
import getAvailableSources from '../../utils/getAvailableFundsSources';
|
||||
import OrionUnit from '..';
|
||||
import { contracts, crypt, utils } from '../..';
|
||||
import { crypt, utils } from '../..';
|
||||
import { INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION, SWAP_THROUGH_ORION_POOL_GAS_LIMIT } from '../../constants';
|
||||
import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency';
|
||||
import simpleFetch from '../../simpleFetch';
|
||||
@@ -82,7 +83,7 @@ export default async function swapMarket({
|
||||
} = await simpleFetch(orionBlockchain.getInfo)();
|
||||
const nativeCryptocurrency = getNativeCryptocurrency(assetToAddress);
|
||||
|
||||
const exchangeContract = contracts.Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const exchangeContract = Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const feeAssets = await simpleFetch(orionBlockchain.getTokensFee)();
|
||||
const pricesInOrn = await simpleFetch(orionBlockchain.getPrices)();
|
||||
const gasPriceWei = await simpleFetch(orionBlockchain.getGasPriceWei)();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* eslint-disable max-len */
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { ethers } from 'ethers';
|
||||
import { Exchange__factory } from '@orionprotocol/contracts/ethers';
|
||||
import getBalances from '../../utils/getBalances';
|
||||
import BalanceGuard from '../../BalanceGuard';
|
||||
import OrionUnit from '..';
|
||||
import { contracts, utils } from '../..';
|
||||
import { utils } from '../..';
|
||||
import {
|
||||
INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION, WITHDRAW_GAS_LIMIT,
|
||||
} from '../../constants';
|
||||
@@ -42,7 +43,7 @@ export default async function withdraw({
|
||||
} = await simpleFetch(orionBlockchain.getInfo)();
|
||||
|
||||
const nativeCryptocurrency = getNativeCryptocurrency(assetToAddress);
|
||||
const exchangeContract = contracts.Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const exchangeContract = Exchange__factory.connect(exchangeContractAddress, provider);
|
||||
const gasPriceWei = await simpleFetch(orionBlockchain.getGasPriceWei)();
|
||||
|
||||
const assetAddress = assetToAddress[asset];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Exchange__factory, IUniswapV2Pair__factory, IUniswapV2Router__factory } from '@orionprotocol/contracts/ethers';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { ethers } from 'ethers';
|
||||
import OrionUnit from '..';
|
||||
import { contracts } from '../..';
|
||||
import BalanceGuard from '../../BalanceGuard';
|
||||
import { ADD_LIQUIDITY_GAS_LIMIT, INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION } from '../../constants';
|
||||
import simpleFetch from '../../simpleFetch';
|
||||
@@ -51,7 +51,7 @@ export default class FarmingManager {
|
||||
|
||||
const walletAddress = await signer.getAddress();
|
||||
|
||||
const exchangeContract = contracts.Exchange__factory
|
||||
const exchangeContract = Exchange__factory
|
||||
.connect(exchangeContractAddress, this.orionUnit.provider);
|
||||
|
||||
const assetAAddress = assetToAddress[assetA];
|
||||
@@ -90,9 +90,9 @@ export default class FarmingManager {
|
||||
const pool = poolsConfig.pools[poolName];
|
||||
if (!pool) throw new Error(`Pool ${poolName} not found`);
|
||||
|
||||
const pairContract = contracts.IUniswapV2Pair__factory
|
||||
const pairContract = IUniswapV2Pair__factory
|
||||
.connect(pool.lpTokenAddress, this.orionUnit.provider);
|
||||
const routerContract = contracts.IUniswapV2Router__factory
|
||||
const routerContract = IUniswapV2Router__factory
|
||||
.connect(poolsConfig.routerAddress, this.orionUnit.provider);
|
||||
|
||||
let pairTokensIsInversed = false;
|
||||
@@ -242,7 +242,7 @@ export default class FarmingManager {
|
||||
|
||||
const walletAddress = await signer.getAddress();
|
||||
|
||||
const exchangeContract = contracts.Exchange__factory
|
||||
const exchangeContract = Exchange__factory
|
||||
.connect(exchangeContractAddress, this.orionUnit.provider);
|
||||
const nativeCryptocurrency = getNativeCryptocurrency(assetToAddress);
|
||||
const balances = await getBalances(
|
||||
@@ -268,12 +268,12 @@ export default class FarmingManager {
|
||||
signer,
|
||||
);
|
||||
|
||||
const pairContract = contracts.IUniswapV2Pair__factory
|
||||
const pairContract = IUniswapV2Pair__factory
|
||||
.connect(pool.lpTokenAddress, this.orionUnit.provider);
|
||||
|
||||
const { _reserve0, _reserve1 } = await pairContract.getReserves();
|
||||
|
||||
const routerContract = contracts.IUniswapV2Router__factory
|
||||
const routerContract = IUniswapV2Router__factory
|
||||
.connect(poolsConfig.routerAddress, this.orionUnit.provider);
|
||||
|
||||
let pairTokensIsInversed = false;
|
||||
|
||||
Reference in New Issue
Block a user