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

v8.0.2 #128

Closed
wants to merge 8 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ draft_metadata.json
draft_proposal.json
bin/chihuahuad
bin/chihuahuad
start-localnet.sh
92 changes: 69 additions & 23 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package app
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"time"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
Expand All @@ -21,6 +21,7 @@ import (
circuittypes "cosmossdk.io/x/circuit/types"
abci "github.com/cometbft/cometbft/abci/types"
tmos "github.com/cometbft/cometbft/libs/os"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -1318,32 +1319,77 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {

})
app.UpgradeKeeper.SetUpgradeHandler(
"v8.0.1",
func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
app.Logger().Info("V8.0.1 upgrade ...")
// New consensus params keeper using the wrong key again and move the data into the consensus params keeper with the right key
storesvc := runtime.NewKVStoreService(app.GetKey("upgrade"))
consensuskeeper := consensuskeeper.NewKeeper(
app.appCodec,
storesvc,
app.AccountKeeper.GetAuthority(),
runtime.EventService{},
)
params, err := consensuskeeper.ParamsStore.Get(ctx)
app.Logger().Info("Getting the params into the Consensus params keeper...")
if err != nil {
return nil, err
"v8.0.2",
func(c context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
app.Logger().Info("V8.0.2 upgrade ...")
ctx := sdk.UnwrapSDKContext(c)
params := app.LiquidityKeeper.GetParams(ctx)
params.SwapFeeRate = math.LegacyNewDecWithPrec(5, 3) // 0.5% swap fees
params.PoolCreationFee = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, math.NewInt(100_000_000_000))) // 100 000 huahua to create a pool
params.BuildersAddresses = []liquiditytypes.WeightedAddress{
{
Address: "chihuahua14nvxlmstzc63w4cshgjmhwr2ep4gax5wlgeqe2",

Weight: math.LegacyNewDecWithPrec(25, 2), //will receive 25% of commission from swap fees and pool creation fees
},
{
Address: "chihuahua1jpfqqpna4nasv53gkn08ta9ygfryq38l8af602",
Weight: math.LegacyNewDecWithPrec(75, 2), //will receive 75% of commission from swap fees and pool creation fees
},
}
params.BuildersCommission = math.LegacyNewDecWithPrec(2, 1) //20% of fees will go to builders

if err := app.LiquidityKeeper.SetParams(ctx, params); err != nil {
app.Logger().Error("Upgrade Error 1: " + err.Error())
}

tokenFactoryParams := app.TokenFactoryKeeper.GetParams(ctx)
tokenFactoryParams.BuildersAddresses = []tokenfactorytypes.WeightedAddress{
{
Address: "chihuahua14nvxlmstzc63w4cshgjmhwr2ep4gax5wlgeqe2",
Weight: math.LegacyNewDecWithPrec(10, 2), //will receive 10% of commission from minting tokens
},
{
Address: "chihuahua1jpfqqpna4nasv53gkn08ta9ygfryq38l8af602",
Weight: math.LegacyNewDecWithPrec(90, 2), //will receive 90% of commission from minting tokens
},
}
tokenFactoryParams.DenomCreationFee = nil
tokenFactoryParams.DenomCreationGasConsume = 50_000
tokenFactoryParams.BuildersCommission = math.LegacyNewDecWithPrec(1, 2) //1% of minted token goes to builders

if err := app.TokenFactoryKeeper.SetParams(ctx, tokenFactoryParams); err != nil {
app.Logger().Error("Upgrade Error 2: " + err.Error())
}
consensusParams := cmtproto.ConsensusParams{}

block := cmtproto.BlockParams{
MaxBytes: 22020096,
MaxGas: -1,
}
consensusParams.Block = &block

evidence := cmtproto.EvidenceParams{
MaxAgeNumBlocks: 100000,
MaxAgeDuration: 48 * time.Hour,
MaxBytes: 1048576,
}
err = app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params)
app.Logger().Info("Setting the params into the Consensus params keeper...")
consensusParams.Evidence = &evidence

validator := cmtproto.ValidatorParams{
PubKeyTypes: []string{"ed25519"},
}
consensusParams.Validator = &validator

consensusParams.Version = &cmtproto.VersionParams{}

