Skip to content

Commit

Permalink
Enable Axelar module account sends, fix community spend sender (#271)
Browse files Browse the repository at this point in the history
* Enable mod acc sends, fix community spend sender

* handle module send error in axelar community spend
  • Loading branch information
EricBolten committed Jan 29, 2024
1 parent bab9a48 commit 32d2ecd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ var (
}

// module accounts that are allowed to receive tokens
allowedReceivingModAcc = map[string]bool{}
// incidentally this permission is also required to be able to send tokens from module accounts
allowedReceivingModAcc = map[string]bool{
axelarcorktypes.ModuleName: true,
}

_ simapp.App = (*SommelierApp)(nil)
_ servertypes.Application = (*SommelierApp)(nil)
Expand Down
9 changes: 6 additions & 3 deletions x/axelarcork/keeper/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"sort"
"time"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
Expand Down Expand Up @@ -146,9 +145,13 @@ func HandleCommunityPoolSpendProposal(ctx sdk.Context, k Keeper, p types.AxelarC
}

feePool.CommunityPool = newPool
sender := authtypes.NewModuleAddress(distributiontypes.ModuleName)

// TODO(bolten: is there really no fee necessary or executor to target?
// since distribution is not an authorized sender, put them in the axelarcork module account
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, distributiontypes.ModuleName, types.ModuleName, sdk.NewCoins(coinWithBridgeFee)); err != nil {
panic(err)
}
sender := k.GetSenderAccount(ctx)

axelarMemo := types.AxelarBody{
DestinationChain: config.Name,
DestinationAddress: p.Recipient,
Expand Down

0 comments on commit 32d2ecd

Please sign in to comment.