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 ADR-22: Per-subspace token factory #1141

Merged
merged 74 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
4410b13
feat: init proto
dadamu Jun 2, 2023
5c24222
build(deps): import osmosis token factory
dadamu Jun 2, 2023
81fdcaa
feat: init types
dadamu Jun 5, 2023
db0e09f
feat: init msg server
dadamu Jun 5, 2023
91e6568
chore: improve name from tkfk into tfk
dadamu Jun 5, 2023
2117a33
feat: remove burn from address and remove unused module account check
dadamu Jun 5, 2023
43ded0e
feat: add grpc query
dadamu Jun 6, 2023
ed37507
feat: add module
dadamu Jun 6, 2023
7de8090
feat: register token factory to app
dadamu Jun 6, 2023
b289f4a
feat: add cli
dadamu Jun 6, 2023
611eb9c
feat: add set-denom-metadata command
dadamu Jun 8, 2023
c93a729
tests: add types tests
dadamu Jun 8, 2023
beae92e
feat: add events
dadamu Jun 8, 2023
cbd98d0
tests: add msg server tests
dadamu Jun 8, 2023
ac73913
chore: fix lint
dadamu Jun 8, 2023
20ed30d
chore: improve permission validation
dadamu Jun 9, 2023
10dc623
test: add query tests
dadamu Jun 9, 2023
37931a3
test: add cli tests
dadamu Jun 9, 2023
8a07dbe
feat: add simulation operations
dadamu Jun 9, 2023
199d19e
fix: fix simulation tests
dadamu Jun 9, 2023
05d1276
chore: fix lint
dadamu Jun 9, 2023
0e844fc
fix: fix osmosis create module account
dadamu Jun 12, 2023
609198c
build: use osmosis v15.1.2-desmos version
dadamu Jun 12, 2023
8fe9f98
fix: fix simulation tests
dadamu Jun 12, 2023
71ab4e6
test: avoid edge case that all validators jailed by changing params
dadamu Jun 14, 2023
81f4d04
test: add proposal msg
dadamu Jun 14, 2023
f6ae379
chore: imporve proto tag order
dadamu Jun 14, 2023
7a2d69b
test: fix create denom simulation test
dadamu Jun 14, 2023
6b189b3
docs: add missing docs to proto
dadamu Jun 15, 2023
c4fc03e
feat: remove mintToAddress
dadamu Jun 15, 2023
c2eccf9
test: add missing from flag to cli test
dadamu Jun 15, 2023
9f2ce90
docs: improve docs
dadamu Jun 15, 2023
be4fc72
chore: add missing swagger config entry
dadamu Jun 15, 2023
5b7f940
docs: update Swagger definition
dadamu Jun 15, 2023
25604c8
test: fix unit test
dadamu Jun 27, 2023
23775d2
chore: fix typos
dadamu Jun 27, 2023
a9cc9ed
feat: merge osmosis tokenfactory keeper into desmos
dadamu Jun 28, 2023
6662067
test: add moved tokenfactory types tests
dadamu Jun 28, 2023
de365b8
test: add moved tokenfactory keeper tests
dadamu Jun 28, 2023
15f0dd3
chore: fix filename typo
dadamu Jun 28, 2023
54ba125
chore: fix lint
dadamu Jun 28, 2023
781746e
test: add missing check
dadamu Jun 28, 2023
6500577
chore: apply suggestions
dadamu Jun 28, 2023
1047b0b
test: add decoder simulation
dadamu Jun 28, 2023
b793de0
docs: update Swagger definition
dadamu Jun 28, 2023
2a4a8ab
chore: apply suggestions
dadamu Jul 4, 2023
e43fe3d
chore: add proto annotation for tokenfactory
dadamu Jul 4, 2023
ef5c76f
chore: run proto all
dadamu Jul 4, 2023
8065c97
fix: fix errors
dadamu Jul 4, 2023
c5267cf
chore: fix code styles
dadamu Jul 4, 2023
0cdde61
docs: update Swagger definition
dadamu Jul 4, 2023
68b858b
fix: fix amino msg name too long
dadamu Jul 4, 2023
eda3577
Merge branch 'paul/DCD-316/token-factory-impl' of github.com:desmos-l…
dadamu Jul 4, 2023
642f27b
chore: fix MsgUpdateParams amino.name annotation
dadamu Jul 4, 2023
7badc1a
test: update test case
dadamu Jul 4, 2023
1eb1d77
test: add missing tokenfactory prefix to import export test
dadamu Jul 4, 2023
afb187b
chore: add missing scalar
dadamu Jul 4, 2023
8c479f7
chore: fix code style
dadamu Jul 4, 2023
c7c210f
Update x/tokenfactory/client/cli/query.go
dadamu Jul 4, 2023
6dc6913
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
05b1b3f
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
b50e215
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
2bb46f7
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
5a821c1
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
de8b4c3
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
4619142
Update x/tokenfactory/client/cli/cli_test.go
dadamu Jul 4, 2023
11fae41
Update x/tokenfactory/client/cli/query.go
dadamu Jul 4, 2023
e60edc8
Update x/tokenfactory/keeper/createdenom_test.go
dadamu Jul 4, 2023
88bd8f2
Update x/tokenfactory/keeper/admins.go
dadamu Jul 4, 2023
653beaf
chore: fix code style
dadamu Jul 4, 2023
5a06cc1
Update x/tokenfactory/keeper/createdenom_test.go
dadamu Jul 4, 2023
3d30fd5
Update x/tokenfactory/client/cli/query.go
dadamu Jul 4, 2023
d2b4206
test: add params unit tests
dadamu Jul 4, 2023
9ece290
test: add creators unit tests
dadamu Jul 4, 2023
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
583 changes: 583 additions & 0 deletions api/desmos/tokenfactory/module/v1/module.pulsar.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import (
relationshipskeeper "github.com/desmos-labs/desmos/v5/x/relationships/keeper"
reportskeeper "github.com/desmos-labs/desmos/v5/x/reports/keeper"
subspaceskeeper "github.com/desmos-labs/desmos/v5/x/subspaces/keeper"

supplykeeper "github.com/desmos-labs/desmos/v5/x/supply/keeper"
tokenfactorykeeper "github.com/desmos-labs/desmos/v5/x/tokenfactory/keeper"

authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
Expand Down Expand Up @@ -171,6 +171,7 @@ type DesmosApp struct {
ReportsKeeper reportskeeper.Keeper
ReactionsKeeper reactionskeeper.Keeper
SupplyKeeper supplykeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper

// Simulation manager
sm *module.SimulationManager
Expand Down Expand Up @@ -248,6 +249,7 @@ func NewDesmosApp(
&app.ReportsKeeper,
&app.ReactionsKeeper,
&app.SupplyKeeper,
&app.TokenFactoryKeeper,
); err != nil {
panic(err)
}
Expand Down
23 changes: 14 additions & 9 deletions app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import (
"os"
"path/filepath"

"github.com/desmos-labs/desmos/v5/x/reactions"
supplytypes "github.com/desmos-labs/desmos/v5/x/supply/types"

postskeeper "github.com/desmos-labs/desmos/v5/x/posts/keeper"
poststypes "github.com/desmos-labs/desmos/v5/x/posts/types"

"github.com/desmos-labs/desmos/v5/x/posts"
"github.com/desmos-labs/desmos/v5/x/relationships"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand Down Expand Up @@ -75,11 +66,16 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/desmos-labs/desmos/v5/x/posts"
postskeeper "github.com/desmos-labs/desmos/v5/x/posts/keeper"
poststypes "github.com/desmos-labs/desmos/v5/x/posts/types"
"github.com/desmos-labs/desmos/v5/x/profiles"
profileskeeper "github.com/desmos-labs/desmos/v5/x/profiles/keeper"
profilestypes "github.com/desmos-labs/desmos/v5/x/profiles/types"
"github.com/desmos-labs/desmos/v5/x/reactions"
reactionskeeper "github.com/desmos-labs/desmos/v5/x/reactions/keeper"
reactionstypes "github.com/desmos-labs/desmos/v5/x/reactions/types"
"github.com/desmos-labs/desmos/v5/x/relationships"
relationshipskeeper "github.com/desmos-labs/desmos/v5/x/relationships/keeper"
relationshipstypes "github.com/desmos-labs/desmos/v5/x/relationships/types"
"github.com/desmos-labs/desmos/v5/x/reports"
Expand All @@ -88,6 +84,9 @@ import (
"github.com/desmos-labs/desmos/v5/x/subspaces"
subspaceskeeper "github.com/desmos-labs/desmos/v5/x/subspaces/keeper"
subspacestypes "github.com/desmos-labs/desmos/v5/x/subspaces/types"
supplytypes "github.com/desmos-labs/desmos/v5/x/supply/types"
"github.com/desmos-labs/desmos/v5/x/tokenfactory"
tokenfactorytypes "github.com/desmos-labs/desmos/v5/x/tokenfactory/types"

"github.com/desmos-labs/desmos/v5/x/supply"

Expand Down Expand Up @@ -198,6 +197,7 @@ var (
reports.AppModuleBasic{},
reactions.AppModuleBasic{},
supply.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
)

// Module account permissions
Expand All @@ -212,6 +212,7 @@ var (
{Account: wasm.ModuleName, Permissions: []string{authtypes.Burner}},
{Account: ibcfeetypes.ModuleName},
{Account: icatypes.ModuleName},
{Account: tokenfactorytypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
}

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -252,6 +253,7 @@ var (
reportstypes.ModuleName,
reactionstypes.ModuleName,
supplytypes.ModuleName,
tokenfactorytypes.ModuleName,

wasm.ModuleName,
}
Expand Down Expand Up @@ -289,6 +291,7 @@ var (
reportstypes.ModuleName,
reactionstypes.ModuleName,
supplytypes.ModuleName,
tokenfactorytypes.ModuleName,

wasm.ModuleName,
}
Expand Down Expand Up @@ -333,6 +336,7 @@ var (
reportstypes.ModuleName,
reactionstypes.ModuleName,
supplytypes.ModuleName,
tokenfactorytypes.ModuleName,

// wasm module should be at the end of app modules
wasm.ModuleName,
Expand Down Expand Up @@ -374,6 +378,7 @@ var (
reportstypes.ModuleName,
reactionstypes.ModuleName,
supplytypes.ModuleName,
tokenfactorytypes.ModuleName,

wasm.ModuleName,
crisistypes.ModuleName,
Expand Down
7 changes: 7 additions & 0 deletions app/app_module_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
reportsmodulev1 "github.com/desmos-labs/desmos/v5/api/desmos/reports/module/v1"
subspacesmodulev1 "github.com/desmos-labs/desmos/v5/api/desmos/subspaces/module/v1"
supplymodulev1 "github.com/desmos-labs/desmos/v5/api/desmos/supply/module/v1"
tokenfactorymodulev1 "github.com/desmos-labs/desmos/v5/api/desmos/tokenfactory/module/v1"

poststypes "github.com/desmos-labs/desmos/v5/x/posts/types"
profilestypes "github.com/desmos-labs/desmos/v5/x/profiles/types"
Expand All @@ -63,6 +64,7 @@ import (
reportstypes "github.com/desmos-labs/desmos/v5/x/reports/types"
subspacestypes "github.com/desmos-labs/desmos/v5/x/subspaces/types"
supplytypes "github.com/desmos-labs/desmos/v5/x/supply/types"
tokenfactorytypes "github.com/desmos-labs/desmos/v5/x/tokenfactory/types"
)

var (
Expand All @@ -77,6 +79,7 @@ var (
ibcfeetypes.ModuleName,
icatypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,

// We allow the following module accounts to receive funds:
// govtypes.ModuleName
Expand Down Expand Up @@ -224,6 +227,10 @@ var (
Name: supplytypes.ModuleName,
Config: appconfig.WrapAny(&supplymodulev1.Module{}),
},
{
Name: tokenfactorytypes.ModuleName,
Config: appconfig.WrapAny(&tokenfactorymodulev1.Module{}),
},
},
})
)
2 changes: 2 additions & 0 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
relationshipstypes "github.com/desmos-labs/desmos/v5/x/relationships/types"
reportstypes "github.com/desmos-labs/desmos/v5/x/reports/types"
subspacestypes "github.com/desmos-labs/desmos/v5/x/subspaces/types"
tokenfactorytypes "github.com/desmos-labs/desmos/v5/x/tokenfactory/types"

authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
Expand Down Expand Up @@ -258,6 +259,7 @@ func TestAppImportExport(t *testing.T) {
{app.GetKey(poststypes.StoreKey), newApp.GetKey(poststypes.StoreKey), [][]byte{}},
{app.GetKey(reportstypes.StoreKey), newApp.GetKey(reportstypes.StoreKey), [][]byte{}},
{app.GetKey(reactionstypes.StoreKey), newApp.GetKey(reactionstypes.StoreKey), [][]byte{}},
{app.GetKey(tokenfactorytypes.StoreKey), newApp.GetKey(tokenfactorytypes.StoreKey), [][]byte{}},

{app.GetKey(wasmtypes.StoreKey), newApp.GetKey(wasmtypes.StoreKey), [][]byte{wasmtypes.TXCounterPrefix}},
}
Expand Down
3 changes: 3 additions & 0 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
},
{
"url": "./tmp-swagger-gen/desmos/supply/v1/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/desmos/tokenfactory/v1beta1/query.swagger.json"
}
]
}
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

189 changes: 189 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14797,6 +14797,125 @@ paths:
format: uint64
tags:
- Query
/desmos/tokenfactory/v1beta1/params:
get:
summary: >-
Params defines a gRPC query method that returns the tokenfactory
module's

parameters.
operationId: Params
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: params defines the parameters of the module.
type: object
properties:
denom_creation_fee:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
description: >-
DenomCreationFee defines the fee to be charged on the
creation of a new

denom. The fee is drawn from the subspace treasruy
account, and

burned.
description: >-
QueryParamsResponse is the response type for the Query/Params RPC
method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Query
/desmos/tokenfactory/v1beta1/subspaces/{subspace_id}/denoms:
get:
summary: |-
SubspaceDenoms defines a gRPC query method for fetching all
denominations created by a specific subspace.
operationId: SubspaceDenoms
responses:
'200':
description: A successful response.
schema:
type: object
properties:
denoms:
type: array
items:
type: string
description: |-
QuerySubspaceDenomsResponse defines the response structure for the
SubspaceDenoms gRPC query.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: subspace_id
in: path
required: true
type: string
format: uint64
tags:
- Query
definitions:
cosmos.base.query.v1beta1.PageRequest:
type: object
Expand Down Expand Up @@ -23482,3 +23601,73 @@ definitions:
total_supply:
type: string
title: QueryTotalResponse is the response type for the Query/Total RPC method
desmos.tokenfactory.v1beta1.Params:
type: object
properties:
denom_creation_fee:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
description: >-
DenomCreationFee defines the fee to be charged on the creation of a
new

denom. The fee is drawn from the subspace treasruy account, and

burned.
description: |-
Params defines the parameters for the tokenfactory module.

Since: Desmos 6.0.0
desmos.tokenfactory.v1beta1.QueryParamsResponse:
type: object
properties:
params:
description: params defines the parameters of the module.
type: object
properties:
denom_creation_fee:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
description: >-
DenomCreationFee defines the fee to be charged on the creation of
a new

denom. The fee is drawn from the subspace treasruy account, and

burned.
description: QueryParamsResponse is the response type for the Query/Params RPC method.
desmos.tokenfactory.v1beta1.QuerySubspaceDenomsResponse:
type: object
properties:
denoms:
type: array
items:
type: string
description: |-
QuerySubspaceDenomsResponse defines the response structure for the
SubspaceDenoms gRPC query.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ require (
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
nhooyr.io/websocket v1.8.6 // indirect
nhooyr.io/websocket v1.8.7 // indirect
pgregory.net/rapid v0.5.5 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2236,8 +2236,9 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphD
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w=
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA=
pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
Loading
Loading