Skip to content

Commit

Permalink
move to v18 namespace + upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 3, 2023
1 parent 43065b4 commit 3d998da
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 20 deletions.
5 changes: 4 additions & 1 deletion app/upgrades/v18/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/CosmosContracts/juno/v18/app/upgrades"
cwhooks "github.com/CosmosContracts/juno/v18/x/cw-hooks"
)

// UpgradeName defines the on-chain upgrade name for the upgrade.
Expand All @@ -13,6 +14,8 @@ var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateV18UpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Added: []string{
cwhooks.ModuleName,
},
},
}
9 changes: 8 additions & 1 deletion app/upgrades/v18/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (

"github.com/CosmosContracts/juno/v18/app/keepers"
"github.com/CosmosContracts/juno/v18/app/upgrades"
cwhookstypes "github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

func CreateV18UpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
_ *keepers.AppKeepers,
k *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)
Expand All @@ -30,6 +31,12 @@ func CreateV18UpgradeHandler(
}
logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap))

// x/cw-hooks
gas_limit := uint64(250_000)

Check warning on line 35 in app/upgrades/v18/upgrades.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: don't use underscores in Go names; var gas_limit should be gasLimit (revive)
if err := k.CWHooksKeeper.SetParams(ctx, cwhookstypes.NewParams(gas_limit)); err != nil {
return nil, err
}

return versionMap, err
}
}
2 changes: 1 addition & 1 deletion x/cw-hooks/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

func GetQueryCmd() *cobra.Command {
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

// NewTxCmd returns a root CLI command handler for modules
Expand Down
4 changes: 2 additions & 2 deletions x/cw-hooks/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

// NewGenesisState - Create a new genesis state
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/gov_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

type GovHooks struct {
Expand Down
6 changes: 3 additions & 3 deletions x/cw-hooks/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

"github.com/CosmosContracts/juno/v17/app"
"github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/app"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

var _ = embed.FS{}
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

var _ types.MsgServer = &msgServer{}
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

func (s *IntegrationTestSuite) TestRegisterContracts() {
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

// SetParams sets the x/cw-hooks module parameters.
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

var _ types.QueryServer = &Querier{}
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

func (s *IntegrationTestSuite) TestContracts() {
Expand Down
2 changes: 1 addition & 1 deletion x/cw-hooks/keeper/staking_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

// TODO: return nil on unmarshal or err?
Expand Down
6 changes: 3 additions & 3 deletions x/cw-hooks/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/CosmosContracts/juno/v17/x/cw-hooks/client/cli"
"github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v17/x/cw-hooks/types"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/client/cli"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper"
"github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
)

const (
Expand Down
4 changes: 3 additions & 1 deletion x/cw-hooks/script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export JUNOD_NODE="tcp://localhost:26657"

# upload the smart contract, then create a validator. Confirm it works

export JUNOD_NODE="tcp://localhost:26657"
FLAGS="--from=juno1 --gas=2500000 --fees=50000ujuno --node=http://localhost:26657 --yes --keyring-backend=test --home $HOME/.juno1 --chain-id=local-1 --output=json"

junod tx wasm store ./keeper/contract/juno_staking_hooks_example.wasm $FLAGS
Expand All @@ -28,3 +28,5 @@ junod q wasm contract-state smart $addr '{"last_delegation_change":{}}' --node=h

# create validator
junod tx staking create-validator --amount 1ujuno --commission-rate="0.05" --commission-max-rate="1.0" --commission-max-change-rate="1.0" --moniker="test123" --from=juno2 --pubkey=$(junod tendermint show-validator --home $HOME/.juno) --min-self-delegation="1" --gas=1000000 --fees=50000ujuno --node=http://localhost:26657 --yes --keyring-backend=test --home $HOME/.juno1 --chain-id=local-1 --output=json

# junod export --output-document=$HOME/Desktop/export.json --home=$HOME/.juno1

0 comments on commit 3d998da

Please sign in to comment.