Skip to content

Commit

Permalink
fix: example contracts fee: stakeuntrn
Browse files Browse the repository at this point in the history
  • Loading branch information
foxpy committed Mar 28, 2023
1 parent f6a9a69 commit 432ecef
Show file tree
Hide file tree
Showing 10 changed files with 624 additions and 186 deletions.
2 changes: 1 addition & 1 deletion contracts/ibc_transfer/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};

use ibc_transfer::contract::{ExecuteMsg, InstantiateMsg};
use ibc_transfer::msg::{ExecuteMsg, InstantiateMsg};

fn main() {
let mut out_dir = current_dir().unwrap();
Expand Down
31 changes: 8 additions & 23 deletions contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ use neutron_sdk::{
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::state::{
read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload,
IBC_SUDO_ID_RANGE_END, IBC_SUDO_ID_RANGE_START,
use crate::{
msg::{ExecuteMsg, InstantiateMsg, MigrateMsg},
state::{
read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload,
IBC_SUDO_ID_RANGE_END, IBC_SUDO_ID_RANGE_START,
},
};

// Default timeout for IbcTransfer is 10000000 blocks
Expand All @@ -22,9 +25,6 @@ const DEFAULT_TIMEOUT_HEIGHT: u64 = 10000000;
const CONTRACT_NAME: &str = concat!("crates.io:neutron-sdk__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InstantiateMsg {}

#[entry_point]
pub fn instantiate(
deps: DepsMut,
Expand All @@ -36,18 +36,6 @@ pub fn instantiate(
Ok(Response::default())
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Send {
channel: String,
to: String,
denom: String,
amount: u128,
timeout_height: Option<u64>,
},
}

#[entry_point]
pub fn execute(
deps: DepsMut,
Expand Down Expand Up @@ -159,8 +147,8 @@ fn execute_send(
// See more info here: https://docs.neutron.org/neutron/feerefunder/overview
let fee = IbcFee {
recv_fee: vec![],
ack_fee: vec![Coin::new(1000u128, "stake")],
timeout_fee: vec![Coin::new(1000u128, "stake")],
ack_fee: vec![Coin::new(2000u128, "untrn")],
timeout_fee: vec![Coin::new(2000u128, "untrn")],
};
let coin1 = coin(amount, denom.clone());
let msg1 = NeutronMsg::IbcTransfer {
Expand Down Expand Up @@ -279,9 +267,6 @@ fn sudo_response(deps: DepsMut, req: RequestPacket, data: Binary) -> StdResult<R
// but it costs an extra gas, so its on you how to use the storage
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct MigrateMsg {}

#[entry_point]
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult<Response> {
deps.api.debug("WASMDEBUG: migrate");
Expand Down
1 change: 1 addition & 0 deletions contracts/ibc_transfer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::unwrap_used, clippy::expect_used)]

pub mod contract;
pub mod msg;
pub mod state;
20 changes: 20 additions & 0 deletions contracts/ibc_transfer/src/msg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InstantiateMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Send {
channel: String,
to: String,
denom: String,
amount: u128,
timeout_height: Option<u64>,
},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct MigrateMsg {}
5 changes: 2 additions & 3 deletions contracts/neutron_interchain_txs/schema/sudo_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,17 @@
"type": "string"
},
"Height": {
"description": "Height represents an ibc Height type",
"type": "object",
"properties": {
"revision_height": {
"description": "*revision** is a revision of remote chain",
"description": "*height** is a height of remote chain",
"default": 0,
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"revision_number": {
"description": "*revision_number** is a height of remote chain",
"description": "the revision that the client is currently on",
"default": 0,
"type": "integer",
"format": "uint64",
Expand Down
Loading

0 comments on commit 432ecef

Please sign in to comment.