Skip to content

Commit

Permalink
feat: implement x/collection (#574)
Browse files Browse the repository at this point in the history
* feat: define x/collection proto

* feat: update proto

* feat: add event_spent and event_received

* feat: add x/collection to simapp

* feat: implement send

* feat: add getters to classes

* feat: implement create

* feat: add new msgs and deprecate the old ones

* fix: fix the type of the event fields

* feat: add new queries and deprecate the old ones

* feat: implement msgs

* fix: use coins

* feat: implement authorization logic

* feat: implement grant

* feat: implement nft

* feat: implement genesis

* docs: update documents on proto

* docs: update version information in the comments

* docs: update ERC777 related comments

* test: add tests on genesis

* feat: update protos

* fix: fix export genesis

* feat: return the id of the created entity

* feat: add next ids to genesis state

* feat: add queries

* fix: split EventMinted

* feat: update field names and comments in tx proto

* feat: update comments in query proto

* fix: fix event types and update proto

* feat: add query client

* feat: add nft to genesis

* fix: fix parents iterator

* lint: suppress unused for a while

* feat: enable servers

* refactor: remove ValidateNFTID() of keeper

* docs: update CHANGELOG.md

* feat: implement mint and burn

* test: increase coverage of msgs.go

* test: increase coverage of msg_server.go

* test: add tests on grpc_query.go

* feat: implement attach and detach

* refactor: remove validateRoot

* feat: implement modify

* test: burn tokens

* lint: lint

* feat: add Msg/CreateFTClass and Msg/CreateNFTClass

* fix: remove an interface TokenClass from proto

* feat: add Query/TokenClassTypeURL

* feat: add tx cli

* docs: update deprecated comments

* test: add tests for collection types

* lint: add a exclude rule for the deprecated collection proto

* feat: add mintable logic

* feat: limit the number of descendants (NFT)

* test: remove redundant test cases

* fix: fix naming collision in enums

* feat: add legacy events

* feat: emit operation events (daphne compat.)

* chore: remove the commented logic

* docs: add error conditions to tx proto

* feat: add depth and width limit on attach

* feat: add params for the limits

* test: check attribute_key_to

* fix: emit legacy event against the original request

* chore: put the logics after get_client_context except setting from

* fix: revisit creation logics

* feat: add tx cli to the module

* chore: clean up legacy logic

* chore: remove commented routerkey

* feat: update genesis validation

* docs: add hints to the deprecation message

* chore: fix typo

* fix: completely remove the rejected spec

* refactor: remove duplicate logic

* chore: completely remove Query/NFTs

* fix: correct event emissions

* chore: literal to nil

* fix: use returned error

* lint: use literal to avoid false negative

* chore: remove unimplemented logics

* chore: remove unused id logic and deprecate old ones

* feat: add a validation on params

* feat: add telemetry on account creation

* style: use variable name other than 'new'
  • Loading branch information
0Tech authored Jul 19, 2022
1 parent aef879d commit cb6ec96
Show file tree
Hide file tree
Showing 38 changed files with 19,991 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ issues:
- text: "SA1019: codec.LegacyAmino is deprecated"
linters:
- staticcheck
- text: "SA1019: collection."
linters:
- staticcheck
max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/foundation) [\#528](https://github.com/line/lbm-sdk/pull/528) add a feature of whitelist for /lbm.foundation.v1.MsgWithdrawFromTreasury
* (proto) [\#584](https://github.com/line/lbm-sdk/pull/564) remove `prove` field in the `GetTxsEventRequest` of `tx` proto
* (x/collection) [\#571](https://github.com/line/lbm-sdk/pull/571) add x/collection proto
* (x/collection) [\#574](https://github.com/line/lbm-sdk/pull/574) implement x/collection

### Improvements

Expand Down
11 changes: 11 additions & 0 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ import (
"github.com/line/lbm-sdk/x/capability"
capabilitykeeper "github.com/line/lbm-sdk/x/capability/keeper"
capabilitytypes "github.com/line/lbm-sdk/x/capability/types"
"github.com/line/lbm-sdk/x/collection"
collectionkeeper "github.com/line/lbm-sdk/x/collection/keeper"
collectionmodule "github.com/line/lbm-sdk/x/collection/module"
"github.com/line/lbm-sdk/x/crisis"
crisiskeeper "github.com/line/lbm-sdk/x/crisis/keeper"
crisistypes "github.com/line/lbm-sdk/x/crisis/types"
Expand Down Expand Up @@ -157,6 +160,7 @@ var (
authzmodule.AppModuleBasic{},
vesting.AppModuleBasic{},
tokenmodule.AppModuleBasic{},
collectionmodule.AppModuleBasic{},
wasm.AppModuleBasic{},
)

Expand Down Expand Up @@ -218,6 +222,7 @@ type SimApp struct {
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
TokenKeeper tokenkeeper.Keeper
CollectionKeeper collectionkeeper.Keeper
WasmKeeper wasm.Keeper

// make scoped keepers public for test purposes
Expand Down Expand Up @@ -279,6 +284,7 @@ func NewSimApp(
foundation.StoreKey,
class.StoreKey,
token.StoreKey,
collection.StoreKey,
authzkeeper.StoreKey,
wasm.StoreKey,
)
Expand Down Expand Up @@ -347,6 +353,7 @@ func NewSimApp(

classKeeper := classkeeper.NewKeeper(appCodec, keys[class.StoreKey])
app.TokenKeeper = tokenkeeper.NewKeeper(appCodec, keys[token.StoreKey], app.AccountKeeper, classKeeper)
app.CollectionKeeper = collectionkeeper.NewKeeper(appCodec, keys[collection.StoreKey], app.AccountKeeper, classKeeper)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
Expand Down Expand Up @@ -470,6 +477,7 @@ func NewSimApp(
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
tokenmodule.NewAppModule(appCodec, app.TokenKeeper),
collectionmodule.NewAppModule(appCodec, app.CollectionKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
transferModule,
)
Expand Down Expand Up @@ -500,6 +508,7 @@ func NewSimApp(
ibchost.ModuleName,
ibctransfertypes.ModuleName,
token.ModuleName,
collection.ModuleName,
wasm.ModuleName,
)
app.mm.SetOrderEndBlockers(
Expand All @@ -523,6 +532,7 @@ func NewSimApp(
ibctransfertypes.ModuleName,
foundation.ModuleName,
token.ModuleName,
collection.ModuleName,
wasm.ModuleName,
)

Expand Down Expand Up @@ -553,6 +563,7 @@ func NewSimApp(
vestingtypes.ModuleName,
foundation.ModuleName,
token.ModuleName,
collection.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
)
Expand Down
Loading

0 comments on commit cb6ec96

Please sign in to comment.