Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: privileged subdaos #NTRN-211 #99

Merged
merged 19 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"contracts/dao/cwd-core",
"contracts/dao/neutron-chain-manager",
"contracts/dao/proposal/*",
"contracts/dao/pre-propose/*",
"contracts/dao/voting/*",
Expand Down
4 changes: 4 additions & 0 deletions contracts/dao/neutron-chain-manager/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example neutron-chain-manager_schema"
15 changes: 15 additions & 0 deletions contracts/dao/neutron-chain-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build results
/target

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
38 changes: 38 additions & 0 deletions contracts/dao/neutron-chain-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
authors = ["Andrei Zavgorodnii <[email protected]>"]
description = "A chain manager implementation that grants fine-grained admin permissions to other contracts"
edition = "2021"
name = "neutron-chain-manager"
repository = "https://github.com/neutron-org/neutron-dao"
version = "0.3.0"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-schema = {version = "1.3.0"}
cosmwasm-std = {version = "1.3.0"}
cosmwasm-storage = {version = "1.3.0"}
cw-controllers = "1.1.0"
cw-paginate = {path = "../../../packages/cw-paginate"}
cw-storage-plus = "1.1.0"
cw-utils = {version = "1.0.1"}
cw2 = "1.1.0"
cwd-interface = {path = "../../../packages/cwd-interface"}
cwd-macros = {path = "../../../packages/cwd-macros"}
schemars = "0.8.8"
serde = {version = "1.0.175", default-features = false, features = ["derive"]}
thiserror = {version = "1.0"}
neutron-sdk = "0.8.0"
serde-json-wasm = "1.0.1"
prost = "0.9.0"

[dev-dependencies]
anyhow = "1.0.57"
cw-multi-test = "0.16.5"
6 changes: 6 additions & 0 deletions contracts/dao/neutron-chain-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Neutron Chain Manager

This contract implements a **chain management** **model** with two types of permission strategies:

1. **ALLOW_ALL**: gives a given address full access to the admin module, allowing to submit all possible types of privileged messages;
2. **ALLOW_ONLY**: allows a given address to submit privileged messages of a specific type, with further restrictions if applicable (see below).
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use cosmwasm_schema::write_api;
use neutron_chain_manager::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg,
migrate: MigrateMsg
}
}
Loading
Loading