mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
ffef832d45
- Upgrade cosmos-sdk to v0.44.5 from v0.39.2 - Add Legacy Tx Endpoint for backwards compatibility - Add IBC v1.2.3 Support Co-authored-by: DracoLi <draco@dracoli.com> Co-authored-by: drklee3 <derrick@dlee.dev> Co-authored-by: denalimarsh <denalimarsh@gmail.com> Co-authored-by: Draco Li <draco@kava.io> Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: Denali Marsh <denali@kava.io>
42 lines
966 B
Go
42 lines
966 B
Go
package v0_16
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
|
tmtypes "github.com/tendermint/tendermint/types"
|
|
|
|
"github.com/kava-labs/kava/app"
|
|
)
|
|
|
|
var (
|
|
GenesisTime = time.Date(2022, 1, 19, 16, 0, 0, 0, time.UTC)
|
|
ChainID = "kava-9"
|
|
)
|
|
|
|
// Migrate converts v15 genesis doc to v16 genesis doc
|
|
func Migrate(genDoc *tmtypes.GenesisDoc, ctx client.Context) (*tmtypes.GenesisDoc, error) {
|
|
app.SetSDKConfig()
|
|
|
|
var appState genutiltypes.AppMap
|
|
var err error
|
|
if err := json.Unmarshal(genDoc.AppState, &appState); err != nil {
|
|
return nil, fmt.Errorf("failed to marchal app state from genesis doc: %w", err)
|
|
}
|
|
|
|
MigrateCosmosAppState(appState, ctx, GenesisTime)
|
|
migrateKavaAppState(appState, ctx)
|
|
|
|
genDoc.AppState, err = json.Marshal(appState)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
genDoc.GenesisTime = GenesisTime
|
|
genDoc.ChainID = ChainID
|
|
return genDoc, nil
|
|
}
|