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

feat: implement x/callback module #501

Merged
merged 23 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c1e1e60
feat: adding x/callback module proto files (#480)
spoo-bar Nov 2, 2023
e5ae961
feat(x/callback): Adding module skeleton (#495)
spoo-bar Nov 2, 2023
4a57254
feat(x/callback): Implement the storage and validation of params (#498)
spoo-bar Nov 6, 2023
591543f
Merge branch 'main' into feat/callback-module
spoo-bar Nov 8, 2023
7c47b4a
refactor: using collections for params (#503)
spoo-bar Nov 9, 2023
82a13c5
feat(x/callback): Implement the storage of callback (#500)
spoo-bar Nov 22, 2023
a75e1e2
feat(x/callback): Implementing Query Server (#509)
spoo-bar Nov 27, 2023
e12a8a1
Merge branch 'main' into feat/callback-module
spoo-bar Nov 29, 2023
301e4c7
feat(x/callback): Implementing Msg Server (#513)
spoo-bar Nov 30, 2023
f8f26bb
feat(x/callback): Implement the callback execution (#508)
spoo-bar Dec 1, 2023
8fcb507
feat: Implementing query and tx CLI (#516)
spoo-bar Dec 1, 2023
4b1ebf7
feat: Implement genesis methods (#515)
spoo-bar Dec 4, 2023
3ccac44
Merge branch 'main' into feat/callback-module
spoo-bar Dec 4, 2023
15d1314
feat(x/callback): Handle fees (#518)
spoo-bar Dec 7, 2023
624f531
feat(x/callback): throw events (#520)
spoo-bar Dec 7, 2023
591dfb1
feat(x/callback): do app wiring (#519)
spoo-bar Dec 12, 2023
57f4ab2
test: Adding x/callback tests (#524)
spoo-bar Dec 21, 2023
dcb610f
docs(x/callback): adding module specs (#526)
spoo-bar Dec 21, 2023
dd2b18f
Merge branch 'main' into feat/callback-module
spoo-bar Dec 21, 2023
7263067
changing the typed event for callback success and failure
spoo-bar Jan 2, 2024
cd578ea
updating swagger file
spoo-bar Jan 2, 2024
5068878
pr review addressing
spoo-bar Jan 4, 2024
d6ffa88
Merge branch 'main' into feat/callback-module
spoo-bar Jan 9, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Contains all the PRs that improved the code without changing the behaviors.
- [#502](https://github.com/archway-network/archway/pull/502) - Improve rewards withdrawal experience by allowing a Metadata owner to set that rewards directly go to the reward address.
- [#504](https://github.com/archway-network/archway/pull/504) - Interchain test gh workflow now runs on PRs targetting release branches as well as main
- [#462](https://github.com/archway-network/archway/pull/462) - adding docs ADR-008 – Improvements on rewards withdrawal experience
- [#501](https://github.com/archway-network/archway/pull/501) - Adding x/callback module

### Improvements

Expand Down
23 changes: 22 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,16 @@ import (
"github.com/spf13/cast"

"github.com/archway-network/archway/wasmbinding"

"github.com/archway-network/archway/x/callback"
callbackKeeper "github.com/archway-network/archway/x/callback/keeper"
callbackTypes "github.com/archway-network/archway/x/callback/types"

"github.com/archway-network/archway/x/rewards"
rewardsKeeper "github.com/archway-network/archway/x/rewards/keeper"
"github.com/archway-network/archway/x/rewards/mintbankkeeper"
rewardsTypes "github.com/archway-network/archway/x/rewards/types"

"github.com/archway-network/archway/x/tracking"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
trackingTypes "github.com/archway-network/archway/x/tracking/types"
Expand Down Expand Up @@ -200,6 +206,7 @@ var (
tracking.AppModuleBasic{},
rewards.AppModuleBasic{},
genmsg.AppModule{},
callback.AppModuleBasic{},
)

// module account permissions
Expand All @@ -217,6 +224,7 @@ var (
icatypes.ModuleName: nil,
wasmdTypes.ModuleName: {authtypes.Burner},
rewardsTypes.TreasuryCollector: {authtypes.Burner},
callbackTypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -296,7 +304,7 @@ func NewArchwayApp(
feegrant.StoreKey, authzkeeper.StoreKey, wasmdTypes.StoreKey, consensusparamtypes.StoreKey,
icahosttypes.StoreKey, ibcfeetypes.StoreKey, crisistypes.StoreKey, group.StoreKey, nftkeeper.StoreKey,

trackingTypes.StoreKey, rewardsTypes.StoreKey,
trackingTypes.StoreKey, rewardsTypes.StoreKey, callbackTypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -555,6 +563,15 @@ func NewArchwayApp(
govModuleAddr,
)

app.Keepers.CallbackKeeper = callbackKeeper.NewKeeper(
appCodec,
keys[callbackTypes.StoreKey],
app.Keepers.WASMKeeper,
app.Keepers.RewardsKeeper,
app.Keepers.BankKeeper,
govModuleAddr,
)

var transferStack porttypes.IBCModule
transferStack = transfer.NewIBCModule(app.Keepers.TransferKeeper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.Keepers.IBCFeeKeeper)
Expand Down Expand Up @@ -628,6 +645,7 @@ func NewArchwayApp(
tracking.NewAppModule(app.appCodec, app.Keepers.TrackingKeeper),
rewards.NewAppModule(app.appCodec, app.Keepers.RewardsKeeper),
genmsg.NewAppModule(app.MsgServiceRouter()),
callback.NewAppModule(app.appCodec, app.Keepers.CallbackKeeper, app.Keepers.WASMKeeper),
crisis.NewAppModule(&app.Keepers.CrisisKeeper, skipGenesisInvariants, app.getSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand Down Expand Up @@ -666,6 +684,7 @@ func NewArchwayApp(
// wasm gas tracking
trackingTypes.ModuleName,
rewardsTypes.ModuleName,
callbackTypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -698,6 +717,7 @@ func NewArchwayApp(
// wasm gas tracking
trackingTypes.ModuleName,
rewardsTypes.ModuleName,
callbackTypes.ModuleName,
// invariants checks are always the last to run
crisistypes.ModuleName,
)
Expand Down Expand Up @@ -739,6 +759,7 @@ func NewArchwayApp(
// wasm gas tracking
trackingTypes.ModuleName,
genmsg.ModuleName,
callbackTypes.ModuleName,
// invariants checks are always the last to run
crisistypes.ModuleName,
)
Expand Down
8 changes: 6 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"

callbackKeeper "github.com/archway-network/archway/x/callback/keeper"
rewardsKeeper "github.com/archway-network/archway/x/rewards/keeper"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
)
Expand Down Expand Up @@ -52,6 +53,9 @@ type ArchwayKeepers struct {
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
WASMKeeper wasmkeeper.Keeper
TrackingKeeper trackingKeeper.Keeper
RewardsKeeper rewardsKeeper.Keeper

// Archway Keepers
TrackingKeeper trackingKeeper.Keeper
RewardsKeeper rewardsKeeper.Keeper
CallbackKeeper callbackKeeper.Keeper
}
7 changes: 6 additions & 1 deletion app/upgrades/latest/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/archway-network/archway/app/keepers"
"github.com/archway-network/archway/app/upgrades"
callbackTypes "github.com/archway-network/archway/x/callback/types"
)

// This upgrade handler is used for all the current changes to the protocol
Expand All @@ -28,5 +29,9 @@ var Upgrade = upgrades.Upgrade{
return migrations, nil
}
},
StoreUpgrades: storetypes.StoreUpgrades{},
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{
callbackTypes.ModuleName,
},
},
}
11 changes: 11 additions & 0 deletions contracts/callback-test/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
indent_size = 4
16 changes: 16 additions & 0 deletions contracts/callback-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build results
/target
/schema

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
Loading
Loading