Skip to content

Commit

Permalink
Merge pull request #434 from neutron-org/feat/privileged-subdaos
Browse files Browse the repository at this point in the history
feat: privileged subdaos #NTRN-211
  • Loading branch information
pr0n00gler authored May 13, 2024
2 parents a58a504 + 79da313 commit 1f64d5e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Binary file added contracts/neutron_chain_manager.wasm
Binary file not shown.
18 changes: 16 additions & 2 deletions network/init-neutrond.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ SUBDAO_PROPOSAL_CONTRACT=$CONTRACTS_BINARIES_DIR/cwd_subdao_proposal_single.wasm
CW4_VOTING_CONTRACT=$THIRD_PARTY_CONTRACTS_DIR/cw4_voting.wasm
CW4_GROUP_CONTRACT=$THIRD_PARTY_CONTRACTS_DIR/cw4_group.wasm

NEUTRON_CHAIN_MANAGER_CONTRACT=$CONTRACTS_BINARIES_DIR/neutron_chain_manager.wasm

echo "Add consumer section..."
$BINARY add-consumer-section --home "$CHAIN_DIR"
### PARAMETERS SECTION
Expand Down Expand Up @@ -137,6 +139,8 @@ SECURITY_SUBDAO_PROPOSAL_LABEL="neutron.subdaos.security.proposals.single"
SECURITY_SUBDAO_PRE_PROPOSE_LABEL="neutron.subdaos.security.proposals.single.pre_propose"
SECURITY_SUBDAO_VOTE_LABEL="neutron.subdaos.security.voting"

NEUTRON_CHAIN_MANAGER_LABEL="neutron.chain.manager"

echo "Initializing dao contract in genesis..."

function store_binary() {
Expand Down Expand Up @@ -172,6 +176,8 @@ SUBDAO_PROPOSAL_BINARY_ID=$(store_binary "$SUBDAO_PROPOSAL_CONTRA
CW4_VOTING_CONTRACT_BINARY_ID=$(store_binary "$CW4_VOTING_CONTRACT")
CW4_GROUP_CONTRACT_BINARY_ID=$(store_binary "$CW4_GROUP_CONTRACT")

NEUTRON_CHAIN_MANAGER_BINARY_ID=$(store_binary "$NEUTRON_CHAIN_MANAGER_CONTRACT")

# WARNING!
# The following code is needed to pre-generate the contract addresses
# Those addresses depend on the ORDER OF CONTRACTS INITIALIZATION
Expand Down Expand Up @@ -221,6 +227,8 @@ GRANTS_SUBDAO_PRE_PROPOSE_CONTRACT_ADDRESS=$(genaddr "$SUBDAO_PRE_PROPOSE_BINA
GRANTS_SUBDAO_TIMELOCK_CONTRACT_ADDRESS=$(genaddr "$SUBDAO_TIMELOCK_BINARY_ID") && (( INSTANCE_ID_COUNTER++ ))
GRANTS_SUBDAO_GROUP_CONTRACT_ADDRESS=$(genaddr "$CW4_GROUP_CONTRACT_BINARY_ID") && (( INSTANCE_ID_COUNTER++ ))

NEUTRON_CHAIN_MANAGER_CONTRACT_ADDRESS=$(genaddr "$NEUTRON_CHAIN_MANAGER_BINARY_ID") && (( INSTANCE_ID_COUNTER++ ))

function check_json() {
MSG=$1
if ! jq -e . >/dev/null 2>&1 <<<"$MSG"; then
Expand Down Expand Up @@ -604,6 +612,11 @@ GRANTS_SUBDAO_CORE_INIT_MSG='{
"security_dao": "'"$SECURITY_SUBDAO_CORE_CONTRACT_ADDRESS"'"
}'

# CHAIN MANAGER
NEUTRON_CHAIN_MANAGER_INIT_MSG='{
"initial_strategy_address": "'"$DAO_CONTRACT_ADDRESS"'"
}'

echo "Instantiate contracts"

function init_contract() {
Expand All @@ -621,12 +634,13 @@ function init_contract() {
# If you're to do any changes, please do it consistently in both sections
init_contract "$NEUTRON_VAULT_CONTRACT_BINARY_ID" "$NEUTRON_VAULT_INIT" "$NEUTRON_VAULT_LABEL"
init_contract "$NEUTRON_INVESTORS_VAULT_CONTRACT_BINARY_ID" "$NEUTRON_INVESTORS_VAULT_INIT" "$NEUTRON_INVESTORS_VAULT_LABEL"
init_contract "$NEUTRON_VESTING_INVESTORS_BINARY_ID" "$NEUTRON_VESTING_INVESTORS_INIT" "$NEUTRON_VESTING_INVESTORS_LABEL"
init_contract "$NEUTRON_VESTING_INVESTORS_BINARY_ID" "$NEUTRON_VESTING_INVESTORS_INIT" "$NEUTRON_VESTING_INVESTORS_LABEL"
init_contract "$DAO_CONTRACT_BINARY_ID" "$DAO_INIT" "$DAO_CORE_LABEL"
init_contract "$RESERVE_CONTRACT_BINARY_ID" "$RESERVE_INIT" "$RESERVE_LABEL"
init_contract "$DISTRIBUTION_CONTRACT_BINARY_ID" "$DISTRIBUTION_INIT" "$DISTRIBUTION_LABEL"
init_contract "$SUBDAO_CORE_BINARY_ID" "$SECURITY_SUBDAO_CORE_INIT_MSG" "$SECURITY_SUBDAO_CORE_LABEL"
init_contract "$SUBDAO_CORE_BINARY_ID" "$GRANTS_SUBDAO_CORE_INIT_MSG" "$GRANTS_SUBDAO_CORE_LABEL"
init_contract "$NEUTRON_CHAIN_MANAGER_BINARY_ID" "$NEUTRON_CHAIN_MANAGER_INIT_MSG" "$NEUTRON_CHAIN_MANAGER_LABEL"

ADD_SUBDAOS_MSG='{
"update_sub_daos": {
Expand Down Expand Up @@ -702,7 +716,7 @@ function convert_bech32_base64_esc() {
DAO_CONTRACT_ADDRESS_B64=$(convert_bech32_base64_esc "$DAO_CONTRACT_ADDRESS")
echo $DAO_CONTRACT_ADDRESS_B64

set_genesis_param admins "[\"$DAO_CONTRACT_ADDRESS\"]" # admin module
set_genesis_param admins "[\"$NEUTRON_CHAIN_MANAGER_CONTRACT_ADDRESS\"]" # admin module
set_genesis_param treasury_address "\"$DAO_CONTRACT_ADDRESS\"" # feeburner
set_genesis_param fee_collector_address "\"$DAO_CONTRACT_ADDRESS\"" # tokenfactory
set_genesis_param security_address "\"$SECURITY_SUBDAO_CORE_CONTRACT_ADDRESS\"," # cron
Expand Down
1 change: 1 addition & 0 deletions wasmbinding/stargate_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
ibcconnectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"

crontypes "github.com/neutron-org/neutron/v3/x/cron/types"

dextypes "github.com/neutron-org/neutron/v3/x/dex/types"
feeburnertypes "github.com/neutron-org/neutron/v3/x/feeburner/types"
interchainqueriestypes "github.com/neutron-org/neutron/v3/x/interchainqueries/types"
Expand Down

0 comments on commit 1f64d5e

Please sign in to comment.