Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandrejev committed Apr 8, 2024
1 parent fe16b86 commit f902440
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 12 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ incremental = false
overflow-checks = true

[workspace.dependencies]
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" }
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/proposal-votes" }
prost = "0.12.1"
prost-types = "0.12.1"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
Expand Down
15 changes: 9 additions & 6 deletions contracts/neutron_interchain_queries/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ use neutron_sdk::interchain_queries::get_registered_query;
use neutron_sdk::interchain_queries::types::{
QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue,
};
use neutron_sdk::interchain_queries::v047::queries::{
query_balance, query_bank_total, query_delegations, query_distribution_fee_pool,
query_government_proposals, query_staking_validators, query_unbonding_delegations,
query_validators_signing_infos,
use neutron_sdk::interchain_queries::v045::register_queries::{
new_register_gov_proposal_votes_query_msg, new_register_validators_signing_infos_query_msg,
};
use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg;
use neutron_sdk::interchain_queries::v047::register_queries::{
use neutron_sdk::interchain_queries::v045::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD};
use neutron_sdk::interchain_queries::v045::{
new_register_balance_query_msg, new_register_bank_total_supply_query_msg,
new_register_delegator_delegations_query_msg,
new_register_delegator_unbonding_delegations_query_msg,
new_register_distribution_fee_pool_query_msg, new_register_gov_proposal_query_msg,
new_register_staking_validators_query_msg, new_register_transfers_query_msg,
};
use neutron_sdk::interchain_queries::v047::queries::{
query_balance, query_bank_total, query_delegations, query_distribution_fee_pool,
query_government_proposal_votes, query_government_proposals, query_staking_validators,
query_unbonding_delegations, query_validators_signing_infos,
};
use neutron_sdk::interchain_queries::v047::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD};
use neutron_sdk::sudo::msg::SudoMsg;
use neutron_sdk::{NeutronError, NeutronResult};
Expand Down
5 changes: 3 additions & 2 deletions contracts/neutron_interchain_queries/src/testing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ use neutron_sdk::interchain_queries::types::{
};
use neutron_sdk::interchain_queries::v047::helpers::{
create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key,
create_total_denom_key, create_validator_key, create_validator_signing_info_key,
create_gov_proposal_votes_key, create_total_denom_key, create_validator_key,
create_validator_signing_info_key,
};
use neutron_sdk::interchain_queries::v047::queries::{
BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse,
TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse,
ProposalVotesResponse, TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse,
};
use neutron_sdk::interchain_queries::v047::types::{
Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, TallyResult,
Expand Down
260 changes: 260 additions & 0 deletions contracts/reflect/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,30 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"staking"
],
"properties": {
"staking": {
"$ref": "#/definitions/StakingMsg"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"distribution"
],
"properties": {
"distribution": {
"$ref": "#/definitions/DistributionMsg"
}
},
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
Expand Down Expand Up @@ -444,6 +468,10 @@
}
]
},
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
},
"DenomUnit": {
"description": "Replicates the cosmos-sdk bank module DenomUnit type",
"type": "object",
Expand All @@ -469,6 +497,55 @@
}
}
},
"DistributionMsg": {
"description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto",
"oneOf": [
{
"description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"set_withdraw_address"
],
"properties": {
"set_withdraw_address": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"description": "The `withdraw_address`",
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"withdraw_delegator_reward"
],
"properties": {
"withdraw_delegator_reward": {
"type": "object",
"required": [
"validator"
],
"properties": {
"validator": {
"description": "The `validator_address`",
"type": "string"
}
}
}
},
"additionalProperties": false
}
]
},
"GovMsg": {
"description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```",
"oneOf": [
Expand Down Expand Up @@ -503,6 +580,36 @@
}
},
"additionalProperties": false
},
{
"description": "This maps directly to [MsgVoteWeighted](https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/proto/cosmos/gov/v1beta1/tx.proto#L66-L78) in the Cosmos SDK with voter set to the contract address.",
"type": "object",
"required": [
"vote_weighted"
],
"properties": {
"vote_weighted": {
"type": "object",
"required": [
"options",
"proposal_id"
],
"properties": {
"options": {
"type": "array",
"items": {
"$ref": "#/definitions/WeightedVoteOption"
}
},
"proposal_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -1516,6 +1623,90 @@
}
}
},
"StakingMsg": {
"description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto",
"oneOf": [
{
"description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"delegate"
],
"properties": {
"delegate": {
"type": "object",
"required": [
"amount",
"validator"
],
"properties": {
"amount": {
"$ref": "#/definitions/Coin"
},
"validator": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"undelegate"
],
"properties": {
"undelegate": {
"type": "object",
"required": [
"amount",
"validator"
],
"properties": {
"amount": {
"$ref": "#/definitions/Coin"
},
"validator": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"redelegate"
],
"properties": {
"redelegate": {
"type": "object",
"required": [
"amount",
"dst_validator",
"src_validator"
],
"properties": {
"amount": {
"$ref": "#/definitions/Coin"
},
"dst_validator": {
"type": "string"
},
"src_validator": {
"type": "string"
}
}
}
},
"additionalProperties": false
}
]
},
"SudoContractProposal": {
"description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.",
"deprecated": true,
Expand Down Expand Up @@ -1758,6 +1949,60 @@
},
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.",
"type": "object",
"required": [
"instantiate2"
],
"properties": {
"instantiate2": {
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg",
"salt"
],
"properties": {
"admin": {
"type": [
"string",
"null"
]
},
"code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"label": {
"description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace",
"type": "string"
},
"msg": {
"description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"salt": {
"$ref": "#/definitions/Binary"
}
}
}
},
"additionalProperties": false
},
{
"description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.",
"type": "object",
Expand Down Expand Up @@ -1842,6 +2087,21 @@
"additionalProperties": false
}
]
},
"WeightedVoteOption": {
"type": "object",
"required": [
"option",
"weight"
],
"properties": {
"option": {
"$ref": "#/definitions/VoteOption"
},
"weight": {
"$ref": "#/definitions/Decimal"
}
}
}
}
}

0 comments on commit f902440

Please sign in to comment.