Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
29 changes: 28 additions & 1 deletion src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
updateAdminProposal,
updateConsensusParamsProposal,
upgradeProposal,
ConsumerParams,
} from './proposal';
import {
Contract,
Expand Down Expand Up @@ -1419,6 +1420,27 @@ export class DaoMember {
);
}

async submitUpdateParamsConsumerProposal(
chainManagerAddress: string,
title: string,
description: string,
message: ConsumerParams,
amount: string,
fee = {
gas: '4000000',
amount: [{ denom: this.denom, amount: '10000' }],
},
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[chainManagerWrapper(chainManagerAddress, message)],
amount,
'single',
fee,
);
}

async submitUpdateParamsConsensusProposal(
chainManagerAddress: string,
title: string,
Expand Down Expand Up @@ -1730,7 +1752,12 @@ export class DaoMember {
const message = chainManagerWrapper(
chainManagerAddress,
bindings
? addScheduleBindings(info.name, info.period, info.msgs)
? addScheduleBindings(
info.name,
info.period,
info.msgs,
info.execution_stage,
)
: addCronScheduleProposal(info),
);
return await this.submitSingleChoiceProposal(
Expand Down
59 changes: 59 additions & 0 deletions src/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,47 @@ export type ConsensusParams = {
};
};

export type ConsumerParams = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why redefining if this struct is exportable from neutronjs src/interchain_security/ccv/v1/shared_consumer.ts?

enabled: boolean;
/// /////////////////////
/// Distribution Params
/// Number of blocks between ibc-token-transfers from the consumer chain to
/// the provider chain. Note that at this transmission event a fraction of
/// the accumulated tokens are divided and sent consumer redistribution
/// address.
blocks_per_distribution_transmission: number;
/// Channel, and provider-chain receiving address to send distribution token
/// transfers over. These parameters is auto-set during the consumer <->
/// provider handshake procedure.
distribution_transmission_channel: string;
provider_fee_pool_addr_str: string;
/// Sent CCV related IBC packets will timeout after this duration
ccv_timeout_period: string; // Duration
/// Sent transfer related IBC packets will timeout after this duration
transfer_timeout_period: string; // Duration
/// The fraction of tokens allocated to the consumer redistribution address
/// during distribution events. The fraction is a string representing a
/// decimal number. For example "0.75" would represent 75%.
consumer_redistribution_fraction: string;
/// The number of historical info entries to persist in store.
/// This param is a part of the cosmos sdk staking module. In the case of
/// a ccv enabled consumer chain, the ccv module acts as the staking module.
historical_entries: number;
/// Unbonding period for the consumer,
/// which should be smaller than that of the provider in general.
unbonding_period: string; // Duration
/// !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md
soft_opt_out_threshold: string;
/// Reward denoms. These are the denominations which are allowed to be sent to
/// the provider as rewards.
reward_denoms: Array<string>;
/// Provider-originated reward denoms. These are denoms coming from the
/// provider which are allowed to be used as rewards. e.g. "uatom"
provider_reward_denoms: Array<string>;
/// The period after which a consumer can retry sending a throttled packet.
retry_delay_period: string; // Duration
};

export type DecCoin = {
denom: string;
amount: string;
Expand Down Expand Up @@ -698,12 +739,14 @@ export const addScheduleBindings = (
name: string,
period: number,
msgs: MsgExecuteContract[],
executionStage: string,
): any => ({
custom: {
add_schedule: {
name,
period,
msgs,
execution_stage: executionStage,
},
},
});
Expand Down Expand Up @@ -753,6 +796,22 @@ export const updateDynamicFeesParamsProposal = (
},
});

export const updateConsumerParamsProposal = (params: ConsumerParams): any => ({
custom: {
submit_admin_proposal: {
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/interchain_security.ccv.consumer.v1.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
params,
}),
},
},
},
},
});

export interface AddSchedule {
name: string;
period: number;
Expand Down