err := app.ConsensusParamsKeeper.ParamsStore.Set(c, consensusParams)
if err != nil {
return nil, err
app.Logger().Error("Upgrade Error 3: " + err.Error())
}
versionMap, err := app.mm.RunMigrations(ctx, cfg, vm)
app.Logger().Info(fmt.Sprintf("post migrate version map: %v", versionMap))
// return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
return versionMap, err
return app.mm.RunMigrations(c, cfg, vm)
})

}

// SimulationManager implements the SimulationApp interface
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/CosmWasm/wasmd v0.53.0
github.com/CosmWasm/wasmvm/v2 v2.1.2
github.com/CosmWasm/wasmvm/v2 v2.1.3
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/gogogateway v1.2.0 // indirect
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
cosmossdk.io/x/nft v0.1.1
cosmossdk.io/x/tx v0.13.4
cosmossdk.io/x/upgrade v0.1.4
github.com/Victor118/liquidity v1.7.0
github.com/Victor118/liquidity v1.7.1
github.com/cometbft/cometbft v0.38.11
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20240808203856-57803750a140
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmd v0.53.0 h1:kdaoAi20bIb4VCsxw9pRaT2g5PpIp82Wqrr9DRVN9ao=
github.com/CosmWasm/wasmd v0.53.0/go.mod h1:FJl/aWjdpGof3usAMFQpDe07Rkx77PUzp0cygFMOvtw=
github.com/CosmWasm/wasmvm/v2 v2.1.2 h1:GkJ5bAsRlLHfIQVg/FY1VHwLyBwlCjAhDea0B8L+e20=
github.com/CosmWasm/wasmvm/v2 v2.1.2/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg=
github.com/CosmWasm/wasmvm/v2 v2.1.3 h1:CSJTauZqkHyb9yic6JVYCjiGUgxI2MJV2QzfSu8m49c=
github.com/CosmWasm/wasmvm/v2 v2.1.3/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
Expand All @@ -240,8 +240,8 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/Victor118/liquidity v1.7.0 h1:VHxV4pKscL3hQeMVBli4kRnUwt4hjoSK2YU5ZWrmc48=
github.com/Victor118/liquidity v1.7.0/go.mod h1:RRGlMTp7z3AKiwbsc9pu4g0hn/UpEyuCrtp3fmzHlGI=
github.com/Victor118/liquidity v1.7.1 h1:SMMUciOFAPVo/o0PDKpMiZ7CKYGO24QTLe/FLSfujsc=
github.com/Victor118/liquidity v1.7.1/go.mod h1:RRGlMTp7z3AKiwbsc9pu4g0hn/UpEyuCrtp3fmzHlGI=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I=
Expand Down
7 changes: 7 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ service Msg {
// originally set to be the creator, but this can be changed later. The token
// denom does not indicate the current admin.
message MsgCreateDenom {
option (cosmos.msg.v1.signer) = "sender";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// subdenom can be up to 44 "alphanumeric" characters long.
string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ];
Expand All @@ -52,6 +54,7 @@ message MsgCreateDenomResponse {
// MsgMint is the sdk.Msg type for allowing an admin account to mint
// more of a token. For now, we only support minting to the sender account
message MsgMint {
option (cosmos.msg.v1.signer) = "sender";
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
Expand All @@ -66,6 +69,7 @@ message MsgMintResponse {}
// MsgBurn is the sdk.Msg type for allowing an admin account to burn
// a token. For now, we only support burning from the sender account.
message MsgBurn {
option (cosmos.msg.v1.signer) = "sender";
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
Expand All @@ -80,6 +84,7 @@ message MsgBurnResponse {}
// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign
// adminship of a denom to a new account
message MsgChangeAdmin {
option (cosmos.msg.v1.signer) = "sender";
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ];
Expand All @@ -92,6 +97,7 @@ message MsgChangeAdminResponse {}
// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set
// the denom's bank metadata
message MsgSetDenomMetadata {
option (cosmos.msg.v1.signer) = "sender";
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.bank.v1beta1.Metadata metadata = 2 [
(gogoproto.moretags) = "yaml:\"metadata\"",
Expand All @@ -104,6 +110,7 @@ message MsgSetDenomMetadata {
message MsgSetDenomMetadataResponse {}

message MsgForceTransfer {
option (cosmos.msg.v1.signer) = "sender";
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
Expand Down
Loading
Loading