-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Shrenuj Bansal <[email protected]>
- Loading branch information
Showing
10 changed files
with
120 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package keeper | ||
|
||
import ( | ||
"testing" | ||
|
||
dbm "github.com/cosmos/cosmos-db" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
"github.com/dydxprotocol/v4-chain/protocol/lib" | ||
"github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" | ||
|
||
storetypes "cosmossdk.io/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/dydxprotocol/v4-chain/protocol/mocks" | ||
keeper "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" | ||
) | ||
|
||
func RevShareKeepers(t testing.TB) ( | ||
ctx sdk.Context, | ||
keeper *keeper.Keeper, | ||
storeKey storetypes.StoreKey, | ||
mockTimeProvider *mocks.TimeProvider, | ||
) { | ||
ctx = initKeepers( | ||
t, func( | ||
db *dbm.MemDB, | ||
registry codectypes.InterfaceRegistry, | ||
cdc *codec.ProtoCodec, | ||
stateStore storetypes.CommitMultiStore, | ||
transientStoreKey storetypes.StoreKey, | ||
) []GenesisInitializer { | ||
// Define necessary keepers here for unit tests | ||
keeper, storeKey, mockTimeProvider = | ||
createRevShareKeeper(stateStore, db, cdc) | ||
|
||
return []GenesisInitializer{keeper} | ||
}, | ||
) | ||
|
||
return ctx, keeper, storeKey, mockTimeProvider | ||
} | ||
|
||
func createRevShareKeeper( | ||
stateStore storetypes.CommitMultiStore, | ||
db *dbm.MemDB, | ||
cdc *codec.ProtoCodec, | ||
) ( | ||
*keeper.Keeper, | ||
storetypes.StoreKey, | ||
*mocks.TimeProvider, | ||
) { | ||
storeKey := storetypes.NewKVStoreKey(types.StoreKey) | ||
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) | ||
mockTimeProvider := &mocks.TimeProvider{} | ||
|
||
k := keeper.NewKeeper( | ||
cdc, storeKey, []string{ | ||
lib.GovModuleAddress.String(), | ||
}, | ||
) | ||
|
||
return k, storeKey, mockTimeProvider | ||
} |
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