Skip to content

Commit

Permalink
feat: enable IBC transfers (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey authored Apr 11, 2023
1 parent 3d8ba6d commit eae0096
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

### Improvements

- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups, and validations.
- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Bump Cosmos SDK to [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) ([`v0.46.11-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.46.11-kyve-rc0)).
- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Switch to CometBFT from Informal Systems' Tendermint fork.
- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups, and validations.
- (ibc) [#27](https://github.com/KYVENetwork/chain/pull/27) Enable tokens to be sent and received via IBC.

### Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ func NewKYVEApp(
app.configurator,
app.AccountKeeper,
app.StakersKeeper,
app.IBCTransferKeeper,
),
)

Expand Down
13 changes: 13 additions & 0 deletions app/upgrades/v1_1/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingExported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
vestingTypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
// IBC Transfer
transferKeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
transferTypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
// Stakers
stakersKeeper "github.com/KYVENetwork/chain/x/stakers/keeper"
// Upgrade
Expand All @@ -20,6 +23,7 @@ func CreateUpgradeHandler(
configurator module.Configurator,
accountKeeper authKeeper.AccountKeeper,
stakerKeeper stakersKeeper.Keeper,
transferKeeper transferKeeper.Keeper,
) upgradeTypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
if ctx.ChainID() == MainnetChainID {
Expand All @@ -28,6 +32,7 @@ func CreateUpgradeHandler(
}
}

EnableIBCTransfers(ctx, transferKeeper)
MigrateStakerMetadata(ctx, stakerKeeper)

return mm.RunMigrations(ctx, configurator, vm)
Expand All @@ -51,6 +56,14 @@ func AdjustInvestorVesting(ctx sdk.Context, keeper authKeeper.AccountKeeper, add
keeper.SetAccount(ctx, updatedAccount)
}

// EnableIBCTransfers updates the parameters of the IBC Transfer module to
// allow both sending and receiving of IBC tokens. Since the default parameters
// of the module have everything enabled, we simply switch to the defaults.
func EnableIBCTransfers(ctx sdk.Context, keeper transferKeeper.Keeper) {
params := transferTypes.DefaultParams()
keeper.SetParams(ctx, params)
}

// MigrateStakerMetadata migrates all existing staker metadata. The `Logo`
// field has been deprecated and replaced by the `Identity` field. This new
// field must be a valid hex string; therefore, must be set to empty for now.
Expand Down

0 comments on commit eae0096

Please sign in to comment.