Skip to content
Merged
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
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.24.3-bookworm as builder
FROM golang:1.25.7-bookworm AS builder

# Set up dependencies
ENV PACKAGES jq curl wget jq file make git
ENV PACKAGES="jq curl wget jq file make git"

RUN apt-get update && \
apt-get install -y $PACKAGES
Expand All @@ -21,7 +21,7 @@ RUN ARCH=`uname -m` && ln -s $GOPATH/pkg/mod/github.com/\!cosm\!wasm/wasmvm/v*/i
FROM debian:bookworm-slim AS hub

# Set up dependencies
ENV PACKAGES jq curl
ENV PACKAGES="jq curl"

RUN apt-get update && \
apt-get install -y $PACKAGES
Expand All @@ -43,22 +43,22 @@ STOPSIGNAL SIGTERM

# ##################################

FROM hub as gcr
FROM hub AS gcr

COPY ./entrypoints/run-node.sh /usr/bin/run-node.sh
COPY ./entrypoints/run-tx-server.sh /usr/bin/run-tx-server.sh

# ##################################

FROM hub as localnet
FROM hub AS localnet

COPY ./entrypoints/run-localnet.sh /usr/bin/run-localnet.sh

ENTRYPOINT [ "/usr/bin/run-localnet.sh" ]

# ##################################

FROM hub as localnet-setup
FROM hub AS localnet-setup

RUN apt-get update && apt-get install -y python3

