performed a rename

This commit is contained in:
Daniel Pyrathon
2020-02-28 16:54:05 -08:00
parent 08619e2c06
commit 7495ac8111
9 changed files with 91 additions and 91 deletions

View File

@@ -342,7 +342,7 @@ describe('DexSampler tests', () => {
expect(quotes).to.deep.eq(expectedQuotes);
});
describe('PLP Operations', () => {
describe('LiquidityProvider Operations', () => {
const xAsset = randomAddress();
const yAsset = randomAddress();
const zAsset = randomAddress();
@@ -392,7 +392,7 @@ describe('DexSampler tests', () => {
expect(yzPool).to.eql(NULL_ADDRESS);
expect(nullPool).to.eql(NULL_ADDRESS);
});
it('is able to sample DEX liquidity from PLP', async () => {
it('is able to sample DEX liquidity from LiquidityProvider', async () => {
const fakeLiquidityPool = await DummyLiquidityProviderContract.deployFrom0xArtifactAsync(
erc20BridgeSamplerArtifacts.DummyLiquidityProvider,
provider,
@@ -408,14 +408,14 @@ describe('DexSampler tests', () => {
);
const [buyQuotes, sellQuotes] = await dexOrderSampler.executeBatchAsync([
DexOrderSampler.ops.getBuyQuotes(
[ERC20BridgeSource.Plp],
[ERC20BridgeSource.LiquidityProvider],
xAsset,
yAsset,
[new BigNumber(10), new BigNumber(100)],
registryContract.address,
),
DexOrderSampler.ops.getSellQuotes(
[ERC20BridgeSource.Plp],
[ERC20BridgeSource.LiquidityProvider],
xAsset,
yAsset,
[new BigNumber(10), new BigNumber(100), new BigNumber(500)],
@@ -423,18 +423,18 @@ describe('DexSampler tests', () => {
),
]);
expect(buyQuotes.length).to.eql(1);
const plpBuyQuotes: DexSample[] = buyQuotes[0];
expect(plpBuyQuotes.length).to.eql(2);
for (const quote of plpBuyQuotes) {
expect(quote.source).to.bignumber.eql(ERC20BridgeSource.Plp);
const liquidityPoolBuyQuotes: DexSample[] = buyQuotes[0];
expect(liquidityPoolBuyQuotes.length).to.eql(2);
for (const quote of liquidityPoolBuyQuotes) {
expect(quote.source).to.bignumber.eql(ERC20BridgeSource.LiquidityProvider);
expect(quote.input.plus(1)).to.bignumber.eql(quote.output);
}
expect(sellQuotes.length).to.eql(1);
const plpSellQuotes: DexSample[] = sellQuotes[0];
expect(plpSellQuotes.length).to.eql(3);
for (const quote of plpSellQuotes) {
expect(quote.source).to.bignumber.eql(ERC20BridgeSource.Plp);
const iquidityPoolSellQuotes: DexSample[] = sellQuotes[0];
expect(iquidityPoolSellQuotes.length).to.eql(3);
for (const quote of iquidityPoolSellQuotes) {
expect(quote.source).to.bignumber.eql(ERC20BridgeSource.LiquidityProvider);
expect(quote.input.minus(1)).to.bignumber.eql(quote.output);
}
});

View File

@@ -141,7 +141,7 @@ describe('MarketOperationUtils tests', () => {
makerToken: string,
takerToken: string,
fillAmounts: BigNumber[],
plpRegistryAddress?: string | undefined,
liquidityProviderAddress?: string | undefined,
) => DexSample[][];
function createGetMultipleSellQuotesOperationFromRates(rates: RatesBySource): GetMultipleQuotesOperation {
@@ -156,26 +156,26 @@ describe('MarketOperationUtils tests', () => {
};
}
function callTradeOperationAndRetainPLPParams(
function callTradeOperationAndRetainLiquidityProviderParams(
tradeOperation: (rates: RatesBySource) => GetMultipleQuotesOperation,
rates: RatesBySource,
): [{ sources: ERC20BridgeSource[]; plpRegistryAddress?: string }, GetMultipleQuotesOperation] {
const plpParams: { sources: ERC20BridgeSource[]; plpRegistryAddress?: string } = {
): [{ sources: ERC20BridgeSource[]; liquidityProviderAddress?: string }, GetMultipleQuotesOperation] {
const liquidityPoolParams: { sources: ERC20BridgeSource[]; liquidityProviderAddress?: string } = {
sources: [],
plpRegistryAddress: undefined,
liquidityProviderAddress: undefined,
};
const fn = (
sources: ERC20BridgeSource[],
makerToken: string,
takerToken: string,
fillAmounts: BigNumber[],
plpRegistryAddress: string | undefined,
liquidityProviderAddress: string | undefined,
) => {
plpParams.plpRegistryAddress = plpRegistryAddress;
plpParams.sources = sources;
return tradeOperation(rates)(sources, makerToken, takerToken, fillAmounts, plpRegistryAddress);
liquidityPoolParams.liquidityProviderAddress = liquidityProviderAddress;
liquidityPoolParams.sources = sources;
return tradeOperation(rates)(sources, makerToken, takerToken, fillAmounts, liquidityProviderAddress);
};
return [plpParams, fn];
return [liquidityPoolParams, fn];
}
function createGetMultipleBuyQuotesOperationFromRates(rates: RatesBySource): GetMultipleQuotesOperation {
@@ -195,7 +195,7 @@ describe('MarketOperationUtils tests', () => {
makerToken: string,
takerToken: string,
fillAmounts: BigNumber[],
plpRegistryAddress?: string | undefined,
liquidityProviderAddress?: string | undefined,
) => BigNumber;
type GetLiquidityProviderFromRegistryOperation = (
@@ -260,7 +260,7 @@ describe('MarketOperationUtils tests', () => {
[ERC20BridgeSource.CurveUsdcDai]: _.times(NUM_SAMPLES, () => 0),
[ERC20BridgeSource.CurveUsdcDaiUsdt]: _.times(NUM_SAMPLES, () => 0),
[ERC20BridgeSource.CurveUsdcDaiUsdtTusd]: _.times(NUM_SAMPLES, () => 0),
[ERC20BridgeSource.Plp]: _.times(NUM_SAMPLES, () => 0),
[ERC20BridgeSource.LiquidityProvider]: _.times(NUM_SAMPLES, () => 0),
};
function findSourceWithMaxOutput(rates: RatesBySource): ERC20BridgeSource {
@@ -375,7 +375,7 @@ describe('MarketOperationUtils tests', () => {
});
it('polls the liquidity provider when the registry is provided in the arguments', async () => {
const [args, fn] = callTradeOperationAndRetainPLPParams(
const [args, fn] = callTradeOperationAndRetainLiquidityProviderParams(
createGetMultipleSellQuotesOperationFromRates,
DEFAULT_RATES,
);
@@ -393,8 +393,8 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS,
excludedSources: [],
});
expect(args.sources.sort()).to.deep.eq(SELL_SOURCES.concat([ERC20BridgeSource.Plp]).sort());
expect(args.plpRegistryAddress).to.eql(registryAddress);
expect(args.sources.sort()).to.deep.eq(SELL_SOURCES.concat([ERC20BridgeSource.LiquidityProvider]).sort());
expect(args.liquidityProviderAddress).to.eql(registryAddress);
});
it('does not poll DEXes in `excludedSources`', async () => {
@@ -669,7 +669,7 @@ describe('MarketOperationUtils tests', () => {
});
it('polls the liquidity provider when the registry is provided in the arguments', async () => {
const [args, fn] = callTradeOperationAndRetainPLPParams(
const [args, fn] = callTradeOperationAndRetainLiquidityProviderParams(
createGetMultipleBuyQuotesOperationFromRates,
DEFAULT_RATES,
);
@@ -687,8 +687,8 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS,
excludedSources: [],
});
expect(args.sources.sort()).to.deep.eq(BUY_SOURCES.concat([ERC20BridgeSource.Plp]).sort());
expect(args.plpRegistryAddress).to.eql(registryAddress);
expect(args.sources.sort()).to.deep.eq(BUY_SOURCES.concat([ERC20BridgeSource.LiquidityProvider]).sort());
expect(args.liquidityProviderAddress).to.eql(registryAddress);
});
it('does not poll DEXes in `excludedSources`', async () => {
@@ -871,17 +871,17 @@ describe('MarketOperationUtils tests', () => {
expect(orderSources).to.deep.eq(expectedSources);
});
it('is able to create a order from PLP', async () => {
it('is able to create a order from LiquidityProvider', async () => {
const registryAddress = randomAddress();
const liquidityPoolAddress = randomAddress();
const xAsset = randomAddress();
const yAsset = randomAddress();
const toSell = Web3Wrapper.toBaseUnitAmount(10, 18);
const [getSellQuiotesParams, getSellQuotesFn] = callTradeOperationAndRetainPLPParams(
const [getSellQuiotesParams, getSellQuotesFn] = callTradeOperationAndRetainLiquidityProviderParams(
createGetMultipleSellQuotesOperationFromRates,
{
[ERC20BridgeSource.Plp]: createDecreasingRates(5),
[ERC20BridgeSource.LiquidityProvider]: createDecreasingRates(5),
},
);
const [
@@ -920,8 +920,8 @@ describe('MarketOperationUtils tests', () => {
expect(decodedAssetData.assetProxyId).to.eql(AssetProxyId.ERC20Bridge);
expect(decodedAssetData.bridgeAddress).to.eql(liquidityPoolAddress);
expect(result[0].takerAssetAmount).to.bignumber.eql(toSell);
expect(getSellQuiotesParams.sources).contains(ERC20BridgeSource.Plp);
expect(getSellQuiotesParams.plpRegistryAddress).is.eql(registryAddress);
expect(getSellQuiotesParams.sources).contains(ERC20BridgeSource.LiquidityProvider);
expect(getSellQuiotesParams.liquidityProviderAddress).is.eql(registryAddress);
expect(getLiquidityProviderParams.registryAddress).is.eql(registryAddress);
expect(getLiquidityProviderParams.makerToken).is.eql(xAsset);
expect(getLiquidityProviderParams.takerToken).is.eql(yAsset);