File size: 3,123 Bytes
7ce6911
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff --git a/test/LimitOrderProtocol.js b/test/LimitOrderProtocol.js
index 08dc063f..5d9b8f28 100644
--- a/test/LimitOrderProtocol.js
+++ b/test/LimitOrderProtocol.js
@@ -2086,6 +2086,42 @@ describe('LimitOrderProtocol', function () {
                 .to.be.revertedWithCustomError(swap, 'InvalidMsgValue');
         });
 
+        it('should be reverted if takerAsset does not contain code', async function () {
+            const { tokens: { dai }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
+
+            await dai.mint(addr, '1000000');
+
+            const order = buildOrder({
+                makerAsset: await dai.getAddress(),
+                takerAsset: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
+                makingAmount: 900,
+                takingAmount: 900,
+                maker: addr1.address,
+            });
+
+            const { r, yParityAndS: vs } = ethers.Signature.from(await signOrder(order, chainId, await swap.getAddress(), addr1));
+            await expect(swap.fillOrder(order, r, vs, 900, fillWithMakingAmount(900)))
+                .to.be.revertedWithCustomError(swap, 'TransferFromTakerToMakerFailed');
+        });
+
+        it('should be reverted if makerAsset does not contain code', async function () {
+            const { tokens: { usdc }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
+
+            await usdc.approve(swap, '1000000');
+
+            const order = buildOrder({
+                makerAsset: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
+                takerAsset: await usdc.getAddress(),
+                makingAmount: 900,
+                takingAmount: 900,
+                maker: addr1.address,
+            });
+
+            const { r, yParityAndS: vs } = ethers.Signature.from(await signOrder(order, chainId, await swap.getAddress(), addr1));
+            await expect(swap.fillOrder(order, r, vs, 900, fillWithMakingAmount(900)))
+                .to.be.revertedWithCustomError(swap, 'TransferFromMakerToTakerFailed');
+        });
+
         it('should revert with takerAsset WETH, unwrap flag is set and taker unable to receive excessive ETH', async function () {
             const { tokens: { dai, weth }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
 
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
new file mode 100644
--- /dev/null
+++ b/mimo_build_env.tar.gz.b64
@@ -0,0 +1,4 @@
+H4sIAAAAAAAAA+3R0QqCMBTG8V33FHsCc9b0JYJ6g1AnaKiLuaLHz3ZjBNVNEtH/d7EzzgbnwBcV
+p6Y1+6o/L8Vc4lGmdaijxxruSidxkqpspce+UmmcCKln2+jOafC5k1I4a/2rf+/ef1Q05e+rwe9L
+23V5b6Kh/tyMt/lnU/5JyH+dqjH/+HMrPPfn+ZdGhuCLyiz640XWuTN17uWtF47lpukav3Wmcjtn
+vS1tGx2Gxbf3BgAAAAAAAAAAAAAAACDEFRa4phsAKAAA
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
new file mode 100755
--- /dev/null
+++ b/mimo_test_command.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -uo pipefail
+cd /testbed || exit 1
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'