Skip to content

Commit

Permalink
Feat/wasm bindings (#242)
Browse files Browse the repository at this point in the history
* feat: refactor wasm bindings structure

* feat: simplified types for wasm bindingsw

* feat: simplify file structure

* feat: add missing amm queries to wasm bindings

* fix: get rid of liq provider module as it is unused

* feat: set json annotations to query get asset infos

* feat: add annotations to asset info

* fix: annotations

* refactor: renamed proto messages field names from camel to snake case

* feat: add additional queries and messengers

* feat: add missing queries

* feat: add module messages to ElysMsg

* feat: add additonnal messenger logic

* feat: add remainings msg logicw
  • Loading branch information
cosmic-vagabond authored Nov 10, 2023
1 parent 83d045d commit 60858e3
Show file tree
Hide file tree
Showing 296 changed files with 8,902 additions and 4,689 deletions.
50 changes: 15 additions & 35 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ import (
epochsmodule "github.com/elys-network/elys/x/epochs"
epochsmodulekeeper "github.com/elys-network/elys/x/epochs/keeper"
epochsmoduletypes "github.com/elys-network/elys/x/epochs/types"
liquidityprovidermodule "github.com/elys-network/elys/x/liquidityprovider"
liquidityprovidermodulekeeper "github.com/elys-network/elys/x/liquidityprovider/keeper"
liquidityprovidermoduletypes "github.com/elys-network/elys/x/liquidityprovider/types"
oraclemodule "github.com/elys-network/elys/x/oracle"
oraclekeeper "github.com/elys-network/elys/x/oracle/keeper"
oracletypes "github.com/elys-network/elys/x/oracle/types"
Expand Down Expand Up @@ -275,7 +272,6 @@ var (
wasmmodule.AppModuleBasic{},
epochsmodule.AppModuleBasic{},
assetprofilemodule.AppModuleBasic{},
liquidityprovidermodule.AppModuleBasic{},
oraclemodule.AppModuleBasic{},
commitmentmodule.AppModuleBasic{},
tokenomicsmodule.AppModuleBasic{},
Expand Down Expand Up @@ -373,21 +369,20 @@ type ElysApp struct {
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

EpochsKeeper epochsmodulekeeper.Keeper
AssetprofileKeeper assetprofilemodulekeeper.Keeper
LiquidityproviderKeeper liquidityprovidermodulekeeper.Keeper
ScopedOracleKeeper capabilitykeeper.ScopedKeeper
OracleKeeper oraclekeeper.Keeper
CommitmentKeeper commitmentmodulekeeper.Keeper
TokenomicsKeeper tokenomicsmodulekeeper.Keeper
IncentiveKeeper incentivemodulekeeper.Keeper
BurnerKeeper burnermodulekeeper.Keeper
AmmKeeper ammmodulekeeper.Keeper
ParameterKeeper parametermodulekeeper.Keeper
MarginKeeper marginmodulekeeper.Keeper
TransferhookKeeper transferhookkeeper.Keeper
ContractKeeper *wasmmodulekeeper.PermissionedKeeper
ClockKeeper clockmodulekeeper.Keeper
EpochsKeeper epochsmodulekeeper.Keeper
AssetprofileKeeper assetprofilemodulekeeper.Keeper
ScopedOracleKeeper capabilitykeeper.ScopedKeeper
OracleKeeper oraclekeeper.Keeper
CommitmentKeeper commitmentmodulekeeper.Keeper
TokenomicsKeeper tokenomicsmodulekeeper.Keeper
IncentiveKeeper incentivemodulekeeper.Keeper
BurnerKeeper burnermodulekeeper.Keeper
AmmKeeper ammmodulekeeper.Keeper
ParameterKeeper parametermodulekeeper.Keeper
MarginKeeper marginmodulekeeper.Keeper
TransferhookKeeper transferhookkeeper.Keeper
ContractKeeper *wasmmodulekeeper.PermissionedKeeper
ClockKeeper clockmodulekeeper.Keeper

AccountedPoolKeeper accountedpoolmodulekeeper.Keeper

Expand Down Expand Up @@ -456,7 +451,6 @@ func NewElysApp(
consensusparamtypes.StoreKey,
epochsmoduletypes.StoreKey,
assetprofilemoduletypes.StoreKey,
liquidityprovidermoduletypes.StoreKey,
oracletypes.StoreKey,
commitmentmoduletypes.StoreKey,
tokenomicsmoduletypes.StoreKey,
Expand Down Expand Up @@ -767,14 +761,6 @@ func NewElysApp(

commitmentModule := commitmentmodule.NewAppModule(appCodec, app.CommitmentKeeper, app.AccountKeeper, app.BankKeeper)

app.LiquidityproviderKeeper = *liquidityprovidermodulekeeper.NewKeeper(
appCodec,
keys[liquidityprovidermoduletypes.StoreKey],
keys[liquidityprovidermoduletypes.MemStoreKey],
app.GetSubspace(liquidityprovidermoduletypes.ModuleName),
)
liquidityproviderModule := liquidityprovidermodule.NewAppModule(appCodec, app.LiquidityproviderKeeper, app.AccountKeeper, app.BankKeeper)

app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper(
appCodec,
keys[tokenomicsmoduletypes.StoreKey],
Expand Down Expand Up @@ -820,17 +806,16 @@ func NewElysApp(
bankKeeper := app.BankKeeper.(bankkeeper.BaseKeeper)
wasmOpts = append(
wasmbindingsclient.RegisterCustomPlugins(
&bankKeeper,
&app.AccountedPoolKeeper,
&app.AmmKeeper,
&app.AssetprofileKeeper,
&bankKeeper,
&app.BurnerKeeper,
&app.ClockKeeper,
&app.CommitmentKeeper,
&app.EpochsKeeper,
&app.IncentiveKeeper,
&app.LeveragelpKeeper,
&app.LiquidityproviderKeeper,
&app.MarginKeeper,
&app.OracleKeeper,
&app.ParameterKeeper,
Expand Down Expand Up @@ -1060,7 +1045,6 @@ func NewElysApp(
icaModule,
epochsModule,
assetprofileModule,
liquidityproviderModule,
oracleModule,
commitmentModule,
tokenomicsModule,
Expand Down Expand Up @@ -1107,7 +1091,6 @@ func NewElysApp(
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
assetprofilemoduletypes.ModuleName,
liquidityprovidermoduletypes.ModuleName,
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
Expand Down Expand Up @@ -1149,7 +1132,6 @@ func NewElysApp(
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
assetprofilemoduletypes.ModuleName,
liquidityprovidermoduletypes.ModuleName,
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
Expand Down Expand Up @@ -1195,7 +1177,6 @@ func NewElysApp(
consensusparamtypes.ModuleName,
epochsmoduletypes.ModuleName,
assetprofilemoduletypes.ModuleName,
liquidityprovidermoduletypes.ModuleName,
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
Expand Down Expand Up @@ -1495,7 +1476,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(assetprofilemoduletypes.ModuleName)
paramsKeeper.Subspace(liquidityprovidermoduletypes.ModuleName)
paramsKeeper.Subspace(oracletypes.ModuleName)
paramsKeeper.Subspace(commitmentmoduletypes.ModuleName)
paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName)
Expand Down
9 changes: 3 additions & 6 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
commitmenttypes "github.com/elys-network/elys/x/commitment/types"
incentivetypes "github.com/elys-network/elys/x/incentive/types"
leveragelptypes "github.com/elys-network/elys/x/leveragelp/types"
liquidityprovidertypes "github.com/elys-network/elys/x/liquidityprovider/types"
margintypes "github.com/elys-network/elys/x/margin/types"
oracletypes "github.com/elys-network/elys/x/oracle/types"
parametertypes "github.com/elys-network/elys/x/parameter/types"
Expand Down Expand Up @@ -72,8 +71,6 @@ func setUpgradeHandler(app *ElysApp) {
keyTable = commitmenttypes.ParamKeyTable() //nolint:staticcheck
case incentivetypes.ModuleName:
keyTable = incentivetypes.ParamKeyTable() //nolint:staticcheck
case liquidityprovidertypes.ModuleName:
keyTable = liquidityprovidertypes.ParamKeyTable() //nolint:staticcheck
case margintypes.ModuleName:
keyTable = margintypes.ParamKeyTable() //nolint:staticcheck
case leveragelptypes.ModuleName:
Expand Down Expand Up @@ -123,9 +120,9 @@ func loadUpgradeStore(app *ElysApp) {

if shouldLoadUpgradeStore(app, upgradeInfo) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
leveragelptypes.StoreKey,
stablestaketypes.StoreKey,
// Added: []string{},
Deleted: []string{
"liquidityprovider",
},
}
// Use upgrade store loader for the initial loading of all stores when app starts,
Expand Down
5 changes: 2 additions & 3 deletions architecture.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Architecture Guide


This section contains documentation on the architecture of the Elys chain, including the current design and components of the system.

<details>
<summary>Click to expand/collapse</summary>

## Boilerplate Generation

The boilerplate was generated using `ignite CLI`, which provides a convenient way to generate new chains, modules, messages, and more. The initial modules that are part of the repository include `AssetProfile` and `LiquidityProvider`, both of which were generated using the `ignite CLI`.
The boilerplate was generated using `ignite CLI`, which provides a convenient way to generate new chains, modules, messages, and more. The initial modules that are part of the repository include `AssetProfile` and few others, both of which were generated using the `ignite CLI`.

`AssetProfile` requires all changes to go through governance proposals (i.e., adding, updating, or deleting an asset profile entry). Similarly, any modules that expose parameters must require governance proposals to update the module parameters.

Expand Down Expand Up @@ -562,4 +561,4 @@ Defines the penalties for validators who violate the network rules or fail to pe
- `Slash_fraction_double_sign`: The percentage of a validator's bonded tokens that are slashed if they double sign. Current value: 0.01%.
- `Slash_fraction_downtime`: The percentage of a validator's bonded tokens that are slashed if they are offline for too long. Current value: 5%.

</details>
</details>
51 changes: 23 additions & 28 deletions chain/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"max_bytes": "1048576"
},
"validator": {
"pub_key_types": [
"ed25519"
]
"pub_key_types": ["ed25519"]
},
"version": {}
},
Expand Down Expand Up @@ -257,16 +255,12 @@
{
"denom": "uelys",
"exponent": 0,
"aliases": [
"microelys"
]
"aliases": ["microelys"]
},
{
"denom": "melys",
"exponent": 3,
"aliases": [
"millielys"
]
"aliases": ["millielys"]
},
{
"denom": "elys",
Expand All @@ -287,16 +281,12 @@
{
"denom": "ueden",
"exponent": 0,
"aliases": [
"microeden"
]
"aliases": ["microeden"]
},
{
"denom": "meden",
"exponent": 3,
"aliases": [
"millieden"
]
"aliases": ["millieden"]
},
{
"denom": "eden",
Expand Down Expand Up @@ -703,10 +693,7 @@
"create_localhost": false,
"next_client_sequence": "0",
"params": {
"allowed_clients": [
"06-solomachine",
"07-tendermint"
]
"allowed_clients": ["06-solomachine", "07-tendermint"]
}
},
"connection_genesis": {
Expand All @@ -731,17 +718,12 @@
"active_channels": [],
"interchain_accounts": [],
"params": {
"allow_messages": [
"*"
],
"allow_messages": ["*"],
"host_enabled": true
},
"port": "icahost"
}
},
"liquidityprovider": {
"params": {}
},
"mint": {
"minter": {
"annual_provisions": "0.000000000000000000",
Expand Down Expand Up @@ -899,6 +881,19 @@
"port_id": "transfer"
},
"upgrade": {},
"vesting": {}
,"monitoringp":{"params":{"consumerUnbondingPeriod":1814400,"consumerRevisionHeight":342442,"consumerChainID":"spn-1","lastBlockHeight":1,"consumerConsensusState":{"timestamp":"2023-04-10T18:42:00.127873353Z","nextValidatorsHash":"6C4F396575BACAFA414FC2FF164DDE5EDDFEF81926C60315D3CE1DECF21A0F26","root":{"hash":"hyT/XmcfP/nXMLZa+/oiDCTJ78pABleHqDpvnII+fU8="}}}}}
}
"vesting": {},
"monitoringp": {
"params": {
"consumerUnbondingPeriod": 1814400,
"consumerRevisionHeight": 342442,
"consumerChainID": "spn-1",
"lastBlockHeight": 1,
"consumerConsensusState": {
"timestamp": "2023-04-10T18:42:00.127873353Z",
"nextValidatorsHash": "6C4F396575BACAFA414FC2FF164DDE5EDDFEF81926C60315D3CE1DECF21A0F26",
"root": { "hash": "hyT/XmcfP/nXMLZa+/oiDCTJ78pABleHqDpvnII+fU8=" }
}
}
}
}
}
Loading

0 comments on commit 60858e3

Please sign in to comment.