1
+ import "module-alias/register" ;
2
+ import { deployments } from "hardhat" ;
3
+
4
+ import { Account } from "@utils/types" ;
5
+
6
+ import {
7
+ ManagerCore ,
8
+ ManagerCore__factory ,
9
+ BatchTradeExtension ,
10
+ BatchTradeExtension__factory ,
11
+ } from "@set/typechain/index" ;
12
+
13
+ import {
14
+ addSnapshotBeforeRestoreAfterEach ,
15
+ getAccounts ,
16
+ getWaffleExpect ,
17
+ findDependency ,
18
+ getContractAddress ,
19
+ } from "@utils/index" ;
20
+ import { DEPENDENCY } from "../../deployments/utils/dependencies" ;
21
+ import { CONTRACT_NAMES } from "../../deployments/constants/003_batch_trade_extension" ;
22
+
23
+ const {
24
+ TRADE_MODULE
25
+ } = DEPENDENCY ;
26
+
27
+ const expect = getWaffleExpect ( ) ;
28
+
29
+ describe ( "Batch Trade Extension" , ( ) => {
30
+ let deployer : Account ;
31
+
32
+ let managerCoreInstance : ManagerCore ;
33
+ let batchTradeExtensionInstance : BatchTradeExtension ;
34
+
35
+ before ( async ( ) => {
36
+ [ deployer ] = await getAccounts ( ) ;
37
+
38
+ await deployments . fixture ( ) ;
39
+
40
+ const deployedManagerCoreContract = await getContractAddress ( CONTRACT_NAMES . MANAGER_CORE ) ;
41
+ managerCoreInstance = new ManagerCore__factory ( deployer . wallet ) . attach ( deployedManagerCoreContract ) ;
42
+
43
+ const deployedBatchTradeExtensionContract = await getContractAddress ( CONTRACT_NAMES . BATCH_TRADE_EXTENSION ) ;
44
+ batchTradeExtensionInstance = new BatchTradeExtension__factory ( deployer . wallet ) . attach ( deployedBatchTradeExtensionContract ) ;
45
+ } ) ;
46
+
47
+ addSnapshotBeforeRestoreAfterEach ( ) ;
48
+
49
+ describe ( "BatchTradeExtension" , async ( ) => {
50
+ it ( "should have the correct ManagerCore address" , async ( ) => {
51
+ const managerCore = await batchTradeExtensionInstance . managerCore ( ) ;
52
+ expect ( managerCore ) . to . eq ( managerCoreInstance . address ) ;
53
+ } ) ;
54
+
55
+ it ( "should have the correct TradeModule address" , async ( ) => {
56
+ const tradeModule = await batchTradeExtensionInstance . tradeModule ( ) ;
57
+ expect ( tradeModule ) . to . eq ( await findDependency ( TRADE_MODULE ) ) ;
58
+ } ) ;
59
+
60
+ it ( "should be a valid extension on the ManagerCore" , async ( ) => {
61
+ const validBatchTradeExtension = await managerCoreInstance . isExtension ( batchTradeExtensionInstance . address ) ;
62
+ expect ( validBatchTradeExtension ) . to . eq ( true ) ;
63
+ } ) ;
64
+
65
+ it ( "should have set the correct integrations length of 1" , async ( ) => {
66
+ const integrations = await batchTradeExtensionInstance . getIntegrations ( ) ;
67
+ expect ( integrations . length ) . to . eq ( 1 ) ;
68
+ } ) ;
69
+
70
+ it ( "should have ZeroExApiAdapterV5 as a valid integration" , async ( ) => {
71
+ const validZeroExApiAdapterV5 = await batchTradeExtensionInstance . isIntegration ( "ZeroExApiAdapterV5" ) ;
72
+ expect ( validZeroExApiAdapterV5 ) . to . eq ( true ) ;
73
+ } ) ;
74
+ } ) ;
75
+ } ) ;
0 commit comments