protocol/contracts/zero-ex/test/lib_limit_orders_test.ts
Lawrence Forman 561b60a24d
EP Native Orders (#27)
* `@0x/contracts-zero-ex`: add limit orders feature
`@0x/contracts-utils`: add `uint128` functions to `LibSafeMathV06`

* `@0x/contract-addresses`: Update ganache snapshot addresses

* `@0x/contracts-zero-ex`: Mask EIP712 struct hash values.

* `@0x/contracts-zero-ex`: Add more limit order tests

* `@0x/contracts-zero-ex`: Fix typos

* `@0x/contracts-zero-ex`: Compute fee collector address after protocol fee zero check.

* `@0x/contracts-zero-ex`: Remove WETH payment logic from fee collector fixin

* `@0x/contracts-zero-ex`: Convert all ETH to WETH in `FeeCollector`.

* `@0x/contracts-zero-ex`: Address review feedback

* `@0x/contracts-zero-ex`: Export more utils

* `@0x/contracts-zero-ex`: Rename `LimitOrdersFeatures`, `LibLimitOrders`, etc. into `*NativeOrders*`.
`@0x/contracts-zero-ex`: Emit `protocolFeePaid` in native order fill events.
`@0x/contracts-zero-ex`: Refactor to get around stack limits.
`@0x/contracts-zero-ex`: Use different storage mappings for RFQ and limit order pair cancellations.

* `@0x/contracts-zero-ex`: Add `getProtocolFeeMultiplier()` and `transferProtocolFeesForPools()` to `NativeOrdersFeature`.

* `@0x/contracts-zero-ex`: Fix broken tests

* update orders docs

* `@0x/contracts-zero-ex`: Add more tests to `NativeOrdersFeature`

* rebuild after rebase

* `@0x/contract-addresses`: Fix changelog booboo

* `@0x/contracts-zero-ex`: Add method selectors output to generated artifacts

* `@0x/contracts-zero-ex`: Add maker address to order cancel events.
`@0x/contracts-zreo-ex`: Remove `UpTo` suffix from order pair cancellation functions.
`@0x/contracts-zreo-ex`: Address misc review comments.

* `@0x/contracts-zero-ex`: More SafeMath in native orders

* update orders docs

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-11-17 15:39:40 -05:00

35 lines
1.2 KiB
TypeScript

import { blockchainTests, describe, expect } from '@0x/contracts-test-utils';
import { artifacts } from './artifacts';
import { getRandomLimitOrder, getRandomRfqOrder } from './utils/orders';
import { TestLibNativeOrderContract } from './wrappers';
blockchainTests('LibLimitOrder tests', env => {
let testContract: TestLibNativeOrderContract;
before(async () => {
testContract = await TestLibNativeOrderContract.deployFrom0xArtifactAsync(
artifacts.TestLibNativeOrder,
env.provider,
env.txDefaults,
artifacts,
);
});
describe('getLimitOrderStructHash()', () => {
it('returns the correct hash', async () => {
const order = getRandomLimitOrder();
const structHash = await testContract.getLimitOrderStructHash(order).callAsync();
expect(structHash).to.eq(order.getStructHash());
});
});
describe('getRfqOrderStructHash()', () => {
it('returns the correct hash', async () => {
const order = getRandomRfqOrder();
const structHash = await testContract.getRfqOrderStructHash(order).callAsync();
expect(structHash).to.eq(order.getStructHash());
});
});
});