Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add dex pause #NTRN-323 #313

Merged
merged 9 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@cosmos-client/core": "^0.47.4",
"@cosmos-client/cosmwasm": "^0.40.3",
"@cosmos-client/ibc": "^1.2.1",
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#40c2c30434e63ab989e42408a94034589d5985d8",
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#649e7d91d09e5f91246e082ffa4bd29c01ab19e8",
"@types/lodash": "^4.14.182",
"@types/long": "^5.0.0",
"axios": "^0.27.2",
Expand Down
54 changes: 53 additions & 1 deletion src/testcases/run_in_band/chain_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import cosmosclient from '@cosmos-client/core';
import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait';
import {
updateCronParamsProposal,
updateDexParamsProposal,
updateTokenfactoryParamsProposal,
} from '@neutron-org/neutronjsplus/dist/proposal';

Expand Down Expand Up @@ -131,7 +132,7 @@ describe('Neutron / Chain Manager', () => {
});
});

describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, Tokenfactory module parameter updates, legacy param changes)', () => {
describe('Add an ALLOW_ONLY strategy for module parameter updates (Cron, Tokenfactory, Dex), and legacy param changes)', () => {
let proposalId: number;
test('create proposal', async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
Expand Down Expand Up @@ -168,6 +169,14 @@ describe('Neutron / Chain Manager', () => {
whitelisted_hooks: true,
},
},
{
update_dex_params_permission: {
fee_tiers: true,
paused: true,
max_jits_per_block: true,
good_til_purge_allowance: true,
},
},
],
},
},
Expand Down Expand Up @@ -288,4 +297,47 @@ describe('Neutron / Chain Manager', () => {
]);
});
});
describe('ALLOW_ONLY: change DEX parameters', () => {
let proposalId: number;
const newParams = {
fee_tiers: [1, 2, 99],
paused: true,
max_jits_per_block: 11,
good_til_purge_allowance: 50000,
};
beforeAll(async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
proposalId = await subdaoMember1.submitUpdateParamsDexProposal(
chainManagerAddress,
'Proposal #1',
'dex update params proposal. Will pass',
updateDexParamsProposal(newParams),
'1000',
);

const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
proposalId,
);

expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('timelocked');
expect(timelockedProp.msgs).toHaveLength(1);
});

test('execute timelocked: success', async () => {
await waitSeconds(10);

await subdaoMember1.executeTimelockedProposal(proposalId);
const timelockedProp = await subDao.getTimelockedProposal(proposalId);
expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('executed');
expect(timelockedProp.msgs).toHaveLength(1);

const dexParams = await neutronChain.queryDexParams();
expect(dexParams.params.fee_tiers).toEqual(['1', '2', '99']);
expect(dexParams.params.paused).toEqual(true);
expect(dexParams.params.max_jits_per_block).toEqual('11');
expect(dexParams.params.good_til_purge_allowance).toEqual('50000');
});
});
});
Loading
Loading