Skip to content
Draft
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
19 changes: 13 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ thiserror = { version = "1.0.64" }
schemars = "0.8"
cw-asset = { version = "4.0.0" }

abstract-app = { version = "0.24.1-beta.2" }
abstract-adapter = { version = "0.24.1-beta.2" }
abstract-standalone = { version = "0.24.1-beta.2" }
abstract-interface = { version = "0.24.1-beta.2" }
abstract-client = { version = "0.24.1-beta.2" }
cw-orch = { version = "0.25.1" }
abstract-app = { version = "0.24.1" }
abstract-adapter = { version = "0.24.1" }
abstract-standalone = { version = "0.24.1" }
abstract-client = { version = "0.24.1" }
cw-orch = { version = "0.27.0" }
{% if include_ibc_app %}
cw-orch-interchain = { version = "0.8.0" }
{% endif %}

lazy_static = "1.4.0"
const_format = "0.2.33"
Expand All @@ -45,3 +47,8 @@ clap = { version = "4.5.19" }
{% if include_standalone %}
{{standalone_name | kebab_case}} = { path = "contracts/{{standalone_name}}" }
{% endif %}

[patch.crates-io]
abstract-client = { git = "https://github.com/AbstractSDK/abstract.git", branch = "buckram/fix-abstract-client-fetch_or_build_account" }
abstract-std = { git = "https://github.com/AbstractSDK/abstract.git", branch = "buckram/fix-abstract-client-fetch_or_build_account" }
abstract-interface = { git = "https://github.com/AbstractSDK/abstract.git", branch = "buckram/fix-abstract-client-fetch_or_build_account" }
11 changes: 6 additions & 5 deletions cargo-generate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ post = ["post-script.rhai"]
include_app = { prompt = "Include App Module", default = true, type = "bool" }
include_adapter = { prompt = "Include Adapter Module", default = true, type = "bool" }
include_standalone = { prompt = "Include Standalone Module", default = true, type = "bool" }
include_ibc_app = { prompt = "Include IBC App Module", default = true, type = "bool" }

[conditional.'include_app'.placeholders]
# App can have IBC
with_ibc = { prompt = "Would you like to include IBC template in the app?", default = false, type = "bool" }
app_name = { prompt = "Enter App Name", default = "my_app", type = "string" }

