Compare commits

...

3 Commits

Author SHA1 Message Date
Github Actions
835ee4e8de Publish
- @0x/contracts-integrations@2.7.53
 - @0x/asset-swapper@6.18.2
2021-06-24 19:25:12 +00:00
Github Actions
63ec42303f Updated CHANGELOGS & MD docs 2021-06-24 19:25:07 +00:00
Romain Butteaud
f789aebddc fix: duplicate SOURCE_FLAGS index (#266) 2021-06-24 11:58:05 -07:00
10 changed files with 29 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-integrations",
"version": "2.7.52",
"version": "2.7.53",
"private": true,
"engines": {
"node": ">=6.12"
@@ -93,7 +93,7 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/asset-swapper": "^6.18.1",
"@0x/asset-swapper": "^6.18.2",
"@0x/base-contract": "^6.4.0",
"@0x/contracts-asset-proxy": "^3.7.16",
"@0x/contracts-erc1155": "^2.1.34",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1624562704,
"version": "6.18.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "6.18.1",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.18.2 - _June 24, 2021_
* Dependencies updated
## v6.18.1 - _June 22, 2021_
* FirebirdOneSwap, ApeSwap. New hop tokens: DFYN, BANANA, WEXPOLY (#265)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-swapper",
"version": "6.18.1",
"version": "6.18.2",
"engines": {
"node": ">=6.12"
},

View File

@@ -262,13 +262,13 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
// HACK(mzhu25): Limit and RFQ orders need to be treated as different sources
// when computing the exchange proxy gas overhead.
export const SOURCE_FLAGS: { [key in ERC20BridgeSource]: number } & {
RfqOrder: number;
LimitOrder: number;
export const SOURCE_FLAGS: { [key in ERC20BridgeSource]: bigint } & {
RfqOrder: bigint;
LimitOrder: bigint;
} = Object.assign(
{},
...['RfqOrder', 'LimitOrder', ...Object.values(ERC20BridgeSource)].map((source, index) => ({
[source]: source === ERC20BridgeSource.Native ? 0 : 1 << index,
[source]: source === ERC20BridgeSource.Native ? BigInt(0) : BigInt(1) << BigInt(index),
})),
);

View File

@@ -523,7 +523,7 @@ export class MarketOperationUtils {
const sturdyFills = fills.filter(p => p.length > 0 && !fragileSources.includes(p[0].source));
const sturdyOptimalPath = await findOptimalPathAsync(side, sturdyFills, inputAmount, opts.runLimit, {
...penaltyOpts,
exchangeProxyOverhead: (sourceFlags: number) =>
exchangeProxyOverhead: (sourceFlags: bigint) =>
// tslint:disable-next-line: no-bitwise
penaltyOpts.exchangeProxyOverhead(sourceFlags | optimalPath.sourceFlags),
});

View File

@@ -36,7 +36,7 @@ export const DEFAULT_PATH_PENALTY_OPTS: PathPenaltyOpts = {
export class Path {
public collapsedFills?: ReadonlyArray<CollapsedFill>;
public orders?: OptimizedMarketOrder[];
public sourceFlags: number = 0;
public sourceFlags: bigint = BigInt(0);
protected _size: PathSize = { input: ZERO_AMOUNT, output: ZERO_AMOUNT };
protected _adjustedSize: PathSize = { input: ZERO_AMOUNT, output: ZERO_AMOUNT };
@@ -95,7 +95,7 @@ export class Path {
const nativeFills = this.fills.filter(f => f.source === ERC20BridgeSource.Native);
this.fills = [...nativeFills.filter(f => f !== lastNativeFillIfExists), ...fallback.fills];
// Recompute the source flags
this.sourceFlags = this.fills.reduce((flags, fill) => flags | fill.flags, 0);
this.sourceFlags = this.fills.reduce((flags, fill) => flags | fill.flags, BigInt(0));
return this;
}

View File

@@ -274,7 +274,7 @@ export interface Fill<TFillData extends FillData = FillData> {
// paths that have the same `source` IDs but are distinct (e.g., Curves).
sourcePathId: string;
// See `SOURCE_FLAGS`.
flags: number;
flags: bigint;
// Input fill amount (taker asset amount in a sell, maker asset amount in a buy).
input: BigNumber;
// Output fill amount (maker asset amount in a sell, taker asset amount in a buy).
@@ -363,7 +363,7 @@ export interface GetMarketOrdersRfqOpts extends RfqRequestOpts {
export type FeeEstimate = (fillData: FillData) => number | BigNumber;
export type FeeSchedule = Partial<{ [key in ERC20BridgeSource]: FeeEstimate }>;
export type ExchangeProxyOverhead = (sourceFlags: number) => BigNumber;
export type ExchangeProxyOverhead = (sourceFlags: bigint) => BigNumber;
/**
* Options for `getMarketSellOrdersAsync()` and `getMarketBuyOrdersAsync()`.
@@ -465,7 +465,7 @@ export interface SourceQuoteOperation<TFillData extends FillData = FillData> ext
export interface OptimizerResult {
optimizedOrders: OptimizedMarketOrder[];
sourceFlags: number;
sourceFlags: bigint;
liquidityDelivered: CollapsedFill[] | DexSample<MultiHopFillData>;
marketSideLiquidity: MarketSideLiquidity;
adjustedRate: BigNumber;

View File

@@ -39,7 +39,7 @@ const feeSchedule = {
[ERC20BridgeSource.Native]: _.constant(GAS_PRICE.times(NATIVE_ORDER_FEE)),
};
const exchangeProxyOverhead = (sourceFlags: number) => {
const exchangeProxyOverhead = (sourceFlags: bigint) => {
if ([SOURCE_FLAGS.RfqOrder].includes(sourceFlags)) {
return new BigNumber(20e3).times(GAS_PRICE);
} else {

View File

@@ -1280,7 +1280,7 @@ describe('MarketOperationUtils tests', () => {
});
const optimizer = new MarketOperationUtils(MOCK_SAMPLER, contractAddresses, ORDER_DOMAIN);
const gasPrice = 100e9; // 100 gwei
const exchangeProxyOverhead = (sourceFlags: number) =>
const exchangeProxyOverhead = (sourceFlags: bigint) =>
sourceFlags === SOURCE_FLAGS.LiquidityProvider
? constants.ZERO_AMOUNT
: new BigNumber(1.3e5).times(gasPrice);
@@ -1663,7 +1663,7 @@ describe('MarketOperationUtils tests', () => {
});
const optimizer = new MarketOperationUtils(MOCK_SAMPLER, contractAddresses, ORDER_DOMAIN);
const gasPrice = 100e9; // 100 gwei
const exchangeProxyOverhead = (sourceFlags: number) =>
const exchangeProxyOverhead = (sourceFlags: bigint) =>
sourceFlags === SOURCE_FLAGS.LiquidityProvider
? constants.ZERO_AMOUNT
: new BigNumber(1.3e5).times(gasPrice);