Lawrence Forman a74a3450eb
@0x/contracts-zero-ex: Add CurveLiquidityProvider and misc refactors (#127)
* `@0x/contracts-zero-ex`: Add `CurveLiquidityProvider` and misc refactors

* `@0x/asset-swapper`: Fix compiler error on `ILiquidityProvider` call
`@0x/protocol-utils`: Add VIP utils.

* `@0x/contracts-zero-ex`: Rebase and fix comiler warnings

* `@0x/asset-swapper`: Clean up curve VIP integration

* `@0x/protocol-utils`: Update changelog

* `@0x/protocol-utils`: tsdoc new functions

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-02-11 19:13:17 -05:00

28 lines
825 B
TypeScript

import { AbiEncoder, BigNumber } from '@0x/utils';
export interface CurveLiquidityProviderData {
curveAddress: string;
exchangeFunctionSelector: string;
fromCoinIdx: BigNumber;
toCoinIdx: BigNumber;
}
export const curveLiquidityProviderDataEncoder = AbiEncoder.create([
{ name: 'curveAddress', type: 'address' },
{ name: 'exchangeFunctionSelector', type: 'bytes4' },
{ name: 'fromCoinIdx', type: 'int128' },
{ name: 'toCoinIdx', type: 'int128' },
]);
/**
* Encode data for the curve liquidity provider contract.
*/
export function encodeCurveLiquidityProviderData(data: CurveLiquidityProviderData): string {
return curveLiquidityProviderDataEncoder.encode([
data.curveAddress,
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
]);
}