@@ -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];
@@ -94,6 +135,26 @@ describe('Neutron / Slinky', () => {
94
135
},
95
136
],
96
137
},
138
+ {
139
+ ticker: {
140
+ currency_pair: {
141
+ Base: 'USDT',
142
+ Quote: 'USD',
143
+ },
144
+ decimals: 6,
145
+ min_provider_count: 1,
146
+ enabled: false,
147
+ metadata_JSON: '',
148
+ },
149
+ provider_configs: [
150
+ {
151
+ name: 'kraken_api',
152
+ off_chain_ticker: 'USDTUSD',
153
+ invert: false,
154
+ metadata_JSON: '',
155
+ },
156
+ ],
157
+ },
97
158
],
98
159
);
99
160
});
@@ -137,23 +198,9 @@ describe('Neutron / Slinky', () => {
137
198
});
138
199
139
200
describe('wasmbindings oracle', () => {
140
- let contractAddress: string;
141
-
142
- test('setup contract', async () => {
143
- const codeId = await neutronAccount.storeWasm(NeutronContract.ORACLE);
144
- expect(codeId).toBeGreaterThan(0);
145
-
146
- const res = await neutronAccount.instantiateContract(
147
- codeId,
148
- '{}',
149
- 'oracle',
150
- );
151
- contractAddress = res[0]._contract_address;
152
- });
153
-
154
201
test('query prices', async () => {
155
202
const res = await neutronChain.queryContract<GetPricesResponse>(
156
- contractAddress ,
203
+ oracleContract ,
157
204
{
158
205
get_prices: {
159
206
currency_pair_ids: ['TIA/USD'],
@@ -166,7 +213,7 @@ describe('Neutron / Slinky', () => {
166
213
167
214
test('query price', async () => {
168
215
const res = await neutronChain.queryContract<GetPriceResponse>(
169
- contractAddress ,
216
+ oracleContract ,
170
217
{
171
218
get_price: { currency_pair: { Base: 'TIA', Quote: 'USD' } },
172
219
},
@@ -176,7 +223,7 @@ describe('Neutron / Slinky', () => {
176
223
177
224
test('query currencies', async () => {
178
225
const res = await neutronChain.queryContract<GetAllCurrencyPairsResponse>(
179
- contractAddress ,
226
+ oracleContract ,
180
227
{
181
228
get_all_currency_pairs: {},
182
229
},
@@ -186,23 +233,9 @@ describe('Neutron / Slinky', () => {
186
233
});
187
234
});
188
235
describe('wasmbindings marketmap', () => {
189
- let contractAddress: string;
190
-
191
- test('setup contract', async () => {
192
- const codeId = await neutronAccount.storeWasm(NeutronContract.MARKETMAP);
193
- expect(codeId).toBeGreaterThan(0);
194
-
195
- const res = await neutronAccount.instantiateContract(
196
- codeId,
197
- '{}',
198
- 'marketmap',
199
- );
200
- contractAddress = res[0]._contract_address;
201
- });
202
-
203
236
test('query last', async () => {
204
237
const res = await neutronChain.queryContract<LastUpdatedResponse>(
205
- contractAddress ,
238
+ marketmapContract ,
206
239
{
207
240
last_updated: {},
208
241
},
@@ -212,17 +245,27 @@ describe('Neutron / Slinky', () => {
212
245
213
246
test('query market', async () => {
214
247
const res = await neutronChain.queryContract<MarketResponse>(
215
- contractAddress ,
248
+ marketmapContract ,
216
249
{
217
250
market: { currency_pair: { Base: 'TIA', Quote: 'USD' } },
218
251
},
219
252
);
220
253
expect(res.market).toBeDefined();
221
254
});
222
255
256
+ test('query market with empty metadata_JSON', async () => {
257
+ const res = await neutronChain.queryContract<MarketResponse>(
258
+ marketmapContract,
259
+ {
260
+ market: { currency_pair: { Base: 'USDT', Quote: 'USD' } },
261
+ },
262
+ );
263
+ expect(res.market).toBeDefined();
264
+ });
265
+
223
266
test('query market map', async () => {
224
267
const res = await neutronChain.queryContract<MarketMapResponse>(
225
- contractAddress ,
268
+ marketmapContract ,
226
269
{
227
270
market_map: {},
228
271
},
@@ -235,7 +278,7 @@ describe('Neutron / Slinky', () => {
235
278
236
279
test('query params', async () => {
237
280
const res = await neutronChain.queryContract<ParamsResponse>(
238
- contractAddress ,
281
+ marketmapContract ,
239
282
{
240
283
params: {},
241
284
},
0 commit comments