Skip to content

Commit

Permalink
Merge branch 'main' into feat/flashloans
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Zavgorodnii committed Jul 8, 2024
2 parents a1732eb + dda76d0 commit 358f15f
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 35 deletions.
3 changes: 3 additions & 0 deletions setup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ services:
- RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=demowallet3
- RELAYER_NEUTRON_CHAIN_GAS_PRICES=0.5untrn
- RELAYER_NEUTRON_CHAIN_GAS_ADJUSTMENT=1.4
- RELAYER_NEUTRON_CHAIN_DENOM=untrn
- RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE=1000
- RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER=1.1
- RELAYER_NEUTRON_CHAIN_CONNECTION_ID=connection-0
- RELAYER_NEUTRON_CHAIN_DEBUG=true
- RELAYER_NEUTRON_CHAIN_ACCOUNT_PREFIX=neutron
Expand Down
113 changes: 78 additions & 35 deletions src/testcases/run_in_band/slinky.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ describe('Neutron / Slinky', () => {

let proposalId: number;

let oracleContract: string;
let marketmapContract: string;

beforeAll(async () => {
testState = new TestStateLocalCosmosTestNet(config);
await testState.init();
Expand Down Expand Up @@ -66,6 +69,44 @@ describe('Neutron / Slinky', () => {
});
});

describe('prepare: deploy contract', () => {
test('setup oracle contract', async () => {
const codeId = await neutronAccount.storeWasm(NeutronContract.ORACLE);
expect(codeId).toBeGreaterThan(0);

const res = await neutronAccount.instantiateContract(
codeId,
'{}',
'oracle',
);
oracleContract = res[0]._contract_address;
});

test('setup marketmap contract', async () => {
const codeId = await neutronAccount.storeWasm(NeutronContract.MARKETMAP);
expect(codeId).toBeGreaterThan(0);

const res = await neutronAccount.instantiateContract(
codeId,
'{}',
'marketmap',
);
marketmapContract = res[0]._contract_address;
});
});

describe('before create market map', () => {
test('query last should return null', async () => {
const res = await neutronChain.queryContract<LastUpdatedResponse>(
marketmapContract,
{
last_updated: {},
},
);
expect(res.last_updated).toBe(null);
});
});

describe('submit proposal', () => {
test('create proposal', async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
Expand Down Expand Up @@ -94,6 +135,26 @@ describe('Neutron / Slinky', () => {
},
],
},
{
ticker: {
currency_pair: {
Base: 'USDT',
Quote: 'USD',
},
decimals: 6,
min_provider_count: 1,
enabled: false,
metadata_JSON: '',
},
provider_configs: [
{
name: 'kraken_api',
off_chain_ticker: 'USDTUSD',
invert: false,
metadata_JSON: '',
},
],
},
],
);
});
Expand Down Expand Up @@ -137,23 +198,9 @@ describe('Neutron / Slinky', () => {
});

describe('wasmbindings oracle', () => {
let contractAddress: string;

test('setup contract', async () => {
const codeId = await neutronAccount.storeWasm(NeutronContract.ORACLE);
expect(codeId).toBeGreaterThan(0);

const res = await neutronAccount.instantiateContract(
codeId,
'{}',
'oracle',
);
contractAddress = res[0]._contract_address;
});

test('query prices', async () => {
const res = await neutronChain.queryContract<GetPricesResponse>(
contractAddress,
oracleContract,
{
get_prices: {
currency_pair_ids: ['TIA/USD'],
Expand All @@ -166,7 +213,7 @@ describe('Neutron / Slinky', () => {

test('query price', async () => {
const res = await neutronChain.queryContract<GetPriceResponse>(
contractAddress,
oracleContract,
{
get_price: { currency_pair: { Base: 'TIA', Quote: 'USD' } },
},
Expand All @@ -176,7 +223,7 @@ describe('Neutron / Slinky', () => {

test('query currencies', async () => {
const res = await neutronChain.queryContract<GetAllCurrencyPairsResponse>(
contractAddress,
oracleContract,
{
get_all_currency_pairs: {},
},
Expand All @@ -186,23 +233,9 @@ describe('Neutron / Slinky', () => {
});
});
describe('wasmbindings marketmap', () => {
let contractAddress: string;

test('setup contract', async () => {
const codeId = await neutronAccount.storeWasm(NeutronContract.MARKETMAP);
expect(codeId).toBeGreaterThan(0);

const res = await neutronAccount.instantiateContract(
codeId,
'{}',
'marketmap',
);
contractAddress = res[0]._contract_address;
});

test('query last', async () => {
const res = await neutronChain.queryContract<LastUpdatedResponse>(
contractAddress,
marketmapContract,
{
last_updated: {},
},
Expand All @@ -212,17 +245,27 @@ describe('Neutron / Slinky', () => {

test('query market', async () => {
const res = await neutronChain.queryContract<MarketResponse>(
contractAddress,
marketmapContract,
{
market: { currency_pair: { Base: 'TIA', Quote: 'USD' } },
},
);
expect(res.market).toBeDefined();
});

test('query market with empty metadata_JSON', async () => {
const res = await neutronChain.queryContract<MarketResponse>(
marketmapContract,
{
market: { currency_pair: { Base: 'USDT', Quote: 'USD' } },
},
);
expect(res.market).toBeDefined();
});

test('query market map', async () => {
const res = await neutronChain.queryContract<MarketMapResponse>(
contractAddress,
marketmapContract,
{
market_map: {},
},
Expand All @@ -235,7 +278,7 @@ describe('Neutron / Slinky', () => {

test('query params', async () => {
const res = await neutronChain.queryContract<ParamsResponse>(
contractAddress,
marketmapContract,
{
params: {},
},
Expand Down

0 comments on commit 358f15f

Please sign in to comment.