Skip to content

Commit

Permalink
Merge pull request #344 from neutron-org/feat/add_simulateXXQueries
Browse files Browse the repository at this point in the history
Feat: Add SimulateXX queries
  • Loading branch information
pr0n00gler authored Sep 24, 2024
2 parents 7204a9b + 863f639 commit 1d992a8
Show file tree
Hide file tree
Showing 2 changed files with 301 additions and 43 deletions.
42 changes: 24 additions & 18 deletions src/testcases/run_in_band/dex_bindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Neutron / dex module bindings', () => {
let contractAddress: string;
let activeTrancheKey: string;
let inactiveTrancheKey: string;
const multiHopSwapDenoms: any[] = [];

beforeAll(async () => {
testState = await LocalState.create(config, inject('mnemonics'));
Expand Down Expand Up @@ -72,7 +73,8 @@ describe('Neutron / dex module bindings', () => {
fees: [0], // u64
options: [
{
disable_swap: true,
disable_autoswap: true,
fail_tx_on_bel: false,
},
],
},
Expand All @@ -94,7 +96,8 @@ describe('Neutron / dex module bindings', () => {
fees: [0], // u64
options: [
{
disable_swap: true,
disable_autoswap: true,
fail_tx_on_bel: false,
},
],
},
Expand Down Expand Up @@ -314,7 +317,6 @@ describe('Neutron / dex module bindings', () => {
});

describe('MultiHopSwap', () => {
const denoms: any[] = [];
test('successful multihops', async () => {
const numberDenoms = 10;
const fee = {
Expand Down Expand Up @@ -366,7 +368,7 @@ describe('Neutron / dex module bindings', () => {
amount: [{ denom: NEUTRON_DENOM, amount: '1000' }],
},
);
denoms.push({
multiHopSwapDenoms.push({
denom: newTokenDenom,
balance: 1000000,
});
Expand All @@ -375,15 +377,16 @@ describe('Neutron / dex module bindings', () => {
const res = await neutronClient.execute(contractAddress, {
deposit: {
receiver: contractAddress,
token_a: denoms[i].denom,
token_b: denoms[i + 1].denom,
token_a: multiHopSwapDenoms[i].denom,
token_b: multiHopSwapDenoms[i + 1].denom,
amounts_a: ['1000'], // uint128
amounts_b: ['1000'], // uint128
tick_indexes_a_to_b: [5], // i64
fees: [0], // u64
options: [
{
disable_swap: true,
disable_autoswap: true,
fail_tx_on_bel: false,
},
],
},
Expand All @@ -396,16 +399,16 @@ describe('Neutron / dex module bindings', () => {
routes: [
{
hops: [
denoms[0].denom,
denoms[1].denom,
denoms[2].denom,
denoms[3].denom,
denoms[4].denom,
denoms[5].denom,
denoms[6].denom,
denoms[7].denom,
denoms[8].denom,
denoms[9].denom,
multiHopSwapDenoms[0].denom,
multiHopSwapDenoms[1].denom,
multiHopSwapDenoms[2].denom,
multiHopSwapDenoms[3].denom,
multiHopSwapDenoms[4].denom,
multiHopSwapDenoms[5].denom,
multiHopSwapDenoms[6].denom,
multiHopSwapDenoms[7].denom,
multiHopSwapDenoms[8].denom,
multiHopSwapDenoms[9].denom,
],
},
],
Expand All @@ -424,7 +427,10 @@ describe('Neutron / dex module bindings', () => {
receiver: contractAddress,
routes: [
{
hops: [denoms[0].denom, denoms[9].denom],
hops: [
multiHopSwapDenoms[0].denom,
multiHopSwapDenoms[9].denom,
],
},
],
amount_in: '100',
Expand Down
Loading

0 comments on commit 1d992a8

Please sign in to comment.