clawchain/x/modelregistry/keeper/param_executor.go
caelum0x cc12b2b899 feat: core chain updates — clawchain, governance, marketplace, tokenfactory, IBC, build
Updates across core modules, app wiring, IBC config, governance execution
tests, tokenfactory keeper/module, Makefile build targets, release CI,
and dependency updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:14:09 +03:00

41 lines
1.0 KiB
Go

package keeper
import (
"context"
"fmt"
"strconv"
)
// UpdateParam applies a governance parameter change to the modelregistry module.
func (k Keeper) UpdateParam(ctx context.Context, paramKey string, newValue string) error {
params, err := k.Params.Get(ctx)
if err != nil {
return fmt.Errorf("failed to get modelregistry params: %w", err)
}
switch paramKey {
case "min_deposit_uclaw":
v, err := strconv.ParseUint(newValue, 10, 64)
if err != nil {
return fmt.Errorf("invalid value for %s: %w", paramKey, err)
}
params.MinDepositUclaw = v
case "max_models":
v, err := strconv.ParseUint(newValue, 10, 64)
if err != nil {
return fmt.Errorf("invalid value for %s: %w", paramKey, err)
}
params.MaxModels = v
case "platform_fee_bps":
v, err := strconv.ParseUint(newValue, 10, 64)
if err != nil {
return fmt.Errorf("invalid value for %s: %w", paramKey, err)
}
params.PlatformFeeBps = v
default:
return fmt.Errorf("unknown modelregistry param key: %s", paramKey)
}
return k.Params.Set(ctx, params)
}