Skip to content

Commit

Permalink
Onex market module v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronKutch committed Nov 29, 2023
1 parent 19c4ab1 commit 5d3c31d
Show file tree
Hide file tree
Showing 10 changed files with 4,943 additions and 1,808 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: appnamed
asset_name: appnamed
asset_path: onexd
asset_name: onexd
asset_content_type: application/bin
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/target
/Cargo.lock
/appnamed
/onexd
30 changes: 28 additions & 2 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ import (
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
"github.com/onomyprotocol/multiverse/docs"
"github.com/tendermint/starport/starport/pkg/openapiconsole"

marketmodule "github.com/pendulum-labs/market/x/market"
marketmodulekeeper "github.com/pendulum-labs/market/x/market/keeper"
marketmoduletypes "github.com/pendulum-labs/market/x/market/types"
)

const (
AppName = "appname"
AppName = "onex"
upgradeName = "v0.1.0"
AccountAddressPrefix = "onomy"
)

Expand Down Expand Up @@ -154,6 +159,7 @@ var (
vesting.AppModuleBasic{},
// router.AppModuleBasic{},
consumer.AppModuleBasic{},
marketmodule.AppModuleBasic{},
)

// module account permissions
Expand All @@ -162,11 +168,12 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
minttypes.ModuleName: {authtypes.Minter, authtypes.Burner},
consumertypes.ConsumerRedistributeName: nil,
consumertypes.ConsumerToSendToProviderName: nil,
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
govtypes.ModuleName: {authtypes.Burner},
marketmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
}
)

Expand Down Expand Up @@ -217,6 +224,8 @@ type App struct { // nolint: golint
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedIBCConsumerKeeper capabilitykeeper.ScopedKeeper

MarketKeeper marketmodulekeeper.Keeper

// the module manager
MM *module.Manager

Expand Down Expand Up @@ -263,6 +272,7 @@ func New(
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, authzkeeper.StoreKey,
consumertypes.StoreKey,
marketmoduletypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -476,6 +486,16 @@ func New(

app.EvidenceKeeper = *evidenceKeeper

app.MarketKeeper = *marketmodulekeeper.NewKeeper(
appCodec,
keys[marketmoduletypes.StoreKey],
keys[marketmoduletypes.MemStoreKey],
app.GetSubspace(marketmoduletypes.ModuleName),

app.BankKeeper,
)
marketModule := marketmodule.NewAppModule(appCodec, app.MarketKeeper, app.AccountKeeper, app.BankKeeper)

skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

// NOTE: Any module instantiated in the module manager that is later modified
Expand All @@ -499,6 +519,7 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
transferModule,
consumerModule,
marketModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -526,6 +547,7 @@ func New(
vestingtypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
marketmoduletypes.ModuleName,
consumertypes.ModuleName,
)
app.MM.SetOrderEndBlockers(
Expand All @@ -546,6 +568,7 @@ func New(
vestingtypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
marketmoduletypes.ModuleName,
consumertypes.ModuleName,
)

Expand Down Expand Up @@ -573,6 +596,7 @@ func New(
vestingtypes.ModuleName,
ibchost.ModuleName,
ibctransfertypes.ModuleName,
marketmoduletypes.ModuleName,
consumertypes.ModuleName,
)

Expand Down Expand Up @@ -600,6 +624,7 @@ func New(
evidence.NewAppModule(app.EvidenceKeeper), ibc.NewAppModule(app.IBCKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
transferModule,
marketModule,
)

app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -885,6 +910,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(consumertypes.ModuleName)
paramsKeeper.Subspace(marketmoduletypes.ModuleName)

return paramsKeeper
}
Expand Down
6 changes: 6 additions & 0 deletions app/consumer-democracy/proposals_whitelisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types"
marketmoduletypes "github.com/pendulum-labs/market/x/market/types"
)

func IsProposalWhitelisted(content govtypes.Content) bool {
Expand Down Expand Up @@ -72,4 +73,9 @@ var WhitelistedParams = map[paramChangeKey]struct{}{
{Subspace: consumertypes.ModuleName, Key: "ConsumerRedistributionFraction"}: {},
{Subspace: consumertypes.ModuleName, Key: "BlocksPerDistributionTransmission"}: {},
{Subspace: consumertypes.ModuleName, Key: "TransferTimeoutPeriod"}: {},
// market
{Subspace: marketmoduletypes.ModuleName, Key: "BurnCoin"}: {},
{Subspace: marketmoduletypes.ModuleName, Key: "BurnRate"}: {},
{Subspace: marketmoduletypes.ModuleName, Key: "EarnRates"}: {},
{Subspace: marketmoduletypes.ModuleName, Key: "MarketFee"}: {},
}
Loading

0 comments on commit 5d3c31d

Please sign in to comment.