-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(axelarnet)!: retry failed transfer
- Loading branch information
Showing
8 changed files
with
149 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
package keeper | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/axelarnetwork/axelar-core/x/axelarnet/types" | ||
) | ||
|
||
// Migrate5to6 returns the handler that performs in-place store migrations from version 5 to 6 | ||
func Migrate5to6(k Keeper) func(ctx sdk.Context) error { | ||
// Migrate6to7 returns the handler that performs in-place store migrations from version 6 to 7 | ||
func Migrate6to7(k Keeper, bankK types.BankKeeper, accountK types.AccountKeeper, nexusK types.Nexus, ibcK IBCKeeper) func(ctx sdk.Context) error { | ||
|
||
return func(ctx sdk.Context) error { | ||
addModuleParamCallContractsProposalMinDeposits(ctx, k) | ||
// Failed IBC transfers are held in Axelarnet module account for later retry. | ||
// This migration escrows tokens back to escrow accounts so that we can use the same code path for retry. | ||
moduleAccount := accountK.GetModuleAddress(types.ModuleName) | ||
|
||
balances := bankK.SpendableCoins(ctx, moduleAccount) | ||
for _, coin := range balances { | ||
asset, err := nexusK.NewLockableAsset(ctx, ibcK, bankK, coin) | ||
if err != nil { | ||
k.Logger(ctx).Info(fmt.Sprintf("coin %s is not a lockable asset", coin), "error", err) | ||
continue | ||
} | ||
|
||
err = asset.LockFrom(ctx, moduleAccount) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
} | ||
|
||
func addModuleParamCallContractsProposalMinDeposits(ctx sdk.Context, k Keeper) { | ||
k.params.Set(ctx, types.KeyCallContractsProposalMinDeposits, types.DefaultParams().CallContractsProposalMinDeposits) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.