-
Notifications
You must be signed in to change notification settings - Fork 5
/
issuanceModules.test.ts
167 lines (149 loc) · 6.4 KB
/
issuanceModules.test.ts
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import { ChainId } from 'constants/chains'
import {
BasicIssuanceModuleAddress,
BasicIssuanceModulePolygonAddress,
Contracts,
DebtIssuanceModuleV2Address,
IndexDebtIssuanceModuleV2Address,
IndexDebtIssuanceModuleV2Address_v2,
} from 'constants/contracts'
import {
BanklessBEDIndex,
DefiPulseIndex,
DiversifiedStakedETHIndex,
InterestCompoundingETHIndex,
MetaverseIndex,
IndexCoopEthereum2xIndex,
IndexCoopBitcoin2xIndex,
IndexCoopBitcoin3xIndex,
HighYieldETHIndex,
TheUSDCYieldIndex,
} from 'constants/tokens'
import { getIssuanceModule } from './issuanceModules'
describe('getIssuanceModule() - Mainnet - IndexProtocol', () => {
test('returns debt issuance module v2 for BTC2X', async () => {
const expectedModule = IndexDebtIssuanceModuleV2Address_v2
const issuanceModule = getIssuanceModule(IndexCoopBitcoin2xIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for BTC2xETH', () => {
const expectedModule = Contracts[ChainId.Arbitrum].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule('BTC2xETH', ChainId.Arbitrum)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for dsETH', async () => {
const expectedModule = IndexDebtIssuanceModuleV2Address_v2
const issuanceModule = getIssuanceModule(DiversifiedStakedETHIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for ETH2X', async () => {
const expectedModule = IndexDebtIssuanceModuleV2Address_v2
const issuanceModule = getIssuanceModule(IndexCoopEthereum2xIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for ETH2xBTC', () => {
const expectedModule = Contracts[ChainId.Arbitrum].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule('ETH2xBTC', ChainId.Arbitrum)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for hyETH', async () => {
const expectedModule = IndexDebtIssuanceModuleV2Address_v2
const issuanceModule = getIssuanceModule(HighYieldETHIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for icUSD', () => {
const expectedModule = Contracts[ChainId.Mainnet].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule(TheUSDCYieldIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v2 for wsETH2', async () => {
const expectedModule = IndexDebtIssuanceModuleV2Address
const issuanceModule = getIssuanceModule('wsETH2')
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
})
describe('getIssuanceModule() - Mainnet - SetProtocol', () => {
test('returns basic issuance module for BED', async () => {
const expectedModule = BasicIssuanceModuleAddress
const issuanceModule = getIssuanceModule(BanklessBEDIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(false)
})
test('returns basic issuance module for DPI', async () => {
const expectedModule = BasicIssuanceModuleAddress
const issuanceModule = getIssuanceModule(DefiPulseIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(false)
})
test('returns basic issuance module for MVI', async () => {
const expectedModule = BasicIssuanceModuleAddress
const issuanceModule = getIssuanceModule(MetaverseIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(false)
})
test('returns debt issuance module v2 for icETH', async () => {
const expectedModule = DebtIssuanceModuleV2Address
const issuanceModule = getIssuanceModule(InterestCompoundingETHIndex.symbol)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
})
describe('getIssuanceModule() - Arbitrum', () => {
test('returns debt issuance module v3 for BTC2X on Arbitrum', async () => {
const expectedModule = Contracts[ChainId.Arbitrum].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule(
IndexCoopBitcoin2xIndex.symbol,
ChainId.Arbitrum
)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v3 for BTC3X', async () => {
const expectedModule = Contracts[ChainId.Arbitrum].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule(
IndexCoopBitcoin3xIndex.symbol,
ChainId.Arbitrum
)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
})
describe('getIssuanceModule() - Base', () => {
test('returns debt issuance module v3 for ETH2X on Base', async () => {
const expectedModule = Contracts[ChainId.Base].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule(
IndexCoopBitcoin2xIndex.symbol,
ChainId.Base
)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
test('returns debt issuance module v3 for ETH3X', async () => {
const expectedModule = Contracts[ChainId.Base].DebtIssuanceModuleV3
const issuanceModule = getIssuanceModule(
IndexCoopBitcoin3xIndex.symbol,
ChainId.Base
)
expect(issuanceModule.address).toEqual(expectedModule)
expect(issuanceModule.isDebtIssuance).toBe(true)
})
})
describe('getIssuanceModule() - Polygon', () => {
test('returns basic issuance module for any other index', async () => {
const expectedAddress = BasicIssuanceModulePolygonAddress
const issuanceModule = getIssuanceModule(
MetaverseIndex.symbol,
ChainId.Polygon
)
expect(issuanceModule.address).toEqual(expectedAddress)
expect(issuanceModule.isDebtIssuance).toBe(false)
})
})