@0x:contracts-exchange
Added tests for matchOrders protocol fees
This commit is contained in:
@@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { artifacts, TestProtocolFeesContract, TestProtocolFeesReceiverContract } from '../src';
|
||||
|
||||
blockchainTests('Protocol Fee Payments', env => {
|
||||
blockchainTests.only('Protocol Fee Payments', env => {
|
||||
let testProtocolFees: TestProtocolFeesContract;
|
||||
let testProtocolFeesReceiver: TestProtocolFeesReceiverContract;
|
||||
|
||||
@@ -75,4 +75,54 @@ blockchainTests('Protocol Fee Payments', env => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
blockchainTests.resets('matchOrders Protocol Fees', () => {
|
||||
it('should not pay protocol fee when there is no registered protocol fee collector', async () => {
|
||||
await testProtocolFeesReceiver.testMatchOrdersProtocolFees.awaitTransactionSuccessAsync(
|
||||
testProtocolFees.address,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
false,
|
||||
{
|
||||
gasPrice: DEFAULT_GAS_PRICE,
|
||||
value: DEFAULT_PROTOCOL_FEE,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should pay protocol fee in WETH when too little value is sent', async () => {
|
||||
await testProtocolFeesReceiver.testMatchOrdersProtocolFees.awaitTransactionSuccessAsync(
|
||||
testProtocolFees.address,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
true,
|
||||
{
|
||||
gasPrice: DEFAULT_GAS_PRICE,
|
||||
value: DEFAULT_PROTOCOL_FEE.minus(new BigNumber(10)),
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should pay protocol fee in ETH when the correct value is sent', async () => {
|
||||
await testProtocolFeesReceiver.testMatchOrdersProtocolFees.awaitTransactionSuccessAsync(
|
||||
testProtocolFees.address,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
true,
|
||||
{
|
||||
gasPrice: DEFAULT_GAS_PRICE,
|
||||
value: DEFAULT_PROTOCOL_FEE,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should pay protocol fee in ETH when extra value is sent', async () => {
|
||||
await testProtocolFeesReceiver.testMatchOrdersProtocolFees.awaitTransactionSuccessAsync(
|
||||
testProtocolFees.address,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
true,
|
||||
{
|
||||
gasPrice: DEFAULT_GAS_PRICE,
|
||||
value: DEFAULT_PROTOCOL_FEE.plus(new BigNumber(10)),
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user