feat(oracle): add oracle module

This commit is contained in:
Prad Nukala
2024-09-26 18:14:18 -04:00
parent 779a45121b
commit 162e246307
42 changed files with 10113 additions and 52 deletions
-11
View File
@@ -93,14 +93,3 @@ message PubKey {
string e = 6; // Exponent (for RSA keys)
}
}
// Service defines a Decentralized Service on the Sonr Blockchain
message Service {
string id = 1;
string service_type = 2;
string authority = 3;
string origin = 4;
string description = 5;
map<string, string> service_endpoints = 6;
map<string, string> permissions = 7;
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto3";
package oracle.module.v1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "github.com/onsonr/sonr"
};
}
+22
View File
@@ -0,0 +1,22 @@
syntax = "proto3";
package oracle.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types";
// GenesisState defines the module genesis state
message GenesisState {
// Params defines all the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}
// Params defines the set of module parameters.
message Params {
option (amino.name) = "oracle/params";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
bool some_value = 2;
}
+24
View File
@@ -0,0 +1,24 @@
syntax = "proto3";
package oracle.v1;
import "google/api/annotations.proto";
import "oracle/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types";
// Query provides defines the gRPC querier service.
service Query {
// Params queries all parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/oracle/v1/params";
}
}
// 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;
}
+19
View File
@@ -0,0 +1,19 @@
syntax = "proto3";
package oracle.v1;
import "cosmos/orm/v1/orm.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData {
option (cosmos.orm.v1.table) = {
id: 1;
primary_key: { fields: "account" }
index: { id: 1 fields: "amount" }
};
bytes account = 1;
uint64 amount = 2;
}
+40
View File
@@ -0,0 +1,40 @@
syntax = "proto3";
package oracle.v1;
import "cosmos/msg/v1/msg.proto";
import "oracle/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types";
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
+13 -2
View File
@@ -1,8 +1,8 @@
syntax = "proto3";
package service.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/service/types";
@@ -19,4 +19,15 @@ message Params {
option (gogoproto.goproto_stringer) = false;
bool some_value = 2;
}
}
// Service defines a Decentralized Service on the Sonr Blockchain
message Service {
string id = 1;
string service_type = 2;
string authority = 3;
string origin = 4;
string description = 5;
map<string, string> service_endpoints = 6;
map<string, string> permissions = 7;
}