Skip to content

Commit

Permalink
Add delaymsg module as a module account (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding authored Oct 19, 2023
1 parent a715432 commit e48f473
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protocol/app/module_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/dydxprotocol/v4-chain/protocol/app/config"
bridgemoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/bridge/types"
clobmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"
delaymsgtypes "github.com/dydxprotocol/v4-chain/protocol/x/delaymsg/types"
rewardsmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/rewards/types"
satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"
vestmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/vest/types"
Expand Down Expand Up @@ -47,6 +48,9 @@ var (
vestmoduletypes.CommunityTreasuryAccountName: nil,
// community vester account vests funds into the community treasury.
vestmoduletypes.CommunityVesterAccountName: nil,
// delaymsg module account doesn't hold funds. It's used as the authority of
// delayed messages.
delaymsgtypes.ModuleName: nil,
}
// Blocked module accounts which cannot receive external funds.
// By default, all native SDK module accounts are blocked. This prevents
Expand Down
4 changes: 4 additions & 0 deletions protocol/app/module_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/dydxprotocol/v4-chain/protocol/app"
bridgemoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/bridge/types"
clobmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"
delaymsgtypes "github.com/dydxprotocol/v4-chain/protocol/x/delaymsg/types"
rewardsmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/rewards/types"
satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"
vestmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/vest/types"
Expand All @@ -32,6 +33,7 @@ func TestModuleAccountsToAddresses(t *testing.T) {
rewardsmoduletypes.VesterAccountName: "dydx1ltyc6y4skclzafvpznpt2qjwmfwgsndp458rmp",
vestmoduletypes.CommunityTreasuryAccountName: "dydx15ztc7xy42tn2ukkc0qjthkucw9ac63pgp70urn",
vestmoduletypes.CommunityVesterAccountName: "dydx1wxje320an3karyc6mjw4zghs300dmrjkwn7xtk",
delaymsgtypes.ModuleName: "dydx1mkkvp26dngu6n8rmalaxyp3gwkjuzztq5zx6tr",
}

require.True(t, len(expectedModuleAccToAddresses) == len(app.GetMaccPerms()))
Expand Down Expand Up @@ -68,6 +70,7 @@ func TestMaccPerms(t *testing.T) {
"rewards_vester": nil,
"community_treasury": nil,
"community_vester": nil,
"delaymsg": nil,
}
require.Equal(t, expectedMaccPerms, maccPerms, "default macc perms list does not match expected")
}
Expand All @@ -87,6 +90,7 @@ func TestModuleAccountAddrs(t *testing.T) {
"dydx1ltyc6y4skclzafvpznpt2qjwmfwgsndp458rmp": true, // x/rewards.vester
"dydx15ztc7xy42tn2ukkc0qjthkucw9ac63pgp70urn": true, // x/vest.communityTreasury
"dydx1wxje320an3karyc6mjw4zghs300dmrjkwn7xtk": true, // x/vest.communityVester
"dydx1mkkvp26dngu6n8rmalaxyp3gwkjuzztq5zx6tr": true, // x/delaymsg
}

require.Equal(t, expectedModuleAccAddresses, app.ModuleAccountAddrs())
Expand Down

0 comments on commit e48f473

Please sign in to comment.