@@ -35,6 +35,9 @@ describe('Neutron / Slinky', () => {
35
35
36
36
let proposalId : number ;
37
37
38
+ let oracleContract : string ;
39
+ let marketmapContract : string ;
40
+
38
41
beforeAll ( async ( ) => {
39
42
testState = new TestStateLocalCosmosTestNet ( config ) ;
40
43
await testState . init ( ) ;
@@ -66,6 +69,44 @@ describe('Neutron / Slinky', () => {
66
69
} ) ;
67
70
} ) ;
68
71
72
+ describe ( 'prepare: deploy contract' , ( ) => {
73
+ test ( 'setup oracle contract' , async ( ) => {
74
+ const codeId = await neutronAccount . storeWasm ( NeutronContract . ORACLE ) ;
75
+ expect ( codeId ) . toBeGreaterThan ( 0 ) ;
76
+
77
+ const res = await neutronAccount . instantiateContract (
78
+ codeId ,
79
+ '{}' ,
80
+ 'oracle' ,
81
+ ) ;
82
+ oracleContract = res [ 0 ] . _contract_address ;
83
+ } ) ;
84
+
85
+ test ( 'setup marketmap contract' , async ( ) => {
86
+ const codeId = await neutronAccount . storeWasm ( NeutronContract . MARKETMAP ) ;
87
+ expect ( codeId ) . toBeGreaterThan ( 0 ) ;
88
+
89
+ const res = await neutronAccount . instantiateContract (
90
+ codeId ,
91
+ '{}' ,
92
+ 'marketmap' ,
93
+ ) ;
94
+ marketmapContract = res [ 0 ] . _contract_address ;
95
+ } ) ;
96
+ } ) ;
97
+
98
+ describe ( 'before create market map' , ( ) => {
99
+ test ( 'query last should return null' , async ( ) => {
100
+ const res = await neutronChain . queryContract < LastUpdatedResponse > (
101
+ marketmapContract ,
102
+ {
103
+ last_updated : { } ,
104
+ } ,
105
+ ) ;
106
+ expect ( res . last_updated ) . toBe ( null ) ;
107
+ } ) ;
108
+ } ) ;
109
+
69
110
describe ( 'submit proposal' , ( ) => {
70
111
test ( 'create proposal' , async ( ) => {
71
112
const chainManagerAddress = ( await neutronChain . getChainAdmins ( ) ) [ 0 ] ;
@@ -157,23 +198,9 @@ describe('Neutron / Slinky', () => {
157
198
} ) ;
158
199
159
200
describe ( 'wasmbindings oracle' , ( ) => {
160
- let contractAddress : string ;
161
-
162
- test ( 'setup contract' , async ( ) => {
163
- const codeId = await neutronAccount . storeWasm ( NeutronContract . ORACLE ) ;
164
- expect ( codeId ) . toBeGreaterThan ( 0 ) ;
165
-
166
- const res = await neutronAccount . instantiateContract (
167
- codeId ,
168
- '{}' ,
169
- 'oracle' ,
170
- ) ;
171
- contractAddress = res [ 0 ] . _contract_address ;
172
- } ) ;
173
-
174
201
test ( 'query prices' , async ( ) => {
175
202
const res = await neutronChain . queryContract < GetPricesResponse > (
176
- contractAddress ,
203
+ oracleContract ,
177
204
{
178
205
get_prices : {
179
206
currency_pair_ids : [ 'TIA/USD' ] ,
@@ -186,7 +213,7 @@ describe('Neutron / Slinky', () => {
186
213
187
214
test ( 'query price' , async ( ) => {
188
215
const res = await neutronChain . queryContract < GetPriceResponse > (
189
- contractAddress ,
216
+ oracleContract ,
190
217
{
191
218
get_price : { currency_pair : { Base : 'TIA' , Quote : 'USD' } } ,
192
219
} ,
@@ -196,7 +223,7 @@ describe('Neutron / Slinky', () => {
196
223
197
224
test ( 'query currencies' , async ( ) => {
198
225
const res = await neutronChain . queryContract < GetAllCurrencyPairsResponse > (
199
- contractAddress ,
226
+ oracleContract ,
200
227
{
201
228
get_all_currency_pairs : { } ,
202
229
} ,
@@ -206,23 +233,9 @@ describe('Neutron / Slinky', () => {
206
233
} ) ;
207
234
} ) ;
208
235
describe ( 'wasmbindings marketmap' , ( ) => {
209
- let contractAddress : string ;
210
-
211
- test ( 'setup contract' , async ( ) => {
212
- const codeId = await neutronAccount . storeWasm ( NeutronContract . MARKETMAP ) ;
213
- expect ( codeId ) . toBeGreaterThan ( 0 ) ;
214
-
215
- const res = await neutronAccount . instantiateContract (
216
- codeId ,
217
- '{}' ,
218
- 'marketmap' ,
219
- ) ;
220
- contractAddress = res [ 0 ] . _contract_address ;
221
- } ) ;
222
-
223
236
test ( 'query last' , async ( ) => {
224
237
const res = await neutronChain . queryContract < LastUpdatedResponse > (
225
- contractAddress ,
238
+ marketmapContract ,
226
239
{
227
240
last_updated : { } ,
228
241
} ,
@@ -232,7 +245,7 @@ describe('Neutron / Slinky', () => {
232
245
233
246
test ( 'query market' , async ( ) => {
234
247
const res = await neutronChain . queryContract < MarketResponse > (
235
- contractAddress ,
248
+ marketmapContract ,
236
249
{
237
250
market : { currency_pair : { Base : 'TIA' , Quote : 'USD' } } ,
238
251
} ,
@@ -242,7 +255,7 @@ describe('Neutron / Slinky', () => {
242
255
243
256
test ( 'query market with empty metadata_JSON' , async ( ) => {
244
257
const res = await neutronChain . queryContract < MarketResponse > (
245
- contractAddress ,
258
+ marketmapContract ,
246
259
{
247
260
market : { currency_pair : { Base : 'USDT' , Quote : 'USD' } } ,
248
261
} ,
@@ -252,7 +265,7 @@ describe('Neutron / Slinky', () => {
252
265
253
266
test ( 'query market map' , async ( ) => {
254
267
const res = await neutronChain . queryContract < MarketMapResponse > (
255
- contractAddress ,
268
+ marketmapContract ,
256
269
{
257
270
market_map : { } ,
258
271
} ,
@@ -265,7 +278,7 @@ describe('Neutron / Slinky', () => {
265
278
266
279
test ( 'query params' , async ( ) => {
267
280
const res = await neutronChain . queryContract < ParamsResponse > (
268
- contractAddress ,
281
+ marketmapContract ,
269
282
{
270
283
params : { } ,
271
284
} ,
0 commit comments