bsc<->development rebase (#189)

* FQT: Pack Protocol/source name into source ID (#162)

* `@0x/contracts-zero-ex`: Encode protocol ID and source name in bridge source ID
`@0x/asset-swapper`: Use new bridge source ID encoding.

* fix linter issues

* contracts cleanup (#164)

* `@0x/contracts-zero-ex`: Add PancakeSwapFeature

* `@0x/contracts-zero-ex`: Remove tokenspender/allowance target/greedy tokens stuff.'
`@0x/contract-addresses`: Add BSC addresses. Remove exchangeProxyAllowanceTarget.
`@0x/migrations`: Remove exchangeProxyAllowanceTarget.

* Update contracts/zero-ex/contracts/src/features/IPancakeSwapFeature.sol

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>

* `@0x/contracts-zero-ex`: Add sushiswap support to PancakeSwap

* `@0x/contract-artifacts`: Regenerate artifacts
`@0x/contract-wrappers`: Regenerate wrappers

* `@0x/contract-addresses`: Add BSC addresses

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>

* feat: Better chain support (#163)

* feat: Better chain support

* feat: better chain support refactor deployment constants (#166)

* proliferate the chainId

* Refactor sampler to remove DeploymentConstants dependency and fixed addresses

* Rework WETH out, replacing with address(0)

* wat

* hack DeploymentConstants for now

* proliferate the chainId

* Refactor sampler to remove DeploymentConstants dependency and fixed addresses

* remove duped network addresses

* Rework the bridge source encoder

* Use the constants NATIVE_FEE_TOKEN in EP consumer

* `@0x/contract-addresses`: Fix WBNB address (#170)

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>

* multichain enable cakez vip (#171)

* feat: Better chain support

* feat: better chain support refactor deployment constants (#166)

* proliferate the chainId

* Refactor sampler to remove DeploymentConstants dependency and fixed addresses

* Rework WETH out, replacing with address(0)

* wat

* hack DeploymentConstants for now

* proliferate the chainId

* Refactor sampler to remove DeploymentConstants dependency and fixed addresses

* remove duped network addresses

* `asset-swapper`: enable pancake VIP route generation

Co-authored-by: Jacob Evans <jacob@dekz.net>
Co-authored-by: Lawrence Forman <me@merklejerk.com>

* `@0x/contracts-zero-ex`: Fix `PancakeSwapFeature` sushi values (#172)

* `@0x/contracts-zero-ex`: Fix `PancakeSwapFeature` sushi values

* `@0x/contracts-zero-ex`: I am a bad protocologist

Co-authored-by: Lawrence Forman <me@merklejerk.com>

* feat: BSC Nerve + Dodo + Nerve + Ellipsis (#181)

* feat: BSC Nerve + DODO v1

* CHANGELOGs

* Remove extra balance fetch

* Add Belt

* Added Ellipsis

* Update FQT address

* `@0x/contracts-zero-ex`: Delete TokenSpenderFeature and get stuff compiling

* `@0x/asset-swapper`: fix compilation

* prettier

* `@0x/asset-swapper`: Truncate LiquidityProvider source ID name

* Update packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts

Co-authored-by: Jacob Evans <jacob@dekz.net>

* Update packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts

Co-authored-by: Jacob Evans <jacob@dekz.net>

* `@0x/contracts-zero-ex`: Fix BakerySwap on PackageSwapFeature (#190)

* address review comments

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>
Co-authored-by: Jacob Evans <jacob@dekz.net>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
This commit is contained in:
Lawrence Forman
2021-03-31 18:49:44 -04:00
committed by GitHub
parent 70ddab0231
commit 164a5d44d9
99 changed files with 2559 additions and 3029 deletions

View File

@@ -1,4 +1,13 @@
[
{
"version": "1.4.0",
"changes": [
{
"note": "Added Nerve",
"pr": 181
}
]
},
{
"timestamp": 1616005394,
"version": "1.3.1",

View File

@@ -1,11 +1,11 @@
import { AbiEncoder, BigNumber, NULL_ADDRESS } from '@0x/utils';
import { AbiEncoder, BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
import * as ethjs from 'ethereumjs-util';
import { LimitOrder, LimitOrderFields, RfqOrder, RfqOrderFields } from './orders';
import { Signature, SIGNATURE_ABI } from './signature_utils';
const BRIDGE_ORDER_ABI_COMPONENTS = [
{ name: 'source', type: 'uint256' },
{ name: 'source', type: 'bytes32' },
{ name: 'takerTokenAmount', type: 'uint256' },
{ name: 'makerTokenAmount', type: 'uint256' },
{ name: 'bridgeData', type: 'bytes' },
@@ -104,38 +104,38 @@ export interface FillQuoteTransformerData {
refundReceiver: string;
}
// tslint:disable: enum-naming
/**
* Identifies the DEX type of a bridge order.
* Identifies the DEX protocol used to fill a bridge order.
*/
export enum BridgeSource {
Balancer,
Bancor,
// tslint:disable-next-line: enum-naming
CoFiX,
export enum BridgeProtocol {
Unknown,
Curve,
Cream,
CryptoCom,
Dodo,
UniswapV2,
Uniswap,
Balancer,
Kyber,
LiquidityProvider,
Mooniswap,
MStable,
Oasis,
Shell,
Snowswap,
Sushiswap,
Swerve,
Uniswap,
UniswapV2,
Dodo,
DodoV2,
Linkswap,
CryptoCom,
Bancor,
CoFiX,
Nerve,
}
// tslint:enable: enum-naming
/**
* `FillQuoteTransformer.BridgeOrder`
*/
export interface FillQuoteTransformerBridgeOrder {
source: BridgeSource;
// A bytes32 hex where the upper 16 bytes are an int128, right-aligned
// protocol ID and the lower 16 bytes are a bytes16, left-aligned,
// ASCII source name.
source: string;
takerTokenAmount: BigNumber;
makerTokenAmount: BigNumber;
bridgeData: string;
@@ -353,3 +353,17 @@ export function encodePositiveSlippageFeeTransformerData(data: PositiveSlippageF
export function decodePositiveSlippageFeeTransformerData(encoded: string): PositiveSlippageFeeTransformerData {
return positiveSlippageFeeTransformerDataEncoder.decode(encoded);
}
/**
* Packs a bridge protocol ID and an ASCII DEX name into a single byte32.
*/
export function encodeBridgeSourceId(protocol: BridgeProtocol, name: string): string {
const nameBuf = Buffer.from(name);
if (nameBuf.length > 16) {
throw new Error(`"${name}" is too long to be a bridge source name (max of 16 ascii chars)`);
}
return hexUtils.concat(
hexUtils.leftPad(hexUtils.toHex(protocol), 16),
hexUtils.rightPad(hexUtils.toHex(Buffer.from(name)), 16),
);
}