Skip to content

Commit

Permalink
[AppGate] Implement DelegateToGateway and add Tests (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law authored Oct 31, 2023
1 parent dd18066 commit dc5c61b
Show file tree
Hide file tree
Showing 22 changed files with 2,532 additions and 395 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,22 @@ app2_unstake: ## Unstake app2
app3_unstake: ## Unstake app3
APP=app3 make app_unstake

.PHONY: app_delegate
app_delegate: ## Delegate trust to a gateway (must specify the APP and GATEWAY_ADDR env vars). Requires the app to be staked
pocketd --home=$(POCKETD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)

.PHONY: app1_delegate_gateway1
app1_delegate_gateway1: ## Delegate trust to gateway1
APP=app1 GATEWAY_ADDR=pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4 make app_delegate

.PHONY: app2_delegate_gateway2
app2_delegate_gateway2: ## Delegate trust to gateway2
APP=app2 GATEWAY_ADDR=pokt15w3fhfyc0lttv7r585e2ncpf6t2kl9uh8rsnyz make app_delegate

.PHONY: app3_delegate_gateway3
app3_delegate_gateway3: ## Delegate trust to gateway3
APP=app3 GATEWAY_ADDR=pokt1zhmkkd0rh788mc9prfq0m2h88t9ge0j83gnxya make app_delegate

#################
### Suppliers ###
#################
Expand Down
24 changes: 13 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"path/filepath"

// this line is used by starport scaffolding # stargate/app/moduleImport

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
Expand Down Expand Up @@ -585,16 +586,6 @@ func New(
)
sessionModule := sessionmodule.NewAppModule(appCodec, app.SessionKeeper, app.AccountKeeper, app.BankKeeper)

app.ApplicationKeeper = *applicationmodulekeeper.NewKeeper(
appCodec,
keys[applicationmoduletypes.StoreKey],
keys[applicationmoduletypes.MemStoreKey],
app.GetSubspace(applicationmoduletypes.ModuleName),

app.BankKeeper,
)
applicationModule := applicationmodule.NewAppModule(appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper)

app.SupplierKeeper = *suppliermodulekeeper.NewKeeper(
appCodec,
keys[suppliermoduletypes.StoreKey],
Expand All @@ -612,10 +603,21 @@ func New(
app.GetSubspace(gatewaymoduletypes.ModuleName),

app.BankKeeper,
app.AccountKeeper,
)
gatewayModule := gatewaymodule.NewAppModule(appCodec, app.GatewayKeeper, app.AccountKeeper, app.BankKeeper)

app.ApplicationKeeper = *applicationmodulekeeper.NewKeeper(
appCodec,
keys[applicationmoduletypes.StoreKey],
keys[applicationmoduletypes.MemStoreKey],
app.GetSubspace(applicationmoduletypes.ModuleName),

app.BankKeeper,
app.AccountKeeper,
app.GatewayKeeper,
)
applicationModule := applicationmodule.NewAppModule(appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

/**** IBC Routing ****/
Expand Down
Loading

0 comments on commit dc5c61b

Please sign in to comment.