further fixes in market operation utils
This commit is contained in:
parent
4803e2f68c
commit
ef65aa5bf6
@ -54,7 +54,7 @@ export class CreamPoolsCache {
|
|||||||
makerToken: string,
|
makerToken: string,
|
||||||
isAllowedSource: boolean,
|
isAllowedSource: boolean,
|
||||||
): { onChain: boolean; offChain: boolean } {
|
): { onChain: boolean; offChain: boolean } {
|
||||||
// If Balancer is excluded as a source, do not sample.
|
// If CREAM is excluded as a source, do not sample.
|
||||||
if (!isAllowedSource) {
|
if (!isAllowedSource) {
|
||||||
return { onChain: false, offChain: false };
|
return { onChain: false, offChain: false };
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ export class CreamPoolsCache {
|
|||||||
// - Cached values are not stale
|
// - Cached values are not stale
|
||||||
// - There is at least one CREAM pool for this pair
|
// - There is at least one CREAM pool for this pair
|
||||||
const onChain = cachedCreamPools !== undefined && cachedCreamPools.length > 0;
|
const onChain = cachedCreamPools !== undefined && cachedCreamPools.length > 0;
|
||||||
// Sample Balancer off-chain (i.e. via GraphQL query + `computeCreamBuy/SellQuote`)
|
// Sample CREAM off-chain (i.e. via GraphQL query + `computeCreamBuy/SellQuote`)
|
||||||
// if cached values are stale
|
// if cached values are stale
|
||||||
const offChain = cachedCreamPools === undefined;
|
const offChain = cachedCreamPools === undefined;
|
||||||
return { onChain, offChain };
|
return { onChain, offChain };
|
||||||
|
@ -520,7 +520,7 @@ export class SamplerOperations {
|
|||||||
makerToken: string,
|
makerToken: string,
|
||||||
takerToken: string,
|
takerToken: string,
|
||||||
makerFillAmounts: BigNumber[],
|
makerFillAmounts: BigNumber[],
|
||||||
): Promise<Array<Array<DexSample<BalancerFillData>>>> {
|
): Promise<Array<Array<DexSample<CreamFillData>>>> {
|
||||||
const pools = await this.creamPoolsCache.getPoolsForPairAsync(takerToken, makerToken);
|
const pools = await this.creamPoolsCache.getPoolsForPairAsync(takerToken, makerToken);
|
||||||
return pools.map(pool =>
|
return pools.map(pool =>
|
||||||
makerFillAmounts.map(amount => ({
|
makerFillAmounts.map(amount => ({
|
||||||
@ -1109,7 +1109,7 @@ export class SamplerOperations {
|
|||||||
return this.creamPoolsCache
|
return this.creamPoolsCache
|
||||||
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
||||||
.map(poolAddress =>
|
.map(poolAddress =>
|
||||||
this.getBalancerSellQuotes(poolAddress, makerToken, takerToken, takerFillAmounts),
|
this.getCreamSellQuotes(poolAddress, makerToken, takerToken, takerFillAmounts),
|
||||||
);
|
);
|
||||||
case ERC20BridgeSource.Shell:
|
case ERC20BridgeSource.Shell:
|
||||||
return this.getShellSellQuotes(makerToken, takerToken, takerFillAmounts);
|
return this.getShellSellQuotes(makerToken, takerToken, takerFillAmounts);
|
||||||
@ -1206,7 +1206,7 @@ export class SamplerOperations {
|
|||||||
return this.creamPoolsCache
|
return this.creamPoolsCache
|
||||||
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
||||||
.map(poolAddress =>
|
.map(poolAddress =>
|
||||||
this.getBalancerBuyQuotes(poolAddress, makerToken, takerToken, makerFillAmounts),
|
this.getCreamBuyQuotes(poolAddress, makerToken, takerToken, makerFillAmounts),
|
||||||
);
|
);
|
||||||
case ERC20BridgeSource.Shell:
|
case ERC20BridgeSource.Shell:
|
||||||
return this.getShellBuyQuotes(makerToken, takerToken, makerFillAmounts);
|
return this.getShellBuyQuotes(makerToken, takerToken, makerFillAmounts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user