Skip to content

Commit

Permalink
Rewrite msg for new asset module
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Jan 15, 2025
1 parent eb346d7 commit fc22983
Show file tree
Hide file tree
Showing 62 changed files with 1,622 additions and 5,313 deletions.
5 changes: 4 additions & 1 deletion proto/realionetwork/asset/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ import "gogoproto/gogo.proto";
option go_package = "github.com/realiotech/realio-network/x/asset/types";

// Params defines the parameters for the module.
message Params { option (gogoproto.goproto_stringer) = false; }
message Params {
option (gogoproto.goproto_stringer) = false;
repeated string allow_extensions = 1;
}
20 changes: 0 additions & 20 deletions proto/realionetwork/asset/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ service Query {
rpc Token(QueryTokenRequest) returns (QueryTokenResponse) {
option (google.api.http).get = "/realionetwork/asset/v1/tokens/{symbol}";
}

// Parameters queries the tokens of the module.
rpc IsAuthorized(QueryIsAuthorizedRequest)
returns (QueryIsAuthorizedResponse) {
option (google.api.http).get =
"/realionetwork/asset/v1/isauthorized/{symbol}/{address}";
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand Down Expand Up @@ -62,16 +55,3 @@ message QueryTokenResponse {
// params holds all the parameters of this module.
Token token = 1 [ (gogoproto.nullable) = false ];
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryIsAuthorizedRequest {
// symbol is the token symbol to query for.
string symbol = 1;
string address = 2;
}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryIsAuthorizedResponse {
// params holds all the parameters of this module.
bool isAuthorized = 1;
}
41 changes: 34 additions & 7 deletions proto/realionetwork/asset/v1/token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,43 @@ syntax = "proto3";
package realionetwork.asset.v1;

import "gogoproto/gogo.proto";
import "realionetwork/asset/v1/tokenauthorization.proto";

option go_package = "github.com/realiotech/realio-network/x/asset/types";

// Token represents an asset in the module
message Token {
string name = 1;
string symbol = 2;
string total = 3;
bool authorizationRequired = 4;
string manager = 5;
repeated TokenAuthorization authorized = 6;
string token_id = 1;
string issuer = 2;
string name = 3;
string symbol = 4;
uint32 decimal = 5;
string description = 6;
string evm_address = 9;
}

// TokenManagement represents the asset manager's execute functions.
message TokenManagement {
repeated string managers = 1;
bool allow_new_extensions = 2;
repeated string extensions_list = 3;
}

// TokenDistribution represents the asset manager's execute functions.
message TokenDistribution {
repeated string distributors = 1;
string max_supply = 2 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

enum Role {
option (gogoproto.goproto_enum_prefix) = false;

// ROLE_UNSPECIFIED defines a no-op role.
ROLE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "EmptyRole"];
// ROLE_MANAGER defines a token manager role.
ROLE_MANAGER = 1 [(gogoproto.enumvalue_customname) = "ManagerRole"];
// ROLE_DISTRIBUTOR defines a token distributor role.
ROLE_DISTRIBUTOR = 2 [(gogoproto.enumvalue_customname) = "DistributorRole"];
}
13 changes: 0 additions & 13 deletions proto/realionetwork/asset/v1/tokenauthorization.proto

This file was deleted.

72 changes: 28 additions & 44 deletions proto/realionetwork/asset/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,53 @@ option go_package = "github.com/realiotech/realio-network/x/asset/types";

import "gogoproto/gogo.proto";
import "realionetwork/asset/v1/params.proto";
import "realionetwork/asset/v1/token.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";

// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
rpc CreateToken(MsgCreateToken) returns (MsgCreateTokenResponse);
rpc UpdateToken(MsgUpdateToken) returns (MsgUpdateTokenResponse);
rpc AuthorizeAddress(MsgAuthorizeAddress)
returns (MsgAuthorizeAddressResponse);
rpc UnAuthorizeAddress(MsgUnAuthorizeAddress)
returns (MsgUnAuthorizeAddressResponse);
rpc TransferToken(MsgTransferToken) returns (MsgTransferTokenResponse);
// this line is used by starport scaffolding # proto/tx/rpc
rpc CreateToken(MsgCreateToken) returns (MsgCreateTokenResponse);
rpc AssignRoles(MsgAssignRoles) returns (MsgAssignRolesResponse);
}

message MsgCreateToken {
option (cosmos.msg.v1.signer) = "manager";
string manager = 1;
string name = 2;
string symbol = 3;
string total = 4;
bool authorizationRequired = 6;
}

message MsgCreateTokenResponse {}
option (cosmos.msg.v1.signer) = "issuer";
// issuer is the address that defines the token
string issuer = 1;

message MsgUpdateToken {
option (cosmos.msg.v1.signer) = "manager";
string manager = 1;
string symbol = 2;
bool authorizationRequired = 3;
}

message MsgUpdateTokenResponse {}

message MsgAuthorizeAddress {
option (cosmos.msg.v1.signer) = "manager";
string manager = 1;
string symbol = 2;
string address = 3;
string name = 2;
uint32 decimal = 3;
string symbol = 4;
string description = 5;
repeated string managers = 6;
repeated string distributors = 7;
bool allow_new_extensions = 8;
repeated string extensions_list = 9;
string max_supply = 10 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message MsgAuthorizeAddressResponse {}

message MsgUnAuthorizeAddress {
option (cosmos.msg.v1.signer) = "manager";
string manager = 1;
string symbol = 2;
string address = 3;
message MsgCreateTokenResponse {
string token_id = 1;
}

message MsgUnAuthorizeAddressResponse {}
message MsgAssignRoles {
option (cosmos.msg.v1.signer) = "issuer";
// issuer is the address that defines the token
string issuer = 1;

message MsgTransferToken {
string symbol = 1;
string from = 2;
string to = 3;
string amount = 4;
string token_id = 2;
repeated string managers = 3;
repeated string distributors = 4;
}

message MsgTransferTokenResponse {}
message MsgAssignRolesResponse {}

message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
Expand Down
28 changes: 0 additions & 28 deletions x/asset/client/cli/query.go

This file was deleted.

35 changes: 0 additions & 35 deletions x/asset/client/cli/query_params.go

This file was deleted.

59 changes: 0 additions & 59 deletions x/asset/client/cli/query_tokens.go

This file was deleted.

36 changes: 0 additions & 36 deletions x/asset/client/cli/tx.go

This file was deleted.

Loading

0 comments on commit fc22983

Please sign in to comment.