Expand Down
52 changes: 44 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/group"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/cosmos-sdk/x/protocolpool"
"github.com/cosmos/gaia/v25/x/liquid"
"github.com/cosmos/gaia/v27/x/liquid"
"github.com/cosmos/gogoproto/proto"
icacontroller "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller"
ibccallbacks "github.com/cosmos/ibc-go/v10/modules/apps/callbacks"
Expand All @@ -51,6 +51,10 @@ import (
transferv2 "github.com/cosmos/ibc-go/v10/modules/apps/transfer/v2"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/strangelove-ventures/tokenfactory/x/tokenfactory"
"github.com/strangelove-ventures/tokenfactory/x/tokenfactory/bindings"
tokenfactorykeeper "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/keeper"
tokenfactorytypes "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
Expand Down Expand Up @@ -122,8 +126,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
liquidkeeper "github.com/cosmos/gaia/v25/x/liquid/keeper"
liquidtypes "github.com/cosmos/gaia/v25/x/liquid/types"
liquidkeeper "github.com/cosmos/gaia/v27/x/liquid/keeper"
liquidtypes "github.com/cosmos/gaia/v27/x/liquid/types"
ica "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts"
icacontrollerkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"
Expand Down Expand Up @@ -160,6 +164,16 @@ var (
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

tokenFactoryCapabilities = []string{
tokenfactorytypes.EnableSudoMint,
tokenfactorytypes.EnableBurnOwn,
//tokenfactorytypes.EnableBurnOwnUnregistered,
//tokenfactorytypes.EnableBurnFrom,
//tokenfactorytypes.EnableForceTransfer,
tokenfactorytypes.EnableSetMetadata,
tokenfactorytypes.EnableCommunityPoolFeeFunding,
}
)

func ConvertToProposals(keys []string) ([]wasmtypes.ProposalType, error) {
Expand Down Expand Up @@ -212,9 +226,10 @@ var (
protocolpooltypes.ModuleName: nil,
protocolpooltypes.ProtocolPoolEscrowAccount: nil,
// non sdk modules
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
}
)

Expand Down Expand Up @@ -278,6 +293,7 @@ type App struct {
ICAHostKeeper icahostkeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasmkeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper

// the module manager
mm *module.Manager
Expand Down Expand Up @@ -347,6 +363,7 @@ func New(
ibcexported.StoreKey, ibctransfertypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
tokenfactorytypes.StoreKey,
paramstypes.StoreKey,
CapabilityStoreKey,
liquidtypes.StoreKey,
Expand Down Expand Up @@ -407,6 +424,7 @@ func New(
slashingSS := app.ParamsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable())

govSS := app.ParamsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
tokenFactorySS := app.ParamsKeeper.Subspace(tokenfactorytypes.ModuleName)

// Combine legacy IBC ParamSets so all migrators (client, connection, channel)
// can read their old params from x/params during the upgrade.
Expand Down Expand Up @@ -583,7 +601,7 @@ func New(

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
// register the governance hooks
),
)

Expand All @@ -606,14 +624,27 @@ func New(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

// Create the TokenFactory Keeper
app.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
maccPerms,
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
tokenFactoryCapabilities,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
wasmOpts = append(wasmOpts, bindings.RegisterCustomPlugins(app.BankKeeper, &app.TokenFactoryKeeper)...)

app.EpochsKeeper = epochskeeper.NewKeeper(
runtime.NewKVStoreService(keys[epochstypes.StoreKey]),
appCodec,
)

app.EpochsKeeper.SetHooks(
epochstypes.NewMultiEpochHooks(
// insert epoch hooks receivers here
// insert epoch hooks receivers here
),
)

Expand Down Expand Up @@ -763,6 +794,7 @@ func New(
transfer.NewAppModule(app.TransferKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
ibctm.NewAppModule(tmLightClientModule),
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, tokenFactorySS),
liquid.NewAppModule(appCodec, app.LiquidKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
)

Expand Down Expand Up @@ -806,6 +838,7 @@ func New(
icatypes.ModuleName,
liquidtypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand All @@ -820,6 +853,7 @@ func New(
ibcexported.ModuleName,
icatypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -857,6 +891,7 @@ func New(
icatypes.ModuleName,
// wasm after ibc transfer
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
liquidtypes.ModuleName,
}

Expand Down Expand Up @@ -886,6 +921,7 @@ func New(
icatypes.ModuleName,
// wasm after ibc transfer
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
liquidtypes.ModuleName,
}

Expand Down
131 changes: 115 additions & 16 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,32 @@ import (
"github.com/CosmWasm/wasmd/app/upgrades"
"github.com/CosmWasm/wasmd/app/upgrades/noop"
v060 "github.com/CosmWasm/wasmd/app/upgrades/v060"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
epochstypes "github.com/cosmos/cosmos-sdk/x/epochs/types"
"github.com/cosmos/cosmos-sdk/x/group"
"github.com/strangelove-ventures/tokenfactory/x/tokenfactory/keeper"

//minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
protocolpooltypes "github.com/cosmos/cosmos-sdk/x/protocolpool/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
liquidtypes "github.com/cosmos/gaia/v25/x/liquid/types"
liquidtypes "github.com/cosmos/gaia/v27/x/liquid/types"
icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
"github.com/fetchai/fetchd/app/ica_migration"
"github.com/fetchai/fetchd/app/traces"
tokenfactorytypes "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"
)

// ---- Match this to the plan name that is already stored on disk and halted the chain.
const UpgradeNameV053 = "v0.15.0-rc1-gemini"
const UpgradeNameV053 = "v0.15.0-rc3"

// List ALL new/renamed/deleted KV stores at this upgrade height.
var v053StoreUpgrades = storetypes.StoreUpgrades{
Expand All @@ -48,6 +53,7 @@ var v053StoreUpgrades = storetypes.StoreUpgrades{
group.StoreKey,
icacontrollertypes.StoreKey,
nft.StoreKey,
tokenfactorytypes.StoreKey,
liquidtypes.StoreKey,
},
Renamed: []storetypes.StoreRename{
Expand Down Expand Up @@ -104,23 +110,16 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
return nil, err
}

/*
// Pre-seed legacy x/params for mint
if ss, ok := app.ParamsKeeper.GetSubspace(minttypes.ModuleName); ok {
if !ss.Has(sdkCtx, minttypes.KeyInflationRateChange) {
p := minttypes.DefaultParams()
p.MintDenom = "afet"
// TODO: if your chain had custom values, set them here:
ss.SetParamSet(sdkCtx, &p)
}
}
*/

err = migrateConsensusParamsFromParamsStore(app, sdkCtx)
if err != nil {
return nil, err
}

res, err := app.mm.RunMigrations(ctx, cfg, fromVM)
if err != nil {
return res, err
}

// Bootstrap liquid staking
err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, v stakingtypes.ValidatorI) (stop bool) {
lv := liquidtypes.LiquidValidator{
Expand All @@ -137,8 +136,108 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
return nil, err
}

// If you must pin any module "from" versions, adjust fromVM here.
return app.mm.RunMigrations(ctx, cfg, fromVM)
bondDenom, err := app.StakingKeeper.BondDenom(sdkCtx)
if err != nil {
return nil, err
}

type DenomAdmin struct {
Denom string
Address string
}

type ChainConfig struct {
Admins []DenomAdmin
Params tokenfactorytypes.Params
}

defaultDenomCreationGasConsume := uint64(2000000)
defaultDenomCreationFee := sdk.NewCoins(sdk.NewCoin(bondDenom, math.NewIntWithDecimal(1, 18)))

defaultParams := tokenfactorytypes.Params{
DenomCreationFee: defaultDenomCreationFee,
DenomCreationGasConsume: defaultDenomCreationGasConsume,
}

var chainConfig ChainConfig

switch sdkCtx.ChainID() {
case "fetchhub-4":
chainConfig = ChainConfig{
Admins: []DenomAdmin{
// Mainnet bridge contract
{Denom: bondDenom, Address: "fetch1qxxlalvsdjd07p07y3rc5fu6ll8k4tmetpha8n"},
},
Params: defaultParams,
}
case "dorado-1":
// Dorado testnet bridge contract
doradoBridgeContractAddress := "fetch182q50y030ctp39dkjhv4pn95h9vxg29s67djtr0560fuwprtks0sfrtyz0"

chainConfig = ChainConfig{
Admins: []DenomAdmin{
{Denom: bondDenom, Address: doradoBridgeContractAddress},
},
Params: defaultParams,
}

msgServer := wasmkeeper.NewMsgServerImpl(&app.WasmKeeper)

_, err := msgServer.UpdateContractLabel(ctx, &wasmtypes.MsgUpdateContractLabel{
Sender: tokenfactorytypes.ModuleAddress(),
Contract: doradoBridgeContractAddress,
NewLabel: "token-bridge-contract",
})
if err != nil {
return nil, err
}

default:
feeAmount := math.NewIntWithDecimal(1, 9)

if metadata, ok := app.BankKeeper.GetDenomMetaData(ctx, bondDenom); ok {
var maxExp uint32
var found bool

for _, du := range metadata.DenomUnits {
if !found || du.Exponent > maxExp {
maxExp = du.Exponent
found = true
}
}

if found {
feeAmount = math.NewIntWithDecimal(1, int(maxExp))
}
}

blockMaxGas := sdkCtx.ConsensusParams().Block.MaxGas

denomCreationGasConsume := uint64(0)
// sanity check
if blockMaxGas > 0 {
denomCreationGasConsume = uint64(blockMaxGas) / 3
}

chainConfig = ChainConfig{
Params: tokenfactorytypes.Params{
DenomCreationFee: sdk.NewCoins(sdk.NewCoin(bondDenom, feeAmount)),
DenomCreationGasConsume: denomCreationGasConsume,
},
}
}

app.TokenFactoryKeeper.SetParams(sdkCtx, chainConfig.Params)

udc := keeper.NewUnboundDenomCreator(app.TokenFactoryKeeper)
for _, denomAdmin := range chainConfig.Admins {
err = udc.CreateDenom(sdkCtx, denomAdmin.Address, denomAdmin.Denom)
if err != nil {
return nil, err
}
}

return res, err
},
)

Expand Down
2 changes: 1 addition & 1 deletion ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24.3-bookworm
FROM golang:1.25.7-bookworm

WORKDIR /src

Expand Down
Loading
Loading