-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add token factory module (#1318)
# Related Github tickets - VolumeFi#2440 # Background This change adds a token factory module that extends Paloma with the following features: - New tokens may be created by anyone - Tokens can only be minted by the admin of the token (by default, the creator of a token is the admin) - Tokens can only be burned by the admin of the token - All data is respected for genesis import/export - Skyway registrations against user tokens do not require governance - Tokens can be bridged outside of Paloma - Creating a token costs 10 GRAIN # Testing completed > [!WARNING] > While most of the code is greatly inspired by the COSMWASM tokenfactory module and should be battle tested, I did not have time to include proper e2e tests to cover all Paloma customizations. Successful bridging still needs smoke testing. - [ ] test coverage exists or has been added/updated - [x] tested in a private testnet # Breaking changes - [x] I have checked my code for breaking changes - [x] If there are breaking changes, there is a supporting migration.
- Loading branch information
1 parent
1adfd7c
commit 06191a2
Showing
130 changed files
with
14,002 additions
and
2,376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
proto/palomachain/paloma/tokenfactory/authorityMetadata.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
syntax = "proto3"; | ||
package palomachain.paloma.tokenfactory; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
|
||
option go_package = "github.com/palomachain/paloma/v2/x/tokenfactory/types"; | ||
|
||
// DenomAuthorityMetadata specifies metadata for addresses that have specific | ||
// capabilities over a token factory denom. Right now there is only one Admin | ||
// permission, but is planned to be extended to the future. | ||
message DenomAuthorityMetadata { | ||
option (gogoproto.equal) = true; | ||
|
||
// Can be empty for no admin, or a valid paloma address | ||
string admin = 1 [ | ||
(gogoproto.moretags) = "yaml:\"admin\"", | ||
(cosmos_proto.scalar) = "cosmos.AddressString" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
syntax = "proto3"; | ||
package palomachain.paloma.tokenfactory; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "palomachain/paloma/tokenfactory/authorityMetadata.proto"; | ||
import "palomachain/paloma/tokenfactory/params.proto"; | ||
|
||
option go_package = "github.com/palomachain/paloma/v2/x/tokenfactory/types"; | ||
|
||
// GenesisState defines the tokenfactory module's genesis state. | ||
message GenesisState { | ||
// params defines the paramaters of the module. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
|
||
repeated GenesisDenom factory_denoms = 2 [ | ||
(gogoproto.moretags) = "yaml:\"factory_denoms\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// GenesisDenom defines a tokenfactory denom that is defined within genesis | ||
// state. The structure contains DenomAuthorityMetadata which defines the | ||
// denom's admin. | ||
message GenesisDenom { | ||
option (gogoproto.equal) = true; | ||
|
||
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
DenomAuthorityMetadata authority_metadata = 2 [ | ||
(gogoproto.moretags) = "yaml:\"authority_metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
package palomachain.paloma.tokenfactory; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "palomachain/paloma/tokenfactory/authorityMetadata.proto"; | ||
|
||
option go_package = "github.com/palomachain/paloma/v2/x/tokenfactory/types"; | ||
|
||
// Params defines the parameters for the tokenfactory module. | ||
message Params { | ||
repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.moretags) = "yaml:\"denom_creation_fee\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
syntax = "proto3"; | ||
package palomachain.paloma.tokenfactory; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "palomachain/paloma/tokenfactory/authorityMetadata.proto"; | ||
import "palomachain/paloma/tokenfactory/params.proto"; | ||
|
||
option go_package = "github.com/palomachain/paloma/v2/x/tokenfactory/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Params defines a gRPC query method that returns the tokenfactory module's | ||
// parameters. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/palomachain/paloma/tokenfactory/params"; | ||
} | ||
|
||
// DenomAuthorityMetadata defines a gRPC query method for fetching | ||
// DenomAuthorityMetadata for a particular denom. | ||
rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) | ||
returns (QueryDenomAuthorityMetadataResponse) { | ||
option (google.api.http).get = | ||
"/palomachain/paloma/tokenfactory/denoms/{denom}/authority_metadata"; | ||
} | ||
|
||
// DenomsFromCreator defines a gRPC query method for fetching all | ||
// denominations created by a specific admin/creator. | ||
rpc DenomsFromCreator(QueryDenomsFromCreatorRequest) | ||
returns (QueryDenomsFromCreatorResponse) { | ||
option (google.api.http).get = | ||
"/palomachain/paloma/tokenfactory/denoms_from_creator/{creator}"; | ||
} | ||
} | ||
|
||
// QueryParamsRequest is the request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is the response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
// params defines the parameters of the module. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// QueryDenomAuthorityMetadataRequest defines the request structure for the | ||
// DenomAuthorityMetadata gRPC query. | ||
message QueryDenomAuthorityMetadataRequest { | ||
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
} | ||
|
||
// QueryDenomAuthorityMetadataResponse defines the response structure for the | ||
// DenomAuthorityMetadata gRPC query. | ||
message QueryDenomAuthorityMetadataResponse { | ||
DenomAuthorityMetadata authority_metadata = 1 [ | ||
(gogoproto.moretags) = "yaml:\"authority_metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// QueryDenomsFromCreatorRequest defines the request structure for the | ||
// DenomsFromCreator gRPC query. | ||
message QueryDenomsFromCreatorRequest { | ||
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; | ||
} | ||
|
||
// QueryDenomsFromCreatorRequest defines the response structure for the | ||
// DenomsFromCreator gRPC query. | ||
message QueryDenomsFromCreatorResponse { | ||
repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ]; | ||
} | ||
|
Oops, something went wrong.