chore: [asset swapper] sampler Solidity 0.6 + Bridge addresses in AS (#4)
* Refactor excess interfaces * Compiles on 0.6 * Refactored into try/catch * Rebase and Refactored to v06 * Handle invalid registry in LP * Update packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol Co-authored-by: Lawrence Forman <lawrence@0xproject.com> * chore: [asset-swapper] Move Bridge Addresses and Gas schedule * curve->pool * lint * Refactor to fix module load order * Move FEE Schedule * rollup: Swerve/Sushi/SnowSwap/DODO (#7) * rollup: Swerve/Sushi * DODO Rollup + Snowswap Swerve * hardcode addresses temporarily * rebase * rename to SUSHISWAP_ROUTER * CHANGELOGs * CHANGELOGs Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// tslint:disable: no-unbound-method
|
||||
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import {
|
||||
assertRoughlyEquals,
|
||||
constants,
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
Numberish,
|
||||
randomAddress,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { Web3Wrapper } from '@0x/dev-utils';
|
||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||
import { AssetProxyId, ERC20BridgeAssetData, SignedOrder } from '@0x/types';
|
||||
import { BigNumber, fromTokenUnitAmount, hexUtils, NULL_ADDRESS } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
|
||||
@@ -21,6 +21,7 @@ import { IS_PRICE_AWARE_RFQ_ENABLED } from '../src/constants';
|
||||
import { getRfqtIndicativeQuotesAsync, MarketOperationUtils } from '../src/utils/market_operation_utils/';
|
||||
import { BalancerPoolsCache } from '../src/utils/market_operation_utils/balancer_utils';
|
||||
import {
|
||||
BRIDGE_ADDRESSES_BY_CHAIN,
|
||||
BUY_SOURCE_FILTER,
|
||||
POSITIVE_INF,
|
||||
SELL_SOURCE_FILTER,
|
||||
@@ -38,6 +39,7 @@ import {
|
||||
ERC20BridgeSource,
|
||||
FillData,
|
||||
GenerateOptimizedOrdersOpts,
|
||||
GetMarketOrdersOpts,
|
||||
MarketSideLiquidity,
|
||||
NativeFillData,
|
||||
} from '../src/utils/market_operation_utils/types';
|
||||
@@ -66,8 +68,12 @@ const SELL_SOURCES = SELL_SOURCE_FILTER.sources;
|
||||
|
||||
// tslint:disable: custom-no-magic-numbers promise-function-async
|
||||
describe('MarketOperationUtils tests', () => {
|
||||
const CHAIN_ID = 1;
|
||||
const contractAddresses = { ...getContractAddressesForChainOrThrow(CHAIN_ID), multiBridge: NULL_ADDRESS };
|
||||
const CHAIN_ID = ChainId.Mainnet;
|
||||
const contractAddresses = {
|
||||
...getContractAddressesForChainOrThrow(CHAIN_ID),
|
||||
multiBridge: NULL_ADDRESS,
|
||||
...BRIDGE_ADDRESSES_BY_CHAIN[CHAIN_ID],
|
||||
};
|
||||
|
||||
function getMockedQuoteRequestor(
|
||||
type: 'indicative' | 'firm',
|
||||
@@ -522,13 +528,15 @@ describe('MarketOperationUtils tests', () => {
|
||||
FILL_AMOUNT,
|
||||
_.times(NUM_SAMPLES, i => DEFAULT_RATES[ERC20BridgeSource.Native][i]),
|
||||
);
|
||||
const DEFAULT_OPTS = {
|
||||
const DEFAULT_OPTS: Partial<GetMarketOrdersOpts> = {
|
||||
numSamples: NUM_SAMPLES,
|
||||
sampleDistributionBase: 1,
|
||||
bridgeSlippage: 0,
|
||||
maxFallbackSlippage: 100,
|
||||
excludedSources: DEFAULT_EXCLUDED,
|
||||
allowFallback: false,
|
||||
gasSchedule: {},
|
||||
feeSchedule: {},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -1428,7 +1436,7 @@ describe('MarketOperationUtils tests', () => {
|
||||
...DEFAULT_OPTS,
|
||||
numSamples: 4,
|
||||
excludedSources: [
|
||||
...DEFAULT_OPTS.excludedSources,
|
||||
...(DEFAULT_OPTS.excludedSources as ERC20BridgeSource[]),
|
||||
ERC20BridgeSource.Eth2Dai,
|
||||
ERC20BridgeSource.Kyber,
|
||||
ERC20BridgeSource.Bancor,
|
||||
@@ -1449,13 +1457,15 @@ describe('MarketOperationUtils tests', () => {
|
||||
FILL_AMOUNT,
|
||||
_.times(NUM_SAMPLES, () => DEFAULT_RATES[ERC20BridgeSource.Native][0]),
|
||||
);
|
||||
const DEFAULT_OPTS = {
|
||||
const DEFAULT_OPTS: Partial<GetMarketOrdersOpts> = {
|
||||
numSamples: NUM_SAMPLES,
|
||||
sampleDistributionBase: 1,
|
||||
bridgeSlippage: 0,
|
||||
maxFallbackSlippage: 100,
|
||||
excludedSources: DEFAULT_EXCLUDED,
|
||||
allowFallback: false,
|
||||
gasSchedule: {},
|
||||
feeSchedule: {},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -1869,7 +1879,7 @@ describe('MarketOperationUtils tests', () => {
|
||||
...DEFAULT_OPTS,
|
||||
numSamples: 4,
|
||||
excludedSources: [
|
||||
...DEFAULT_OPTS.excludedSources,
|
||||
...(DEFAULT_OPTS.excludedSources as ERC20BridgeSource[]),
|
||||
ERC20BridgeSource.Eth2Dai,
|
||||
ERC20BridgeSource.Kyber,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user