Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Derivatives #611

Merged
merged 28 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
run: go build -v ./...

- name: Test
run: go test -v `go list ./... | grep -v -E 'deprecated/|x/derivatives/|x/ecosystemincentive/|x/nftbackedloan/|x/nftfactory/|x/pricefeed/|x/yieldaggregator/'`
run: go test -v `go list ./... | grep -v -E 'deprecated/|x/ecosystemincentive/|x/nftbackedloan/|x/nftfactory/|x/derivatives/'`
83 changes: 43 additions & 40 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ import (
// "github.com/UnUniFi/chain/x/nftfactory"
// nftmintkeeper "github.com/UnUniFi/chain/x/nftfactory/keeper"
// nftminttypes "github.com/UnUniFi/chain/x/nftfactory/types"
// "github.com/UnUniFi/chain/x/derivatives"
// derivativeskeeper "github.com/UnUniFi/chain/x/derivatives/keeper"
// derivativestypes "github.com/UnUniFi/chain/x/derivatives/types"
// "github.com/UnUniFi/chain/x/pricefeed"
// pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types"
"github.com/UnUniFi/chain/x/derivatives"
derivativeskeeper "github.com/UnUniFi/chain/x/derivatives/keeper"
derivativestypes "github.com/UnUniFi/chain/x/derivatives/types"
"github.com/UnUniFi/chain/x/pricefeed"
pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper"
pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types"

// ecosystemincentive "github.com/UnUniFi/chain/x/ecosystemincentive"
// ecosystemincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types"

Expand Down Expand Up @@ -253,8 +255,8 @@ var (
records.AppModuleBasic{},
icacallbacks.AppModuleBasic{},

// pricefeed.AppModuleBasic{},
// derivatives.AppModuleBasic{},
pricefeed.AppModuleBasic{},
derivatives.AppModuleBasic{},

// ecosystemincentive.AppModuleBasic{},
)
Expand Down Expand Up @@ -282,9 +284,9 @@ var (
stakeibctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
interchainquerytypes.ModuleName: nil,

// derivativestypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// derivativestypes.DerivativeFeeCollector: nil,
// derivativestypes.MarginManager: nil,
derivativestypes.ModuleName: {authtypes.Minter, authtypes.Burner},
derivativestypes.DerivativeFeeCollector: nil,
derivativestypes.MarginManager: nil,

// ecosystemincentivetypes.ModuleName: nil,
}
Expand Down Expand Up @@ -374,8 +376,8 @@ type App struct {
ScopedIcacallbacksKeeper capabilitykeeper.ScopedKeeper
IcacallbacksKeeper icacallbackskeeper.Keeper

// DerivativesKeeper derivativeskeeper.Keeper
// PricefeedKeeper pricefeedkeeper.Keeper
DerivativesKeeper derivativeskeeper.Keeper
PricefeedKeeper pricefeedkeeper.Keeper

// EcosystemincentiveKeeper ecosystemincentivekeeper.Keeper

Expand Down Expand Up @@ -440,8 +442,8 @@ func NewApp(
recordstypes.StoreKey,
icacallbackstypes.StoreKey,

// derivativestypes.StoreKey,
// pricefeedtypes.StoreKey,
derivativestypes.StoreKey,
pricefeedtypes.StoreKey,

// ecosystemincentivetypes.StoreKey,
)
Expand Down Expand Up @@ -809,23 +811,22 @@ func NewApp(
app.StakeibcKeeper.Hooks(),
),
)
app.PricefeedKeeper = pricefeedkeeper.NewKeeper(
appCodec,
keys[pricefeedtypes.StoreKey],
keys[pricefeedtypes.MemStoreKey],
app.GetSubspace(pricefeedtypes.ModuleName),
app.BankKeeper,
)

// app.DerivativesKeeper = derivativeskeeper.NewKeeper(
// appCodec,
// keys[derivativestypes.StoreKey],
// keys[derivativestypes.MemStoreKey],
// app.GetSubspace(derivativestypes.ModuleName),
// app.BankKeeper,
// app.PricefeedKeeper,
// )

// app.PricefeedKeeper = pricefeedkeeper.NewKeeper(
// appCodec,
// keys[pricefeedtypes.StoreKey],
// keys[pricefeedtypes.MemStoreKey],
// app.GetSubspace(pricefeedtypes.ModuleName),
// app.BankKeeper,
// )
app.DerivativesKeeper = derivativeskeeper.NewKeeper(
appCodec,
keys[derivativestypes.StoreKey],
keys[derivativestypes.MemStoreKey],
app.GetSubspace(derivativestypes.ModuleName),
app.BankKeeper,
app.PricefeedKeeper,
)

// app.EcosystemincentiveKeeper = ecosystemincentivekeeper.NewKeeper(
// appCodec,
Expand Down Expand Up @@ -954,8 +955,8 @@ func NewApp(
records.NewAppModule(appCodec, app.RecordsKeeper, app.AccountKeeper, app.BankKeeper),
icacallbacks.NewAppModule(appCodec, app.IcacallbacksKeeper, app.AccountKeeper, app.BankKeeper),

// derivatives.NewAppModule(appCodec, app.DerivativesKeeper, app.BankKeeper),
// pricefeed.NewAppModule(appCodec, app.PricefeedKeeper, app.AccountKeeper),
derivatives.NewAppModule(appCodec, app.DerivativesKeeper, app.BankKeeper),
pricefeed.NewAppModule(appCodec, app.PricefeedKeeper, app.AccountKeeper),
// ecosystemincentive.NewAppModule(appCodec, app.EcosystemincentiveKeeper, app.BankKeeper),
)

Expand Down Expand Up @@ -985,7 +986,7 @@ func NewApp(
consensusparamtypes.ModuleName,
// original modules
// ecosystemincentivetypes.ModuleName,
// pricefeedtypes.ModuleName,
pricefeedtypes.ModuleName,

// nftminttypes.ModuleName,
// nftmarkettypes.ModuleName,
Expand All @@ -997,7 +998,7 @@ func NewApp(
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
// derivativestypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1029,7 +1030,7 @@ func NewApp(
consensusparamtypes.ModuleName,
// original modules
// ecosystemincentivetypes.ModuleName,
// pricefeedtypes.ModuleName,
pricefeedtypes.ModuleName,

// nftminttypes.ModuleName,
// nftmarkettypes.ModuleName,
Expand All @@ -1040,7 +1041,7 @@ func NewApp(
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
// derivativestypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1079,7 +1080,7 @@ func NewApp(
consensusparamtypes.ModuleName,

// original modules
// pricefeedtypes.ModuleName,
pricefeedtypes.ModuleName,
// nftminttypes.ModuleName,
// nftmarkettypes.ModuleName,
// ecosystemincentivetypes.ModuleName,
Expand All @@ -1091,7 +1092,7 @@ func NewApp(
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
// derivativestypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1434,8 +1435,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacallbackstypes.ModuleName)
paramsKeeper.Subspace(yieldaggregatortypes.ModuleName)

// paramsKeeper.Subspace(pricefeedtypes.ModuleName)
// paramsKeeper.Subspace(derivativestypes.ModuleName)
paramsKeeper.Subspace(pricefeedtypes.ModuleName)
paramsKeeper.Subspace(derivativestypes.ModuleName)
// paramsKeeper.Subspace(ecosystemincentivetypes.ModuleName)

return paramsKeeper
Expand Down Expand Up @@ -1480,4 +1481,6 @@ func (app *App) setupAppkeeper() {
app.AppKeepers.ParamsKeeper = &app.ParamsKeeper
app.AppKeepers.WasmKeeper = &app.WasmKeeper
app.AppKeepers.YieldaggregatorKeeper = &app.YieldaggregatorKeeper
app.AppKeepers.PricefeedKeeper = &app.PricefeedKeeper
app.AppKeepers.DerivativesKeeper = &app.DerivativesKeeper
}
4 changes: 4 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"

derivativeskeeper "github.com/UnUniFi/chain/x/derivatives/keeper"
pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper"
yieldaggregatorKeeper "github.com/UnUniFi/chain/x/yieldaggregator/keeper"
)

Expand Down Expand Up @@ -43,4 +45,6 @@ type AppKeepers struct {

// ununifi original keepers
YieldaggregatorKeeper *yieldaggregatorKeeper.Keeper
PricefeedKeeper *pricefeedkeeper.Keeper
DerivativesKeeper *derivativeskeeper.Keeper
}
6 changes: 3 additions & 3 deletions app/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/stretchr/testify/require"

"github.com/CosmWasm/wasmd/x/wasm"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto"
Expand All @@ -33,10 +32,11 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

// "github.com/cosmos/cosmos-sdk/x/supply"
pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
// "github.com/cosmos/cosmos-sdk/x/supply"
// "github.com/CosmWasm/wasmd/x/wasm"
"github.com/CosmWasm/wasmd/x/wasm"
)

var emptyWasmOpts []wasm.Option = nil
Expand Down Expand Up @@ -98,7 +98,7 @@ func (tApp TestApp) GetUpgradeKeeper() *upgradekeeper.Keeper { return tApp.Upgr
func (tApp TestApp) GetParamsKeeper() paramskeeper.Keeper { return tApp.ParamsKeeper }

// func (tApp TestApp) GetVVKeeper() validatorvesting.Keeper { return tApp.vvKeeper }
// func (tApp TestApp) GetPriceFeedKeeper() pricefeedkeeper.Keeper { return tApp.PricefeedKeeper }
func (tApp TestApp) GetPriceFeedKeeper() pricefeedkeeper.Keeper { return tApp.PricefeedKeeper }

// func (tApp TestApp) GetHarvestKeeper() harvest.Keeper { return tApp.harvestKeeper }
// func (tApp TestApp) GetCommitteeKeeper() committee.Keeper { return tApp.committeeKeeper }
Expand Down
Loading