[conditional.'include_adapter'.placeholders]
Expand All @@ -21,13 +20,15 @@ adapter_name = { prompt = "Enter Adapter Name", default = "my_adapter", type = "
[conditional.'include_standalone'.placeholders]
standalone_name = { prompt = "Enter Standalone Name", default = "my_standalone", type = "string" }

[conditional.'include_ibc_app'.placeholders]
ibc_app_name = { prompt = "Enter IBC App Name", default = "my_ibc_app", type = "string" }

# Ignore files if not included
[conditional.'!include_app']
ignore = ["contracts/{{app_name}}"]
[conditional.'!include_adapter']
ignore = ["contracts/{{adapter_name}}"]
[conditional.'!include_standalone']
ignore = ["contracts/{{standalone_name}}"]

[conditional.'!with_ibc']
ignore = ["contracts/{{app_name}}/src/ibc"]
[conditional.'!include_ibc_app']
ignore = ["contracts/{{ibc_app_name}}"]
1 change: 0 additions & 1 deletion contracts/{{adapter_name}}/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const_format = { workspace = true }

# Dependencies for interface
cw-orch = { workspace = true }
abstract-interface = { workspace = true }

# Dependencies for bins
clap = { workspace = true, optional = true, features = ["derive"] }
Expand Down
6 changes: 4 additions & 2 deletions contracts/{{adapter_name}}/src/bin/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ fn publish(networks: Vec<ChainInfo>) -> anyhow::Result<()> {

// Get the [`Publisher`] that owns the namespace, otherwise create a new one and claim the namespace
let publisher: Publisher<_> = abstract_client
.publisher_builder(adapter_namespace)
.build()?;
.account_builder()
.namespace(adapter_namespace)
.build()?
.publisher()?;

if publisher.account().owner()? != chain.sender_addr() {
panic!("The current sender can not publish to this namespace. Please use the wallet that owns the Account that owns the Namespace.")
Expand Down
12 changes: 8 additions & 4 deletions contracts/{{adapter_name}}/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ impl TestEnv<MockBech32> {
abs_client.set_balance(&sender, &coins(123, "ucosm"))?;

// Publish the adapter
let publisher = abs_client.publisher_builder(namespace).build()?;
let publisher = abs_client
.account_builder()
.namespace(namespace)
.build()?
.publisher()?;
publisher.publish_adapter::<{{adapter_name | upper_camel_case}}InstantiateMsg, {{adapter_name | upper_camel_case}}Interface<_>>(
{{adapter_name | upper_camel_case}}InstantiateMsg {},
)?;
Expand Down Expand Up @@ -67,8 +71,8 @@ fn update_config() -> anyhow::Result<()> {
// Note that it's not a requirement to have it installed in this case
let publisher_account = env
.abs
.publisher_builder(Namespace::new({{project-name | shouty_snake_case}}_NAMESPACE).unwrap())
.build()?;
.fetch_account(Namespace::new({{project-name | shouty_snake_case}}_NAMESPACE).unwrap())?
.publisher()?;

adapter.execute(
&AdapterRequestMsg {
Expand Down Expand Up @@ -109,7 +113,7 @@ fn set_status() -> anyhow::Result<()> {
let new_account = env
.abs
.account_builder()
.install_adapter::<{{adapter_name | upper_camel_case}}Interface<MockBech32>>()?
.install_adapter::<{{adapter_name | upper_camel_case}}Interface<MockBech32>>()
.build()?;

new_account.as_ref().execute_on_module(
Expand Down
1 change: 0 additions & 1 deletion contracts/{{app_name}}/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const_format = { workspace = true }

# Dependencies for interface
cw-orch = { workspace = true }
abstract-interface = { workspace = true }

# Dependencies for bins
clap = { workspace = true, optional = true, features = ["derive"] }
Expand Down
6 changes: 5 additions & 1 deletion contracts/{{app_name}}/src/bin/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ fn publish(networks: Vec<ChainInfo>) -> anyhow::Result<()> {
let abstract_client: AbstractClient<Daemon> = AbstractClient::new(chain.clone())?;

// Get the [`Publisher`] that owns the namespace, otherwise create a new one and claim the namespace
let publisher: Publisher<_> = abstract_client.publisher_builder(app_namespace).build()?;
let publisher: Publisher<_> = abstract_client
.account_builder()
.namespace(app_namespace)
.build()?
.publisher()?;

if publisher.account().owner()? != chain.sender_addr() {
panic!("The current sender can not publish to this namespace. Please use the wallet that owns the Account that owns the Namespace.")
Expand Down
6 changes: 2 additions & 4 deletions contracts/{{app_name}}/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const APP: {{app_name | upper_camel_case}} = {{app_name | upper_camel_case}}::ne
.with_execute(handlers::execute_handler)
.with_query(handlers::query_handler)
.with_migrate(handlers::migrate_handler)
.with_replies(&[(INSTANTIATE_REPLY_ID, replies::instantiate_reply)]){% if with_ibc %}
.with_ibc_callback(crate::ibc::ibc_callback)
.with_module_ibc(crate::ibc::receive_module_ibc){% endif %}
.with_replies(&[(INSTANTIATE_REPLY_ID, replies::instantiate_reply)])
.with_dependencies(&[]);

// Export handlers
Expand All @@ -37,7 +35,7 @@ abstract_app::cw_orch_interface!(APP, {{app_name | upper_camel_case}}, {{app_nam
// TODO: add to docmuentation
// https://linear.app/abstract-sdk/issue/ABS-414/add-documentation-on-dependencycreation-trait
#[cfg(not(target_arch = "wasm32"))]
impl<Chain: cw_orch::environment::CwEnv> abstract_interface::DependencyCreation
impl<Chain: cw_orch::environment::CwEnv> abstract_app::abstract_interface::DependencyCreation
for crate::{{app_name | upper_camel_case}}Interface<Chain>
{
type DependenciesConfig = cosmwasm_std::Empty;
Expand Down
19 changes: 0 additions & 19 deletions contracts/{{app_name}}/src/ibc/callback.rs

This file was deleted.

21 changes: 0 additions & 21 deletions contracts/{{app_name}}/src/ibc/module.rs

This file was deleted.

2 changes: 0 additions & 2 deletions contracts/{{app_name}}/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ pub mod msg;
mod replies;
pub mod state;

{% if with_ibc %}pub mod ibc;{% endif %}

pub use error::{{app_name | upper_camel_case}}Error;

/// The version of your app
Expand Down
11 changes: 0 additions & 11 deletions contracts/{{app_name}}/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,3 @@ pub struct ConfigResponse {}
pub struct CountResponse {
pub count: i32,
}

{% if with_ibc %}
#[cosmwasm_schema::cw_serde]
pub enum IbcCallbackMsg {
Empty {},
}

#[cosmwasm_schema::cw_serde]
pub struct IbcMsg {
}
{% endif %}
6 changes: 5 additions & 1 deletion contracts/{{app_name}}/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ impl TestEnv<MockBech32> {
abs_client.set_balance(&sender, &coins(123, "ucosm"))?;

// Publish the app
let publisher = abs_client.publisher_builder(namespace).build()?;
let publisher = abs_client
.account_builder()
.namespace(namespace)
.build()?
.publisher()?;
publisher.publish_app::<{{app_name | upper_camel_case}}Interface<_>>()?;

let app = publisher
Expand Down
50 changes: 50 additions & 0 deletions contracts/{{ibc_app_name}}/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[package]
name = "ping-pong"
version = "0.1.0"
edition = "2021"

[features]
default = ["export"]
export = []
daemon-bin = [
"cw-orch/daemon",
"dep:clap",
"dep:abstract-client",
"dep:dotenv",
"dep:env_logger",
]
schema = ["abstract-app/schema"]

[lib]
crate-type = ["cdylib", "rlib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-controllers = { workspace = true }
cw-storage-plus = { workspace = true }
thiserror = { workspace = true }
schemars = { workspace = true }
cw-asset = { workspace = true }
abstract-app = { workspace = true }
abstract-ibc-client = { version = "0.24.1", default-features = false }
const_format = { workspace = true }

# Dependencies for interface
cw-orch = { workspace = true }
abstract-interface = { workspace = true }

# Dependencies for bins
clap = { workspace = true, optional = true, features = ["derive"] }
abstract-client = { workspace = true, features = [
"interchain",
], optional = true }
dotenv = { workspace = true, optional = true }
env_logger = { workspace = true, optional = true }

[dev-dependencies]
cw-orch-interchain = { workspace = true, features = ["daemon"] }
cw-orch = { workspace = true, features = ["daemon"] }
abstract-client = { workspace = true, features = ["interchain"] }
env_logger = "0.11"
9 changes: 9 additions & 0 deletions contracts/{{ibc_app_name}}/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "MyIbcApp",
"description": "IBC app description.",
"website": "",
"docs": "",
"type": "app",
"icon": "GiTrade",
"enabled": true
}
65 changes: 65 additions & 0 deletions contracts/{{ibc_app_name}}/src/bin/publish.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//! Publishes the module to the Abstract platform by uploading it and registering it on the app store.
//!
//! Info: The mnemonic used to register the module must be the same as the owner of the account that claimed the namespace.
//!
//! ## Example
//!
//! ```bash
//! $ just publish test-app uni-6 osmo-test-5
//! ```
use ping_pong::PING_PONG_ID;

use abstract_app::objects::namespace::Namespace;
use abstract_client::{AbstractClient, Publisher};
use clap::Parser;
use cw_orch::{anyhow, daemon::networks::parse_network, prelude::*, tokio::runtime::Runtime};
use ping_pong::PingPongInterface;

fn publish(networks: Vec<ChainInfo>) -> anyhow::Result<()> {
// run for each requested network
for network in networks {
// Setup
let rt = Runtime::new()?;
let chain = DaemonBuilder::new(network).handle(rt.handle()).build()?;

let app_namespace = Namespace::from_id(PING_PONG_ID)?;

// Create an [`AbstractClient`]
let abstract_client: AbstractClient<Daemon> = AbstractClient::new(chain.clone())?;

// Get the [`Publisher`] that owns the namespace, otherwise create a new one and claim the namespace
let publisher: Publisher<_> = abstract_client
.account_builder()
.namespace(app_namespace)
.build()?
.publisher()?;

if publisher.account().owner()? != chain.sender_addr() {
panic!("The current sender can not publish to this namespace. Please use the wallet that owns the Account that owns the Namespace.")
}

// Publish the App to the Abstract Platform
publisher.publish_app::<PingPongInterface<Daemon>>()?;
}
Ok(())
}

#[derive(Parser, Default, Debug)]
#[command(author, version, about, long_about = None)]
struct Arguments {
/// Network Id to publish on
#[arg(short, long, value_delimiter = ' ', num_args = 1..)]
network_ids: Vec<String>,
}

fn main() {
dotenv::dotenv().ok();
env_logger::init();
let args = Arguments::parse();
let networks = args
.network_ids
.iter()
.map(|n| parse_network(n).unwrap())
.collect();
publish(networks).unwrap();
}
13 changes: 13 additions & 0 deletions contracts/{{ibc_app_name}}/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use cosmwasm_schema::remove_schemas;
use ping_pong::contract::PingPong;
use std::env::current_dir;
use std::fs::create_dir_all;

fn main() {
let mut out_dir = current_dir().unwrap();
out_dir.push("schema");
create_dir_all(&out_dir).unwrap();
remove_schemas(&out_dir).unwrap();

PingPong::export_schema(&out_dir);
}
Loading
Loading