Skip to content

Commit

Permalink
Merge pull request #41 from neutron-org/feat/add-dex-pause
Browse files Browse the repository at this point in the history
NTRN-323 Feat: Add dex pause dao logic
  • Loading branch information
pr0n00gler authored Jul 31, 2024
2 parents 40c2c30 + 73f56cc commit 649e7d9
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import {
ParamsFeerefunderResponse,
ParamsContractmanagerResponse,
ParamsCronResponse,
ParamsDexResponse,
ParamsTokenfactoryResponse,
Strategy, TransferParamsResponse,
Strategy,
TransferParamsResponse,
} from './types';
import { DEBUG_SUBMIT_TX, getContractBinary, getHeight } from './env';
import { Message } from '@bufbuild/protobuf';
Expand Down Expand Up @@ -213,12 +215,9 @@ export class CosmosWrapper {
}

async queryTransferParams(): Promise<TransferParamsResponse> {
const req = await axios.get(
`${this.sdk.url}/ibc/apps/transfer/v1/params`,
);
const req = await axios.get(`${this.sdk.url}/ibc/apps/transfer/v1/params`);

return req.data;

}

async queryFeeburnerParams(): Promise<ParamsFeeburnerResponse> {
Expand Down Expand Up @@ -249,6 +248,12 @@ export class CosmosWrapper {
return req.data;
}

async queryDexParams(): Promise<ParamsDexResponse> {
const req = await axios.get(`${this.sdk.url}/neutron/dex/params`);

return req.data;
}

async queryTokenfactoryParams(): Promise<ParamsTokenfactoryResponse> {
const req = await axios.get(
`${this.sdk.url}/osmosis/tokenfactory/v1beta1/params`,
Expand Down
20 changes: 20 additions & 0 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
ParamChangeProposalInfo,
ParamsContractmanagerInfo,
ParamsCronInfo,
ParamsDexInfo,
ParamsFeeburnerInfo,
ParamsFeerefunderInfo,
ParamsGlobalfeeInfo,
Expand Down Expand Up @@ -1622,6 +1623,25 @@ export class DaoMember {
);
}

/**
* submitUpdateParamsDexProposal creates proposal which changes soe params of dex module.
*/

async submitUpdateParamsDexProposal(
chainManagerAddress: string,
title: string,
description: string,
message: ParamsDexInfo,
amount: string,
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[chainManagerWrapper(chainManagerAddress, message)],
amount,
);
}

/**
* submitUpdateParamsContractmanagerProposal creates proposal which changes some params of contractmanager module.
*/
Expand Down
28 changes: 28 additions & 0 deletions src/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export type ParamsCronInfo = {
limit: number;
};

export type ParamsDexInfo = {
fee_tiers: number[];
paused: boolean;
max_jits_per_block: number;
good_til_purge_allowance: number;
};

export type ParamsContractmanagerInfo = {
sudo_call_gas_limit: string;
};
Expand Down Expand Up @@ -443,6 +450,27 @@ export const updateCronParamsProposal = (info: ParamsCronInfo): any => ({
},
});

export const updateDexParamsProposal = (info: ParamsDexInfo): any => ({
custom: {
submit_admin_proposal: {
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/neutron.dex.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
params: {
fee_tiers: info.fee_tiers,
paused: info.paused,
max_jits_per_block: info.max_jits_per_block,
good_til_purge_allowance: info.good_til_purge_allowance,
},
}),
},
},
},
},
});

export const updateContractmanagerParamsProposal = (
info: ParamsContractmanagerInfo,
): any => ({
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import bech32 from 'bech32';
import {
ParamsContractmanagerInfo,
ParamsCronInfo,
ParamsDexInfo,
ParamsFeeburnerInfo,
ParamsFeerefunderInfo,
ParamsInterchainqueriesInfo,
Expand Down Expand Up @@ -345,6 +346,10 @@ export type ParamsCronResponse = {
params: ParamsCronInfo;
};

export type ParamsDexResponse = {
params: ParamsDexInfo;
};

export type ParamsFeerefunderResponse = {
params: ParamsFeerefunderInfo;
};
Expand Down

0 comments on commit 649e7d9

Please sign in to comment.