aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-30 03:11:06 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commit003075a8a594060817f2ddcb2124580e27b6b2a8 (patch)
treec80cde0630092372597c5c49dcb3a1ec027c2fc4 /packages
parentb4aca370defb9dfe6c01b60d1b522d4a7b731f43 (diff)
downloaddexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar.gz
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar.bz2
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar.lz
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar.xz
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.tar.zst
dexon-sol-tools-003075a8a594060817f2ddcb2124580e27b6b2a8.zip
WIP - Tests for compliant forwarder
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol1
-rw-r--r--packages/contracts/test/extensions/compliant_forwarder.ts16
2 files changed, 12 insertions, 5 deletions
diff --git a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
index 2febc5cce..0ecf44006 100644
--- a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
+++ b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
@@ -51,6 +51,7 @@ contract CompliantForwarder {
if (selector != EXCHANGE_FILL_ORDER_SELECTOR) {
revert("EXCHANGE_TRANSACTION_NOT_FILL_ORDER");
}
+
// Extract maker address from fill order transaction
// Below is the table of calldata offsets into a fillOrder transaction.
diff --git a/packages/contracts/test/extensions/compliant_forwarder.ts b/packages/contracts/test/extensions/compliant_forwarder.ts
index 9100c32f8..da023a192 100644
--- a/packages/contracts/test/extensions/compliant_forwarder.ts
+++ b/packages/contracts/test/extensions/compliant_forwarder.ts
@@ -147,7 +147,7 @@ describe.only(ContractName.Forwarder, () => {
const defaultTakerAssetAddress = wethContract.address;
const defaultOrderParams = {
exchangeAddress: exchangeInstance.address,
- compliantMakerAddress,
+ makerAddress: compliantMakerAddress,
feeRecipientAddress,
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
@@ -174,10 +174,15 @@ describe.only(ContractName.Forwarder, () => {
/*
forwarderWrapper = new ForwarderWrapper(compliantForwarderContract, provider);
*/
+ // Initialize Yes Token
+ await yesTokenInstance._upgradeable_initialize.sendTransactionAsync({from: owner});
+ const yesTokenName = "YesToken";
+ const yesTokenTicker = "YEET";
+ await yesTokenInstance.initialize.sendTransactionAsync(yesTokenName, yesTokenTicker, {from: owner});
// Verify Maker / Taker
const addressesCanControlTheirToken = true;
- compliantMakerYesTokenId = await yesTokenInstance.mint2.sendTransactionAsync(compliantMakerAddress, compliantMakerEntityId, addressesCanControlTheirToken, compliantMakerCountryCode, [compliantMakerYesMark]);
- compliantTakerYesTokenId = await yesTokenInstance.mint2.sendTransactionAsync(compliantTakerAddress, compliantTakerEntityId, addressesCanControlTheirToken, compliantTakerCountryCode, [compliantTakerYesMark]);
+ compliantMakerYesTokenId = await yesTokenInstance.mint2.sendTransactionAsync(compliantMakerAddress, compliantMakerEntityId, addressesCanControlTheirToken, compliantMakerCountryCode, [compliantMakerYesMark], {from: owner});
+ compliantTakerYesTokenId = await yesTokenInstance.mint2.sendTransactionAsync(compliantTakerAddress, compliantTakerEntityId, addressesCanControlTheirToken, compliantTakerCountryCode, [compliantTakerYesMark], {from: owner});
// Create Valid/Invalid orders
const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(compliantTakerAddress)];
const takerTransactionFactory = new TransactionFactory(takerPrivateKey, exchangeInstance.address);
@@ -200,13 +205,14 @@ describe.only(ContractName.Forwarder, () => {
});
describe.only('fillOrder', () => {
- let takerAssetFillAmount: BigNumber;
beforeEach(async () => {
erc20Balances = await erc20Wrapper.getBalancesAsync();
});
// @TODO: Should fail if order's senderAddress is not set to the compliant forwarding contract
- // @TODO: Should fail if the
+ // @TODO: Should fail if the signed transaction is not intended for fillOrder
+ // @TODO: Should fail if maker is not verified
+ // @TODO: Should fail it taker is not verified
it.only('should transfer the correct amounts when maker and taker are verified', async () => {
await compliantForwarderInstance.fillOrder.sendTransactionAsync(compliantSignedFillOrderTx.salt, compliantSignedFillOrderTx.signerAddress, compliantSignedFillOrderTx.data, compliantSignedFillOrderTx.signature);